create()); CreditProduct::create([ 'name' => 'Certification', 'type' => CreditProductType::ONE_TIME, 'purpose' => BillingProductPurpose::CERTIFICATION, 'credits' => 0, 'amount' => 1999, 'currency' => 'eur', 'stripe_price_id' => 'price_certification', 'sort_order' => 20, ]); CreditProduct::create([ 'name' => 'Bowli Plus', 'type' => CreditProductType::MONTHLY, 'purpose' => BillingProductPurpose::SUBSCRIPTION, 'credits' => 0, 'amount' => 999, 'currency' => 'eur', 'stripe_price_id' => 'price_subscription', 'sort_order' => 10, ]); CreditProduct::create([ 'name' => 'Ancien pack', 'type' => CreditProductType::ONE_TIME, 'credits' => 5, 'amount' => 299, 'currency' => 'eur', 'stripe_price_id' => 'price_legacy', ]); $this ->getJson('/api/billing/products') ->assertOk() ->assertJsonCount(2, 'data') ->assertJsonPath('data.0.name', 'Bowli Plus') ->assertJsonPath('data.0.purpose', BillingProductPurpose::SUBSCRIPTION->value) ->assertJsonPath('data.0.formattedAmount', '9,99 EUR') ->assertJsonPath('data.1.name', 'Certification') ->assertJsonPath('data.1.purpose', BillingProductPurpose::CERTIFICATION->value); });