From 27f10a53446e4562afcbc5daf9cfec72b101208e Mon Sep 17 00:00:00 2001 From: Daniel Subiabre Date: Mon, 29 Sep 2025 18:57:45 +0200 Subject: [PATCH] Set allowed roles of Gateways --- src/Gateway/Gateway/CashGateway.php | 5 +++++ src/Gateway/Gateway/CecaGateway.php | 8 ++++++++ src/Gateway/Paypal/PaypalGateway.php | 5 +++++ src/Gateway/Stripe/StripeGateway.php | 5 +++++ src/Gateway/Wallet/WalletGateway.php | 5 +++++ 5 files changed, 28 insertions(+) diff --git a/src/Gateway/Gateway/CashGateway.php b/src/Gateway/Gateway/CashGateway.php index 31ac495..9de3ac2 100644 --- a/src/Gateway/Gateway/CashGateway.php +++ b/src/Gateway/Gateway/CashGateway.php @@ -21,6 +21,11 @@ class CashGateway implements GatewayInterface return []; } + public static function getAllowedRoles(): array + { + return ['ROLE_ADMIN']; + } + public function process(Checkout $checkout): Checkout { return $checkout; diff --git a/src/Gateway/Gateway/CecaGateway.php b/src/Gateway/Gateway/CecaGateway.php index 63d7d00..5d22d8f 100644 --- a/src/Gateway/Gateway/CecaGateway.php +++ b/src/Gateway/Gateway/CecaGateway.php @@ -26,6 +26,14 @@ class CecaGateway implements GatewayInterface ]; } + public static function getAllowedRoles(): array + { + // This Gateway only exists for historical purposes + // DO NOT USE + // DO NOT IMPLEMENT + return ['']; + } + public function process(Checkout $checkout): Checkout { throw new \Exception(self::LEGACY_MESSAGE); diff --git a/src/Gateway/Paypal/PaypalGateway.php b/src/Gateway/Paypal/PaypalGateway.php index 3d44132..522704b 100644 --- a/src/Gateway/Paypal/PaypalGateway.php +++ b/src/Gateway/Paypal/PaypalGateway.php @@ -56,6 +56,11 @@ class PaypalGateway extends AbstractGateway ]; } + public static function getAllowedRoles(): array + { + return ['PUBLIC_ACCESS']; + } + public function process(Checkout $checkout): Checkout { $order = $this->paypal->postOrder([ diff --git a/src/Gateway/Stripe/StripeGateway.php b/src/Gateway/Stripe/StripeGateway.php index 96a7198..34a4f56 100644 --- a/src/Gateway/Stripe/StripeGateway.php +++ b/src/Gateway/Stripe/StripeGateway.php @@ -47,6 +47,11 @@ class StripeGateway extends AbstractGateway ]; } + public static function getAllowedRoles(): array + { + return ['PUBLIC_ACCESS']; + } + public function process(Checkout $checkout): Checkout { $session = $this->stripe->checkout->sessions->create([ diff --git a/src/Gateway/Wallet/WalletGateway.php b/src/Gateway/Wallet/WalletGateway.php index d0bcbde..8df5b29 100644 --- a/src/Gateway/Wallet/WalletGateway.php +++ b/src/Gateway/Wallet/WalletGateway.php @@ -30,6 +30,11 @@ class WalletGateway implements GatewayInterface ]; } + public static function getAllowedRoles(): array + { + return ['ROLE_USER']; + } + public function __construct( private WalletService $wallet, private MoneyService $money,