@@ -1409,7 +1409,9 @@ protected function _doRequest()
1409
1409
if (!$ originRegion ) {
1410
1410
$ xml ->addChild ('RequestedPickupTime ' , 'N ' , '' );
1411
1411
}
1412
- $ xml ->addChild ('NewShipper ' , 'N ' , '' );
1412
+ if ($ originRegion !== 'AP ' ) {
1413
+ $ xml ->addChild ('NewShipper ' , 'N ' , '' );
1414
+ }
1413
1415
$ xml ->addChild ('LanguageCode ' , 'EN ' , '' );
1414
1416
$ xml ->addChild ('PiecesEnabled ' , 'Y ' , '' );
1415
1417
@@ -1451,7 +1453,9 @@ protected function _doRequest()
1451
1453
}
1452
1454
1453
1455
$ nodeConsignee ->addChild ('City ' , $ rawRequest ->getRecipientAddressCity ());
1454
- $ nodeConsignee ->addChild ('Division ' , $ rawRequest ->getRecipientAddressStateOrProvinceCode ());
1456
+ if ($ originRegion !== 'AP ' ) {
1457
+ $ nodeConsignee ->addChild ('Division ' , $ rawRequest ->getRecipientAddressStateOrProvinceCode ());
1458
+ }
1455
1459
$ nodeConsignee ->addChild ('PostalCode ' , $ rawRequest ->getRecipientAddressPostalCode ());
1456
1460
$ nodeConsignee ->addChild ('CountryCode ' , $ rawRequest ->getRecipientAddressCountryCode ());
1457
1461
$ nodeConsignee ->addChild (
@@ -1500,7 +1504,9 @@ protected function _doRequest()
1500
1504
$ nodeShipper = $ xml ->addChild ('Shipper ' , '' , '' );
1501
1505
$ nodeShipper ->addChild ('ShipperID ' , (string )$ this ->getConfigData ('account ' ));
1502
1506
$ 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
+ }
1504
1510
1505
1511
$ address = $ rawRequest ->getShipperAddressStreet1 () . ' ' . $ rawRequest ->getShipperAddressStreet2 ();
1506
1512
$ address = $ this ->string ->split ($ address , 35 , false , true );
@@ -1513,7 +1519,9 @@ protected function _doRequest()
1513
1519
}
1514
1520
1515
1521
$ nodeShipper ->addChild ('City ' , $ rawRequest ->getShipperAddressCity ());
1516
- $ nodeShipper ->addChild ('Division ' , $ rawRequest ->getShipperAddressStateOrProvinceCode ());
1522
+ if ($ originRegion !== 'AP ' ) {
1523
+ $ nodeShipper ->addChild ('Division ' , $ rawRequest ->getShipperAddressStateOrProvinceCode ());
1524
+ }
1517
1525
$ nodeShipper ->addChild ('PostalCode ' , $ rawRequest ->getShipperAddressPostalCode ());
1518
1526
$ nodeShipper ->addChild ('CountryCode ' , $ rawRequest ->getShipperAddressCountryCode ());
1519
1527
$ nodeShipper ->addChild (
@@ -1533,7 +1541,7 @@ protected function _doRequest()
1533
1541
1534
1542
$ responseBody = $ this ->_getCachedQuotes ($ request );
1535
1543
if ($ responseBody === null ) {
1536
- $ debugData = ['request ' => $ request ];
1544
+ $ debugData = ['request ' => $ this -> filterDebugData ( $ request) ];
1537
1545
try {
1538
1546
/** @var \Magento\Framework\HTTP\ZendClient $client */
1539
1547
$ client = $ this ->_httpClientFactory ->create ();
@@ -1542,7 +1550,7 @@ protected function _doRequest()
1542
1550
$ client ->setRawData ($ request );
1543
1551
$ responseBody = $ client ->request (\Magento \Framework \HTTP \ZendClient::POST )->getBody ();
1544
1552
$ responseBody = utf8_decode ($ responseBody );
1545
- $ debugData ['result ' ] = $ responseBody ;
1553
+ $ debugData ['result ' ] = $ this -> filterDebugData ( $ responseBody) ;
1546
1554
$ this ->_setCachedQuotes ($ request , $ responseBody );
1547
1555
} catch (\Exception $ e ) {
1548
1556
$ this ->_errors [$ e ->getCode ()] = $ e ->getMessage ();
@@ -1727,15 +1735,15 @@ protected function _getXMLTracking($trackings)
1727
1735
1728
1736
$ responseBody = $ this ->_getCachedQuotes ($ request );
1729
1737
if ($ responseBody === null ) {
1730
- $ debugData = ['request ' => $ request ];
1738
+ $ debugData = ['request ' => $ this -> filterDebugData ( $ request) ];
1731
1739
try {
1732
1740
/** @var \Magento\Framework\HTTP\ZendClient $client */
1733
1741
$ client = $ this ->_httpClientFactory ->create ();
1734
1742
$ client ->setUri ((string )$ this ->getConfigData ('gateway_url ' ));
1735
1743
$ client ->setConfig (['maxredirects ' => 0 , 'timeout ' => 30 ]);
1736
1744
$ client ->setRawData ($ request );
1737
1745
$ responseBody = $ client ->request (\Magento \Framework \HTTP \ZendClient::POST )->getBody ();
1738
- $ debugData ['result ' ] = $ responseBody ;
1746
+ $ debugData ['result ' ] = $ this -> filterDebugData ( $ responseBody) ;
1739
1747
$ this ->_setCachedQuotes ($ request , $ responseBody );
1740
1748
} catch (\Exception $ e ) {
1741
1749
$ this ->_errors [$ e ->getCode ()] = $ e ->getMessage ();
0 commit comments