Scenario
External system uploads sales orders to EZR, to calculate level/points and Provide report/analysis.
Direction
External system will call EZR
Call path: api/csale/vipsaleupload
Core Logic
Only sales orders of members are accepted.
Non-member order will be rejected.
100 pieces maximum at a time
Request Parameters
Field | Type | Required | Length | Description |
ShopCode | string | Yes | 1~16 | Shop ID |
SaleNo | string | Yes | 1~26 | Sales orders number |
RefSaleNo | string | 0~26 | Reference order number | |
SaleType | string | Yes | 1 | S = Sales |
VipOffCode | string | Yes | 1~20 | Member's unique code (external system) |
SaleDate | string | Yes | - | yyyy-MM-dd HH:mm:ss |
SaleQty | int | Total quantity | ||
SaleMoney | double | Sales price | ||
SaleProdQty | int | Product quntity (SKU) | ||
SaleOrigMoney | double | Tag price | ||
SalePayMoney | double | Actual paid price | ||
UseBonus | int | Points used as cash | ||
CalcBonus | Int | Points rewarded for this order | ||
SalerCode | string | 0~16 | ID of sales person | |
Dtls | [] | Yes | Detail items of order | |
DataOrigin | Int | Source of record | ||
SaleCategory | Int | 0:member |
Detail of “Dtls”
Field | Type | Required | Length | Description |
ProdCode | string | Yes | 1~22 | SKU information |
RetailPrice | double | Yes | Retail price of single item (tag) | |
SalePrice | double | Yes | Sale price of single item (actual price) | |
SaleQty | int | Yes | Quantity of sold item | |
SaleMoney | double | Total price | ||
CmdShopCode | string | 0~16 | No. of store as salse source | |
CmdSalerCode | string | 0~16 | No. of saler as sales source | |
SalerCode | string | 0~16 | Salesman's ID |
How to process return/exchange order
Here are examples to deal with return/exchange orders. Since numbers of fields with affect related points calculation process, it is required to follow these instructions.
Original order
Body
ShopCode | SaleNo | SaleType | SaleMoney | SaleQty |
S001 | ORD00001 | S | 1200 | 6 |
Dtls[]:
ProdCode | SalePrice | SaleMoney | SaleQty |
P001 | 100 | 300 | 3 |
P002 | 200 | 400 | 2 |
P003 | 500 | 500 | 1 |
Return order (only return)
Body
ShopCode | SaleNo | RefSaleNo | SaleType | SaleMoney | SaleQty |
S002 | ORD00002 | ORD00001 | R | -200 | -2 |
Dtls[]
ProdCode | SalePrice | SaleMoney | SaleQty |
P001 | -100 | -200 | -2 |
1. Use SaleType = R to upload order with only returned items;
2. Use negative value for “SaleMoney” and “SaleQty”;
3. Make sure to put correct order number of original order in “RefSaleNo”;
Exchange order (return + sale)
Body
ShopCode | SaleNo | RefSaleNo | SaleType | SaleMoney | SaleQty |
S003 | ORD00003 | ORD00001 | C | 800 | -1 |
Dtls[]
ProdCode | SalePrice | SaleMoney | SaleQty |
P001 | -100 | -200 | -2 |
P004 | 1000 | 1000 | 1 |
1. Use SaleType = C to upload order with returned items mixed with sold items;
2. Use negative value for “SaleMoney” and “SaleQty” for returned items;
3. Make sure to put correct order number of original order in “RefSaleNo”;
Example Request (JSON)
[{
"ShopCode": "HQS0001",
"SaleNo": "000012809",
"RefSaleNo": "",
"SaleType": "S",
"VipOffCode": "EZ00001201",
"SaleDate": "2015-06-22 10:30:01",
"SaleQty": 2,
"SaleMoney": 890.00,
"SaleProdQty": 1,
"SaleOrigMoney": 890.00,
"UseBonus": 10,
"Dtls": [{
"ProdCode": "15026609123",
"ProdUID": "12389",
"RetailPrice": 450.00,
"SalePrice": 450.00,
"SaleQty": 1,
"SaleMoney": 450.00,
"SalerCode": ""
}, {
...
}]
}, {
...
}]
Example Result (JSON)
{
"Status": true,
"StatusCode": 200,
"Msg": "成功",
"Timestamp": "20150622093101",
"Sign": "6ECC9BF07C69E80F6D8552FF7B2E7A8FCA2CC80E",
"Result": 见业务返回结果示例,
}