User-Panel-Restarbeiten: PM-Guard, Profil-Rework, USt-ID-Prüfung, Buchungspflicht-Adresse
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
036a53499f
commit
afcca34f91
25 changed files with 905 additions and 140 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
use App\Enums\SinglePurchaseStatus;
|
||||
use App\Enums\SinglePurchaseType;
|
||||
use App\Models\BillingAddress;
|
||||
use App\Models\Plan;
|
||||
use App\Models\SinglePurchase;
|
||||
use App\Models\User;
|
||||
|
|
@ -21,6 +22,9 @@ function checkoutTestCustomer(): User
|
|||
$user = User::factory()->create();
|
||||
$user->assignRole('customer');
|
||||
|
||||
// Buchungs-Voraussetzung (12.06.2026): vollständige Rechnungsadresse.
|
||||
BillingAddress::factory()->create(['user_id' => $user->id]);
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
|
|
@ -55,6 +59,26 @@ test('an unknown plan or invalid interval responds 404', function () {
|
|||
$this->get("/admin/me/checkout/abo/{$plan->slug}/weekly")->assertNotFound();
|
||||
});
|
||||
|
||||
test('a checkout without a complete billing address redirects to the profile', function () {
|
||||
/** @var TestCase $this */
|
||||
$user = User::factory()->create();
|
||||
$user->assignRole('customer');
|
||||
$plan = Plan::factory()->create(['stripe_price_id_monthly' => 'price_test_m_addr']);
|
||||
config()->set('billing.single_pm_stripe_price_id', 'price_test_single_pm');
|
||||
|
||||
$this->actingAs($user)
|
||||
->get(route('me.checkout.subscription', ['planSlug' => $plan->slug, 'interval' => 'monthly']))
|
||||
->assertRedirect(route('me.profile'))
|
||||
->assertSessionHas('checkout-notice');
|
||||
|
||||
$this->actingAs($user)
|
||||
->get(route('me.checkout.single-pm'))
|
||||
->assertRedirect(route('me.profile'))
|
||||
->assertSessionHas('checkout-notice');
|
||||
|
||||
expect(SinglePurchase::count())->toBe(0);
|
||||
});
|
||||
|
||||
test('a plan without a synced stripe price redirects back with a notice', function () {
|
||||
/** @var TestCase $this */
|
||||
$plan = Plan::factory()->create(['stripe_price_id_monthly' => null]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue