订单
金色童年
购买商品生成订单
Method and URL Structure
| Method |
Resource URL |
| POST |
/market/product/purchase/${pk} |
Request Paramaters
| Name |
Description |
| linkman |
联系人 |
| shipping_address |
地址 |
| telephone |
电话 |
| quantity |
数量 |
| user_point |
是否用积分 |
Requeset Data
{ "linkman": "张三", "telephone":"12345678910", "shipping_address":"山东青岛四方四方火车站", "quantity":3, "user_point": false,}
cURL Example
curl -X POT -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\ -H 'Content-Type: application/json' --data '{...}' http://localhost/market/proudct/purchase/124/
Response
{ "order_number":"14925746786777522516430013", "amount":"297.0", "channel":"alipay", "status":0, "evaluation":null, "is_done":false, "created":"2016-10-04T23:44:42.988819", "shipping_address":"山东青岛四方四方火车站", "telephone":"12345678910", "linkman":"张三", "tracking_number": "1234567899900", "shipper_name": "顺丰快递", "shipper_code": "SF", "profile":{ "owner":13, "nickname":"xiaoming", "avatar_url":"http://www.example.com/xiaoming.jpg", "slogan":"xiaoming's slogan" }, "bought_product_set":[{ "product":{ "pk":2, "category":6, "category_name":"Test Product Category", "name":"产品第一", "price":"99.00", "desc":"test desc", "evaluate_count":0, "cover":"http://cover.example.com/cover.png", "desc_files":"http://img.example.com/file1.png, http://img.example.com/fil2.jpg", "file_list":["http://img.example.com/file1.png","http://img.example.com/fil2.jpg"], "shop":null }, "quantity":3, "amount":297.0, "created":"2016-10-16T17:37:15.240813" }]}
购物车生成订单
购物车里没有选中商品,生成订单失败
Method and URL Structure
| Method |
Resource URL |
| POST |
/market/cart/purchase/ |
Request Paramaters
| Name |
Description |
| linkman |
联系人 |
| shipping_address |
地址 |
| telephone |
电话 |
| user_point |
是否用积分 |
Requeset Data
{ "linkman": "张三", "telephone":"12345678910", "shipping_address":"山东青岛四方四方火车站", "user_point": false,}
cURL Example
curl -X POT -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\ -H 'Content-Type: application/json' --data '{...}' http://localhost/market/cart/purchase/
Response
{ "order_number":"14925746786777522516430013", "amount":"297.0", "channel":"alipay", "status":0, "is_done":false, "created":"2016-10-04T23:44:42.988819", "profile":{ "owner":13, "nickname":"xiaoming", "avatar_url":"http://www.example.com/xiaoming.jpg", "slogan":"xiaoming's slogan" },}
支付订单
返回 HTTP 200、 status = 0、 charge 为 null 是直接支付成功的订单,
不需要再调用支付宝或微信支付
Method and URL Structure
| Method |
Resource URL |
| PATCH |
/market/order/payment/${order_number} |
Request Parameters
| Name |
Description |
Required |
Default |
| channel |
支付渠道 |
NO |
alipay |
Channel List
| Name |
Description |
| alipay |
支付宝 |
| wx |
微信支付 |
Request Data
{ "channel": "alipay"}
cURL Example
curl -X POT -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\ http://localhost/market/order/payment/124/
Response
{ "status":0, "message":"", "charge":{ # pingpp charge }}
取消订单、确认收货、获取订单详情
Method and URL Structure
| Method |
Resource URL |
| PATCH |
/market/order/cancel/${order_number} |
| PATCH |
/market/order/confirm/${order_number} |
| GET |
/market/order/${order_number} |
cURL Example
# 取消订单curl -X PATCH -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\ http://localhost/market/order/cancel/124/# 获取订单详情curl -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\ http://localhost/market/order/124/
Response
{ "order_number":"14925746786777522516430013", "amount":"99.00", "channel":"alipay", "status":0, "evaluation":null, "is_done":false, "created":"2016-10-04T23:44:42.988819", "shipping_address":"山东青岛四方四方火车站", "telephone":"12345678910", "linkman":"张三", "tracking_number": "1234567899900", "shipper_name": "顺丰快递", "shipper_code": "SF", "profile":{ "owner":13, "nickname":"xiaoming", "avatar_url":"http://www.example.com/xiaoming.jpg", "slogan":"xiaoming's slogan" }, "bought_product_set":[{ "product":{ "pk":2, "category":6, "category_name":"Test Product Category", "name":"产品第一", "price":"99.00", "desc":"test desc", "evaluate_count":0, "cover":"http://cover.example.com/cover.png", "desc_files":"http://img.example.com/file1.png, http://img.example.com/fil2.jpg", "file_list":["http://img.example.com/file1.png","http://img.example.com/fil2.jpg"], "shop":null }, "quantity":1, "amount":99.0, "created":"2016-10-16T17:37:15.240813" }]}
获取订单列表
Method and URL Structure
| Method |
Resource URL |
| GET |
/market/orders/ |
cURL Example
curl -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\ http://localhost/market/orders/
Response
{ "count":4, "next":null, "previous":null, "results":[{ "profile":{ "owner":7, "nickname":"xiaoming", "avatar_url":"http://www.example.com/xiaoming.jpg", "slogan":"xiaoming's slogan" }, "order_number":"44fb62de-8a4d-11e6-8d37-a45e60e355d7", "amount":"297.00", "channel":"alipay", "status":0, "evaluation":null, "is_done":false, "shipping_address":"山东青岛四方四方火车站", "telephone":"12345678910", "linkman":"张三", "tracking_number": "1234567899900", "shipper_name": "顺丰快递", "shipper_code": "SF", "created":"2016-10-05T00:11:55.582339", "bought_product_set":[{ "product":{ "pk":2, "ctegory":6, "category_name":"Test Product Category", "name":"产品第一", "price":"99.00", "desc":"test desc", "evaluate_count":0, "cover":"http://cover.example.com/cover.png", "desc_files":"http://img.example.com/file1.png, http://img.example.com/fil2.jpg", "file_list":["http://img.example.com/file1.png","http://img.example.com/fil2.jpg"], "shop":null }, "quantity":3, "amount":297.0, "created":"2016-10-16T17:37:15.240813" }] },... ]}
评价订单
评价商品要一起评价
Method and URL Structure
| Method |
Resource URL |
| PUT |
/market/order/evaluate/${order_number} |
Request Data
{ "proudct": 1349, "scores":5, "image":"http://example.com/xx.png", "content":"评价订单相当于评价服务",}
Reponse
[{ "proudct": 1349, "scores":5, "image":"http://example.com/xx.png", "content":"评价订单相当于评价服务", "created":"2016-10-05T00:17:06.991977"}]
查询订单物流信息
评价商品要一起评价
Method and URL Structure
| Method |
Resource URL |
| GET |
/market/order/tracking/${order_number} |
cURL Example
curl --X GET http://localhost/market/order/tracking/100039393939/
Response Data
{ "Success":true, "ShipperCode":"YD", "LogisticCode":"3917551653360", "State":"3", "Traces":[{ "AcceptTime":"2017-01-07 23:26:52", "AcceptStation":"到达: xxx中心分拨分部 发往:xxx分拨中心" }, ..... { "AcceptTime":"2017-01-09 13:52:00", "AcceptStation":"到达:xxxx 由 已签收 签收" }], "EBusinessID":"1270798"}
ping++ 返回的 Charge 对象