Make Events payment routing plan-aware.
Deploy Ladill Events / deploy (push) Successful in 51s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-21 19:47:10 +00:00
co-authored by Cursor
parent 837c249634
commit 1bcbdbfdb1
6 changed files with 119 additions and 37 deletions
@@ -19,11 +19,13 @@ class MerchantGatewayService
public function isConfigured(User|string $owner): bool
{
if (! $this->ownerMayUseGateway($owner)) {
return false;
}
return $this->shouldUseOwnerGateway($owner);
}
return (bool) $this->settingFor($owner)?->isConfigured();
public function shouldUseOwnerGateway(User|string $owner): bool
{
return $this->ownerMayUseGateway($owner)
&& (bool) $this->settingFor($owner)?->isConfigured();
}
/**
@@ -55,7 +57,12 @@ class MerchantGatewayService
*/
public function verify(User|string $owner, string $reference): array
{
$setting = $this->requireConfigured($owner);
// Do not re-check the current plan here: an owner-gateway payment
// initiated before a downgrade must remain verifiable.
$setting = $this->settingFor($owner);
if (! $setting?->isConfigured()) {
throw new RuntimeException('The payment gateway used for this transaction is no longer configured.');
}
return match ($setting->provider) {
PaymentGatewaySetting::PROVIDER_PAYSTACK => $this->paystackVerify($setting, $reference),