[关闭]
@fuyb1986 2017-01-18T07:12:01.000000Z 字数 5788 阅读 652

订单

金色童年


购买商品生成订单

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

  1. {
  2. "linkman": "张三",
  3. "telephone":"12345678910",
  4. "shipping_address":"山东青岛四方四方火车站",
  5. "quantity":3,
  6. "user_point": false,
  7. }

cURL Example

  1. curl -X POT -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\
  2. -H 'Content-Type: application/json' --data '{...}' http://localhost/market/proudct/purchase/124/

Response

  1. {
  2. "order_number":"14925746786777522516430013",
  3. "amount":"297.0",
  4. "channel":"alipay",
  5. "status":0,
  6. "evaluation":null,
  7. "is_done":false,
  8. "created":"2016-10-04T23:44:42.988819",
  9. "shipping_address":"山东青岛四方四方火车站",
  10. "telephone":"12345678910",
  11. "linkman":"张三",
  12. "tracking_number": "1234567899900",
  13. "shipper_name": "顺丰快递",
  14. "shipper_code": "SF",
  15. "profile":{
  16. "owner":13,
  17. "nickname":"xiaoming",
  18. "avatar_url":"http://www.example.com/xiaoming.jpg",
  19. "slogan":"xiaoming's slogan"
  20. },
  21. "bought_product_set":[{
  22. "product":{
  23. "pk":2,
  24. "category":6,
  25. "category_name":"Test Product Category",
  26. "name":"产品第一",
  27. "price":"99.00",
  28. "desc":"test desc",
  29. "evaluate_count":0,
  30. "cover":"http://cover.example.com/cover.png",
  31. "desc_files":"http://img.example.com/file1.png,
  32. http://img.example.com/fil2.jpg",
  33. "file_list":["http://img.example.com/file1.png","http://img.example.com/fil2.jpg"],
  34. "shop":null
  35. },
  36. "quantity":3,
  37. "amount":297.0,
  38. "created":"2016-10-16T17:37:15.240813"
  39. }]
  40. }

购物车生成订单

购物车里没有选中商品,生成订单失败

Method and URL Structure

Method Resource URL
POST /market/cart/purchase/

Request Paramaters

Name Description
linkman 联系人
shipping_address 地址
telephone 电话
user_point 是否用积分

Requeset Data

  1. {
  2. "linkman": "张三",
  3. "telephone":"12345678910",
  4. "shipping_address":"山东青岛四方四方火车站",
  5. "user_point": false,
  6. }

cURL Example

  1. curl -X POT -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\
  2. -H 'Content-Type: application/json' --data '{...}' http://localhost/market/cart/purchase/

Response

  1. {
  2. "order_number":"14925746786777522516430013",
  3. "amount":"297.0",
  4. "channel":"alipay",
  5. "status":0,
  6. "is_done":false,
  7. "created":"2016-10-04T23:44:42.988819",
  8. "profile":{
  9. "owner":13,
  10. "nickname":"xiaoming",
  11. "avatar_url":"http://www.example.com/xiaoming.jpg",
  12. "slogan":"xiaoming's slogan"
  13. },
  14. }

支付订单

返回 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

  1. {
  2. "channel": "alipay"
  3. }

cURL Example

  1. curl -X POT -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\
  2. http://localhost/market/order/payment/124/

Response

  1. {
  2. "status":0,
  3. "message":"",
  4. "charge":{
  5. # pingpp charge
  6. }
  7. }

取消订单、确认收货、获取订单详情

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

  1. # 取消订单
  2. curl -X PATCH -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\
  3. http://localhost/market/order/cancel/124/
  4. # 获取订单详情
  5. curl -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\
  6. http://localhost/market/order/124/

Response

  1. {
  2. "order_number":"14925746786777522516430013",
  3. "amount":"99.00",
  4. "channel":"alipay",
  5. "status":0,
  6. "evaluation":null,
  7. "is_done":false,
  8. "created":"2016-10-04T23:44:42.988819",
  9. "shipping_address":"山东青岛四方四方火车站",
  10. "telephone":"12345678910",
  11. "linkman":"张三",
  12. "tracking_number": "1234567899900",
  13. "shipper_name": "顺丰快递",
  14. "shipper_code": "SF",
  15. "profile":{
  16. "owner":13,
  17. "nickname":"xiaoming",
  18. "avatar_url":"http://www.example.com/xiaoming.jpg",
  19. "slogan":"xiaoming's slogan"
  20. },
  21. "bought_product_set":[{
  22. "product":{
  23. "pk":2,
  24. "category":6,
  25. "category_name":"Test Product Category",
  26. "name":"产品第一",
  27. "price":"99.00",
  28. "desc":"test desc",
  29. "evaluate_count":0,
  30. "cover":"http://cover.example.com/cover.png",
  31. "desc_files":"http://img.example.com/file1.png,
  32. http://img.example.com/fil2.jpg",
  33. "file_list":["http://img.example.com/file1.png","http://img.example.com/fil2.jpg"],
  34. "shop":null
  35. },
  36. "quantity":1,
  37. "amount":99.0,
  38. "created":"2016-10-16T17:37:15.240813"
  39. }]
  40. }

获取订单列表

Method and URL Structure

Method Resource URL
GET /market/orders/

cURL Example

  1. curl -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\
  2. http://localhost/market/orders/

Response

  1. {
  2. "count":4,
  3. "next":null,
  4. "previous":null,
  5. "results":[{
  6. "profile":{
  7. "owner":7,
  8. "nickname":"xiaoming",
  9. "avatar_url":"http://www.example.com/xiaoming.jpg",
  10. "slogan":"xiaoming's slogan"
  11. },
  12. "order_number":"44fb62de-8a4d-11e6-8d37-a45e60e355d7",
  13. "amount":"297.00",
  14. "channel":"alipay",
  15. "status":0,
  16. "evaluation":null,
  17. "is_done":false,
  18. "shipping_address":"山东青岛四方四方火车站",
  19. "telephone":"12345678910",
  20. "linkman":"张三",
  21. "tracking_number": "1234567899900",
  22. "shipper_name": "顺丰快递",
  23. "shipper_code": "SF",
  24. "created":"2016-10-05T00:11:55.582339",
  25. "bought_product_set":[{
  26. "product":{
  27. "pk":2,
  28. "ctegory":6,
  29. "category_name":"Test Product Category",
  30. "name":"产品第一",
  31. "price":"99.00",
  32. "desc":"test desc",
  33. "evaluate_count":0,
  34. "cover":"http://cover.example.com/cover.png",
  35. "desc_files":"http://img.example.com/file1.png,
  36. http://img.example.com/fil2.jpg",
  37. "file_list":["http://img.example.com/file1.png","http://img.example.com/fil2.jpg"],
  38. "shop":null
  39. },
  40. "quantity":3,
  41. "amount":297.0,
  42. "created":"2016-10-16T17:37:15.240813"
  43. }]
  44. },... ]
  45. }

评价订单

评价商品要一起评价

Method and URL Structure

Method Resource URL
PUT /market/order/evaluate/${order_number}

Request Data

  1. {
  2. "proudct": 1349,
  3. "scores":5,
  4. "image":"http://example.com/xx.png",
  5. "content":"评价订单相当于评价服务",
  6. }

Reponse

  1. [{
  2. "proudct": 1349,
  3. "scores":5,
  4. "image":"http://example.com/xx.png",
  5. "content":"评价订单相当于评价服务",
  6. "created":"2016-10-05T00:17:06.991977"
  7. }]

查询订单物流信息

评价商品要一起评价

Method and URL Structure

Method Resource URL
GET /market/order/tracking/${order_number}

cURL Example

  1. curl --X GET http://localhost/market/order/tracking/100039393939/

Response Data

  1. {
  2. "Success":true,
  3. "ShipperCode":"YD",
  4. "LogisticCode":"3917551653360",
  5. "State":"3",
  6. "Traces":[{
  7. "AcceptTime":"2017-01-07 23:26:52",
  8. "AcceptStation":"到达: xxx中心分拨分部 发往:xxx分拨中心"
  9. },
  10. .....
  11. {
  12. "AcceptTime":"2017-01-09 13:52:00",
  13. "AcceptStation":"到达:xxxx 由 已签收 签收"
  14. }],
  15. "EBusinessID":"1270798"
  16. }

ping++ 返回的 Charge 对象

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注