Set allowed roles of Gateways
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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([
|
||||
|
||||
@@ -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([
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user