diff --git a/Helper/PurchaseHelper.php b/Helper/PurchaseHelper.php index bfead7ca..ca02bee2 100644 --- a/Helper/PurchaseHelper.php +++ b/Helper/PurchaseHelper.php @@ -756,7 +756,18 @@ public function makeShipments(Order $order) public function makeShipper($shippingMethod) { - $shippingCarrier = $shippingMethod->getCarrierCode(); + if (is_string($shippingMethod)) { + $shippingMethodArray = explode('_', $shippingMethod); + + if (count($shippingMethodArray) < 2) { + return false; + } + + $shippingCarrier = $shippingMethodArray[0]; + } else { + $shippingCarrier = $shippingMethod->getCarrierCode(); + } + $allowMethodsJson = $this->scopeConfigInterface->getValue('signifyd/general/shipper_config'); $allowMethods = $this->jsonSerializer->unserialize($allowMethodsJson); @@ -771,7 +782,18 @@ public function makeShipper($shippingMethod) public function makeshippingMethod($shippingMethod) { - $shippingMethodCode = $shippingMethod->getMethod(); + if (is_string($shippingMethod)) { + $shippingMethodArray = explode('_', $shippingMethod); + + if (count($shippingMethodArray) < 2) { + return false; + } + + $shippingMethodCode = $shippingMethodArray[1]; + } else { + $shippingMethodCode = $shippingMethod->getMethod(); + } + $allowMethodsJson = $this->scopeConfigInterface->getValue('signifyd/general/shipping_method_config'); $allowMethods = $this->jsonSerializer->unserialize($allowMethodsJson);