-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-adding orders client library (without anticipated changes yet)
- Loading branch information
1 parent
da87f85
commit 3d4121f
Showing
52 changed files
with
13,098 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
<?php | ||
/******************************************************************************* | ||
* Copyright 2009-2018 Amazon Services. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* | ||
* You may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at: http://aws.amazon.com/apache2.0 | ||
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
******************************************************************************* | ||
* PHP Version 5 | ||
* @category Amazon | ||
* @package Marketplace Web Service Orders | ||
* @version 2013-09-01 | ||
* Library Version: 2018-01-31 | ||
* Generated: Tue Jan 30 16:03:22 PST 2018 | ||
*/ | ||
|
||
|
||
/** | ||
* Marketplace Web Service Orders Exception provides details of errors | ||
* returned by Marketplace Web Service Orders service | ||
* | ||
*/ | ||
class MarketplaceWebServiceOrders_Exception extends Exception | ||
|
||
{ | ||
/** @var string */ | ||
private $_message = null; | ||
/** @var int */ | ||
private $_statusCode = -1; | ||
/** @var string */ | ||
private $_errorCode = null; | ||
/** @var string */ | ||
private $_errorType = null; | ||
/** @var string */ | ||
private $_requestId = null; | ||
/** @var string */ | ||
private $_xml = null; | ||
|
||
private $_responseHeaderMetadata = null; | ||
|
||
/** | ||
* Constructs MarketplaceWebServiceOrders_Exception | ||
* @param array $errorInfo details of exception. | ||
* Keys are: | ||
* <ul> | ||
* <li>Message - (string) text message for an exception</li> | ||
* <li>StatusCode - (int) HTTP status code at the time of exception</li> | ||
* <li>ErrorCode - (string) specific error code returned by the service</li> | ||
* <li>ErrorType - (string) Possible types: Sender, Receiver or Unknown</li> | ||
* <li>RequestId - (string) request id returned by the service</li> | ||
* <li>XML - (string) compete xml response at the time of exception</li> | ||
* <li>Exception - (Exception) inner exception if any</li> | ||
* </ul> | ||
* | ||
*/ | ||
public function __construct(array $errorInfo = array()) | ||
{ | ||
$this->_message = $errorInfo["Message"]; | ||
parent::__construct($this->_message); | ||
if (array_key_exists("Exception", $errorInfo)) { | ||
$exception = $errorInfo["Exception"]; | ||
if ($exception instanceof MarketplaceWebServiceOrders_Exception) { | ||
$this->_statusCode = $exception->getStatusCode(); | ||
$this->_errorCode = $exception->getErrorCode(); | ||
$this->_errorType = $exception->getErrorType(); | ||
$this->_requestId = $exception->getRequestId(); | ||
$this->_xml= $exception->getXML(); | ||
$this->_responseHeaderMetadata = $exception->getResponseHeaderMetadata(); | ||
} | ||
} else { | ||
$this->_statusCode = $this->arr_val($errorInfo, "StatusCode"); | ||
$this->_errorCode = $this->arr_val($errorInfo, "ErrorCode"); | ||
$this->_errorType = $this->arr_val($errorInfo, "ErrorType"); | ||
$this->_requestId = $this->arr_val($errorInfo, "RequestId"); | ||
$this->_xml = $this->arr_val($errorInfo, "XML"); | ||
$this->_responseHeaderMetadata = $this->arr_val($errorInfo, "ResponseHeaderMetadata"); | ||
} | ||
} | ||
|
||
private function arr_val($arr, $key) { | ||
if(array_key_exists($key, $arr)) { | ||
return $arr[$key]; | ||
} else { | ||
return null; | ||
} | ||
} | ||
|
||
/** | ||
* Gets error type returned by the service if available. | ||
* | ||
* @return string Error Code returned by the service | ||
*/ | ||
public function getErrorCode(){ | ||
return $this->_errorCode; | ||
} | ||
|
||
/** | ||
* Gets error type returned by the service. | ||
* | ||
* @return string Error Type returned by the service. | ||
* Possible types: Sender, Receiver or Unknown | ||
*/ | ||
public function getErrorType(){ | ||
return $this->_errorType; | ||
} | ||
|
||
/** | ||
* Gets error message | ||
* | ||
* @return string Error message | ||
*/ | ||
public function getErrorMessage() { | ||
return $this->_message; | ||
} | ||
|
||
/** | ||
* Gets status code returned by the service if available. If status | ||
* code is set to -1, it means that status code was unavailable at the | ||
* time exception was thrown | ||
* | ||
* @return int status code returned by the service | ||
*/ | ||
public function getStatusCode() { | ||
return $this->_statusCode; | ||
} | ||
|
||
/** | ||
* Gets XML returned by the service if available. | ||
* | ||
* @return string XML returned by the service | ||
*/ | ||
public function getXML() { | ||
return $this->_xml; | ||
} | ||
|
||
/** | ||
* Gets Request ID returned by the service if available. | ||
* | ||
* @return string Request ID returned by the service | ||
*/ | ||
public function getRequestId() { | ||
return $this->_requestId; | ||
} | ||
|
||
public function getResponseHeaderMetadata() { | ||
return $this->_responseHeaderMetadata; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<?php | ||
/******************************************************************************* | ||
* Copyright 2009-2018 Amazon Services. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* | ||
* You may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at: http://aws.amazon.com/apache2.0 | ||
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
******************************************************************************* | ||
* PHP Version 5 | ||
* @category Amazon | ||
* @package Marketplace Web Service Orders | ||
* @version 2013-09-01 | ||
* Library Version: 2018-01-31 | ||
* Generated: Tue Jan 30 16:03:22 PST 2018 | ||
*/ | ||
|
||
interface MarketplaceWebServiceOrders_Interface | ||
{ | ||
|
||
/** | ||
* Get Order | ||
* This operation takes up to 50 order ids and returns the corresponding orders. | ||
* | ||
* @param mixed $request array of parameters for MarketplaceWebServiceOrders_Model_GetOrder request or MarketplaceWebServiceOrders_Model_GetOrder object itself | ||
* @see MarketplaceWebServiceOrders_Model_GetOrderRequest | ||
* @return MarketplaceWebServiceOrders_Model_GetOrderResponse | ||
* | ||
* @throws MarketplaceWebServiceOrders_Exception | ||
*/ | ||
public function getOrder($request); | ||
|
||
|
||
/** | ||
* Get Service Status | ||
* Returns the service status of a particular MWS API section. The operation | ||
* takes no input. | ||
* | ||
* @param mixed $request array of parameters for MarketplaceWebServiceOrders_Model_GetServiceStatus request or MarketplaceWebServiceOrders_Model_GetServiceStatus object itself | ||
* @see MarketplaceWebServiceOrders_Model_GetServiceStatusRequest | ||
* @return MarketplaceWebServiceOrders_Model_GetServiceStatusResponse | ||
* | ||
* @throws MarketplaceWebServiceOrders_Exception | ||
*/ | ||
public function getServiceStatus($request); | ||
|
||
|
||
/** | ||
* List Order Items | ||
* This operation can be used to list the items of the order indicated by the | ||
* given order id (only a single Amazon order id is allowed). | ||
* | ||
* @param mixed $request array of parameters for MarketplaceWebServiceOrders_Model_ListOrderItems request or MarketplaceWebServiceOrders_Model_ListOrderItems object itself | ||
* @see MarketplaceWebServiceOrders_Model_ListOrderItemsRequest | ||
* @return MarketplaceWebServiceOrders_Model_ListOrderItemsResponse | ||
* | ||
* @throws MarketplaceWebServiceOrders_Exception | ||
*/ | ||
public function listOrderItems($request); | ||
|
||
|
||
/** | ||
* List Order Items By Next Token | ||
* If ListOrderItems cannot return all the order items in one go, it will | ||
* provide a nextToken. That nextToken can be used with this operation to | ||
* retrive the next batch of items for that order. | ||
* | ||
* @param mixed $request array of parameters for MarketplaceWebServiceOrders_Model_ListOrderItemsByNextToken request or MarketplaceWebServiceOrders_Model_ListOrderItemsByNextToken object itself | ||
* @see MarketplaceWebServiceOrders_Model_ListOrderItemsByNextTokenRequest | ||
* @return MarketplaceWebServiceOrders_Model_ListOrderItemsByNextTokenResponse | ||
* | ||
* @throws MarketplaceWebServiceOrders_Exception | ||
*/ | ||
public function listOrderItemsByNextToken($request); | ||
|
||
|
||
/** | ||
* List Orders | ||
* ListOrders can be used to find orders that meet the specified criteria. | ||
* | ||
* @param mixed $request array of parameters for MarketplaceWebServiceOrders_Model_ListOrders request or MarketplaceWebServiceOrders_Model_ListOrders object itself | ||
* @see MarketplaceWebServiceOrders_Model_ListOrdersRequest | ||
* @return MarketplaceWebServiceOrders_Model_ListOrdersResponse | ||
* | ||
* @throws MarketplaceWebServiceOrders_Exception | ||
*/ | ||
public function listOrders($request); | ||
|
||
|
||
/** | ||
* List Orders By Next Token | ||
* If ListOrders returns a nextToken, thus indicating that there are more orders | ||
* than returned that matched the given filter criteria, ListOrdersByNextToken | ||
* can be used to retrieve those other orders using that nextToken. | ||
* | ||
* @param mixed $request array of parameters for MarketplaceWebServiceOrders_Model_ListOrdersByNextToken request or MarketplaceWebServiceOrders_Model_ListOrdersByNextToken object itself | ||
* @see MarketplaceWebServiceOrders_Model_ListOrdersByNextTokenRequest | ||
* @return MarketplaceWebServiceOrders_Model_ListOrdersByNextTokenResponse | ||
* | ||
* @throws MarketplaceWebServiceOrders_Exception | ||
*/ | ||
public function listOrdersByNextToken($request); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
<?php | ||
/******************************************************************************* | ||
* Copyright 2009-2018 Amazon Services. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* | ||
* You may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at: http://aws.amazon.com/apache2.0 | ||
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
******************************************************************************* | ||
* PHP Version 5 | ||
* @category Amazon | ||
* @package Marketplace Web Service Orders | ||
* @version 2013-09-01 | ||
* Library Version: 2018-01-31 | ||
* Generated: Tue Jan 30 16:03:22 PST 2018 | ||
*/ | ||
|
||
/** | ||
* @see MarketplaceWebServiceOrders_Interface | ||
*/ | ||
require_once (dirname(__FILE__) . '/Interface.php'); | ||
|
||
class MarketplaceWebServiceOrders_Mock implements MarketplaceWebServiceOrders_Interface | ||
{ | ||
// Public API ------------------------------------------------------------// | ||
|
||
/** | ||
* Get Order | ||
* This operation takes up to 50 order ids and returns the corresponding orders. | ||
* | ||
* @param mixed $request array of parameters for MarketplaceWebServiceOrders_Model_GetOrder request or MarketplaceWebServiceOrders_Model_GetOrder object itself | ||
* @see MarketplaceWebServiceOrders_Model_GetOrder | ||
* @return MarketplaceWebServiceOrders_Model_GetOrderResponse | ||
* | ||
* @throws MarketplaceWebServiceOrders_Exception | ||
*/ | ||
public function getOrder($request) | ||
{ | ||
require_once (dirname(__FILE__) . '/Model/GetOrderResponse.php'); | ||
return MarketplaceWebServiceOrders_Model_GetOrderResponse::fromXML($this->_invoke('GetOrder')); | ||
} | ||
|
||
/** | ||
* Get Service Status | ||
* Returns the service status of a particular MWS API section. The operation | ||
* takes no input. | ||
* | ||
* @param mixed $request array of parameters for MarketplaceWebServiceOrders_Model_GetServiceStatus request or MarketplaceWebServiceOrders_Model_GetServiceStatus object itself | ||
* @see MarketplaceWebServiceOrders_Model_GetServiceStatus | ||
* @return MarketplaceWebServiceOrders_Model_GetServiceStatusResponse | ||
* | ||
* @throws MarketplaceWebServiceOrders_Exception | ||
*/ | ||
public function getServiceStatus($request) | ||
{ | ||
require_once (dirname(__FILE__) . '/Model/GetServiceStatusResponse.php'); | ||
return MarketplaceWebServiceOrders_Model_GetServiceStatusResponse::fromXML($this->_invoke('GetServiceStatus')); | ||
} | ||
|
||
/** | ||
* List Order Items | ||
* This operation can be used to list the items of the order indicated by the | ||
* given order id (only a single Amazon order id is allowed). | ||
* | ||
* @param mixed $request array of parameters for MarketplaceWebServiceOrders_Model_ListOrderItems request or MarketplaceWebServiceOrders_Model_ListOrderItems object itself | ||
* @see MarketplaceWebServiceOrders_Model_ListOrderItems | ||
* @return MarketplaceWebServiceOrders_Model_ListOrderItemsResponse | ||
* | ||
* @throws MarketplaceWebServiceOrders_Exception | ||
*/ | ||
public function listOrderItems($request) | ||
{ | ||
require_once (dirname(__FILE__) . '/Model/ListOrderItemsResponse.php'); | ||
return MarketplaceWebServiceOrders_Model_ListOrderItemsResponse::fromXML($this->_invoke('ListOrderItems')); | ||
} | ||
|
||
/** | ||
* List Order Items By Next Token | ||
* If ListOrderItems cannot return all the order items in one go, it will | ||
* provide a nextToken. That nextToken can be used with this operation to | ||
* retrive the next batch of items for that order. | ||
* | ||
* @param mixed $request array of parameters for MarketplaceWebServiceOrders_Model_ListOrderItemsByNextToken request or MarketplaceWebServiceOrders_Model_ListOrderItemsByNextToken object itself | ||
* @see MarketplaceWebServiceOrders_Model_ListOrderItemsByNextToken | ||
* @return MarketplaceWebServiceOrders_Model_ListOrderItemsByNextTokenResponse | ||
* | ||
* @throws MarketplaceWebServiceOrders_Exception | ||
*/ | ||
public function listOrderItemsByNextToken($request) | ||
{ | ||
require_once (dirname(__FILE__) . '/Model/ListOrderItemsByNextTokenResponse.php'); | ||
return MarketplaceWebServiceOrders_Model_ListOrderItemsByNextTokenResponse::fromXML($this->_invoke('ListOrderItemsByNextToken')); | ||
} | ||
|
||
/** | ||
* List Orders | ||
* ListOrders can be used to find orders that meet the specified criteria. | ||
* | ||
* @param mixed $request array of parameters for MarketplaceWebServiceOrders_Model_ListOrders request or MarketplaceWebServiceOrders_Model_ListOrders object itself | ||
* @see MarketplaceWebServiceOrders_Model_ListOrders | ||
* @return MarketplaceWebServiceOrders_Model_ListOrdersResponse | ||
* | ||
* @throws MarketplaceWebServiceOrders_Exception | ||
*/ | ||
public function listOrders($request) | ||
{ | ||
require_once (dirname(__FILE__) . '/Model/ListOrdersResponse.php'); | ||
return MarketplaceWebServiceOrders_Model_ListOrdersResponse::fromXML($this->_invoke('ListOrders')); | ||
} | ||
|
||
/** | ||
* List Orders By Next Token | ||
* If ListOrders returns a nextToken, thus indicating that there are more orders | ||
* than returned that matched the given filter criteria, ListOrdersByNextToken | ||
* can be used to retrieve those other orders using that nextToken. | ||
* | ||
* @param mixed $request array of parameters for MarketplaceWebServiceOrders_Model_ListOrdersByNextToken request or MarketplaceWebServiceOrders_Model_ListOrdersByNextToken object itself | ||
* @see MarketplaceWebServiceOrders_Model_ListOrdersByNextToken | ||
* @return MarketplaceWebServiceOrders_Model_ListOrdersByNextTokenResponse | ||
* | ||
* @throws MarketplaceWebServiceOrders_Exception | ||
*/ | ||
public function listOrdersByNextToken($request) | ||
{ | ||
require_once (dirname(__FILE__) . '/Model/ListOrdersByNextTokenResponse.php'); | ||
return MarketplaceWebServiceOrders_Model_ListOrdersByNextTokenResponse::fromXML($this->_invoke('ListOrdersByNextToken')); | ||
} | ||
|
||
// Private API ------------------------------------------------------------// | ||
|
||
private function _invoke($actionName) | ||
{ | ||
return $xml = file_get_contents(dirname(__FILE__) . '/Mock/' . $actionName . 'Response.xml', /** search include path */ TRUE); | ||
} | ||
|
||
} |
Oops, something went wrong.