UI: Credit-Wallet-Hub + Per-PM Add-ons im Backend-Pressekonto
Wallet-Oekonomie im Customer-Bereich sichtbar gemacht: - Buchungen & Add-ons: Guthaben-Anzeige, Credit-Paket-Topup (Bonus-Staffel), Extra-PM-Kauf aus der Wallet mit kontextuellem Mini-Checkout-Hinweis, Pruefkontingent-Status (frei/Monat, heute/Tageslimit), Wallet-Verlauf - PM-Detailseite: Add-ons-Panel fuer veroeffentlichte PMs -- Boost buchen (7/14/30 Tage, Gate nur gruen, Verlaengerung), Veroeffentlichungsnachweis kaufen + Download. Aktionen ueber BoostService/ProofPdfService Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
bd7022ffaf
commit
31bef7ab49
4 changed files with 482 additions and 2 deletions
|
|
@ -5,6 +5,7 @@ use App\Models\Plan;
|
|||
use App\Models\SinglePurchase;
|
||||
use App\Models\User;
|
||||
use App\Models\UserPaymentOption;
|
||||
use App\Services\Billing\CreditWalletService;
|
||||
use App\Services\Billing\StripeCheckoutService;
|
||||
use Database\Seeders\RolesAndPermissionsSeeder;
|
||||
use Livewire\Volt\Volt as LivewireVolt;
|
||||
|
|
@ -162,3 +163,48 @@ test('the checkout success banner is shown after returning from stripe', functio
|
|||
->assertOk()
|
||||
->assertSee('Vielen Dank für Ihre Buchung!');
|
||||
});
|
||||
|
||||
test('the wallet block shows the balance and the credit pack topup links', function () {
|
||||
/** @var TestCase $this */
|
||||
$user = bookingsTestCustomer();
|
||||
app(CreditWalletService::class)->credit($user, 30);
|
||||
|
||||
$this->actingAs($user);
|
||||
|
||||
LivewireVolt::test('customer.bookings')
|
||||
->assertSee('Credit-Wallet & Add-ons')
|
||||
->assertSee('30')
|
||||
->assertSee('27 Credits') // Bonus-Paket
|
||||
->assertSee(route('me.checkout.credit-topup', ['pack' => 'p25']), false)
|
||||
->assertSee('Prüfkontingent')
|
||||
->assertSee('4 / 4'); // Einzel-Tier: 4 Freiprüfungen
|
||||
});
|
||||
|
||||
test('buying an extra pm from the wallet succeeds with enough credits', function () {
|
||||
/** @var TestCase $this */
|
||||
$user = bookingsTestCustomer();
|
||||
app(CreditWalletService::class)->credit($user, 25);
|
||||
|
||||
$this->actingAs($user);
|
||||
|
||||
LivewireVolt::test('customer.bookings')
|
||||
->call('buyExtraPm')
|
||||
->assertSee('Extra-Pressemitteilung gebucht');
|
||||
|
||||
expect($user->fresh()->creditBalance())->toBe(6); // 25 - 19 (Einzel-Tier)
|
||||
expect($user->singlePurchases()->grantingSubmission()->count())->toBe(1);
|
||||
});
|
||||
|
||||
test('buying an extra pm without enough credits shows the mini checkout hint', function () {
|
||||
/** @var TestCase $this */
|
||||
$user = bookingsTestCustomer();
|
||||
app(CreditWalletService::class)->credit($user, 8);
|
||||
|
||||
$this->actingAs($user);
|
||||
|
||||
LivewireVolt::test('customer.bookings')
|
||||
->call('buyExtraPm')
|
||||
->assertSee('Bitte laden Sie mindestens 11 Credits nach');
|
||||
|
||||
expect($user->singlePurchases()->count())->toBe(0);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue