diff --git a/apps/billing-web/e2e/full-page-authentication.spec.ts b/apps/billing-web/e2e/full-page-authentication.spec.ts index 07b18609644..67664f7a563 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("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() 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..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. - * 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). - */ +/** The card an operation's own verdict earns, or none when its outcome is unknown. */ export function operationOutcomeOf( operation: BillingOperationState ): OperationOutcome | undefined { @@ -132,7 +127,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..d2f0afea1f2 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": "The payment wasn't verified. 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)