Files
api/services/nginx/app/tests/Unit/Stripe/ModuleStripePaymentLinkRetirementWiringTest.php
T
Jeppe B 30d860fdef Retire payment links and capture card payments (#327)
## Summary

- retire Stripe hosted payment-link creation routes used by POS and
order management
- automatically capture authorized payment intents rather than requiring
a separate manual capture action
- preserve ordinary terminal payment and payment-intent lifecycle
behavior
- add API and wiring regressions for payment-link retirement and
automatic capture

Paired frontend change:
https://github.com/copenhagentruckwash/pleno-vue/pull/233

## Verification

- focused backend unit suite: 2 tests, 36 assertions passed
- PHP syntax checks passed
- paired frontend unit and Playwright suites passed locally
- full required GitHub runner suites are required before this task may
enter Review or merge

## Security and operational notes

- no credentials, terminal secrets, or payment data are added
- no live Stripe account or physical terminal was exercised locally
- automatic merge remains gated on both paired PRs having passing
required checks and current branches
2026-07-27 19:09:37 +02:00

32 lines
1.1 KiB
PHP

<?php
it('keeps direct Stripe payment-link creation retired while preserving legacy cleanup', function (): void {
$routeFile = dirname(__DIR__, 3) . '/routes/moduleStripeRoute.php';
$content = file_get_contents($routeFile);
expect($content)->not->toBeFalse();
$postStart = strpos($content, "\$this->post('/modules/stripe/invoice'");
$deleteStart = strpos($content, "\$this->delete('/modules/stripe/invoice'");
expect($postStart)->not->toBeFalse()
->and($deleteStart)->not->toBeFalse()
->and($deleteStart)->toBeGreaterThan($postStart);
$retiredCreationRoute = substr($content, $postStart, $deleteStart - $postStart);
expect($retiredCreationRoute)
->toContain("'code' => 'stripe_email_payment_disabled'")
->toContain('], 410);')
->not->toContain('invoice->generate(')
->not->toContain('sendStripeInvoiceEmail(')
->not->toContain('setStripeInvoicing(');
$legacyCleanupRoute = substr($content, $deleteStart);
expect($legacyCleanupRoute)
->toContain('retrievePaymentLink()')
->toContain('invoice->void(')
->toContain('clearStripeInvoicing()');
});