我正在尝试使用梦幻般的api davidtsadler / ebay-sdk-php获取我的订单列表(已售出的商品)
https://github.com/davidtsadler/ebay-sdk-php
但我无法列出我发现了一些例子,但对我没有用。
$service = new Services\TradingService(array(
'apiVersion' => $this->config['tradingApiVersion'],
'siteId' => Constants\SiteIds::ES,
'sandbox'=> true,
));
/**
* Create the request object.
*
* For more information about creating a request object, see:
* http://devbay.net/sdk/guides/getting-started/#request-object
*/
$request = new Types\GetMyeBaySellingRequestType();
/**
* An user token is required when using the Trading service.
*
* For more information about getting your user tokens, see:
* http://devbay.net/sdk/guides/application-keys/
*/
$args = array(
"OrderStatus" => "Completed",
"OrderStatus" => "All",
"SortingOrder" => "Ascending",
//"OrderRole" => "Seller",
"ModTimeFrom" => new \DateTime('2015-01-01'),
);
$getOrders = new Types\GetOrdersRequestType($args);
$getOrders->RequesterCredentials = new Types\CustomSecurityHeaderType();
$getOrders->RequesterCredentials->eBayAuthToken = $this->config['sandbox']['userToken'];
$getOrders->IncludeFinalValueFee = true;
$getOrders->Pagination = new Types\PaginationType();
$getOrders->Pagination->EntriesPerPage = 200;
//$getOrders->OrderIDArray = new Types\OrderIDArrayType();
$getOrdersPageNum = 10;
//$getOrders->OrderIDArray->OrderID[] = '110169861526-110169862570'; //'200980916385-1185594371010'
$response = $service->getOrders($getOrders);
echo print_r($response,1);
foreach ($response->OrderArray->Order as $order) {
printf("SaleRecordID %s\n", $order->ShippingDetails->SellingManagerSalesRecordNumber);
}
它返回0页,虽然我已经'出售'和付费项目我的易趣私人帐户
DTS\eBaySDK\Trading\Types\GetOrdersResponseType Object
(
[values:DTS\eBaySDK\Types\BaseType:private] => Array
(
[Timestamp] => DateTime Object
(
[date] => 2015-10-05 15:14:01.578000
[timezone_type] => 2
[timezone] => Z
)
[Ack] => Success
[Version] => 927
[Build] => E927_INTL_API_17590342_R1
[PaginationResult] => DTS\eBaySDK\Trading\Types\PaginationResultType Object
(
[values:DTS\eBaySDK\Types\BaseType:private] => Array
(
[TotalNumberOfPages] => 0
[TotalNumberOfEntries] => 0
)
[attachment:DTS\eBaySDK\Types\BaseType:private] => Array
(
[data] =>
[mimeType] =>
)
)
[HasMoreOrders] =>
[OrderArray] => DTS\eBaySDK\Trading\Types\OrderArrayType Object
(
[values:DTS\eBaySDK\Types\BaseType:private] => Array
(
)
[attachment:DTS\eBaySDK\Types\BaseType:private] => Array
(
[data] =>
[mimeType] =>
)
)
[OrdersPerPage] => 100
[PageNumber] => 1
[ReturnedOrderCountActual] => 0
)
[attachment:DTS\eBaySDK\Types\BaseType:private] => Array
(
[data] =>
[mimeType] =>
)
)
答案 0 :(得分:1)
好 我发现自己是解决方案! 它必须在GetOrdersRequestType($ args)的调用中被调整一段时间
“CreateTimeFrom”=> new \ DateTime('2015-01-01'), “CreateTimeTo”=> new \ DateTime('2015-10-06'),
如果不是,则不会检索任何内容。
工作示例:
$service = new Services\TradingService(array(
'apiVersion' => $this->config['tradingApiVersion'],
'siteId' => Constants\SiteIds::ES,
'sandbox'=> true,
));
/**
* Create the request object.
*
* For more information about creating a request object, see:
* http://devbay.net/sdk/guides/getting-started/#request-object
*/
$request = new Types\GetMyeBaySellingRequestType();
/**
* An user token is required when using the Trading service.
*
* For more information about getting your user tokens, see:
* http://devbay.net/sdk/guides/application-keys/
*/
$args = array(
"OrderStatus" => "Completed",
"OrderStatus" => "All",
"SortingOrder" => "Ascending",
//"OrderRole" => "Seller",
"CreateTimeFrom" => new \DateTime('2015-01-01'),
"CreateTimeTo" => new \DateTime('2015-10-06'),
);
$getOrders = new Types\GetOrdersRequestType($args);
$getOrders->RequesterCredentials = new Types\CustomSecurityHeaderType();
$getOrders->RequesterCredentials->eBayAuthToken = $this->config['sandbox']['userToken'];
$getOrders->IncludeFinalValueFee = true;
$getOrders->Pagination = new Types\PaginationType();
$getOrders->Pagination->EntriesPerPage = 3;
//$getOrders->OrderIDArray = new Types\OrderIDArrayType();
$getOrdersPageNum = 1;
//$getOrders->OrderIDArray->OrderID[] = '200980916385-1185594371010'; //'200980916385-1185594371010'
$response = $service->getOrders($getOrders);
echo print_r($response,1);
foreach ($response->OrderArray->Order as $order) {
printf("SaleRecordID %s\n", $order->ShippingDetails->SellingManagerSalesRecordNumber);
}
exit(0);