旺店通 API 封装
旺店通ERP系统覆盖线上电商以及线下实体店,涵盖订单管理,货品管理,仓库管理,采购管理,售后管理,会员管理等主要功能。此 Gem 主要封装了以下 API:
- 原始单推送(已完成)
- 待同步物流查询 (todo)
- 物流同步状态回写 (todo)
- 订单查询 (todo)
- 外部库存同步 (todo)
- 退换单查询 (todo)
Quick Start
Add this line to your application's Gemfile:
gem 'wdt'
And then execute:
$ bundle
Or install it yourself as:
$ gem install wdt
Usage
[API methods][] are available as module methods (consuming module-level configuration) or as client instance methods.
# Provide authentication credentials
Wdt.configure do |config|
config.sid = "9i7fz2xp1s7x"
config.appkey = "942w2atpk218"
config.appsecret = "sfx4ne1mvy1k"
config.endpoint = "http://v2.wangdian.com/"
config.shop_no = "123456"
end
# 推送订单至旺店通 erp
params = {
"tid" => "test00051",
"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-011",
"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" => ""
}
]
}
Wdt.push_trade(params)
or
# 创建一个 client 对象
client = Wdt::Client.new(
sid: "9i7fz2xp1s7x"
appkey: "942w2atpk218"
appsecret: "sfx4ne1mvy1k"
endpoint: "http://www.xxxx.com"
shop_no: "123456"
)
# 推送订单至旺店通 erp
client.push_trade(params)
Contributing
- Fork it ( https://github.com/xiaoronglv/wdt/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request