From 24ebac7f9f7023c5d84a0a46256426a6ca037a54 Mon Sep 17 00:00:00 2001 From: duncanmcclean Date: Sat, 13 Jan 2024 23:14:08 +0000 Subject: [PATCH] Fix styling --- src/Gateways/BaseGateway.php | 1 - src/Gateways/Builtin/MollieGateway.php | 1 + src/Gateways/Builtin/PayPalGateway.php | 1 + src/Gateways/Builtin/StripeGateway.php | 1 + src/Gateways/Manager.php | 2 +- src/Orders/Calculator/ShippingTaxCalculator.php | 1 - src/Shipping/Manager.php | 2 +- src/Tags/CheckoutTags.php | 2 +- 8 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Gateways/BaseGateway.php b/src/Gateways/BaseGateway.php index 6af3eacdf..3a5e93c2b 100644 --- a/src/Gateways/BaseGateway.php +++ b/src/Gateways/BaseGateway.php @@ -12,7 +12,6 @@ use Illuminate\Support\Collection; use Illuminate\Support\Str; use Statamic\Extend\HasHandle; -use Statamic\Extend\RegistersItself; abstract class BaseGateway { diff --git a/src/Gateways/Builtin/MollieGateway.php b/src/Gateways/Builtin/MollieGateway.php index 925f90315..fe0fd9dde 100644 --- a/src/Gateways/Builtin/MollieGateway.php +++ b/src/Gateways/Builtin/MollieGateway.php @@ -23,6 +23,7 @@ class MollieGateway extends BaseGateway implements Gateway { protected $mollie; + protected static $handle = 'mollie'; public function name(): string diff --git a/src/Gateways/Builtin/PayPalGateway.php b/src/Gateways/Builtin/PayPalGateway.php index ba5e72415..d00488a01 100644 --- a/src/Gateways/Builtin/PayPalGateway.php +++ b/src/Gateways/Builtin/PayPalGateway.php @@ -26,6 +26,7 @@ class PayPalGateway extends BaseGateway implements Gateway { protected $paypalClient; + protected static $handle = 'paypal'; public function name(): string diff --git a/src/Gateways/Builtin/StripeGateway.php b/src/Gateways/Builtin/StripeGateway.php index 972ef513c..bf711cfba 100644 --- a/src/Gateways/Builtin/StripeGateway.php +++ b/src/Gateways/Builtin/StripeGateway.php @@ -26,6 +26,7 @@ class StripeGateway extends BaseGateway implements Gateway { protected bool $isUsingTestMode = false; + protected static $handle = 'stripe'; public function name(): string diff --git a/src/Gateways/Manager.php b/src/Gateways/Manager.php index 79ddc85c8..32215958c 100644 --- a/src/Gateways/Manager.php +++ b/src/Gateways/Manager.php @@ -136,7 +136,7 @@ public function resolve() $gateway = SimpleCommerce::gateways() ->filter(function ($gateway) { - return $gateway['class']::handle() === $this->handle || $gateway['class'] === $this->handle; + return $this->handle === $gateway['class']::handle() || $gateway['class'] === $this->handle; }) ->first(); diff --git a/src/Orders/Calculator/ShippingTaxCalculator.php b/src/Orders/Calculator/ShippingTaxCalculator.php index 78739b5fc..c12ae22d0 100644 --- a/src/Orders/Calculator/ShippingTaxCalculator.php +++ b/src/Orders/Calculator/ShippingTaxCalculator.php @@ -4,7 +4,6 @@ use Closure; use DoubleThreeDigital\SimpleCommerce\Contracts\Order; -use DoubleThreeDigital\SimpleCommerce\Contracts\ShippingMethod; use DoubleThreeDigital\SimpleCommerce\Facades\Shipping; use DoubleThreeDigital\SimpleCommerce\SimpleCommerce; use Statamic\Facades\Site; diff --git a/src/Shipping/Manager.php b/src/Shipping/Manager.php index 99e929ffa..f41e13ade 100644 --- a/src/Shipping/Manager.php +++ b/src/Shipping/Manager.php @@ -55,7 +55,7 @@ public function resolve() $shippingMethod = SimpleCommerce::shippingMethods($siteHandle) ->filter(function ($shippingMethod) { - return $shippingMethod['class']::handle() === $this->handle || $shippingMethod['class'] === $this->handle; + return $this->handle === $shippingMethod['class']::handle() || $shippingMethod['class'] === $this->handle; }) ->first(); diff --git a/src/Tags/CheckoutTags.php b/src/Tags/CheckoutTags.php index b7a02623f..696ebd46b 100644 --- a/src/Tags/CheckoutTags.php +++ b/src/Tags/CheckoutTags.php @@ -69,7 +69,7 @@ public function wildcard(string $tag) $gatewayHandle = last(explode(':', $tag)); $gateway = SimpleCommerce::gateways() - ->filter(fn ($gateway) => $gateway['class']::handle() === $gatewayHandle) + ->filter(fn ($gateway) => $gatewayHandle === $gateway['class']::handle()) ->first(); if (! $gateway) {