PHP | <?php
require_once("../WdtClient.php");
$c = new WdtClient;
$c->sid = '';
$c->appkey = '';
$c->appsecret = '';
$c->gatewayUrl = 'http://sandbox.wangdian.cn/openapi2/sales_refund_push.php';
$api_refund_list = array( array(
"tid" => "test00053120009-3",
"shop_no" => "api_test",
"platform_id" => 127,
"refund_no" => "6",
"type" => "2",
"status" => "success",
"refund_fee" => "",
"buyer_nick" => "",
"refund_time" => "2023-04-12 16:24:08",
"reason" => "测试者",
"desc" => "北京",
"refund_version" => "北京市",
"order_list" => array(
array(
"oid" => "test0005-01-03",
"num" => 2
)
)
)
);
$c->putApiParam('api_refund_list',json_encode($api_refund_list,JSON_UNESCAPED_UNICODE));
$json = $c->wdtOpenApi();
var_dump($json);
?>
|
JAVA | package com.wangdian.api.refund;
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 SalesRefundPush {
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/
List<Map<String, Object>> api_refund_list = new ArrayList<Map<String, Object>>();
List<Map<String, Object>> order_list = new ArrayList<Map<String, Object>>();
Map<String, Object> order_1 = new HashMap<String, Object>();
order_1.put("oid", "AD201812110009");
order_1.put("num", "1");
order_list.add(order_1);
Map<String, Object> api_refund_1 = new HashMap<String, Object>();
api_refund_1.put("tid", "AT201812110001");
api_refund_1.put("platform_id", "127");
api_refund_1.put("shop_no", "ghs2test");
api_refund_1.put("refund_no", "sgsh1221g124");
api_refund_1.put("type", 3);
api_refund_1.put("status", "success");
api_refund_1.put("buyer_nick", "ghs");
api_refund_1.put("refund_time", "2023-04-12 16:24:08");
api_refund_1.put("order_list", order_list);
api_refund_list.add(api_refund_1);
String api_refund_list_json = JSON.toJSONString(api_refund_list);
//System.out.println(purchase_info_json);
Map<String, String> params = new HashMap<String, String>();
params.put("api_refund_list", api_refund_list_json);
try {
String response = client.execute("sales_refund_push.php", params);
System.out.println(response);
} catch (IOException e) {
e.printStackTrace();
}
}
} |
C# | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WdtSdk;
namespace salesRefundPush
{
class salesRefundPush
{
static void Main(string[] args)
{
WdtClient client = new WdtClient();
client.sid = "";
client.appkey = "";
client.appsecret = "";
client.gatewayUrl = "http://sandbox.wangdian.cn/openapi2/sales_refund_push.php";
var api_refund_list = new[]
{
new
{
platform_id="127",
shop_no="api_test",
tid="202202070001",
refund_no="202202070001",
type="1",
status="success",
refund_time="2023-04-12 16:24:08",
buyer_nick="1",
type="1",
order_list=new[]
{
new
{
oid="-1",
num= "1"
}
}
}
};
string json = api_refund_list.ToJsonString();
client.putParams("api_refund_list", 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/')
api_refund_list = []
order_list = []
order_1 = {}
order_1.update({"oid": 'ghsTest121101'})
order_1.update({"num": 1})
order_list.append(order_1)
refund_1 = {}
refund_1.update({"platform_id": '127'})
refund_1.update({"shop_no": 'test2-ot'})
refund_1.update({"tid": '12345678'})
refund_1.update({"refund_no": '12345678'})
refund_1.update({"type": '3'})
refund_1.update({"status": 'goods_returning'})
refund_1.update({"refund_fee": '10'})
refund_1.update({"buyer_nick": 'ceshi'})
refund_1.update({"refund_time": '2021-01-01 00:00:00'})
refund_1.update({"reason": '退款原因'})
refund_1.update({"desc": '备注'})
refund_1.update({"logistics_no": '物流单号'})
refund_1.update({"logistics_name": '物流公司名称'})
refund_1.update({"order_list": order_list})
api_refund_list.append(refund_1)
# del(api_refund_list[0])
jsonArr = json.dumps(api_refund_list, ensure_ascii=False)
params = {}
params.update({"api_refund_list": jsonArr})
response = t.execute("sales_refund_push.php", params)
print(response) |