Gate payment gateway behind Pro and Business plans.
Deploy Ladill Events / deploy (push) Successful in 46s
Deploy Ladill Events / deploy (push) Successful in 46s
Free accounts can no longer connect or use Paystack/Flutterwave/Hubtel; settings show an upgrade path and checkout requires a paid subscription.
This commit is contained in:
@@ -75,4 +75,32 @@ class EventsProTest extends TestCase
|
||||
$this->assertTrue($svc->canCreateEvent($user));
|
||||
$this->assertSame(0, $svc->liveEventCount($user));
|
||||
}
|
||||
|
||||
public function test_free_user_cannot_use_payment_gateway(): void
|
||||
{
|
||||
$user = $this->user();
|
||||
$svc = app(SubscriptionService::class);
|
||||
|
||||
$this->assertFalse($svc->canUsePaymentGateway($user));
|
||||
$this->assertFalse(app(\App\Services\Payments\MerchantGatewayService::class)->isConfigured($user));
|
||||
}
|
||||
|
||||
public function test_pro_user_can_use_payment_gateway_when_configured(): void
|
||||
{
|
||||
Http::fake(['*/debit' => Http::response(['id' => 1], 201)]);
|
||||
$user = $this->user();
|
||||
$svc = app(SubscriptionService::class);
|
||||
$svc->subscribe($user);
|
||||
|
||||
\App\Models\PaymentGatewaySetting::create([
|
||||
'owner_ref' => $user->public_id,
|
||||
'provider' => \App\Models\PaymentGatewaySetting::PROVIDER_PAYSTACK,
|
||||
'public_key' => 'pk_test',
|
||||
'secret_key' => 'sk_test',
|
||||
'is_active' => true,
|
||||
]);
|
||||
|
||||
$this->assertTrue($svc->canUsePaymentGateway($user));
|
||||
$this->assertTrue(app(\App\Services\Payments\MerchantGatewayService::class)->isConfigured($user));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user