Module: Wdt::Client::Trades

Included in:
Wdt::Client
Defined in:
lib/wdt/client/trades.rb

Overview

订单推送 和 订单查询接口

Instance Method Summary collapse

Instance Method Details

#push_trade(options = {}) ⇒ Object

原始单推送接口 是一个订单的基本信息

options example {

"tid" =>  "test0005",
"trade_status" =>  30,
"pay_status" =>  2,
"delivery_term" =>  1,
"trade_time" =>  "2015-01-01 10:00:00",
"pay_time" =>  "",
"buyer_nick" =>  "mytest",
"buyer_email" =>  "",
"pay_id" =>  "1212121",
"pay_account" =>  "[email protected]",
"receiver_name" =>  "测试者",
"receiver_province" =>  "北京",
"receiver_city" =>  "北京市",
"receiver_district" =>  "昌平区",
"receiver_address" =>  "天通苑",
"receiver_mobile" =>  "15345543211",
"receiver_telno" =>  "",
"receiver_zip" =>  "",
"logistics_type" =>  "-1",
"invoice_type" =>  1,
"invoice_title" =>  "测试抬头",
"buyer_message" =>  "买家留言",
"seller_memo" =>  "卖家备注",
"seller_flag" =>  "0",
"post_amount" =>  "10",
"cod_amount" =>  0,
"ext_cod_fee" =>  0,
"paid" =>  20,
"order_list" =>  [
  {
    "oid" =>  "test0005-01",
    "num" =>  2,
    "price" =>  10,
    "status" =>  30,
    "refund_status" =>  0,
    "goods_id" =>  "1001",
    "spec_id" =>  "1001",
    "goods_no" =>  "test001",
    "spec_no" =>  "test001-01",
    "goods_name" =>  "测试用例1",
    "spec_name" =>  "规格01",
    "adjust_amount" =>  0,
    "discount" =>  10,
    "share_discount" =>  0,
    "cid" =>  ""
  }
]

}



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/wdt/client/trades.rb', line 59

def push_trade(options={})
  params = {
    shop_no: shop_no,
    trade_list: [ options ].to_json
  }


  # 请求参数的完整结构
  # 
  # {
  #   shop_no: ""
  #   sid: ""
  #   appkey: ""
  #   timestamp: ""
  #   sign: ""
  #   trade_list: [trade_info, trade_info, trade_info].to_json
  # }
  response = post "/openapi2/trade_push.php", params
  response
end