Data Model
Data model of an order
JSON example:
{
# Status, Service, Request
"_id" : "QMB0HO",
"status" : "CANCELLED",
"service_id" : "SGN-TRICYCLE", # Service ID
"city_id" : "SGN", # City ID
# List of special requests
"requests" : [
{
"_id":"SGN-TRUCK-500-CART",
"num":2,
"price": 100000 # Final request price = 50000 x 2
},
{
"_id":"SGN-TRUCK-500-BOCXEP",
"price": 50000,
},
{
"_id":"SGN-TRUCK-500-COD",
"price": 0,
"value": 300000
},
{
"_id":"SGN-COFFEEHOUSE-COMBO-1",
"num": 2,
"price": 0, # Request fee
"item_price": 980000 # Final item price = 49000 x 2
}
],
# User ID & Supplier ID
"user_id" : "84972709963", # User who created this order
"user_name" : "Thao Vy", # User name
"supplier_id" : "84909561477", # Supplier who accepted this order
"supplier_name" : "Hieu Nguyen", # Supplier name
# Partner
"partner": "foodbook", # If this order is created by 3rd-party partners
# Time
"order_time" : 1426297774, # Pick-up time
"create_time" : 1426297174.649361, # Order create time
"accept_time" : 1426298634.189912, # Order accept time
"accept_lat": 10.7890462,
"accept_lng": 106.7763078,
"accept_distance": 1.2, # Distance from accepted location to pick up point
"accept_duration": 150, # Time from accepted location to pick up point
"cancel_time" : 1426671164.374609, # Order cancel time
"cancel_comment" : "Lich chuyen nha bi hoan", # Cancelled reason by user or supplier
"cancel_by_user" : False, # True if this order is cancelled by user, otherwise False
# Others: complete_time, complete_lat, complete_lng, accept_lat, accept_lng, fail_time, fail_lat, fail_lng, fail_comment
# Payment
"currency" : "VND",
"stop_fee" : 0,
"request_fee" : 0,
"distance" : 5.597,
"distance_fee" : 142358,
"promo_code" : "AHAMOVE",
"discount" : 0,
"total_fee" : 142358, # Total fee = Distance Fee + Request Fee + Stop Fee - Discount
"payment_method": "BALANCE" # User pay by Ahamove balance (Available methods: CASH | BALANCE)
# Use credit from user account if available
"user_bonus_account" : 0,
"user_main_account" : 0,
"total_pay" : 142358, # Total pay = Total fee - User Main account - User Bonus account
# Supplier commission = Service commission = Supplier Main account + Supplier Bonus account
"supplier_main_account" : 0,
"supplier_bonus_account" : 14235.8,
# These fields applied for food orders
"partner_fee" : 20000, # Partner total fee = Partner Distance Fee + Request Fee + Stop Fee - Discount
"partner_distance_fee" : 10000,
"partner_subsidy": 20000, # partner_subsidy = total_fee - partner_fee
"partner_discount": 10000, # discount = partner_discount + partner_subsidy
"partner_pay": 90000, # Total partner pay in cash, partner_pay = total_pay + item_fee - item_discount + item_vat_fee
"online_pay": 0, # Total pay via online channels
# Rating
"rating_by_user": 4,
"comment_by_user": "Good",
"rating_by_supplier": 5,
"comment_by_supplier": "Great customer",
"rating_by_receiver": 4,
"comment_by_receiver": "Good driver",
"store_rating_by_user": 4, # For food orders
"store_comment_by_user": "Delicious food", # For food orders
# Path, at least 2 locations, 1 From and >= 1 To
"path" : [
{
"lat" : 10.7890462,
"lng" : 106.7763078,
"address" : "Số 47, Bình Trưng Đông, Quận 2, Hồ Chí Minh, Vietnam",
},
{
"lat" : 10.76403580333166,
"lng" : 106.7558794096112,
"address" : "Vũ Phương Đề, Thạnh Mỹ Lợi, Quận 2, Hồ Chí Minh, Vietnam",
"mobile": "0908842285",
"name": "Ngon",
"cod": 500000,
"remarks": "Call me when arrive",
"require_pod": True, # If true, supplier will be required proof of delivery before complete the transaction
"require_verification": True, # If true, a verification code will be sent to the receiver, then the supplier will need to enter this code to complete the transaction
"rating_by_receiver": 4,
"comment_by_receiver": "Good",
"complete_time": 1426671164,
"complete_lat": 10.7890462,
"complete_lng": 106.7763078,
"complete_comment": "Nice receiver",
"image_url": "https://i.imgur.com/lchC2xz.jpg", # Image to show that the supplier has already completed the order, uploaded by the supplier
"pod_info" : "024792155", # Proof of delivery information that supplier has collected, can be recipient's ID number or image URL
"status": "COMPLETED"
},
{
"lat" : 10.7640412,
"lng" : 106.755910,
"address" : "Nha tho Duc Ba",
"mobile": "0908842285",
"name": "Ngon",
"cod": 500000,
"remarks": "Call me when arrive",
"fail_time": 1426671164,
"fail_comment": "User does not show",
"fail_lat": 10.7890462,
"fail_lng": 106.7763078,
"status": "FAILED",
# Note from supplier, to reschedule time and address for failed delivery
"redelivery_note":
{
"from_time" : NumberInt(1532109600), # Redeliver after this time
"to_time" : NumberInt(1532111400), # Redeliver before this time
"address" : "21 Nguyễn Trung Ngạn, Bến Nghé, Quận 1, Hồ Chí Minh, Vietnam", # Redelivery address
"lat" : 10.782938,
"lng" : 106.704899
}
}
],
# Others
"remarks": "Den noi goi dien cho toi", # Note to supplier
"remind": True, # If this is advance booking and the system already reminds users
"assigned_by": "84908842285", # If this order is assigned by a user or "auto" if by the system
"index": 1, # 0 if first order request from the user, 1 for second...
# For internal Geo index only
"from_location" : {
"type" : "Point",
"coordinates" : [
106.7763078,
10.7890462
]
}
}
Parameter | Type | Description |
---|---|---|
id | String | Order ID. |
status | String | Order status |
service_id | String | Service ID. |
city_id | String | City ID. |
user_id | String | User ID who created this order. |
user_name | String | User name who created this order. |
partner | String | Partner ID. |
supplier_id | String | Supplier who accepted this order. |
supplier_name | String | Supplier name. |
path | Object | Pickup and drop-offs information |
create_time | Number | Time when order was created, in epoch timestamp format. |
order_time | Number | Time user want supplier to pick up his package, in epoch timestamp format. |
accept_time | Number | Time when a supplier accepts an order, in epoch timestamp format |
board_time | Number | Time when a supplier arrives at the user's place, in epoch timestamp format. |
pickup_time | Number | Time when a supplier successfully picks up the user's package, in epoch timestamp format. |
cancel_time | Number | Time when an order was cancelled, in epoch timestamp format. |
complete_time | Number | Time when an order was completed, in epoch timestamp format. |
currency | String | Currency (ISO 4217 currency code) |
promo_code | String | Promotion code to be applied |
payment_method | String | Method which user chooses to pay for this order (Available methods: CASH, CASH_BY_RECIPIENT, BALANCE) |
user_bonus_account | Number | The amount of credit which is deducted from the user's bonus account if the bonus account has enough credit |
user_main_account | Number | The amount of credit which is deducted from the user's main account if the main account has enough credit |
total_pay | Number | The amount of CASH that the user has to pay for this order (Total pay = Total fee - User Main account - User Bonus account) |
distance_price | Number | Service fee calculated based on distance |
special_request_price | Number | Extra fee for adding a special request to the order |
stoppoint_price | Number | Stop fee for multiple drop-offs |
voucher_discount | Number | Discount |
subtotal_price | Number | Sum of distance price, special_request_price, and stoppoint_price |
total_price | Number | Final price, total_price = distance_price + stoppoint_price + special_request_price + cod_commission_price - voucher_discount |
Path
Representing From path[0]
and multiple Tos path[x], x > 0
Parameter | Type | Description |
---|---|---|
address | String | Address of the location. |
lat | Number | Latitude of the location. |
lng | Number | Longitude of the location. |
name | String | Recipient's name. Optional if is path[0] . |
mobile | String | Recipient's mobile number. Optional if is path[0] . |
tracking_number | String | Tracking number for the package (Partner's order id). |
remarks | String | Note to supplier, for multiple delivery points. |
cod | Number | COD amount (Cash on delivery), for multiple delivery points. |
status | String | Delivery Status |
building | String | Building name for delivery to door |
apt_number | String | Apartment, Suite or Floor number for delivery to door |