本文整理汇总了PHP中MarketplaceWebService_Interface类的典型用法代码示例。如果您正苦于以下问题:PHP MarketplaceWebService_Interface类的具体用法?PHP MarketplaceWebService_Interface怎么用?PHP MarketplaceWebService_Interface使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MarketplaceWebService_Interface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: invokeGetFeedSubmissionResult
/**
* Get Feed Submission Result Action Sample
* retrieves the feed processing report
*
* @param MarketplaceWebService_Interface $service instance of MarketplaceWebService_Interface
* @param mixed $request MarketplaceWebService_Model_GetFeedSubmissionResult or array of parameters
*/
function invokeGetFeedSubmissionResult(MarketplaceWebService_Interface $service, $request)
{
try {
$response = $service->getFeedSubmissionResult($request);
result("Service Response\n");
result("=============================================================================\n");
result(" GetFeedSubmissionResultResponse\n");
if ($response->isSetGetFeedSubmissionResultResult()) {
$getFeedSubmissionResultResult = $response->getGetFeedSubmissionResultResult();
result(" GetFeedSubmissionResult");
if ($getFeedSubmissionResultResult->isSetContentMd5()) {
result(" ContentMd5");
result(" " . $getFeedSubmissionResultResult->getContentMd5() . "\n");
}
}
if ($response->isSetResponseMetadata()) {
result(" ResponseMetadata\n");
$responseMetadata = $response->getResponseMetadata();
if ($responseMetadata->isSetRequestId()) {
result(" RequestId\n");
result(" " . $responseMetadata->getRequestId() . "\n");
}
}
result(" ResponseHeaderMetadata: " . $response->getResponseHeaderMetadata() . "\n");
echo json_encode($response);
} catch (MarketplaceWebService_Exception $ex) {
result("Caught Exception: " . $ex->getMessage() . "\n");
result("Response Status Code: " . $ex->getStatusCode() . "\n");
result("Error Code: " . $ex->getErrorCode() . "\n");
result("Error Type: " . $ex->getErrorType() . "\n");
result("Request ID: " . $ex->getRequestId() . "\n");
result("XML: " . $ex->getXML() . "\n");
result("ResponseHeaderMetadata: " . $ex->getResponseHeaderMetadata() . "\n");
}
}
开发者ID:adnanoner,项目名称:purple-xmls-google-product-feed-for-woocommerce,代码行数:42,代码来源:upload_feed_status.php
示例2: invokeGetReportList
function invokeGetReportList(MarketplaceWebService_Interface $service, $request)
{
try {
$response = $service->getReportList($request);
if ($response->isSetGetReportListResult()) {
$getReportListResult = $response->getGetReportListResult();
$reportInfoList = $getReportListResult->getReportInfoList();
foreach ($reportInfoList as $reportInfo) {
if ($reportInfo->isSetReportType() && $reportInfo->getReportType() == '_GET_ORDERS_DATA_' && $reportInfo->isSetReportId()) {
return $reportInfo->getReportId();
}
}
} else {
return false;
}
} catch (MarketplaceWebService_Exception $ex) {
$message = 'MWS Report API : Caught Exception : ' . $ex->getMessage() . "\n";
$message .= "Response Status Code: " . $ex->getStatusCode() . "\n";
$message .= "Error Code: " . $ex->getErrorCode() . "\n";
$message .= "Error Type: " . $ex->getErrorType() . "\n";
$param['message'] = $message;
$obj = new Pwapresta();
$obj->generate_log($param);
}
}
示例3: invokeGetFeedSubmissionResult
function invokeGetFeedSubmissionResult(MarketplaceWebService_Interface $service, $request)
{
try {
$response = $service->getFeedSubmissionResult($request);
} catch (MarketplaceWebService_Exception $ex) {
echo "Caught Exception: " . $ex->getMessage() . "\n";
echo "Response Status Code: " . $ex->getStatusCode() . "\n";
echo "Error Code: " . $ex->getErrorCode() . "\n";
echo "Error Type: " . $ex->getErrorType() . "\n";
echo "Request ID: " . $ex->getRequestId() . "\n";
echo "XML: " . $ex->getXML() . "\n";
}
}
示例4: invokeGetReport
function invokeGetReport(MarketplaceWebService_Interface $service, $request)
{
try {
$response = $service->getReport($request);
return stream_get_contents($request->getReport());
} catch (MarketplaceWebService_Exception $ex) {
$message = 'MWS Report API : Caught Exception : ' . $ex->getMessage() . "\n";
$message .= "Response Status Code: " . $ex->getStatusCode() . "\n";
$message .= "Error Code: " . $ex->getErrorCode() . "\n";
$message .= "Error Type: " . $ex->getErrorType() . "\n";
$param['message'] = $message;
$this->generate_log($param);
}
}
示例5: invokeGetFeedSubmissionList
/**
* Get Feed Submission List Action Sample
* returns a list of feed submission identifiers and their associated metadata
*
* @param MarketplaceWebService_Interface $service instance of MarketplaceWebService_Interface
* @param mixed $request MarketplaceWebService_Model_GetFeedSubmissionList or array of parameters
*/
function invokeGetFeedSubmissionList(MarketplaceWebService_Interface $service, $request)
{
try {
$response = $service->getFeedSubmissionList($request);
echo "<h1>Service Response</h1>\n";
if ($response->isSetGetFeedSubmissionListResult()) {
$getFeedSubmissionListResult = $response->getGetFeedSubmissionListResult();
$feedSubmissionInfoList = $getFeedSubmissionListResult->getFeedSubmissionInfoList();
foreach ($feedSubmissionInfoList as $feedSubmissionInfo) {
echo "<h2>FeedSubmissionInfo</h2>\n";
if ($feedSubmissionInfo->isSetFeedSubmissionId()) {
echo "<p>FeedSubmissionId:\n";
echo " " . $feedSubmissionInfo->getFeedSubmissionId() . "</p>\n";
}
if ($feedSubmissionInfo->isSetFeedType()) {
echo "<p>FeedType:\n";
echo " " . $feedSubmissionInfo->getFeedType() . "</p>\n";
}
if ($feedSubmissionInfo->isSetSubmittedDate()) {
echo "<p>SubmittedDate:\n";
echo " " . $feedSubmissionInfo->getSubmittedDate()->format(DATE_FORMAT) . "</p>\n";
}
if ($feedSubmissionInfo->isSetFeedProcessingStatus()) {
echo "<p>FeedProcessingStatus:\n";
echo " " . $feedSubmissionInfo->getFeedProcessingStatus() . "</p>\n";
}
if ($feedSubmissionInfo->isSetStartedProcessingDate()) {
echo "<p>StartedProcessingDate:\n";
echo " " . $feedSubmissionInfo->getStartedProcessingDate()->format(DATE_FORMAT) . "</p>\n";
}
if ($feedSubmissionInfo->isSetCompletedProcessingDate()) {
echo "<p>CompletedProcessingDate:\n";
echo " " . $feedSubmissionInfo->getCompletedProcessingDate()->format(DATE_FORMAT) . "</p>\n";
}
}
}
} catch (MarketplaceWebService_Exception $ex) {
echo "Caught Exception: " . $ex->getMessage() . "\n";
echo "Response Status Code: " . $ex->getStatusCode() . "\n";
echo "Error Code: " . $ex->getErrorCode() . "\n";
echo "Error Type: " . $ex->getErrorType() . "\n";
echo "Request ID: " . $ex->getRequestId() . "\n";
echo "XML: " . $ex->getXML() . "\n";
}
}
示例6: invokeSubmitFeed
public function invokeSubmitFeed(MarketplaceWebService_Interface $service, $request)
{
try {
$response = $service->submitFeed($request);
if ($response->isSetSubmitFeedResult()) {
echo "<p>SubmitFeedResult</p>\n";
$submitFeedResult = $response->getSubmitFeedResult();
if ($submitFeedResult->isSetFeedSubmissionInfo()) {
$feedSubmissionInfo = $submitFeedResult->getFeedSubmissionInfo();
if ($feedSubmissionInfo->isSetFeedSubmissionId()) {
echo "<p>FeedSubmissionId:\n";
echo " " . $feedSubmissionInfo->getFeedSubmissionId() . "</p>\n";
}
if ($feedSubmissionInfo->isSetFeedType()) {
echo "<p>FeedType:\n";
echo " " . $feedSubmissionInfo->getFeedType() . "</p>\n";
}
if ($feedSubmissionInfo->isSetSubmittedDate()) {
echo "<p>SubmittedDate:\n";
echo " " . $feedSubmissionInfo->getSubmittedDate()->format(DATE_FORMAT) . "</p>\n";
}
if ($feedSubmissionInfo->isSetFeedProcessingStatus()) {
echo "<p>FeedProcessingStatus:\n";
echo " " . $feedSubmissionInfo->getFeedProcessingStatus() . "</p>\n";
}
if ($feedSubmissionInfo->isSetStartedProcessingDate()) {
echo "<p>StartedProcessingDate\n";
echo " " . $feedSubmissionInfo->getStartedProcessingDate()->format(DATE_FORMAT) . "</p>\n";
}
if ($feedSubmissionInfo->isSetCompletedProcessingDate()) {
echo "<p>CompletedProcessingDate\n";
echo " " . $feedSubmissionInfo->getCompletedProcessingDate()->format(DATE_FORMAT) . "</p>\n";
}
}
}
} catch (MarketplaceWebService_Exception $ex) {
echo "Caught Exception: " . $ex->getMessage() . "\n";
echo "Response Status Code: " . $ex->getStatusCode() . "\n";
echo "Error Code: " . $ex->getErrorCode() . "\n";
echo "Error Type: " . $ex->getErrorType() . "\n";
echo "Request ID: " . $ex->getRequestId() . "\n";
echo "XML: " . $ex->getXML() . "\n";
}
}
示例7: invokeManageReportSchedule
function invokeManageReportSchedule(MarketplaceWebService_Interface $service, $request)
{
try {
$response = $service->manageReportSchedule($request);
echo " ManageReportScheduleResponse\n";
if ($response->isSetManageReportScheduleResult()) {
echo " ManageReportScheduleResult\n";
$manageReportScheduleResult = $response->getManageReportScheduleResult();
if ($manageReportScheduleResult->isSetCount()) {
echo " Count\n";
echo " " . $manageReportScheduleResult->getCount() . "\n";
}
$reportScheduleList = $manageReportScheduleResult->getReportScheduleList();
foreach ($reportScheduleList as $reportSchedule) {
echo " ReportSchedule\n";
if ($reportSchedule->isSetReportType()) {
echo " ReportType\n";
echo " " . $reportSchedule->getReportType() . "\n";
}
if ($reportSchedule->isSetSchedule()) {
echo " Schedule\n";
echo " " . $reportSchedule->getSchedule() . "\n";
}
if ($reportSchedule->isSetScheduledDate()) {
echo " ScheduledDate\n";
echo " " . $reportSchedule->getScheduledDate()->format(DATE_FORMAT) . "\n";
}
}
}
} catch (MarketplaceWebService_Exception $ex) {
$message = 'MWS Report API : Caught Exception : ' . $ex->getMessage() . "\n";
$message .= "Response Status Code: " . $ex->getStatusCode() . "\n";
$message .= "Error Code: " . $ex->getErrorCode() . "\n";
$message .= "Error Type: " . $ex->getErrorType() . "\n";
$param['message'] = $message;
$obj = new Pwapresta();
$obj->generate_log($param);
echo $message;
}
}
示例8: invokeManageReportSchedule
/**
* Manage Report Schedule Action Sample
* Creates, updates, or deletes a report schedule
* for a given report type, such as order reports in particular.
*
* @param MarketplaceWebService_Interface $service instance of MarketplaceWebService_Interface
* @param mixed $request MarketplaceWebService_Model_ManageReportSchedule or array of parameters
*/
function invokeManageReportSchedule(MarketplaceWebService_Interface $service, $request)
{
try {
$response = $service->manageReportSchedule($request);
echo "Service Response\n";
echo "=============================================================================\n";
echo " ManageReportScheduleResponse\n";
if ($response->isSetManageReportScheduleResult()) {
echo " ManageReportScheduleResult\n";
$manageReportScheduleResult = $response->getManageReportScheduleResult();
if ($manageReportScheduleResult->isSetCount()) {
echo " Count\n";
echo " " . $manageReportScheduleResult->getCount() . "\n";
}
$reportScheduleList = $manageReportScheduleResult->getReportSchedule();
foreach ($reportScheduleList as $reportSchedule) {
echo " ReportSchedule\n";
if ($reportSchedule->isSetReportType()) {
echo " ReportType\n";
echo " " . $reportSchedule->getReportType() . "\n";
}
if ($reportSchedule->isSetSchedule()) {
echo " Schedule\n";
echo " " . $reportSchedule->getSchedule() . "\n";
}
if ($reportSchedule->isSetScheduledDate()) {
echo " ScheduledDate\n";
echo " " . $reportSchedule->getScheduledDate()->format(DATE_FORMAT) . "\n";
}
}
}
if ($response->isSetResponseMetadata()) {
echo " ResponseMetadata\n";
$responseMetadata = $response->getResponseMetadata();
if ($responseMetadata->isSetRequestId()) {
echo " RequestId\n";
echo " " . $responseMetadata->getRequestId() . "\n";
}
}
echo " ResponseHeaderMetadata: " . $response->getResponseHeaderMetadata() . "\n";
} catch (MarketplaceWebService_Exception $ex) {
echo "Caught Exception: " . $ex->getMessage() . "\n";
echo "Response Status Code: " . $ex->getStatusCode() . "\n";
echo "Error Code: " . $ex->getErrorCode() . "\n";
echo "Error Type: " . $ex->getErrorType() . "\n";
echo "Request ID: " . $ex->getRequestId() . "\n";
echo "XML: " . $ex->getXML() . "\n";
echo "ResponseHeaderMetadata: " . $ex->getResponseHeaderMetadata() . "\n";
}
}
示例9: invokeSubmitFeed
function invokeSubmitFeed(MarketplaceWebService_Interface $service, $request)
{
try {
$response = $service->submitFeed($request);
if ($response->isSetSubmitFeedResult()) {
$submitFeedResult = $response->getSubmitFeedResult();
if ($submitFeedResult->isSetFeedSubmissionInfo()) {
$feedSubmissionInfo = $submitFeedResult->getFeedSubmissionInfo();
if ($feedSubmissionInfo->isSetFeedSubmissionId()) {
echo " " . $feedSubmissionInfo->getFeedSubmissionId() . "\n";
}
}
}
echo " ResponseHeaderMetadata: " . $response->getResponseHeaderMetadata() . "\n";
} catch (MarketplaceWebService_Exception $ex) {
echo "Caught Exception: " . $ex->getMessage() . "\n";
echo "Response Status Code: " . $ex->getStatusCode() . "\n";
echo "Error Code: " . $ex->getErrorCode() . "\n";
echo "Error Type: " . $ex->getErrorType() . "\n";
echo "Request ID: " . $ex->getRequestId() . "\n";
echo "XML: " . $ex->getXML() . "\n";
echo "ResponseHeaderMetadata: " . $ex->getResponseHeaderMetadata() . "\n";
}
}
示例10: invokeSubmitFeed
/**
* Submit Feed Action Sample
* Uploads a file for processing together with the necessary
* metadata to process the file, such as which type of feed it is.
* PurgeAndReplace if true means that your existing e.g. inventory is
* wiped out and replace with the contents of this feed - use with
* caution (the default is false).
*
* @param MarketplaceWebService_Interface $service instance of MarketplaceWebService_Interface
* @param mixed $request MarketplaceWebService_Model_SubmitFeed or array of parameters
*/
function invokeSubmitFeed(MarketplaceWebService_Interface $service, $request)
{
try {
$response = $service->submitFeed($request);
result("Service Response\n");
result("=============================================================================\n");
result(" SubmitFeedResponse\n");
if ($response->isSetSubmitFeedResult()) {
result(" SubmitFeedResult\n");
$submitFeedResult = $response->getSubmitFeedResult();
if ($submitFeedResult->isSetFeedSubmissionInfo()) {
result(" FeedSubmissionInfo\n");
$feedSubmissionInfo = $submitFeedResult->getFeedSubmissionInfo();
if ($feedSubmissionInfo->isSetFeedSubmissionId()) {
result(" FeedSubmissionId\n");
result(" " . $feedSubmissionInfo->getFeedSubmissionId() . "\n");
echo $feedSubmissionInfo->getFeedSubmissionId();
}
if ($feedSubmissionInfo->isSetFeedType()) {
result(" FeedType\n");
result(" " . $feedSubmissionInfo->getFeedType() . "\n");
}
if ($feedSubmissionInfo->isSetSubmittedDate()) {
result(" SubmittedDate\n");
result(" " . $feedSubmissionInfo->getSubmittedDate()->format(DATE_FORMAT) . "\n");
}
if ($feedSubmissionInfo->isSetFeedProcessingStatus()) {
result(" FeedProcessingStatus\n");
result(" " . $feedSubmissionInfo->getFeedProcessingStatus() . "\n");
}
if ($feedSubmissionInfo->isSetStartedProcessingDate()) {
result(" StartedProcessingDate\n");
result(" " . $feedSubmissionInfo->getStartedProcessingDate()->format(DATE_FORMAT) . "\n");
}
if ($feedSubmissionInfo->isSetCompletedProcessingDate()) {
result(" CompletedProcessingDate\n");
result(" " . $feedSubmissionInfo->getCompletedProcessingDate()->format(DATE_FORMAT) . "\n");
}
}
}
if ($response->isSetResponseMetadata()) {
result(" ResponseMetadata\n");
$responseMetadata = $response->getResponseMetadata();
if ($responseMetadata->isSetRequestId()) {
result(" RequestId\n");
result(" " . $responseMetadata->getRequestId() . "\n");
}
}
result(" ResponseHeaderMetadata: " . $response->getResponseHeaderMetadata() . "\n");
} catch (MarketplaceWebService_Exception $ex) {
result("Caught Exception: " . $ex->getMessage() . "\n");
result("Response Status Code: " . $ex->getStatusCode() . "\n");
result("Error Code: " . $ex->getErrorCode() . "\n");
result("Error Type: " . $ex->getErrorType() . "\n");
result("Request ID: " . $ex->getRequestId() . "\n");
result("XML: " . $ex->getXML() . "\n");
result("ResponseHeaderMetadata: " . $ex->getResponseHeaderMetadata() . "\n");
echo json_encode(array('Caught Exception' => $ex->getMessage(), 'Response Status Code' => $ex->getStatusCode(), 'Error Code' => $ex->getErrorCode()));
}
}
示例11: invokeGetReportCount
/**
* Get Report Count Action Sample
* returns a count of reports matching your criteria;
* by default, the number of reports generated in the last 90 days,
* regardless of acknowledgement status
*
* @param MarketplaceWebService_Interface $service instance of MarketplaceWebService_Interface
* @param mixed $request MarketplaceWebService_Model_GetReportCount or array of parameters
*/
function invokeGetReportCount(MarketplaceWebService_Interface $service, $request)
{
try {
$response = $service->getReportCount($request);
echo "Service Response\n";
echo "=============================================================================\n";
echo " GetReportCountResponse\n";
if ($response->isSetGetReportCountResult()) {
echo " GetReportCountResult\n";
$getReportCountResult = $response->getGetReportCountResult();
if ($getReportCountResult->isSetCount()) {
echo " Count\n";
echo " " . $getReportCountResult->getCount() . "\n";
}
}
if ($response->isSetResponseMetadata()) {
echo " ResponseMetadata\n";
$responseMetadata = $response->getResponseMetadata();
if ($responseMetadata->isSetRequestId()) {
echo " RequestId\n";
echo " " . $responseMetadata->getRequestId() . "\n";
}
}
print_r(" ResponseHeaderMetadata: " . $response->getResponseHeaderMetadata() . "\n");
} catch (MarketplaceWebService_Exception $ex) {
echo "Caught Exception: " . $ex->getMessage() . "\n";
echo "Response Status Code: " . $ex->getStatusCode() . "\n";
echo "Error Code: " . $ex->getErrorCode() . "\n";
echo "Error Type: " . $ex->getErrorType() . "\n";
echo "Request ID: " . $ex->getRequestId() . "\n";
echo "XML: " . $ex->getXML() . "\n";
echo "ResponseHeaderMetadata: " . $ex->getResponseHeaderMetadata() . "\n";
}
}
示例12: invokeSubmitFeed
function invokeSubmitFeed(MarketplaceWebService_Interface $service, $request)
{
try {
$response = $service->submitFeed($request);
if ($response->isSetSubmitFeedResult()) {
$submitFeedResult = $response->getSubmitFeedResult();
if ($submitFeedResult->isSetFeedSubmissionInfo()) {
$feedSubmissionInfo = $submitFeedResult->getFeedSubmissionInfo();
if ($feedSubmissionInfo->isSetFeedSubmissionId()) {
$feedSubmissionId = $feedSubmissionInfo->getFeedSubmissionId();
$param['message'] = 'Order Acknowledged : Feed Submission Id - ' . $feedSubmissionId;
$obj = new Pwapresta();
$obj->generate_log($param);
}
}
}
} catch (MarketplaceWebService_Exception $ex) {
$message = 'MWS Feed API : Caught Exception : ' . $ex->getMessage() . "\n";
$message .= "Response Status Code: " . $ex->getStatusCode() . "\n";
$message .= "Error Code: " . $ex->getErrorCode() . "\n";
$message .= "Error Type: " . $ex->getErrorType() . "\n";
$param['message'] = $message;
$obj = new Pwapresta();
$obj->generate_log($param);
}
}
示例13: invokeSubmitFeed
function invokeSubmitFeed(MarketplaceWebService_Interface $service, $request)
{
try {
$response = $service->submitFeed($request);
print_r($response);
echo 'cccc';
die;
if ($response->isSetSubmitFeedResult()) {
$submitFeedResult = $response->getSubmitFeedResult();
if ($submitFeedResult->isSetFeedSubmissionInfo()) {
$feedSubmissionInfo = $submitFeedResult->getFeedSubmissionInfo();
if ($feedSubmissionInfo->isSetFeedSubmissionId()) {
echo " " . $feedSubmissionInfo->getFeedSubmissionId() . "\n";
$sb = "update ebay_order set ebay_markettime='{$mctime}',ShippedTime='{$mctime}' where ebay_id='{$ebay_id}'";
echo $sb . '<br>';
$dbConn->execute($sb);
}
}
}
echo " ResponseHeaderMetadata: " . $response->getResponseHeaderMetadata() . "\n";
} catch (MarketplaceWebService_Exception $ex) {
echo "Caught Exception: " . $ex->getMessage() . "\n";
echo "Response Status Code: " . $ex->getStatusCode() . "\n";
echo "Error Code: " . $ex->getErrorCode() . "\n";
echo "Error Type: " . $ex->getErrorType() . "\n";
echo "Request ID: " . $ex->getRequestId() . "\n";
echo "XML: " . $ex->getXML() . "\n";
echo "ResponseHeaderMetadata: " . $ex->getResponseHeaderMetadata() . "\n";
}
}
示例14: invokeSubmitFeed
/**
* Submit Feed Action Sample
* Uploads a file for processing together with the necessary
* metadata to process the file, such as which type of feed it is.
* PurgeAndReplace if true means that your existing e.g. inventory is
* wiped out and replace with the contents of this feed - use with
* caution (the default is false).
*
* @param MarketplaceWebService_Interface $service instance of MarketplaceWebService_Interface
* @param mixed $request MarketplaceWebService_Model_SubmitFeed or array of parameters
* Added to submit feeds through MWS (uses Amazon's MWS PHP SDK in magento/lib)
*/
function invokeSubmitFeed(MarketplaceWebService_Interface $service, $request)
{
try {
$response = $service->submitFeed($request);
$feedSubmissionId = null;
if ($response->isSetSubmitFeedResult()) {
$submitFeedResult = $response->getSubmitFeedResult();
if ($submitFeedResult->isSetFeedSubmissionInfo()) {
$feedSubmissionInfo = $submitFeedResult->getFeedSubmissionInfo();
if ($feedSubmissionInfo->isSetFeedSubmissionId()) {
$feedSubmissionId = $feedSubmissionInfo->getFeedSubmissionId();
}
}
}
} catch (MarketplaceWebService_Exception $ex) {
Mage::log("Caught Exception: " . $ex->getMessage() . "\n");
Mage::log("Response Status Code: " . $ex->getStatusCode() . "\n");
Mage::log("Error Code: " . $ex->getErrorCode() . "\n");
Mage::log("Error Type: " . $ex->getErrorType() . "\n");
Mage::log("Request ID: " . $ex->getRequestId() . "\n");
Mage::log("XML: " . $ex->getXML() . "\n");
return null;
}
return $feedSubmissionId;
}
示例15: invokeGetReportRequestList
function invokeGetReportRequestList(MarketplaceWebService_Interface $service, $request)
{
global $wpdb, $woocommerce;
try {
$response = $service->getReportRequestList($request);
if ($response->isSetGetReportRequestListResult()) {
$getReportRequestListResult = $response->getGetReportRequestListResult();
$reportRequestInfoList = $getReportRequestListResult->getReportRequestInfoList();
print_r($reportRequestInfoList);
foreach ($reportRequestInfoList as $reportRequestInfo) {
if ($reportRequestInfo->isSetReportType() && $reportRequestInfo->getReportType() == '_GET_ORDERS_DATA_' && ($reportRequestInfo->isSetReportProcessingStatus() && $reportRequestInfo->getReportProcessingStatus() == '_DONE_')) {
if ($reportRequestInfo->isSetReportRequestId()) {
$ReportRequestId = $reportRequestInfo->getReportRequestId();
}
if ($reportRequestInfo->isSetGeneratedReportId()) {
$GeneratedReportId = $reportRequestInfo->getGeneratedReportId();
if ($GeneratedReportId == '' && $ReportRequestId != '') {
$GeneratedReportId = $this->get_report_list_api($ReportRequestId);
$data = $this->get_report_api($GeneratedReportId);
} else {
$data = $this->get_report_api($GeneratedReportId);
}
$xml = simplexml_load_string($data);
// Check and dump MWS Report API Response
$pwacheckkout = new Pwacheckout();
if ($pwacheckkout->get_option('mws_report_dump') == 'yes') {
$dir = $pwacheckkout->get_option('mws_report_dump_url');
if (!file_exists($dir) && !is_dir($dir)) {
mkdir($dir, 0777);
}
$filename = $dir . $GeneratedReportId . '_mws_report';
$myfile = fopen($filename, "w");
fwrite($myfile, $data);
fclose($myfile);
}
foreach ($xml->Message as $orderdetail) {
$AmazonOrderID = (string) $orderdetail->OrderReport->AmazonOrderID;
$order_postmeta = $wpdb->get_results("select post_id from {$wpdb->postmeta} where meta_key = '_pwa_order_id' and meta_value = '{$AmazonOrderID}' ");
if (empty($order_postmeta)) {
$order = wc_create_order();
add_post_meta($order->id, '_pwa_order_id', $AmazonOrderID);
$this->update_order_detail($order->id, $orderdetail);
} else {
$order_id = $order_postmeta[0]->post_id;
$this->update_order_detail($order_id, $orderdetail);
}
}
}
}
}
$dateTime = new DateTime('now', new DateTimeZone('UTC'));
$time = $dateTime->format(DATE_ISO8601);
$wpdb->insert($wpdb->prefix . 'pwa_mws_report_cron', array('created_before' => $time));
}
} catch (MarketplaceWebService_Exception $ex) {
$message = 'MWS Report API : Caught Exception : ' . $ex->getMessage() . "\n";
$message .= "Response Status Code: " . $ex->getStatusCode() . "\n";
$message .= "Error Code: " . $ex->getErrorCode() . "\n";
$message .= "Error Type: " . $ex->getErrorType() . "\n";
$param['message'] = $message;
$this->generate_log($param);
}
}