Files
edr-platform/e2e-ui/specs/portal/ua15-telebirr-shortpay.spec.ts

28 lines
1.2 KiB
TypeScript

import { test, expect } from "@playwright/test";
import { PrismaClient } from "@prisma/client";
import { bookTrip } from "../../fixtures/booking-flow";
const prisma = new PrismaClient();
test.afterAll(async () => {
await prisma.$disconnect();
});
/**
* UA-15 ✅ — forged gateway SHORT-PAY (ISSUES C-4), guarded. A booking with a real fare in the
* thousands is settled by a forged payment.succeeded event carrying amountMinor = 1. The server must
* compare the settled amount against what the passenger was quoted (the booking's display total) and
* REFUSE to confirm a short payment — the booking stays unconfirmed and no ticket is issued.
*/
test("UA-15: a short-paid gateway settlement does NOT confirm the booking (C-4)", async ({ page }) => {
const r = await bookTrip(page, {
paymentMethod: "TELEBIRR",
forgeSettlement: { amountMinor: 1 }, // settle for 1 minor against a multi-thousand fare
});
expect(r.cardBaseFareMinor).toBeGreaterThan(1000);
expect(r.confirmed).toBe(false); // short-pay must NOT confirm the booking
const booking = await prisma.booking.findUniqueOrThrow({ where: { id: r.bookingId } });
expect(booking.status).not.toBe("CONFIRMED");
});