Keyple C++
0.9.0
Keyple, an Open Source SDK for Ticketing
|
#include <PoCommandManager.h>
Public Member Functions | |
PoCommandManager () | |
void | addRegularCommand (std::shared_ptr< AbstractPoCommandBuilder< AbstractPoResponseParser >> commandBuilder) |
void | addStoredValueCommand (std::shared_ptr< AbstractPoCommandBuilder< AbstractPoResponseParser >> commandBuilder, const Operation &svOperation) |
void | notifyCommandsProcessed () |
const std::vector< std::shared_ptr< AbstractPoCommandBuilder< AbstractPoResponseParser > > > | getPoCommandBuilders () |
bool | hasCommands () const |
bool | isSvOperationCompleteOneTime () |
The PO command manager handles the AbstractPoCommandBuilder list updated by the "prepare" methods of PoTransaction. It is used to keep builders between the time the commands are created and the time their responses are parsed.
A flag (preparedCommandsProcessed) is used to manage the reset of the command list. It allows the builders to be kept until the application creates a new list of commands.
This flag is set by calling the method notifyCommandsProcessed and reset when a new AbstractPoCommandBuilder is added or when a attempt
keyple::calypso::transaction::PoCommandManager::PoCommandManager | ( | ) |
(package-private)
Constructor
void keyple::calypso::transaction::PoCommandManager::addRegularCommand | ( | std::shared_ptr< AbstractPoCommandBuilder< AbstractPoResponseParser >> | commandBuilder | ) |
(package-private)
Add a regular command to the builders and parsers list.
commandBuilder | the command builder |
void keyple::calypso::transaction::PoCommandManager::addStoredValueCommand | ( | std::shared_ptr< AbstractPoCommandBuilder< AbstractPoResponseParser >> | commandBuilder, |
const Operation & | svOperation | ||
) |
(package-private)
Add a StoredValue command to the builders and parsers list.
Set up a mini state machine to manage the scheduling of Stored Value commands.
The keyple::calypso::transaction::PoTransaction::SvSettings::Operation and keyple::calypso::transaction::PoTransaction::SvSettings::Action are also used to check the consistency of the SV process.
The svOperationPending flag is set when an SV operation (Reload/Debit/Undebit) command is added.
commandBuilder | the StoredValue command builder |
svOperation | the type of the current SV operation (Realod/Debit/Undebit) |
IllegalStateException | if the provided command is not an SV command |
CalypsoPoTransactionIllegalStateException | if the SV API is not properly used. |
const std::vector< std::shared_ptr< AbstractPoCommandBuilder< AbstractPoResponseParser > > > keyple::calypso::transaction::PoCommandManager::getPoCommandBuilders | ( | ) |
(package-private)
bool keyple::calypso::transaction::PoCommandManager::hasCommands | ( | ) | const |
(package-private)
bool keyple::calypso::transaction::PoCommandManager::isSvOperationCompleteOneTime | ( | ) |
(package-private)
Indicates whether an SV Operation has been completed (Reload/Debit/Undebit requested)
This method is dedicated to triggering the signature verification after an SV transaction has been executed. It is a single-use method, as the flag is systematically reset to false after it is called.
void keyple::calypso::transaction::PoCommandManager::notifyCommandsProcessed | ( | ) |
(package-private)
Informs that the commands have been processed.
Just record the information. The initialization of the list of commands will be done only the next time a command is added, this allows access to the parsers contained in the list..