PHP | <?php
require_once("../WdtClient.php");
$c = new WdtClient;
$c->sid = '';
$c->appkey = '';
$c->appsecret = '';
$c->gatewayUrl = 'http://sandbox.wangdian.cn/openapi2/purchase_return_push.php';
$return_info = array (
"receiver_city" => "",
"logistics_code" => "",
"warehouse_no" => "api_test",
"contact" => "",
"post_fee" => "0",
"telno" => "",
"receiver_province" => "",
"detail_list" => array (
array (
"spec_no" => "test-sd-ptpt-00001",
"detail_remark" => "",
"num" => "6.0000",
"price" => "149.3097",
"discount" => "0"
)
),
"receiver_district" => "",
"address" => "",
"remark" => "",
"outer_no" => "1525",
"purchaser_no" => "",
"provider_no" => "88888805"
);
$c->putApiParam('return_info', json_encode($return_info, JSON_UNESCAPED_UNICODE));
$json = $c->wdtOpenApi();
var_dump($json);
?> |
JAVA | package com.wangdian.api.purchase;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.alibaba.fastjson.JSON;
import com.wangdian.api.WdtClient;
public class PurchaseReturnPush {
public static void main(String[] args) {
// TODO Auto-generated method stub
WdtClient client = new WdtClient("传入sid", "传入appkey", "传入appsecret", "传入url");
//测试环境sid、appkey、密钥请到旺店通开放平台-自助对接-申请测试环境内查看,测试环境url=https://sandbox.wangdian.cn/openapi2/
//调用正式环境时请将sid、appkey、appsecret切换为实际参数,参数在旺店通开放平台-自助对接-应用管理内应用状态为已上线的应用中查看,调用正式环境注意切换正式环境url=https://api.wangdian.cn/openapi2/
Map<String, Object> return_info = new HashMap<String, Object>();
List<Map<String, Object>> detail_list = new ArrayList<Map<String,Object>>();
Map<String, Object> detail_1 = new HashMap<String, Object>();
detail_1.put("spec_no", "qqq");
detail_1.put("num", 6);
detail_1.put("price", 123);
detail_1.put("discount", 0);
detail_list.add(detail_1);
return_info.put("provider_no", "ghs123");
return_info.put("outer_no", "ghs23214");
return_info.put("warehouse_no", "ghs2test");
return_info.put("detail_list", detail_list);
String return_info_json = JSON.toJSONString(return_info);
Map<String, String> params = new HashMap<String, String>();
params.put("return_info", return_info_json);
try {
String response = client.execute("purchase_return_push.php", params);
System.out.println(response);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} |
C# | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WdtSdk;
namespace PurchaseReturnPush
{
class PurchaseReturnPush
{
static void Main(string[] args)
{
WdtClient client = new WdtClient();
client.sid = "";
client.appkey = "";
client.appsecret = "";
client.gatewayUrl = "http://sandbox.wangdian.cn/openapi2/purchase_return_push.php";
var return_info = new
{
purchase_no = "34567876543234",
provider_no = "wl00001",
outer_no = "345678987654",
warehouse_no = "api_test",
detail_list = new[]
{
new
{
spec_no ="1001017308AYS2S",
num = "1"
},
new
{
spec_no ="sku002",
num = "1"
}
}
};
string json = return_info.ToJsonString();
client.putParams("return_info", json);
string result = client.wdtOpenapi();
Console.WriteLine(result);
Console.ReadKey();
}
}
} |
python
| import WdtClient
import json
t = WdtClient.WdtClient('appkey', 'appsecret', 'sid', 'http://sandbox.wangdian.cn/openapi2/')
return_info = {}
detail_list = []
details_1 = {}
details_1.update({"spec_no": 'spec_001'})
details_1.update({"num": '10'})
details_1.update({"price": '1'})
details_1.update({"discount": ''})
details_1.update({"detail_remark": '备注'})
detail_list.append(details_1)
return_info.update({"provider_no": '001'})
return_info.update({"warehouse_no": 'test001'})
return_info.update({"outer_no": 'test001'})
return_info.update({"purchaser_no": ''})
return_info.update({"is_check": '0'})
return_info.update({"is_create_batch": '0'})
return_info.update({"logistics_code": ''})
return_info.update({"post_fee": ''})
return_info.update({"prop1": ''})
return_info.update({"prop2": ''})
return_info.update({"remark": '备注'})
return_info.update({"detail_list": detail_list})
# del(return_info[0])
jsonArr = json.dumps(return_info, ensure_ascii=False)
params = {}
params.update({"return_info": jsonArr})
response = t.execute("purchase_return_push.php", params)
print(response) |