Set allowed roles of Gateways

This commit is contained in:
2025-09-29 18:57:45 +02:00
parent 0f99ec8c92
commit 27f10a5344
5 changed files with 28 additions and 0 deletions
+5
View File
@@ -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;
+8
View File
@@ -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);
+5
View File
@@ -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([
+5
View File
@@ -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([
+5
View File
@@ -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,