Merge branch 'feature/stripe-steuersatz' into develop
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
631502c064
5 files changed
+62
No files matched your search
@@ -85,6 +85,40 @@ public function test_paying_creates_a_checkout_session_with_the_order_amounts_an
|
||||
$this->assertSame('offen', $order->fresh()->status, 'Bezahlt wird erst durch die signierte Meldung.');
|
||||
}
|
||||
|
||||
public function test_a_configured_tax_rate_is_sent_with_every_line_and_otherwise_none(): void
|
||||
{
|
||||
$order = $this->orderOf($this->tina(), [$this->privateKonflikte(), $this->privateGrenzen()]);
|
||||
Http::fake(['stripe.test/v1/checkout/sessions' => Http::response(['id' => 'cs_test_s', 'url' => 'https://checkout.stripe.test/s'])]);
|
||||
|
||||
$this->actingAs($this->tina())->post(route('member.order.pay', $order))->assertRedirect();
|
||||
Http::assertSent(function (HttpRequest $request): bool {
|
||||
parse_str($request->body(), $body);
|
||||
|
||||
return ! isset($body['line_items'][0]['tax_rates']) && ! isset($body['line_items'][1]['tax_rates']);
|
||||
});
|
||||
|
||||
$order->payments()->delete();
|
||||
config(['services.stripe.tax_rate' => 'txr_Testsatz123']);
|
||||
$this->actingAs($this->tina())->post(route('member.order.pay', $order))->assertRedirect();
|
||||
Http::assertSent(function (HttpRequest $request): bool {
|
||||
parse_str($request->body(), $body);
|
||||
|
||||
return ($body['line_items'][0]['tax_rates'] ?? null) === ['txr_Testsatz123']
|
||||
&& ($body['line_items'][1]['tax_rates'] ?? null) === ['txr_Testsatz123'];
|
||||
});
|
||||
}
|
||||
|
||||
public function test_an_invalid_tax_rate_id_is_refused_before_any_call(): void
|
||||
{
|
||||
$order = $this->orderOf($this->tina(), [$this->privateKonflikte()]);
|
||||
config(['services.stripe.tax_rate' => 'txcd_99999999']);
|
||||
Http::fake();
|
||||
|
||||
$this->actingAs($this->tina())->post(route('member.order.pay', $order))
|
||||
->assertSessionHasErrors(['payment' => 'Die Steuersatz-ID für Stripe ist ungültig (erwartet txr_...).']);
|
||||
Http::assertNothingSent();
|
||||
}
|
||||
|
||||
public function test_an_open_session_is_reused(): void
|
||||
{
|
||||
$order = $this->orderOf($this->tina(), [$this->privateKonflikte()]);
|
||||
|
||||
Reference in new issue
Block a user