Vending Session Management

This page covers the data structures used in the Marshall SDK to handle vending product requests and sessions. These structures define the classes and fields necessary to manage product details, session data, and the overall vending session.

Product request instance

The vend_item_t class represents an individual product request within a vending session. This class includes the product code, price, quantity, and unit of measure. The following code block lists all class parameters:

public static class vend_item_t {
    public short code;
    public int price;
    public int qty;
    public byte unit;
}
struct vend_item_t
	uint16_t code;
	uint16_t/uint32_t price;
	uint32_t qty;
	uint32_t unit;

Where:

  • code : The unique identifier for the product is also known as the MDB code.
  • price: Product price, where the real price is calculated as price / (10 ^ decimal places).
  • qty: The quantity of the product being vented.
  • unit: Unit of measure for the product, with 0 indicating a discrete unit (e.g., a single drink bottle).

Vending session data

The vend_session_data_t class holds detailed information about a vending session, including transaction details and card information. The following code block lists all class parameters:

public static class vend_session_data_t {  
    public long transaction_id;  
    public short choose_product_timeout;  
    public int card_type;  
    public int card_entry_mode;  
    public String card_bin;  
    public String card_bin_hash;  
    public String prop_card_uid;  
    public int vmc_auth_status;  
    public int com_status;  
    public String excel_data;  
    public String cc_last_4_digits;  
}
struct vmc_vend_transfer_data_t
  int 	 encode_bitmap;
  int       transaction_id_len;
  uint8_t[] transaction_id;
  uint16_t  choose_product_timeout;
  uint8_t   card_type;
  uint8_t   card_sub_type;
  uint8_t   card_entry_mode;
  int     	 card_bin_len;
  uint8_t[] card_bin;
  int     	 card_bin_hash_len;
  uint8_t[] card_bin_hash;
  int     	 prop_card_uid_len;
  uint8_t[] prop_card_uid;
  uint8_t   vmc_auth_status;
  uint32_t  com_status;
  int     	 ftl_data_len;
  uint8_t[] ftl_data;
  char[] 	 cc_last_4_digits;
  uint16_t  product_code;
  uint32_t  product_price;
  uint32_t  default_credit;
  uint8_t[] main_fw_ver;
  uint8_t[] pos_fw_ver
  uint8_t[] monyx_id;
  uint32_t  final_price;
  sint32_t  card_balance;

Where: /

  • transaction_id: Transaction unique identifier.
  • choose_product_timeout: Timeout duration for choosing a product.
  • card_type: Card type used in the transaction.
  • card_entry_mode: Card entry mode (e.g., swipe, insert).
  • card_bin: The Bank Identification Number (BIN) of the card.
  • card_bin_hash: The hashed BIN of the card for security purposes.
  • prop_card_uid: The UID of the proprietary card.
  • vmc_auth_status: Authorization status from the VMC.
  • com_status: Communication status.
  • excel_data : Additional data in Excel format.
  • cc_last_4_digits: The last four digits of the credit card.

Vending session handle

The vend_session_t class represents a vending session, encapsulating session-specific data, product lists, and session status. The following code block lists all class parameters:

public static class vend_session_t {
    public int funds_avail;
    public int session_status;
    public vend_session_data_t data;
    public ArrayList<vend_item_t> products_list;
}
struct vend_session_t
  int funds_avail;
	int total_amount;
	int vend_amount;
	int discount;
	uint16_t session_id;
	vmc_vend_transfer_data_t* data;
	vend_item_t* products;
	int total_products;

Where:

  • funds_avail : Available funds for the session.
  • session_status : The user sets the session's status, especially in cases of cancellation or failed dispensing.
  • vend_session_data_t data: An instance of vend_session_data_t containing detailed session data.
  • ArrayList<vend_item_t> products_list: A list of vend_item_t objects representing the products involved in the session. Note that only a single product is allowed in multi-session mode.