Skip to content

Commit

Permalink
Merge pull request #91 from Paazl/release/1.11.2
Browse files Browse the repository at this point in the history
Release/1.11.2
  • Loading branch information
Marvin-Magmodules authored Apr 5, 2022
2 parents f1019d7 + 3dc2dd0 commit 1c12ef5
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion Helper/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Order
*/
public function isPaazlOrder(OrderInterface $order)
{
return $this->isPaazlShippingMethod($order->getShippingMethod());
return $this->isPaazlShippingMethod((string)$order->getShippingMethod());

This comment has been minimized.

Copy link
@muuk-iO

muuk-iO Apr 6, 2022

Contributor

By casting $order->getShippingMethod() to string when the value is null you will get ''. This will result in a false.

When the order is incomplete do you want to return a false? This can cause confusion.
Is my order not a paazl order or is my order incomplete. I cant know the difference.

You could throw an exception when the shippingMethod is not set. this will make clear to the programmer that there is something wrong with the order that needs to be fixed.

The false result will not break the code but could cause processing a broken order as a non paazl order.

This comment has been minimized.

Copy link
@Marvin-Magmodules

Marvin-Magmodules Apr 6, 2022

Author Collaborator

The main purpose of this function is to check if the order has a Paazl shipping method. I don't see any use case why it should throw an exception if not set (e.g. on virtual order also don't have a shipping method). Think i'm missing the concept of 'incomplete orders' and 'broken orders', can you explain how to reproduce this and why we should throw an exception here?

}

/**
Expand All @@ -33,6 +33,9 @@ public function isPaazlOrder(OrderInterface $order)
*/
public function isPaazlShippingMethod(string $shippingMethod)
{
if (!$shippingMethod) {

This comment has been minimized.

Copy link
@muuk-iO

muuk-iO Apr 6, 2022

Contributor

This check is unnecessary. The shippingMethod needs to be a string so it must be a text or ''.
if the string is '' the check below wil return false just as intended.

return false;
}
$params = explode('_', $shippingMethod, 2);
return !empty($params[0]) && ($params[0] === Paazlshipping::CODE);
}
Expand Down
2 changes: 1 addition & 1 deletion Plugin/Quote/CartManagementPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function beforePlaceOrder(
}

$shippingMethod = $quote->getShippingAddress()->getShippingMethod();
if (!$this->orderHelper->isPaazlShippingMethod($shippingMethod)) {
if (!$this->orderHelper->isPaazlShippingMethod((string)$shippingMethod)) {
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion Plugin/Tax/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function afterShippingPriceIncludesTax(
$cartId = $this->session->getData($this->getQuoteIdKey());
$shippingMethod = $this->quoteAddressResource->getShippingMethodByQuoteId((int)$cartId);
if ($shippingMethod
&& $this->orderHelper->isPaazlShippingMethod($shippingMethod)
&& $this->orderHelper->isPaazlShippingMethod((string)$shippingMethod)
&& $this->paazlConfig->isPriceIncludesTax($store)
) {
return true;
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "paazl/magento2-checkout-widget",
"description": "Paazl checkoutWidget for Magento 2",
"type": "magento2-module",
"version": "1.11.1",
"version": "1.11.2",
"keywords": [
"Paazl",
"Magento 2",
Expand Down
2 changes: 1 addition & 1 deletion etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<default>
<carriers>
<paazlshipping>
<version>v1.11.1</version>
<version>v1.11.2</version>
<active>0</active>
<sallowspecific>0</sallowspecific>
<price>0</price>
Expand Down

0 comments on commit 1c12ef5

Please sign in to comment.