Skip to content

Commit

Permalink
PS-9877: Adjusted shipment sanitizing
Browse files Browse the repository at this point in the history
  • Loading branch information
demkos committed Apr 9, 2020
1 parent ceb5795 commit 2419e5a
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public function clearShipmentMethod(CartChangeTransfer $cartChangeTransfer): Car
return $cartChangeTransfer;
}

$cartChangeTransfer = $this->clearQuoteLevelShipmentForEmptyQuote($cartChangeTransfer);
$cartChangeTransfer = $this->clearQuoteLevelShipmentMethod($cartChangeTransfer);
$cartChangeTransfer = $this->clearItemsShipmentMethod($cartChangeTransfer);
$cartChangeTransfer = $this->clearShipmentExpenses($cartChangeTransfer);
Expand Down Expand Up @@ -85,6 +86,24 @@ protected function clearShipmentExpenses(CartChangeTransfer $cartChangeTransfer)
return $cartChangeTransfer;
}

/**
* @deprecated Exists for Backward Compatibility reasons only.
*
* @param \Generated\Shared\Transfer\CartChangeTransfer $cartChangeTransfer
*
* @return \Generated\Shared\Transfer\CartChangeTransfer
*/
protected function clearQuoteLevelShipmentForEmptyQuote(CartChangeTransfer $cartChangeTransfer): CartChangeTransfer
{
$quoteTransfer = $cartChangeTransfer->getQuote();

if (!$quoteTransfer->getItems()->count()) {
$quoteTransfer->setShipment(null);
}

return $cartChangeTransfer;
}

/**
* @deprecated Exists for Backward Compatibility reasons only.
*
Expand Down

0 comments on commit 2419e5a

Please sign in to comment.