Codes and profiles
A consumer user is the person. What the machine reads is their code. What decides what they may take is the code's profile.
Code
The physical identifier the user presents. Supported types: QR, NFC, FINGERPRINT, CODE128, CODE39, PDF417, EAN13, UPCA, MAXICODE, MRZ.
A code has:
- a value (the ID the machine reads);
- a level: operation (the value exists and works only there) or account (same code, balance and quota across every operation of the account);
- up to two profiles: one vending, one EAS. It must keep at least one;
- balance and top-up if it operates vending (see Balances);
- an active/inactive status, independent of the user's status.
The level belongs to the code, not to the profile: it defines where the code is valid and which other codes compete for the same value. A value cannot exist both at the account and inside one of its operations.
Profile
The consumption rule. It belongs to one account and one business line, and has no level: where it works is defined by its list of authorised devices.
Vending profile
| Field | Purpose |
|---|---|
| Top-up period | How often credit is granted: daily, weekly, biweekly, monthly, quarterly, semiannual, annual, or custom dates. |
| Top-up value | How much is credited each period. |
| Max balance | Ceiling for the subsidised balance. |
| Cumulative credit | On: the previous balance adds up to the top-up. Off: it replaces it. |
| Consumption days | Optional. Days when dispensing is allowed. |
EAS profile
| Field | Purpose |
|---|---|
| Products | Allowed products, each with a quantity per period (or unlimited). |
| Period | Window that quantity applies to. |
| Time between deliveries | Minimum wait between two deliveries of the same product. |
| Consumption days | Optional, same as vending. |
Whether a product is returnable or restricts delivery is an attribute of the product, not the profile.
Authorised devices: an explicit list
The profile carries the list of devices where it may dispense. On creation the app checks every device of the account for that line, and you uncheck what does not apply; there is a shortcut to check or uncheck a whole operation, but what gets saved are the devices.
Two consequences:
- A device installed later is not added automatically. You must edit the profile and check it.
- With no device checked, the profile dispenses nowhere, even while active.
Code ↔ profile: same account
The only pairing rule is the account: the profile must belong to the user's account. Otherwise the server answers The profile does not belong to the user's account. The code's level (account or operation) does not constrain which profile you may assign.
How a delivery gets authorised
- The user presents the code at a device.
- The device determines the business line; the code needs a profile for that line.
- That device must be in the profile's authorised devices list.
- If the code is operation-level, the device must belong to that operation.
- If consumption days are configured, today must be enabled.
- Vending: enough credit for the price. EAS: remaining quota and the time between deliveries elapsed.
- User and code must be active, and so must the profile.
If anything fails, the attempt is recorded in Failed deliveries with its reason.