Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions apps/billing-web/e2e/full-page-authentication.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand Down Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions apps/billing-web/src/checkout/checkoutPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
6 changes: 3 additions & 3 deletions apps/billing-web/src/checkout/payVerdict.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand Down
12 changes: 5 additions & 7 deletions apps/billing-web/src/checkout/payVerdict.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions apps/billing-web/src/locales/en/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
8 changes: 4 additions & 4 deletions apps/billing-web/src/views/FullPageCheckoutView.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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)
Expand Down
Loading