1.
Tasks to be Done by Vendy Team
1.1. Create a new table for DMA as tbl_DMA_token
1.1.1. Where the following fields will be there.
1.1.1.1. token_key, token_applied_date, token_expiery_date,
token_value, is_valid, other_value
1.2. Create a cron job that would request the DMA Login API for creating a token
and save them in the stated table.
1.3. Create an API implantation for validating every transaction.
1.3.1. There the token will be used to send the request.
1.3.2. Every transaction will keep track of the transaction logs for future
reference.
1.3.3. If the API is successful then vending machine will be command to
dispense the stated product.
2. DMA API Spec
2.1. LOGIN API:
METHOD: POST
URL https://dcard.clouddma.com/cms/auth/login/
Request Body {
'usr_email': '[email protected]',
'password': 'xxxxxxxxxx'
}
success response: {
"success": true,
"status_code": 200,
"message": "User logged in successfully",
"token": "fa6204c531b54521ed696c33411f1f87b10e3f1f",
"data": {
"id": 180,
"usr_email": "[email protected]",
"first_name": "Vendy",
"last_name": "LTD",
"birth_date": null,
"blood_group": null,
"campus_code": null,
"student_code": null,
"is_active": true,
"user_phone": {
"phn_business": null,
"phn_cell": "01673586685",
"phn_home": null
},
"user_address": null,
"groups": [
"Collector"
],
"usr_profile_pic": ""
}
}
fail response: {
"success": false,
"status_code": 404,
"message": "Wrong Credentials"
}
3. DMA API Spec
1.1. SWIPE CARD API:
METHOD: POST
URL https://dcard.clouddma.com/cms/pos/swipe-card/
Request Body {
"gw_mac": "<vendy machine mac id>",
"nfc_mac": <nfc card mac id>,
"amount": 0,
"use_point": false,
"gw_lat": <vendy location lat>,
"gw_lon": <vendy location lng>,
"payment_mode": "cashless"
}
Example {
"gw_mac": "2b5b3f21c441a8b44",
"nfc_mac": 27083860461,
"amount": 0,
"use_point": false,
"gw_lat": 23.75381061692294,
"gw_lon": 90.38216686989884,
"payment_mode": "cashless"
}
success {
"success": true,
"status_code": 200,