Loading CHANGELOG.md +6 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] ### Fixed - Exclude Afterpay from orders with a different currency [#3254344]. ### Changed - Support PHP 8.x [#3301307]. Loading Loading @@ -60,6 +64,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). [#3231706]: https://www.drupal.org/project/commerce_afterpay/issues/3231706 [#3254344]: https://www.drupal.org/project/commerce_afterpay/issues/3254344 [#3301307]: https://www.drupal.org/project/commerce_afterpay/issues/3301307 ###### Loading src/EventSubscriber/FilterAfterpayGatewaySubscriber.php +5 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,11 @@ class FilterAfterpayGatewaySubscriber implements EventSubscriberInterface { $min = $config->getMinimumAmount(); $max = $config->getMaximumAmount(); $total = $order->getTotalPrice(); // Only allow the gateway if the order's using the Afterpay store // currency. if ($max->getCurrencyCode() !== $total->getCurrencyCode()) { return FALSE; } return $min->lessThanOrEqual($total) && $total->lessThanOrEqual($max); }); $event->setPaymentGateways($gateways); Loading Loading
CHANGELOG.md +6 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] ### Fixed - Exclude Afterpay from orders with a different currency [#3254344]. ### Changed - Support PHP 8.x [#3301307]. Loading Loading @@ -60,6 +64,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). [#3231706]: https://www.drupal.org/project/commerce_afterpay/issues/3231706 [#3254344]: https://www.drupal.org/project/commerce_afterpay/issues/3254344 [#3301307]: https://www.drupal.org/project/commerce_afterpay/issues/3301307 ###### Loading
src/EventSubscriber/FilterAfterpayGatewaySubscriber.php +5 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,11 @@ class FilterAfterpayGatewaySubscriber implements EventSubscriberInterface { $min = $config->getMinimumAmount(); $max = $config->getMaximumAmount(); $total = $order->getTotalPrice(); // Only allow the gateway if the order's using the Afterpay store // currency. if ($max->getCurrencyCode() !== $total->getCurrencyCode()) { return FALSE; } return $min->lessThanOrEqual($total) && $total->lessThanOrEqual($max); }); $event->setPaymentGateways($gateways); Loading