diff --git a/Helper/FulfillmentHelper.php b/Helper/FulfillmentHelper.php index 593780fb..54e9ede5 100644 --- a/Helper/FulfillmentHelper.php +++ b/Helper/FulfillmentHelper.php @@ -175,11 +175,11 @@ public function prepareFulfillmentToDatabase(\Signifyd\Models\Fulfillment $fulfi $fulfillment->setData('created_at', $fulfillmentData->createdAt); $fulfillment->setData('delivery_email', $fulfillmentData->deliveryEmail); $fulfillment->setData('fulfillment_status', $fulfillmentData->fulfillmentStatus); - $fulfillment->setData('tracking_numbers', $this->serializer->serialize($fulfillmentData->trackingNumbers)); - $fulfillment->setData('tracking_urls', $this->serializer->serialize($fulfillmentData->trackingUrls)); - $fulfillment->setData('products', $this->serializer->serialize($fulfillmentData->products)); + $fulfillment->setData('tracking_numbers', $this->serialize($fulfillmentData->trackingNumbers)); + $fulfillment->setData('tracking_urls', $this->serialize($fulfillmentData->trackingUrls)); + $fulfillment->setData('products', $this->serialize($fulfillmentData->products)); $fulfillment->setData('shipment_status', $fulfillmentData->shipmentStatus); - $fulfillment->setData('delivery_address', $this->serializer->serialize($fulfillmentData->deliveryAddress)); + $fulfillment->setData('delivery_address', $this->serialize($fulfillmentData->deliveryAddress)); $fulfillment->setData('recipient_name', $fulfillmentData->recipientName); $fulfillment->setData('confirmation_name', $fulfillmentData->confirmationName); $fulfillment->setData('confirmation_phone', $fulfillmentData->confirmationPhone); @@ -188,6 +188,19 @@ public function prepareFulfillmentToDatabase(\Signifyd\Models\Fulfillment $fulfi return $fulfillment; } + /** + * @param $data + * @return bool|string + */ + public function serialize($data) + { + try { + return $this->serializer->serialize($data); + } catch (\InvalidArgumentException $e) { + return ''; + } + } + /** * @param \Magento\Sales\Model\Order\Shipment $shipment * @return bool|\Signifyd\Models\Fulfillment diff --git a/Model/Casedata.php b/Model/Casedata.php index 7927a0da..aba4f5fc 100644 --- a/Model/Casedata.php +++ b/Model/Casedata.php @@ -525,7 +525,10 @@ public function getEntries($index = null) $entries = $this->getData('entries_text'); if (!empty($entries)) { - $entries = $this->serializer->unserialize($entries); + try { + $entries = $this->serializer->unserialize($entries); + } catch (\InvalidArgumentException $e) { + } } if (!is_array($entries)) { @@ -548,7 +551,11 @@ public function setEntries($index, $value = null) $entries[$index] = $value; } - $entries = $this->serializer->serialize($entries); + try { + $entries = $this->serializer->serialize($entries); + } catch (\InvalidArgumentException $e) { + } + $this->setData('entries_text', $entries); return $this; diff --git a/Ui/Component/Listing/Columns/CaseLink.php b/Ui/Component/Listing/Columns/CaseLink.php index e1221b3c..c97764e0 100644 --- a/Ui/Component/Listing/Columns/CaseLink.php +++ b/Ui/Component/Listing/Columns/CaseLink.php @@ -5,6 +5,7 @@ */ namespace Signifyd\Connect\Ui\Component\Listing\Columns; +use Braintree\Exception; use Magento\Framework\ObjectManagerInterface; use Magento\Framework\View\Element\UiComponent\ContextInterface; use Magento\Framework\View\Element\UiComponentFactory; @@ -68,7 +69,10 @@ public function prepareDataSource(array $dataSource) $entries = $case->getEntriesText(); if (!empty($entries)) { - $entries = $this->serializer->unserialize($entries); + try { + $entries = $this->serializer->unserialize($entries); + } catch (\InvalidArgumentException $e) { + } if (is_array($entries) && isset($entries['testInvestigation']) && $entries['testInvestigation'] == true) { $item[$name] = "TEST: {$item[$name]}"; }