diff --git a/src/app/(mobile-ui)/qr-pay/__tests__/qr-pay-states.test.tsx b/src/app/(mobile-ui)/qr-pay/__tests__/qr-pay-states.test.tsx index d2c45a152..c0f6f3e7c 100644 --- a/src/app/(mobile-ui)/qr-pay/__tests__/qr-pay-states.test.tsx +++ b/src/app/(mobile-ui)/qr-pay/__tests__/qr-pay-states.test.tsx @@ -1052,6 +1052,31 @@ describe('GROUP 4: Success States', () => { expect(screen.getByText('Split this bill')).toBeInTheDocument() }) + test('See receipt opens the drawer keyed by the Manteca synthetic id, not externalId', async () => { + // getReceiptUrl builds /receipt/?kind=QR_PAY, and the backend resolves + // that id only via the Manteca synthetic id. Stamping externalId here 404s + // every shared receipt. + const openTransactionDetails = jest.fn() + mockUseTransactionDetailsDrawer.mockReturnValue({ + openTransactionDetails, + selectedTransaction: null, + isDrawerOpen: false, + closeTransactionDetails: jest.fn(), + }) + + await completeMantecaPayment() + + await waitFor(() => { + expect(screen.getByText('See receipt')).toBeInTheDocument() + }) + + await act(async () => { + fireEvent.click(screen.getByText('See receipt')) + }) + + expect(openTransactionDetails).toHaveBeenCalledWith(expect.objectContaining({ id: 'qp1' })) + }) + test('Manteca success, perk eligible shows hold-to-claim button', async () => { await completeMantecaPayment({ perk: { diff --git a/src/app/(mobile-ui)/qr-pay/page.tsx b/src/app/(mobile-ui)/qr-pay/page.tsx index 9aef2fb13..c3066e7e5 100644 --- a/src/app/(mobile-ui)/qr-pay/page.tsx +++ b/src/app/(mobile-ui)/qr-pay/page.tsx @@ -1440,7 +1440,11 @@ export default function QRPayPage() { onClick={() => { const now = new Date() openTransactionDetails({ - id: qrPayment!.externalId, + // Manteca synthetic id — the only key /receipt/ + // resolves, and what Activity rows already carry. + // `externalId` is UUID-shaped, so it slips past the + // id-shape gate and 404s silently instead of erroring. + id: qrPayment!.id, direction: 'qr_payment', userName: qrPayment!.details.merchant.name, fullName: qrPayment!.details.merchant.name,