diff --git a/src/AmazonCore.php b/src/AmazonCore.php index 4ccaf9b0..0ab7792a 100755 --- a/src/AmazonCore.php +++ b/src/AmazonCore.php @@ -113,6 +113,7 @@ abstract class AmazonCore protected $env; protected $marketplaceId; protected $rawResponses = array(); + protected $proxy_info = []; /** * AmazonCore constructor sets up key information used in all Amazon requests. @@ -430,6 +431,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']; + } if (array_key_exists('authToken', $store[$s]) && !empty($store[$s]['authToken'])) { $this->options['MWSAuthToken'] = $store[$s]['authToken']; @@ -725,6 +729,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; diff --git a/src/AmazonOrder.php b/src/AmazonOrder.php index 23554c23..135f3aae 100755 --- a/src/AmazonOrder.php +++ b/src/AmazonOrder.php @@ -224,7 +224,16 @@ protected function parseXML($xml) if (isset($xml->BuyerEmail)) { $d['BuyerEmail'] = (string)$xml->BuyerEmail; } - if (isset($xml->ShipmentServiceLevelCategory)){ + 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['ShipmentServiceLevelCategory'] = (string)$xml->ShipmentServiceLevelCategory; } if (isset($xml->CbaDisplayableShippingLabel)){ @@ -640,14 +649,33 @@ public function getBuyerEmail() * * @return string|boolean single value, or FALSE if category not set yet */ - public function getShipmentServiceLevelCategory(){ - if (isset($this->data['ShipmentServiceLevelCategory'])){ + public function getShipmentServiceLevelCategory() + { + 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; + } + } + /** * Use getShipmentServiceLevelCategory instead. * @deprecated since version 1.3.0