Compare commits
2 Commits
187ee14549
...
adc581282f
| Author | SHA1 | Date | |
|---|---|---|---|
| adc581282f | |||
| 7601859990 |
@@ -15,7 +15,7 @@ class Usps_Api_Bridge extends Module
|
|||||||
{
|
{
|
||||||
$this->name = 'usps_api_bridge';
|
$this->name = 'usps_api_bridge';
|
||||||
$this->tab = 'shipping_logistics';
|
$this->tab = 'shipping_logistics';
|
||||||
$this->version = '1.0.1';
|
$this->version = '1.0.2';
|
||||||
$this->author = 'Panariga';
|
$this->author = 'Panariga';
|
||||||
$this->need_instance = 0;
|
$this->need_instance = 0;
|
||||||
$this->bootstrap = true;
|
$this->bootstrap = true;
|
||||||
@@ -219,8 +219,12 @@ class Usps_Api_Bridge extends Module
|
|||||||
if (!empty($params->id_address_delivery)) {
|
if (!empty($params->id_address_delivery)) {
|
||||||
$address = new Address($params->id_address_delivery);
|
$address = new Address($params->id_address_delivery);
|
||||||
if (Validate::isLoadedObject($address)) {
|
if (Validate::isLoadedObject($address)) {
|
||||||
$destZip = $address->postcode;
|
if (!empty($address->postcode)) {
|
||||||
$destCountryIso = Country::getIsoById($address->id_country);
|
$destZip = $address->postcode;
|
||||||
|
}
|
||||||
|
if (!empty($address->id_country)) {
|
||||||
|
$destCountryIso = Country::getIsoById($address->id_country);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -234,10 +238,16 @@ class Usps_Api_Bridge extends Module
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (empty($destCountryIso)) {
|
if (empty($destCountryIso)) {
|
||||||
|
$this->externalLog([
|
||||||
|
'destCountryIso' => 'set to default',
|
||||||
|
]);
|
||||||
$destCountryIso = 'US';
|
$destCountryIso = 'US';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($destZip)) {
|
if (empty($destZip)) {
|
||||||
|
$this->externalLog([
|
||||||
|
'destZip' => 'is empty',
|
||||||
|
]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,11 +259,25 @@ class Usps_Api_Bridge extends Module
|
|||||||
|
|
||||||
// Map Code
|
// Map Code
|
||||||
$newApiClass = $this->mapServiceCodeToApiClass($methodCode, $isInternational);
|
$newApiClass = $this->mapServiceCodeToApiClass($methodCode, $isInternational);
|
||||||
if (!$newApiClass) return false;
|
if (!$newApiClass) {
|
||||||
|
$this->externalLog([
|
||||||
|
'mapServiceCodeToApiClass()' => 'failed',
|
||||||
|
'methodCode' => $methodCode,
|
||||||
|
'isInternational' => $isInternational,
|
||||||
|
]);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// 6. Pack Products
|
// 6. Pack Products
|
||||||
$packedBoxes = $originalModule->getHelper()->getCarrierHelper()->packProducts($products, $params->id);
|
$packedBoxes = $originalModule->getHelper()->getCarrierHelper()->packProducts($products, $params->id);
|
||||||
if (empty($packedBoxes)) return false;
|
if (empty($packedBoxes)) {
|
||||||
|
$this->externalLog([
|
||||||
|
'packProducts()' => 'failed',
|
||||||
|
'products' => $products,
|
||||||
|
'params->id' => $params->id,
|
||||||
|
]);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// 7. Setup Client
|
// 7. Setup Client
|
||||||
$client = new UspsV3Client($token, (bool)\Configuration::get('USPS_BRIDGE_LIVE_MODE'));
|
$client = new UspsV3Client($token, (bool)\Configuration::get('USPS_BRIDGE_LIVE_MODE'));
|
||||||
|
|||||||
Reference in New Issue
Block a user