feat: clean credits users
This commit is contained in:
@@ -2,13 +2,12 @@
|
||||
|
||||
use App\Actions\ReviewIdentityVerification;
|
||||
use App\Enums\BillingProductPurpose;
|
||||
use App\Enums\CreditProductType;
|
||||
use App\Enums\IdentityVerificationStatus;
|
||||
use App\Enums\PaymentTransactionStatus;
|
||||
use App\Enums\UserRole;
|
||||
use App\Filament\Resources\IdentityVerificationRequests\Pages\ListIdentityVerificationRequests;
|
||||
use App\Listeners\GrantCreditsFromStripeWebhook;
|
||||
use App\Models\CreditProduct;
|
||||
use App\Listeners\HandleStripeWebhook;
|
||||
use App\Models\BillingProduct;
|
||||
use App\Models\IdentityVerificationRequest;
|
||||
use App\Models\PaymentTransaction;
|
||||
use App\Models\User;
|
||||
@@ -173,11 +172,9 @@ it('grants lifetime certification entitlement from the paid Stripe webhook once'
|
||||
$user = User::factory()->create([
|
||||
'stripe_id' => 'cus_certification',
|
||||
]);
|
||||
$product = CreditProduct::create([
|
||||
$product = BillingProduct::create([
|
||||
'name' => 'Certification',
|
||||
'type' => CreditProductType::ONE_TIME,
|
||||
'purpose' => BillingProductPurpose::CERTIFICATION,
|
||||
'credits' => 0,
|
||||
'amount' => 1999,
|
||||
'currency' => 'eur',
|
||||
'stripe_price_id' => 'price_certification',
|
||||
@@ -196,7 +193,7 @@ it('grants lifetime certification entitlement from the paid Stripe webhook once'
|
||||
'amount_total' => 1999,
|
||||
'currency' => 'eur',
|
||||
'metadata' => [
|
||||
'credit_product_id' => $product->getKey(),
|
||||
'billing_product_id' => $product->getKey(),
|
||||
'billing_product_purpose' => BillingProductPurpose::CERTIFICATION->value,
|
||||
],
|
||||
],
|
||||
@@ -204,7 +201,7 @@ it('grants lifetime certification entitlement from the paid Stripe webhook once'
|
||||
],
|
||||
];
|
||||
|
||||
$listener = app(GrantCreditsFromStripeWebhook::class);
|
||||
$listener = app(HandleStripeWebhook::class);
|
||||
$listener->handle($event);
|
||||
$firstPurchaseDate = $user->fresh()->certification_purchased_at;
|
||||
$listener->handle($event);
|
||||
|
||||
Reference in New Issue
Block a user