Files
api/services/nginx/app/tests/Unit/Stripe/ModuleStripePaymentLinkRetirementOpenApiTest.php
T
bugfix feb95a5375 TRU-74: document retired direct Stripe payment-link route in OpenAPI
The POST /modules/stripe/invoice endpoint was retired in PR #327 (always
returns HTTP 410 with code stripe_email_payment_disabled). This patch
aligns the public OpenAPI spec with the new behaviour, documents the
legacy DELETE /modules/stripe/invoice cleanup route, and adds a unit
test that guards the documentation so future contributors cannot
silently un-retire the payment-link creation route.

Refs: TRU-74 / DRIFT 13
2026-08-17 14:23:07 +00:00

29 lines
1.2 KiB
PHP

<?php
it('documents the retired Stripe hosted invoice creation route in the public OpenAPI spec (TRU-74)', function (): void {
$openApiFile = dirname(__DIR__, 3) . '/openapi.yaml';
$contents = file_get_contents($openApiFile);
expect($contents)->not->toBeFalse();
$needle = " /modules/stripe/invoice:";
$start = strpos($contents, $needle);
expect($start)->not->toBeFalse();
$nextPathStart = strpos($contents, "\n /", $start + strlen($needle));
if ($nextPathStart === false) {
$nextPathStart = strlen($contents);
}
$block = substr($contents, $start, $nextPathStart - $start);
// Normalise trailing whitespace so the assertion is stable across editors.
$normalised = preg_replace('/[ \t]+$/m', '', $block);
expect($normalised)->toContain(" /modules/stripe/invoice:");
expect($normalised)->toContain('summary: Create Stripe invoice (retired - TRU-74 / DRIFT 13)');
expect($normalised)->toContain("'410':");
expect($normalised)->toContain('stripe_email_payment_disabled');
expect($normalised)->toContain('Cancel/clean up a legacy Stripe hosted invoice');
expect($normalised)->toContain('cancelLegacyStripeInvoice');
});