From 78933b4dd357ed29b77b98ba9b140de764927ee3 Mon Sep 17 00:00:00 2001 From: dante01yoon Date: Thu, 29 Oct 2026 16:26:39 -0400 Subject: [PATCH 1/3] fix(billing-web): say not verified, not "not charged", while a refused bank check is still pending A challenge the bank refused leaves the operation pending and retryable until the server ends it. The page showed "Payment not completed... you haven't been charged" from the first failed attempt. It now shows "Payment not verified" while the operation is pending, and keeps the not-charged card for an operation that has terminally failed. --- apps/billing-web/e2e/full-page-authentication.spec.ts | 9 +++++---- apps/billing-web/src/checkout/checkoutPage.ts | 1 + apps/billing-web/src/checkout/payVerdict.test.ts | 6 +++--- apps/billing-web/src/checkout/payVerdict.ts | 11 +++++++---- apps/billing-web/src/locales/en/main.json | 4 ++++ .../src/views/FullPageCheckoutView.test.ts | 8 ++++---- 6 files changed, 24 insertions(+), 15 deletions(-) diff --git a/apps/billing-web/e2e/full-page-authentication.spec.ts b/apps/billing-web/e2e/full-page-authentication.spec.ts index 07b18609644..46fc5e5061f 100644 --- a/apps/billing-web/e2e/full-page-authentication.spec.ts +++ b/apps/billing-web/e2e/full-page-authentication.spec.ts @@ -234,7 +234,7 @@ test('a saved-method Pay keeps the tabs and the list inert through Phase A', asy await expect(backArrow(page)).toBeHidden() }) -test('314-10555: a challenge the bank refuses lands on capture with Payment not completed, the form still mounted and Pay live', async ({ +test('314-10555: a challenge the bank refuses lands on capture with Payment not verified, the form still mounted and Pay live', async ({ page, cloud, signIn @@ -250,8 +250,9 @@ test('314-10555: a challenge the bank refuses lands on capture with Payment not await releaseChallenge(page, 'requires_action') const card = page.getByRole('alert') - await expect(card).toContainText('Payment not completed') - await expect(card).toContainText("you haven't been charged") + await expect(card).toContainText('Payment not verified') + await expect(card).toContainText("Your bank didn't confirm it") + await expect(card).not.toContainText("you haven't been charged") await expect(footnote(page)).toHaveText('') await expect(payButton(page)).toBeEnabled() await expect(backArrow(page)).toBeVisible() @@ -680,7 +681,7 @@ test("closing Stripe's challenge window cancels the payment on the server before await releaseChallenge(page, 'requires_payment_method') - await expect(page.getByRole('alert')).toContainText('Payment not completed') + await expect(page.getByRole('alert')).toContainText('Payment not verified') await expect.poll(() => cancelRequests(cloud).length).toBe(1) await payButton(page).click() diff --git a/apps/billing-web/src/checkout/checkoutPage.ts b/apps/billing-web/src/checkout/checkoutPage.ts index 62176c26ad1..7161cc5c4dd 100644 --- a/apps/billing-web/src/checkout/checkoutPage.ts +++ b/apps/billing-web/src/checkout/checkoutPage.ts @@ -70,6 +70,7 @@ export type InlineOutcome = readonly serverMessage?: string } | { readonly kind: 'not_completed'; readonly operationId?: string } + | { readonly kind: 'not_verified'; readonly operationId?: string } | { readonly kind: 'price_updated' } | { readonly kind: 'promo_expired'; readonly code: string } | { readonly kind: 'reconciling'; readonly because?: Recheck } diff --git a/apps/billing-web/src/checkout/payVerdict.test.ts b/apps/billing-web/src/checkout/payVerdict.test.ts index e237d43083c..802658f3ffa 100644 --- a/apps/billing-web/src/checkout/payVerdict.test.ts +++ b/apps/billing-web/src/checkout/payVerdict.test.ts @@ -219,7 +219,7 @@ describe('operationOutcomeOf', () => { authenticationState: 'failed_retryable', declineReason: 'payment_not_completed' }, - outcome: { kind: 'not_completed', operationId: 'op_x' } + outcome: { kind: 'not_verified', operationId: 'op_x' } }, { name: 'an Alipay payment the customer backed out of, still pending', @@ -228,7 +228,7 @@ describe('operationOutcomeOf', () => { authenticationState: 'failed_retryable', declineReason: 'authentication_failed' }, - outcome: { kind: 'not_completed', operationId: 'op_x' } + outcome: { kind: 'not_verified', operationId: 'op_x' } }, { name: 'a pending payment the bank refused for missing authentication', @@ -237,7 +237,7 @@ describe('operationOutcomeOf', () => { authenticationState: 'failed_retryable', declineReason: 'authentication_required' }, - outcome: { kind: 'not_completed', operationId: 'op_x' } + outcome: { kind: 'not_verified', operationId: 'op_x' } }, { name: 'an attempt the server ended unpaid and marks a plain retry', diff --git a/apps/billing-web/src/checkout/payVerdict.ts b/apps/billing-web/src/checkout/payVerdict.ts index 8cf057c2990..0983ff4f19a 100644 --- a/apps/billing-web/src/checkout/payVerdict.ts +++ b/apps/billing-web/src/checkout/payVerdict.ts @@ -117,9 +117,9 @@ export function topupVerdictOf(result: TopupResult): PayVerdict { /** * The card an operation's own verdict earns, through the shared projection. - * Nothing for one still pending or succeeded, and nothing for a poll budget - * that ran out or an operation parked for a human: an unknown outcome never - * gets the card (rule 12). + * A pending attempt the bank did not confirm is not verified, never "not + * charged". Nothing for one succeeded or still in flight, a poll budget that + * ran out or an operation parked for a human (rule 12). */ export function operationOutcomeOf( operation: BillingOperationState @@ -132,7 +132,10 @@ export function operationOutcomeOf( return undefined const projection = projectPaymentStep(operation, 'preview') const operationId = operation.id - if (isNotCompleted(projection)) return { kind: 'not_completed', operationId } + if (isNotCompleted(projection)) + return operation.phase === 'pending' + ? { kind: 'not_verified', operationId } + : { kind: 'not_completed', operationId } if (projection.step === 'processing_error') return { kind: 'processing_error', operationId } if (projection.step !== 'declined') return undefined diff --git a/apps/billing-web/src/locales/en/main.json b/apps/billing-web/src/locales/en/main.json index 19bb7f04ec6..ab1abe76094 100644 --- a/apps/billing-web/src/locales/en/main.json +++ b/apps/billing-web/src/locales/en/main.json @@ -230,6 +230,10 @@ "title": "Payment not completed", "body": "Your payment wasn't completed, so you haven't been charged. Pay to try again, or use a different payment method." }, + "not_verified": { + "title": "Payment not verified", + "body": "Your bank didn't confirm it. Try again later, or contact support." + }, "promo_expired": { "title": "Your promo code expired", "body": "The {code} code expired, so the total was updated. Review the new total before paying. You have not been charged." diff --git a/apps/billing-web/src/views/FullPageCheckoutView.test.ts b/apps/billing-web/src/views/FullPageCheckoutView.test.ts index cd57fd16f06..26597bed3b0 100644 --- a/apps/billing-web/src/views/FullPageCheckoutView.test.ts +++ b/apps/billing-web/src/views/FullPageCheckoutView.test.ts @@ -2501,7 +2501,7 @@ describe('FullPageCheckoutView payment authentication', () => { ) }) - it('puts a challenge the bank refused on its card and frees Pay for the retry, on the same form', async () => { + it('puts a challenge the bank refused, still pending, on a not-verified card and frees Pay for the retry, on the same form', async () => { const fake = await payHeld() fake.publishOperation(challengedOperation('op_3ds', 'in_progress')) await waitFor(() => expect(footnote()).toHaveTextContent(PHASE_A)) @@ -2512,9 +2512,9 @@ describe('FullPageCheckoutView payment authentication', () => { challenge: { clientSecret: 'cs', status: 'failed' } }) - expect(await screen.findByRole('alert')).toHaveTextContent( - 'Payment not completed' - ) + const alert = await screen.findByRole('alert') + expect(alert).toHaveTextContent('Payment not verified') + expect(alert).not.toHaveTextContent("you haven't been charged") await waitFor(() => expect(payButton()).toBeEnabled()) expect(footnote()).toBeEmptyDOMElement() expect(form.locked()).toBe(false) From 3f4ea619d9c45800160e326e9258e4a6f453e0b8 Mon Sep 17 00:00:00 2001 From: dante01yoon Date: Thu, 29 Oct 2026 16:37:18 -0400 Subject: [PATCH 2/3] fix(billing-web): trim the outcome verdict JSDoc to its contract --- apps/billing-web/src/checkout/payVerdict.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/apps/billing-web/src/checkout/payVerdict.ts b/apps/billing-web/src/checkout/payVerdict.ts index 0983ff4f19a..077d2eb4f87 100644 --- a/apps/billing-web/src/checkout/payVerdict.ts +++ b/apps/billing-web/src/checkout/payVerdict.ts @@ -115,12 +115,7 @@ export function topupVerdictOf(result: TopupResult): PayVerdict { } } -/** - * The card an operation's own verdict earns, through the shared projection. - * A pending attempt the bank did not confirm is not verified, never "not - * charged". Nothing for one succeeded or still in flight, a poll budget that - * ran out or an operation parked for a human (rule 12). - */ +/** The card an operation's own verdict earns, or none when its outcome is unknown. */ export function operationOutcomeOf( operation: BillingOperationState ): OperationOutcome | undefined { From df35b99ade9c92df61c39e61efbee2f73b32be9b Mon Sep 17 00:00:00 2001 From: dante01yoon Date: Thu, 29 Oct 2026 18:18:09 -0400 Subject: [PATCH 3/3] fix(billing-web): word the not-verified card without naming the bank --- apps/billing-web/e2e/full-page-authentication.spec.ts | 2 +- apps/billing-web/src/locales/en/main.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/billing-web/e2e/full-page-authentication.spec.ts b/apps/billing-web/e2e/full-page-authentication.spec.ts index 46fc5e5061f..67664f7a563 100644 --- a/apps/billing-web/e2e/full-page-authentication.spec.ts +++ b/apps/billing-web/e2e/full-page-authentication.spec.ts @@ -251,7 +251,7 @@ test('314-10555: a challenge the bank refuses lands on capture with Payment not const card = page.getByRole('alert') await expect(card).toContainText('Payment not verified') - await expect(card).toContainText("Your bank didn't confirm it") + await expect(card).toContainText("The payment wasn't verified") await expect(card).not.toContainText("you haven't been charged") await expect(footnote(page)).toHaveText('') await expect(payButton(page)).toBeEnabled() diff --git a/apps/billing-web/src/locales/en/main.json b/apps/billing-web/src/locales/en/main.json index ab1abe76094..d2f0afea1f2 100644 --- a/apps/billing-web/src/locales/en/main.json +++ b/apps/billing-web/src/locales/en/main.json @@ -232,7 +232,7 @@ }, "not_verified": { "title": "Payment not verified", - "body": "Your bank didn't confirm it. Try again later, or contact support." + "body": "The payment wasn't verified. Try again later, or contact support." }, "promo_expired": { "title": "Your promo code expired",