TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
AlitripBtripSupplychainTrainCallbackBookRequest req = new AlitripBtripSupplychainTrainCallbackBookRequest();
AlitripBtripSupplychainTrainCallbackBookRequest.BookCallbackParam obj1 = new AlitripBtripSupplychainTrainCallbackBookRequest.BookCallbackParam();
List<AlitripBtripSupplychainTrainCallbackBookRequest.BookTrainDetail> list3 = new ArrayList<AlitripBtripSupplychainTrainCallbackBookRequest.BookTrainDetail>();
AlitripBtripSupplychainTrainCallbackBookRequest.BookTrainDetail obj4 = new AlitripBtripSupplychainTrainCallbackBookRequest.BookTrainDetail();
list3.add(obj4);
obj4.setToStationName("上海");
obj4.setArriveTime("2022-10-28 12:00:00");
obj4.setOrderTotalPrice("1000");
obj4.setTrainDate("2022-10-28");
obj4.setFromStationName("北京");
obj4.setTicketNum("1");
obj4.setToStationCode("SHH");
List<AlitripBtripSupplychainTrainCallbackBookRequest.BookTicketDetail> list7 = new ArrayList<AlitripBtripSupplychainTrainCallbackBookRequest.BookTicketDetail>();
AlitripBtripSupplychainTrainCallbackBookRequest.BookTicketDetail obj8 = new AlitripBtripSupplychainTrainCallbackBookRequest.BookTicketDetail();
list7.add(obj8);
obj8.setResignFlag("1");
obj8.setCoachNo("01");
obj8.setTicketPrice("1000");
obj8.setTicketEntrance("{\"0\":\"xx检票口\"}");
AlitripBtripSupplychainTrainCallbackBookRequest.PassengerInfo obj10 = new AlitripBtripSupplychainTrainCallbackBookRequest.PassengerInfo();
obj10.setPassengerName("张三");
obj10.setPassengerMobile("1667xx87xxx");
obj10.setPassengerIdNo("432524100011191212");
obj10.setPassengerIdType("0");
obj10.setCountryCode("CN");
obj10.setSex("0");
obj10.setPassengerId("123452");
obj10.setValidDateStart("2000-12-12");
obj10.setBirthDate("1000-11-19");
obj10.setValidDateEnd("2030-12-12");
list9.setPassengerInfo(obj10);
obj8.setTicketType("1");
obj8.setSeatType("1");
obj8.setTicketStatus("11");
obj8.setRefundFlag("0");
obj8.setSeatName("硬座");
obj8.setChangeFlag("1");
obj8.setSeatNo("001");
obj8.setPassengerTicketNo("EW123123212");
obj8.setFailCode("1001");
obj8.setFailReason("车次已无票");
list5.setBookTicketDetails(list7);
obj4.setTrainNo("T123");
obj4.setFromStationCode("BJP");
obj4.setStartTime("2022-10-10 12:00:00");
obj4.setTrainId("车次id");
obj1.setBookTrainDetails(list3);
obj1.setSupplierOrderId("987654321");
obj1.setTicketNo("EW123452");
obj1.setOrderId("123456789");
obj1.setOrderStatus("11");
obj1.setPurchaseType("2");
obj1.setFailCode("1001");
obj1.setFailReason("车次已无票");
req.setBookCallbackParam(obj1);
AlitripBtripSupplychainTrainCallbackBookResponse rsp = client.execute(req);
System.out.println(rsp.getBody());
ITopClient client = new DefaultTopClient(url, appkey, secret);
AlitripBtripSupplychainTrainCallbackBookRequest req = new AlitripBtripSupplychainTrainCallbackBookRequest();
AlitripBtripSupplychainTrainCallbackBookRequest.BookCallbackParamDomain obj1 = new AlitripBtripSupplychainTrainCallbackBookRequest.BookCallbackParamDomain();
List<AlitripBtripSupplychainTrainCallbackBookRequest.BookTrainDetailDomain> list3 = new List<AlitripBtripSupplychainTrainCallbackBookRequest.BookTrainDetailDomain>();
AlitripBtripSupplychainTrainCallbackBookRequest.BookTrainDetailDomain obj4 = new AlitripBtripSupplychainTrainCallbackBookRequest.BookTrainDetailDomain();
list3.Add(obj4);
obj4.ToStationName = "上海";
obj4.ArriveTime = "2022-10-28 12:00:00";
obj4.OrderTotalPrice = "1000";
obj4.TrainDate = "2022-10-28";
obj4.FromStationName = "北京";
obj4.TicketNum = "1";
obj4.ToStationCode = "SHH";
List<AlitripBtripSupplychainTrainCallbackBookRequest.BookTicketDetailDomain> list6 = new List<AlitripBtripSupplychainTrainCallbackBookRequest.BookTicketDetailDomain>();
AlitripBtripSupplychainTrainCallbackBookRequest.BookTicketDetailDomain obj7 = new AlitripBtripSupplychainTrainCallbackBookRequest.BookTicketDetailDomain();
list6.Add(obj7);
obj7.ResignFlag = "1";
obj7.CoachNo = "01";
obj7.TicketPrice = "1000";
obj7.TicketEntrance = "{\"0\":\"xx检票口\"}";
AlitripBtripSupplychainTrainCallbackBookRequest.PassengerInfoDomain obj8 = new AlitripBtripSupplychainTrainCallbackBookRequest.PassengerInfoDomain();
obj8.PassengerName = "张三";
obj8.PassengerMobile = "1667xx87xxx";
obj8.PassengerIdNo = "432524100011191212";
obj8.PassengerIdType = "0";
obj8.CountryCode = "CN";
obj8.Sex = "0";
obj8.PassengerId = "123452";
obj8.ValidDateStart = "2000-12-12";
obj8.BirthDate = "1000-11-19";
obj8.ValidDateEnd = "2030-12-12";
obj7.PassengerInfo= obj8;
obj7.TicketType = "1";
obj7.SeatType = "1";
obj7.TicketStatus = "11";
obj7.RefundFlag = "0";
obj7.SeatName = "硬座";
obj7.ChangeFlag = "1";
obj7.SeatNo = "001";
obj7.PassengerTicketNo = "EW123123212";
obj7.FailCode = "1001";
obj7.FailReason = "车次已无票";
obj4.BookTicketDetails= list6;
obj4.TrainNo = "T123";
obj4.FromStationCode = "BJP";
obj4.StartTime = "2022-10-10 12:00:00";
obj4.TrainId = "车次id";
obj1.BookTrainDetails= list3;
obj1.SupplierOrderId = "987654321";
obj1.TicketNo = "EW123452";
obj1.OrderId = "123456789";
obj1.OrderStatus = "11";
obj1.PurchaseType = "2";
obj1.FailCode = "1001";
obj1.FailReason = "车次已无票";
req.BookCallbackParam_ = obj1;
AlitripBtripSupplychainTrainCallbackBookResponse rsp = client.Execute(req);
Console.WriteLine(rsp.Body);
$c = new TopClient;
$c->appkey = $appkey;
$c->secretKey = $secret;
$req = new AlitripBtripSupplychainTrainCallbackBookRequest;
$book_callback_param = new BookCallbackParam;
$book_train_details = new BookTrainDetail;
$book_train_details->to_station_name="上海";
$book_train_details->arrive_time="2022-10-28 12:00:00";
$book_train_details->order_total_price="1000";
$book_train_details->train_date="2022-10-28";
$book_train_details->from_station_name="北京";
$book_train_details->ticket_num="1";
$book_train_details->to_station_code="SHH";
$book_ticket_details = new BookTicketDetail;
$book_ticket_details->resign_flag="1";
$book_ticket_details->coach_no="01";
$book_ticket_details->ticket_price="1000";
$book_ticket_details->ticket_entrance="{\"0\":\"xx检票口\"}";
$passenger_info = new PassengerInfo;
$passenger_info->passenger_name="张三";
$passenger_info->passenger_mobile="1667xx87xxx";
$passenger_info->passenger_id_no="432524100011191212";
$passenger_info->passenger_id_type="0";
$passenger_info->country_code="CN";
$passenger_info->sex="0";
$passenger_info->passenger_id="123452";
$passenger_info->valid_date_start="2000-12-12";
$passenger_info->birth_date="1000-11-19";
$passenger_info->valid_date_end="2030-12-12";
$book_ticket_details->passenger_info = $passenger_info;
$book_ticket_details->ticket_type="1";
$book_ticket_details->seat_type="1";
$book_ticket_details->ticket_status="11";
$book_ticket_details->refund_flag="0";
$book_ticket_details->seat_name="硬座";
$book_ticket_details->change_flag="1";
$book_ticket_details->seat_no="001";
$book_ticket_details->passenger_ticket_no="EW123123212";
$book_ticket_details->fail_code="1001";
$book_ticket_details->fail_reason="车次已无票";
$book_train_details->book_ticket_details = $book_ticket_details;
$book_train_details->train_no="T123";
$book_train_details->from_station_code="BJP";
$book_train_details->start_time="2022-10-10 12:00:00";
$book_train_details->train_id="车次id";
$book_callback_param->book_train_details = $book_train_details;
$book_callback_param->supplier_order_id="987654321";
$book_callback_param->ticket_no="EW123452";
$book_callback_param->order_id="123456789";
$book_callback_param->order_status="11";
$book_callback_param->purchase_type="2";
$book_callback_param->fail_code="1001";
$book_callback_param->fail_reason="车次已无票";
$req->setBookCallbackParam(json_encode($book_callback_param));
$resp = $c->execute($req);
curl -X POST 'http://gw.api.taobao.com/router/rest' \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'app_key=12129701' \
-d 'format=json' \
-d 'method=alitrip.btrip.supplychain.train.callback.book' \
-d 'partner_id=apidoc' \
-d 'sign=92B792D9AC3CB1EF70830011EA158121' \
-d 'sign_method=hmac' \
-d 'timestamp=2024-11-21+19%3A54%3A35' \
-d 'v=2.0' \
-d 'book_callback_param=null'
# -*- coding: utf-8 -*-
import top.api
req=top.api.AlitripBtripSupplychainTrainCallbackBookRequest(url,port)
req.set_app_info(top.appinfo(appkey,secret))
req.book_callback_param="数据结构示例JSON格式"
try:
resp= req.getResponse()
print(resp)
except Exception,e:
print(e)
pTopRequest pRequest = alloc_top_request();
pTopResponse pResponse = NULL;
pTaobaoClient pClient = alloc_taobao_client(url, appkey, appsecret);
set_api_name(pRequest,"alitrip.btrip.supplychain.train.callback.book");
add_param(pRequest,"book_callback_param","数据结构JSON示例");
pResponse = top_execute(pClient,pRequest,NULL);
printf("ret code:%d\n",pResponse->code);
if(pResponse->code == 0){
pTopResponseIterator ite = init_response_iterator(pResponse);
pResultItem pResultItem = alloc_result_item();
while(parseNext(ite, pResultItem) == 0){
printf("%s:%s\n",pResultItem->key,pResultItem->value);
}
destroy_response_iterator(ite);
destroy_result_item(pResultItem);
}
destroy_top_request(pRequest);
destroy_top_response(pResponse);
destroy_taobao_client(pClient);
TopClient = require('./topClient').TopClient;
var client = new TopClient({
'appkey': 'appkey',
'appsecret': 'secret',
'REST_URL': 'http://gw.api.taobao.com/router/rest'
});
client.execute('alitrip.btrip.supplychain.train.callback.book', {
'book_callback_param':'数据结构JSON示例'
}, function(error, response) {
if (!error) console.log(response);
else console.log(error);
})