Cashless Master
This section describes the "Cashless Master" mode. It provides a very simple method to simulate the VMC side and talk with a credit card terminal.
If you are missing functionality in this implementation, you can always use the generic master mode and implement your own version of a cashless master.
Before starting making vending cycles, consider configure your device first. For that, check the Configuration page.
Some configurations are volatile and need to be set each time the MDB-USB boots
Commands
Enable/Disable Cashless Master
Prior to initiating transactions with the MDB Bus, it is necessary to Enable the Cashless Master. Specifically for Cashless Devices, in addition to "Idle" Mode, it is also possible to enable the Device in "Always Idle" Mode.
"Authorization First" First Mode- Vending sessions are initiated by the Cashless Peripherals (Meaning that in a real terminal, the user would first have to swipe his card to pre-authorize a certain amount, and then select the product. Further information in Cashless Slave).
"Always Idle"/Selection First Mode (direct vend), the Master can request the credit to the Cashless Slave first and therefore it will start the session (In a real terminal, the user would select the product first on the machine, and then swipe the card to confirm the requested amount).
The Enable/Disable state of the Cashless Master can be configured with the commands presented below.
D,0 #Disable
D,1 #Enable in "Authorize First" Mode
D,2 #Enable in "Always Idle" Mode
Start polling for the Cashless Reader
Once the Master and Slave are enabled (please see instructions to enable Slave Peripherals in Cashless Slave) , the master can start polling the Cashless Reader, by issuing the command below.
This instruction must be issued every time the Cashless Master is enabled or booted.
D,READER,1
When this instruction succeeds, the response should be:
d,STATUS,IDLE
If the Cashless Peripheral is not enabled yet, the response will be:
d,ERR,"-1" #Cashless Slave is not enabled to start polling
Request Credit
The following command is used to send a request to the Cashless Slave. When the Cashless Master is configured in "Idle" Mode, this command should be preceded by a start session command (further info in Cashless Slave ). If the Cashless Master is configured in "Always Idle" Mode, the instruction below will trigger a "Start" operation on the slave.
D,REQ,<amount>,<product>
D,REQ,1.20,10
Requests 1.20$ for product number 10)
Amounts sent via the MDB Standard usually are 16bit values. Depending on the setting of currency code and number of digits after the decimal point, the amount will be limited. For example, in usual €,$,CAD etc currencies, we have 'cents', 2 digits after the decimal point. As the maximum value which can be represented in a 16bit value is 65535, this implies that the maximum amount which can be transmitted via the standard MDB representation is 655.35. Other currencies which do not know decimals can use values up to 65535.
Cancel a pending vending request
D,REQ,-1
End and finalize a transaction
In versions prior to 3.8.X.X the transaction MUST be ended with undefined product ID, i.e. D,END
D,END #End transaction with undefined Product ID
or
D,END,<product_id(decimal)> #End transaction with Defined product id (only available since firmware version 3.8.X.X
End and revert a transaction
D,END,-1
Used, for example, if a product was not dispensed
Answers
Following is a list of answers that can be received from the master instance:
Answer | Description |
---|---|
D,ERR,"cashless master is on" | Master instance was already ON |
d,STATUS,RESET | Master/VMC instance was initialized and there are no peripherals connected to it |
d,STATUS,INIT,1 | There is a peripheral on the bus and the master instance is polling it |
d,STATUS,IDLE | The reader is enabled and VMC is Idle (waiting for a vending cycle to be started) |
d,STATUS,CREDIT,-1 | The peripheral has started the session and a payment method with has been inserted |
d,STATUS,RESULT,-1 | The terminal has denied the vending session. E.g. due to lack of funds in the credit card. |
d,STATUS,VEND | A vending request has been made by the master instance and it is waiting for the slave to accept it |
d,STATUS,RESULT,1,1.50 | The peripheral has accepted 1.50€ for the VMC vending request |
d,ERR,-1 | Command not applicable in current state |
Get Cashless Status From Master
D,STATUS
d,STATUS,<status>,#,<featurelevel>,<CurrCode>,<scalefac>,<decimals>,<timeout>,<flags>,<direct_vend_mode>
<featurelevel>,<CurrCode>,<scalefac>,<decimals>,<timeout> and <flags> <direct_vend_mode>are all part of the information exchanged between the Cashless Terminal and the VMC during setup. Please refer to section 7.4.2 of the MDB Specification for more details about these fields.
Status Field | Description |
---|---|
status | The state of the Cashless Reader:
|
featurelevel | Reader announced MDB Feature level |
CurrCode | Reader Currency Code |
scalefac | Country/Currency Code |
decimals | Decimal Places |
timeout | Application Maximum Response time (s) |
flags | Miscellaneous options announced by the reader during the setup |
direct_vend___mode | It will display 0 or 1 depending if you start with D,1 or D,2. NOTE: Even if you start with D,2 but the machine does not support it, it will display 0 |
d,STATUS,INIT,1,#,3,1756,1,2,30,8 Reader level 3, <!--currency code Swiss francs (756),Scaling factor 1,2 decimal places, 30s timeout, and bit 3 of flags enabled=Supports Cash Sale subcommand -->
(Reader enabled during this interval ...)
d,STATUS,IDLE,#,3,1756,1,2,30,8
(Vend Request during this interval ...)
d,STATUS,VEND,#,3,1756,1,2,30,8
(Vend Approved by the reader and confirmed by the VMC (MASTER) during this interval ... )
d,STATUS,IDLE,#,3,1756,1,2,30,8
##