|
2 | 2 |
|
3 | 3 | class MplusQAPIclient |
4 | 4 | { |
5 | | - const CLIENT_VERSION = '1.27.9'; |
| 5 | + const CLIENT_VERSION = '1.28.0'; |
6 | 6 | const WSDL_TTL = 300; |
7 | 7 |
|
8 | 8 | var $MIN_API_VERSION_MAJOR = 0; |
@@ -2673,26 +2673,26 @@ function() use ($request) { |
2673 | 2673 | } |
2674 | 2674 | ); |
2675 | 2675 | } |
| 2676 | + |
2676 | 2677 | //---------------------------------------------------------------------------- |
2677 | | - |
2678 | | - public function cancelOrder($orderId, $attempts=0) |
2679 | | - { |
2680 | | - try { |
2681 | | - if (false !== ($result = $this->client->cancelOrder($this->parser->convertOrderId($orderId)))) { |
2682 | | - return $this->parser->parseCancelOrderResult($result); |
2683 | | - } |
2684 | | - } catch (SoapFault $e) { |
2685 | | - $msg = $e->getMessage(); |
2686 | | - if (false !== stripos($msg, 'Could not connect to host') and $attempts < 3) { |
2687 | | - sleep(1); |
2688 | | - return $this->cancelOrder($orderId, $attempts+1); |
2689 | | - } else { |
2690 | | - throw new MplusQAPIException('SoapFault occurred: '.$msg, 0, $e); |
2691 | | - } |
2692 | | - } catch (Exception $e) { |
2693 | | - throw new MplusQAPIException('Exception occurred: '.$e->getMessage(), 0, $e); |
| 2678 | + public function cancelOrder($orderId, $branchNumber = null, $attempts = 0) { |
| 2679 | + try { |
| 2680 | + if (false !== ($result = $this->client->cancelOrder($this->parser->convertCancelOrder($orderId, $branchNumber)))) { |
| 2681 | + return $this->parser->parseCancelOrderResult($result); |
| 2682 | + } |
| 2683 | + } catch (SoapFault $e) { |
| 2684 | + $msg = $e->getMessage(); |
| 2685 | + if (false !== stripos($msg, 'Could not connect to host') and $attempts < 3) { |
| 2686 | + sleep(1); |
| 2687 | + return $this->cancelOrder($orderId, $branchNumber, $attempts + 1); |
| 2688 | + } else { |
| 2689 | + throw new MplusQAPIException('SoapFault occurred: ' . $msg, 0, $e); |
| 2690 | + } |
| 2691 | + } catch (Exception $e) { |
| 2692 | + throw new MplusQAPIException('Exception occurred: ' . $e->getMessage(), 0, $e); |
| 2693 | + } |
2694 | 2694 | } |
2695 | | - } // END cancelOrder() |
| 2695 | +// END cancelOrder() |
2696 | 2696 |
|
2697 | 2697 | //---------------------------------------------------------------------------- |
2698 | 2698 |
|
@@ -3549,6 +3549,22 @@ public function getAuthorizationTree($attempts = 0) { |
3549 | 3549 | } |
3550 | 3550 |
|
3551 | 3551 | // END getAuthorizationTree() |
| 3552 | + |
| 3553 | + //---------------------------------------------------------------------------- |
| 3554 | + public function updateOrderV2($order) { |
| 3555 | + try { |
| 3556 | + if (!isset($order['orderId'])) { |
| 3557 | + throw new MplusQAPIException('No orderId set.'); |
| 3558 | + } |
| 3559 | + $result = $this->client->updateOrderV2($this->parser->convertUpdateOrderV2($order)); |
| 3560 | + return $this->parser->parseUpdateOrderV2Result($result); |
| 3561 | + } catch (SoapFault $e) { |
| 3562 | + throw new MplusQAPIException('SoapFault occurred: ' . $e->getMessage(), 0, $e); |
| 3563 | + } catch (Exception $e) { |
| 3564 | + throw new MplusQAPIException('Exception occurred: ' . $e->getMessage(), 0, $e); |
| 3565 | + } |
| 3566 | + } |
| 3567 | +// END updateOrderV2() |
3552 | 3568 | } |
3553 | 3569 |
|
3554 | 3570 | //============================================================================== |
@@ -6116,6 +6132,20 @@ public function parseGetAuthorizationTreeResult($soapGetAuthorizationTreeResult) |
6116 | 6132 | } |
6117 | 6133 | } |
6118 | 6134 | // END parseGetAuthorizationTreeResult() |
| 6135 | + |
| 6136 | + //---------------------------------------------------------------------------- |
| 6137 | + public function parseUpdateOrderV2Result($soapUpdateOrderV2Result) { |
| 6138 | + if (isset($soapUpdateOrderV2Result->result) and $soapUpdateOrderV2Result->result == 'UPDATE-ORDER-RESULT-OK') { |
| 6139 | + if (isset($soapUpdateOrderV2Result->order)) { |
| 6140 | + return $this->parseOrder($soapUpdateOrderV2Result->order); |
| 6141 | + } else { |
| 6142 | + return true; |
| 6143 | + } |
| 6144 | + } else { |
| 6145 | + return false; |
| 6146 | + } |
| 6147 | + } |
| 6148 | + // END parseUpdateOrderV2Result() |
6119 | 6149 |
|
6120 | 6150 | //---------------------------------------------------------------------------- |
6121 | 6151 |
|
@@ -8850,6 +8880,35 @@ public function convertUpdateGroupAuthorizationsRequest($groupNumber, $authoriza |
8850 | 8880 | } |
8851 | 8881 | // END convertUpdateGroupAuthorizationsRequest() |
8852 | 8882 |
|
| 8883 | + //---------------------------------------------------------------------------- |
| 8884 | + public function convertCancelOrder($orderId, $branchNumber = null) { |
| 8885 | + $data = array('orderId' => $orderId); |
| 8886 | + if ($branchNumber !== null) { |
| 8887 | + $data['request'] = array('branchNumber' => $branchNumber); |
| 8888 | + } |
| 8889 | + $object = arrayToObject($data); |
| 8890 | + return $object; |
| 8891 | + } |
| 8892 | + // END convertCancelOrder() |
| 8893 | + |
| 8894 | + //---------------------------------------------------------------------------- |
| 8895 | + public function convertUpdateOrderV2($order, $applySalesAndActions = null, $applySalesPrices = null, $applyPriceGroups = null) { |
| 8896 | + $order = $this->convertOrder($order); |
| 8897 | + $request = ['order' => $order->order]; |
| 8898 | + if (!is_null($applySalesAndActions)) { |
| 8899 | + $request['applySalesAndActions'] = $applySalesAndActions; |
| 8900 | + } |
| 8901 | + if (!is_null($applySalesPrices)) { |
| 8902 | + $request['applySalesPrices'] = $applySalesPrices; |
| 8903 | + } |
| 8904 | + if (!is_null($applyPriceGroups)) { |
| 8905 | + $request['applyPriceGroups'] = $applyPriceGroups; |
| 8906 | + } |
| 8907 | + $object = arrayToObject(['request' => $request]); |
| 8908 | + return $object; |
| 8909 | + } |
| 8910 | + // END convertUpdateOrderV2() |
| 8911 | + |
8853 | 8912 | } |
8854 | 8913 |
|
8855 | 8914 | //------------------------------------------------------------------------------ |
|
0 commit comments