From 9b0a0f3e817b0485a0a1dbd4a18af0c72f1a7001 Mon Sep 17 00:00:00 2001 From: a349944418 <1jingzhongren@163.com> Date: Thu, 4 May 2017 15:58:50 +0800 Subject: [PATCH 1/4] Update AmazonOrder.php fixed the error parameter --- src/AmazonOrder.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/AmazonOrder.php b/src/AmazonOrder.php index 30bd956b..0f6bb9ed 100755 --- a/src/AmazonOrder.php +++ b/src/AmazonOrder.php @@ -224,8 +224,11 @@ protected function parseXML($xml) if (isset($xml->BuyerEmail)) { $d['BuyerEmail'] = (string)$xml->BuyerEmail; } - if (isset($xml->ShipServiceLevelCategory)) { - $d['ShipServiceLevelCategory'] = (string)$xml->ShipServiceLevelCategory; + if (isset($xml->ShipmentServiceLevelCategory)) { + $d['ShipServiceLevelCategory'] = (string)$xml->ShipmentServiceLevelCategory; + } + if (isset($xml->OrderType)) { + $d['OrderType'] = (string)$xml->OrderType; } if (isset($xml->EarliestShipDate)) { $d['EarliestShipDate'] = (string)$xml->EarliestShipDate; From 873a55ed26c2ee8d723e428f3d8c2098a32f6caf Mon Sep 17 00:00:00 2001 From: zhouboqi Date: Fri, 5 May 2017 09:51:58 +0800 Subject: [PATCH 2/4] add the lost parameter PaymentMethodDetails --- src/AmazonOrder.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/AmazonOrder.php b/src/AmazonOrder.php index 0f6bb9ed..532ad6b0 100755 --- a/src/AmazonOrder.php +++ b/src/AmazonOrder.php @@ -224,8 +224,17 @@ protected function parseXML($xml) if (isset($xml->BuyerEmail)) { $d['BuyerEmail'] = (string)$xml->BuyerEmail; } + if (isset($xml->PaymentMethodDetails)) { + $d['PaymentMethodDetails'] = array(); + + $i = 0; + foreach ($xml->PaymentMethodDetails->children() as $x) { + $d['PaymentMethodDetails']['PaymentMethodDetail'][] = (string) $x; + $i++; + } + } if (isset($xml->ShipmentServiceLevelCategory)) { - $d['ShipServiceLevelCategory'] = (string)$xml->ShipmentServiceLevelCategory; + $d['ShipmentServiceLevelCategory'] = (string)$xml->ShipmentServiceLevelCategory; } if (isset($xml->OrderType)) { $d['OrderType'] = (string)$xml->OrderType; From c3ba85ec3fd1bd499fd0ecc6cc11806cb0466fb4 Mon Sep 17 00:00:00 2001 From: zhouboqi Date: Fri, 5 May 2017 13:20:07 +0800 Subject: [PATCH 3/4] add get shipmentServiceLevelCategory, PaymentMethodDetails, OrderType function --- src/AmazonOrder.php | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/AmazonOrder.php b/src/AmazonOrder.php index 532ad6b0..d24278f9 100755 --- a/src/AmazonOrder.php +++ b/src/AmazonOrder.php @@ -624,10 +624,28 @@ public function getBuyerEmail() * * @return string|boolean single value, or FALSE if category not set yet */ - public function getShipServiceLevelCategory() + public function getShipmentServiceLevelCategory() { - if (isset($this->data['ShipServiceLevelCategory'])) { - return $this->data['ShipServiceLevelCategory']; + if (isset($this->data['ShipmentServiceLevelCategory'])) { + return $this->data['ShipmentServiceLevelCategory']; + } else { + return false; + } + } + + public function getPaymentMethodDetails() + { + if (isset($this->data['PaymentMethodDetails'])) { + return $this->data['PaymentMethodDetails']; + } else { + return false; + } + } + + public function getOrderType() + { + if (isset($this->data['OrderType'])) { + return $this->data['OrderType']; } else { return false; } From 31529ea86ed85739d7f6a2e52f56e4854496ea72 Mon Sep 17 00:00:00 2001 From: zhouboqi Date: Wed, 7 Feb 2018 17:35:26 +0800 Subject: [PATCH 4/4] add proxy info to manage multi shop --- src/AmazonCore.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/AmazonCore.php b/src/AmazonCore.php index 620ee2e7..87476386 100755 --- a/src/AmazonCore.php +++ b/src/AmazonCore.php @@ -112,6 +112,7 @@ abstract class AmazonCore protected $mockIndex = 0; protected $env; protected $rawResponses = array(); + protected $proxy_info = []; /** * AmazonCore constructor sets up key information used in all Amazon requests. @@ -429,6 +430,9 @@ public function setStore($s) $AMAZON_SERVICE_URL = $store[$s]['amazonServiceUrl']; $this->urlbase = $AMAZON_SERVICE_URL; } + if (array_key_exists('proxyInfo', $store[$s])) { + $this->proxy_info = $store[$s]['proxyInfo']; + } } else { throw new \Exception("Store $s does not exist!"); @@ -713,6 +717,20 @@ function fetchURL($url, $param) } } + if (!empty($this->proxy_info) + && !empty($this->proxy_info['ip']) + && !empty($this->proxy_info['port']) + ) { + curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_BASIC); //代理认证模式 + curl_setopt($ch, CURLOPT_PROXY, $this->proxy_info['ip']); //代理服务器地址 + curl_setopt($ch, CURLOPT_PROXYPORT, $this->proxy_info['port']); //代理服务器端口 + //http代理认证帐号,username:password的格式 + if (!empty($this->proxy_info['user_pwd'])) { + curl_setopt($ch, CURLOPT_PROXYUSERPWD, $this->proxy_info['user_pwd']); + } + curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); //使用http代理模式 + } + $data = curl_exec($ch); if (curl_errno($ch)) { $return['ok'] = -1;