@@ -1409,7 +1409,9 @@ protected function _doRequest()
14091409 if (!$ originRegion ) {
14101410 $ xml ->addChild ('RequestedPickupTime ' , 'N ' , '' );
14111411 }
1412- $ xml ->addChild ('NewShipper ' , 'N ' , '' );
1412+ if ($ originRegion !== 'AP ' ) {
1413+ $ xml ->addChild ('NewShipper ' , 'N ' , '' );
1414+ }
14131415 $ xml ->addChild ('LanguageCode ' , 'EN ' , '' );
14141416 $ xml ->addChild ('PiecesEnabled ' , 'Y ' , '' );
14151417
@@ -1451,7 +1453,9 @@ protected function _doRequest()
14511453 }
14521454
14531455 $ nodeConsignee ->addChild ('City ' , $ rawRequest ->getRecipientAddressCity ());
1454- $ nodeConsignee ->addChild ('Division ' , $ rawRequest ->getRecipientAddressStateOrProvinceCode ());
1456+ if ($ originRegion !== 'AP ' ) {
1457+ $ nodeConsignee ->addChild ('Division ' , $ rawRequest ->getRecipientAddressStateOrProvinceCode ());
1458+ }
14551459 $ nodeConsignee ->addChild ('PostalCode ' , $ rawRequest ->getRecipientAddressPostalCode ());
14561460 $ nodeConsignee ->addChild ('CountryCode ' , $ rawRequest ->getRecipientAddressCountryCode ());
14571461 $ nodeConsignee ->addChild (
@@ -1500,7 +1504,9 @@ protected function _doRequest()
15001504 $ nodeShipper = $ xml ->addChild ('Shipper ' , '' , '' );
15011505 $ nodeShipper ->addChild ('ShipperID ' , (string )$ this ->getConfigData ('account ' ));
15021506 $ nodeShipper ->addChild ('CompanyName ' , $ rawRequest ->getShipperContactCompanyName ());
1503- $ nodeShipper ->addChild ('RegisteredAccount ' , (string )$ this ->getConfigData ('account ' ));
1507+ if ($ originRegion !== 'AP ' ) {
1508+ $ nodeShipper ->addChild ('RegisteredAccount ' , (string )$ this ->getConfigData ('account ' ));
1509+ }
15041510
15051511 $ address = $ rawRequest ->getShipperAddressStreet1 () . ' ' . $ rawRequest ->getShipperAddressStreet2 ();
15061512 $ address = $ this ->string ->split ($ address , 35 , false , true );
@@ -1513,7 +1519,9 @@ protected function _doRequest()
15131519 }
15141520
15151521 $ nodeShipper ->addChild ('City ' , $ rawRequest ->getShipperAddressCity ());
1516- $ nodeShipper ->addChild ('Division ' , $ rawRequest ->getShipperAddressStateOrProvinceCode ());
1522+ if ($ originRegion !== 'AP ' ) {
1523+ $ nodeShipper ->addChild ('Division ' , $ rawRequest ->getShipperAddressStateOrProvinceCode ());
1524+ }
15171525 $ nodeShipper ->addChild ('PostalCode ' , $ rawRequest ->getShipperAddressPostalCode ());
15181526 $ nodeShipper ->addChild ('CountryCode ' , $ rawRequest ->getShipperAddressCountryCode ());
15191527 $ nodeShipper ->addChild (
@@ -1533,7 +1541,7 @@ protected function _doRequest()
15331541
15341542 $ responseBody = $ this ->_getCachedQuotes ($ request );
15351543 if ($ responseBody === null ) {
1536- $ debugData = ['request ' => $ request ];
1544+ $ debugData = ['request ' => $ this -> filterDebugData ( $ request) ];
15371545 try {
15381546 /** @var \Magento\Framework\HTTP\ZendClient $client */
15391547 $ client = $ this ->_httpClientFactory ->create ();
@@ -1542,7 +1550,7 @@ protected function _doRequest()
15421550 $ client ->setRawData ($ request );
15431551 $ responseBody = $ client ->request (\Magento \Framework \HTTP \ZendClient::POST )->getBody ();
15441552 $ responseBody = utf8_decode ($ responseBody );
1545- $ debugData ['result ' ] = $ responseBody ;
1553+ $ debugData ['result ' ] = $ this -> filterDebugData ( $ responseBody) ;
15461554 $ this ->_setCachedQuotes ($ request , $ responseBody );
15471555 } catch (\Exception $ e ) {
15481556 $ this ->_errors [$ e ->getCode ()] = $ e ->getMessage ();
@@ -1727,15 +1735,15 @@ protected function _getXMLTracking($trackings)
17271735
17281736 $ responseBody = $ this ->_getCachedQuotes ($ request );
17291737 if ($ responseBody === null ) {
1730- $ debugData = ['request ' => $ request ];
1738+ $ debugData = ['request ' => $ this -> filterDebugData ( $ request) ];
17311739 try {
17321740 /** @var \Magento\Framework\HTTP\ZendClient $client */
17331741 $ client = $ this ->_httpClientFactory ->create ();
17341742 $ client ->setUri ((string )$ this ->getConfigData ('gateway_url ' ));
17351743 $ client ->setConfig (['maxredirects ' => 0 , 'timeout ' => 30 ]);
17361744 $ client ->setRawData ($ request );
17371745 $ responseBody = $ client ->request (\Magento \Framework \HTTP \ZendClient::POST )->getBody ();
1738- $ debugData ['result ' ] = $ responseBody ;
1746+ $ debugData ['result ' ] = $ this -> filterDebugData ( $ responseBody) ;
17391747 $ this ->_setCachedQuotes ($ request , $ responseBody );
17401748 } catch (\Exception $ e ) {
17411749 $ this ->_errors [$ e ->getCode ()] = $ e ->getMessage ();
0 commit comments