Layr

acme / shop

protected main

Checkout: support saved cards 4f2a91

openbob wants to merge topic-checkout into main
bobopened this change on Oct 22

Customers can save a card at checkout and use it next time.

  • The Stripe customer token is kept in the overlay secrets, never in shared files.
  • New table saved_cards with a migration.
  • The payment step lists saved cards first.

Versions

  • v3 7d3e9a1c · Oct 23, 18:55

    Content: handle expired cards (+24 −6 in 2 files)

  • Replayed onto main 9a0c13d7 · Oct 23, 09:10

    Base move only. Hidden in the file compare.

  • v2 5b20e1f7 · Oct 22, 16:40

    Content: move the token to the overlay secrets (+40 −31 in 4 files)

  • v1 31d8c0aa · Oct 22, 10:14

    First version (+212 −18 in 7 files)

Checks

CheckStateResultDurationRunnerCommand
unit7d3e9a1c✓ passed2m 14sexecutor-eu1cargo test --workspacereused from earlier run
lint7d3e9a1c✓ passed41sexecutor-eu1cargo clippy -- -D warnings
e2e7d3e9a1c⟳ running3m 02sexecutor-eu1npm --prefix web run e2e
e2e5b20e1f7✕ failed4m 40sci-runner-2npm --prefix web run e2ev2
build-image7d3e9a1c✓ passed1m 05sexecutor-eu1layr build app
Log of e2e on v2 (failed)
$ npm --prefix web run e2e> web@1.4.2 e2e> playwright testRunning 48 tests using 4 workers  ✓  checkout › pays with a new card (2.1s)  ✕  checkout › pays with a saved card (30.0s)  Error: Timed out 30000ms waiting for locator('[data-test=saved-card]')     at tests/checkout.spec.ts:57:22  1 failed, 47 passed (4m 40s)

Conversation

aliceon src/payments/card.rs:88 · v2
Do we delete the token when the customer removes the card?
bob· v3
Yes. v3 calls stripe.detach and removes the row.

Clone shop

Get the project with all lines and states. Data is decrypted on your machine.

layr clone layr+https://cloud.acme.dev/shop