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" => "",
"alipay_no" => "mytest",
"buyer_nick" => "",
"refund_time" => "1212121",
"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("", "", "", "");
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", "1212121");
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();
}
}
} |