feat(xl-vask): TRU-71 replace 'Stripe' wording in invoice email (#399)

Implements **TRU-71 (DRIFT 10)** for the api repo: rewrites the
customer-facing Stripe invoice email body so it no longer exposes the
payment-processor name 'Stripe' to the customer. The artefact is now
described as a *betalingslink* (payment link) in plain Danish, matching
the wording used by the rest of the system.

## Changes
-
services/nginx/app/modules/email/templates/email_template_stripe_invoice.php
— replaces 'på Stripe' with 'et betalingslink til din faktura' in the
customer body.
- services/nginx/app/tests/auth/StripeInvoiceEmailTemplateTest.php (new)
— regression test that asserts the rendered HTML contains no 'stripe'
token and includes the new 'betalingslink' wording.

## Tests
- php8.4
services/nginx/app/tests/auth/StripeInvoiceEmailTemplateTest.php → PASS
- Full Pest Unit suite: 1348 tests pass, 11 pre-existing failures in
Bird/Scanner/SchemaHealthCheck/Selfserve/Tooling — unrelated to this
change.

Refs: TRU-71. Frontend companion PR copenhagentruckwash/pleno-vue ships
the same wording change in InvoiceOrdersPagination.vue.

---------

Co-authored-by: perf-investigator <[email protected]>
This commit is contained in:
Jeppe B
2026-08-17 12:37:46 +00:00
committed by GitHub
co-authored by perf-investigator <[email protected]>
parent 18dc8e6e9c
commit 3e39a50a4f
3 changed files with 75 additions and 1 deletions
@@ -32,7 +32,7 @@ class email_template_stripe_invoice
<!-- Email template -->
<p>Kære <?= $this->name ?>,</p>
<p>Tak for din bestilling hos Truck Wash. Vi har sendt dig en faktura på Stripe.
<p>Tak for din bestilling hos Truck Wash. Vi har sendt dig et betalingslink til din faktura.
Du kan betale fakturaen ved at klikke på linket nedenfor:</p>
<p><a href="<?= $this->stripe_payment_link ?>">Betal faktura for ordre <?= $this->order_id ?></a></p>
<!-- End of the email template -->
@@ -6,6 +6,7 @@ return [
['path' => 'tests/auth/PasskeyChallengeTest.php', 'classification' => 'unit', 'type' => 'script'],
['path' => 'tests/auth/PemToCoseConversionTest.php', 'classification' => 'unit', 'type' => 'script'],
['path' => 'tests/auth/RegisterCvrTest.php', 'classification' => 'unit', 'type' => 'script'],
['path' => 'tests/auth/StripeInvoiceEmailTemplateTest.php', 'classification' => 'unit', 'type' => 'script'],
['path' => 'tests/auth/TwoFactorAuthTest.php', 'classification' => 'integration', 'type' => 'script'],
['path' => 'tests/auth/WebAuthnInstallTest.php', 'classification' => 'unit', 'type' => 'script'],
['path' => 'tests/bookingModule/BookingModuleTest.php', 'classification' => 'unit', 'type' => 'script'],
@@ -0,0 +1,73 @@
<?php
namespace {
if (!defined('WD')) {
define('WD', dirname(__DIR__, 2));
}
}
namespace {
require_once WD . '/modules/email/helpers/email_template.php';
require_once WD . '/modules/email/templates/email_template_stripe_invoice.php';
function assert_true(bool $condition, string $message): void
{
if (!$condition) {
throw new \RuntimeException($message);
}
}
function cleanup_buffers_to(int $base_level): string
{
$output = '';
while (ob_get_level() > $base_level) {
$output .= (string)ob_get_clean();
}
return $output;
}
$base_level = ob_get_level();
ob_start();
try {
$html = (new \email\templates\email_template_stripe_invoice(
4242,
'https://pay.example.com/invoice/abc',
'Anders And'
))->generate_html();
$leaked_output = cleanup_buffers_to($base_level);
assert_true($leaked_output === '', 'Template generation must not leak buffered HTML output.');
// TRU-71: user-facing wording must not mention the payment processor
// by name. The email body must describe the artefact in plain
// language instead.
assert_true(
stripos($html, 'stripe') === false,
'Stripe-invoice email body must no longer expose the payment processor name "Stripe" to the customer.'
);
assert_true(
str_contains($html, 'betalingslink'),
'Stripe-invoice email body must describe the artefact as a betalingslink (payment link).'
);
assert_true(
str_contains($html, 'Kære Anders And'),
'Template must still greet the customer by name.'
);
assert_true(
str_contains($html, 'Betal faktura for ordre 4242'),
'Template must still expose a pay-now action link for the order.'
);
} catch (\Throwable $exception) {
$leaked_output = cleanup_buffers_to($base_level);
fwrite(STDERR, $leaked_output);
fwrite(STDERR, $exception->getMessage() . PHP_EOL);
exit(1);
}
echo "\033[32m[PASS]\033[0m Stripe-invoice email template no longer mentions Stripe to the customer.\n";
exit(0);
}