Skip to content

fix(add-money): offer an open ARS deposit order back instead of creating a new one - #4118

Merged
innolope-dev merged 4 commits into
devfrom
fix/ars-deposit-reopen-open-order
Nov 16, 2026
Merged

innolope-dev merged 4 commits into
devfrom
fix/ars-deposit-reopen-open-order

Conversation

@innolope-dev

@innolope-dev innolope-dev commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Why

The ARS add-money step keeps the deposit order's details in screen state only. A person who leaves (to their bank app, or home) and comes back lands on the amount step again and creates a new order. Manteca keeps one open ramp-on per user, so the new order cancels the old one. Until peanut-api-ts#2158 that also sent a "deposit failed" push.

Prod data since 2 Nov: 18 people replaced their own open order this way. One made 26 orders in 13 minutes on 14 Nov.

What changes

  • The amount step asks GET /manteca/deposit/open?currency=ARS (peanut-api-ts#2158) for Argentina, when the person is verified for Manteca.
  • When an unpaid order is open, an info callout says "You have an open transfer" and names its amount. Its link, "See transfer details", opens that order's details screen: deadline, CBU, alias when present, polling.
  • Entering a new amount still creates a new order, and the callout says that the new order replaces the open one.
  • The details screen now falls back to the order's own amount when the step was opened without a typed amount (currencyAmount={localCurrencyAmount || undefined}).
  • Copy in en, es-419 and pt-BR (es-AR inherits es-419: the short copy has no voseo forms).
  • Dev fixture add-money-argentina-deposit-open for the screen, listed in scripts/screens/capture-catalogue.json.

Wordiness baseline

scripts/screen-wordiness-baseline.json: the regional add-money screen goes 414 → 456 (+42). That is the new notice itself: title, one sentence and the link, doubled because callout words count twice. The copy is already cut to the minimum that still says the open order is waiting and that a new amount replaces it.

Merge order

Merge after peanut-api-ts#2158. Before that route exists the request fails, the hook returns null and the screen looks as it does today.

Screens (dev fixture, 390×844)

Open /add-money/argentina/manteca?step=inputAmount&currency=ARS&__fixture=add-money-argentina-deposit-open on a dev build to see the notice, then tap "See transfer details" for the details screen.

Tests

  • npx jest --testPathPattern 'useOpenMantecaDeposit|useMantecaDepositPolling': 2 suites, 11 tests passed (new: useOpenMantecaDeposit.test.tsx).
  • tsc --noEmit --incremental false: clean.
  • Fixture run in Chrome: the notice renders, and the link opens the details for ARS 10,000.
  • Not verified: native shells (iOS/Android) and the Spanish and Portuguese renders.

…ing a new one

The amount step keeps the deposit details in screen state only. A person who
leaves (to their bank app, home) and comes back creates a new order, and
Manteca cancels the open one, which also sent them a "deposit failed" push.
Since 2 Nov, 18 people replaced their own order this way; one made 26 orders
in 13 minutes.

The amount step now asks GET /manteca/deposit/open and, when an unpaid ARS
order is open, shows a notice with "See transfer details" that opens that
order's details. Entering a new amount still creates a new order.
@vercel

vercel Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
peanut-wallet Ready Ready Preview Nov 16, 2026 5:03pm UTC

Request Review

@innolope-dev innolope-dev self-assigned this Nov 16, 2026
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Code-analysis diff

Painscore total: 11093.18 → 11093.23 (+0.05)
Findings: +2 net (+39 new, -37 resolved)

🆕 New findings (39)

  • critical complexity — src/utils/demo-api.ts — CC 221, MI 57.07, SLOC 1636
  • critical complexity — src/components/AddMoney/components/MantecaAddMoneyFlow.tsx — CC 102, MI 55.17, SLOC 345
  • critical complexity — src/dev/fixtures/registry.ts — CC 90, MI 31.59, SLOC 5662
  • high hotspot — src/dev/fixtures/registry.ts — 231 commits, +8133/-2050 lines since 6 months ago
  • high hotspot — src/utils/demo-api.ts — 96 commits, +1923/-483 lines since 6 months ago
  • high complexity — src/services/manteca.ts — CC 47, MI 53.69, SLOC 215
  • high method-complexity — src/components/AddMoney/components/MantecaAddMoneyFlow.tsx:56 — CC 39 SLOC 181
  • high method-complexity — src/utils/demo-api.ts:1264 — demoRespond CC 34 SLOC 132
  • medium high-mdd — src/components/AddMoney/components/MantecaAddMoneyFlow.tsx:56 — MantecaAddMoneyFlow: MDD 187.5 (uses across many lines from declarations)
  • medium high-dlt — src/components/AddMoney/components/MantecaAddMoneyFlow.tsx:56 — MantecaAddMoneyFlow: DLT 64 (calls 64 distinct functions — high context load)
  • medium high-mdd — src/utils/demo-api.ts:1264 — demoRespond: MDD 37.4 (uses across many lines from declarations)
  • medium structural-dup — services/manteca.ts:222 — 29 duplicate lines / 56 tokens with services/manteca.ts:458
  • medium structural-dup — dev/fixtures/registry.ts:5333 — 26 duplicate lines / 97 tokens with dev/fixtures/registry.ts:5365
  • medium structural-dup — dev/fixtures/registry.ts:2205 — 22 duplicate lines / 72 tokens with dev/fixtures/registry.ts:4527
  • medium structural-dup — dev/fixtures/registry.ts:2863 — 21 duplicate lines / 65 tokens with dev/fixtures/registry.ts:2901
  • medium structural-dup — dev/fixtures/registry.ts:4071 — 20 duplicate lines / 65 tokens with dev/fixtures/registry.ts:4095
  • medium structural-dup — dev/fixtures/registry.ts:5397 — 20 duplicate lines / 82 tokens with dev/fixtures/registry.ts:5613
  • medium structural-dup — dev/fixtures/registry.ts:5406 — 20 duplicate lines / 61 tokens with dev/fixtures/registry.ts:5525
  • medium react-effect-derives-state — src/components/AddMoney/components/MantecaAddMoneyFlow.tsx:354 — small useEffect that only sets state from deps
  • low high-dlt — src/utils/demo-api.ts:1264 — demoRespond: DLT 21 (calls 21 distinct functions — high context load)

…and 19 more.

✅ Resolved (37)

  • src/utils/demo-api.ts — CC 220, MI 57.03, SLOC 1630
  • src/components/AddMoney/components/MantecaAddMoneyFlow.tsx — CC 96, MI 55.48, SLOC 324
  • src/dev/fixtures/registry.ts — CC 90, MI 31.63, SLOC 5643
  • src/dev/fixtures/registry.ts — 230 commits, +8114/-2050 lines since 6 months ago
  • src/utils/demo-api.ts — 95 commits, +1922/-483 lines since 6 months ago
  • src/services/manteca.ts — CC 43, MI 53.87, SLOC 199
  • src/components/AddMoney/components/MantecaAddMoneyFlow.tsx:53 — CC 35 SLOC 168
  • src/utils/demo-api.ts:1263 — demoRespond CC 34 SLOC 132
  • src/components/AddMoney/components/MantecaAddMoneyFlow.tsx:53 — MantecaAddMoneyFlow: MDD 179.5 (uses across many lines from declarations)
  • src/components/AddMoney/components/MantecaAddMoneyFlow.tsx:53 — MantecaAddMoneyFlow: DLT 62 (calls 62 distinct functions — high context load)
  • src/utils/demo-api.ts:1263 — demoRespond: MDD 37.4 (uses across many lines from declarations)
  • services/manteca.ts:222 — 29 duplicate lines / 56 tokens with services/manteca.ts:443
  • dev/fixtures/registry.ts:5314 — 26 duplicate lines / 97 tokens with dev/fixtures/registry.ts:5346
  • dev/fixtures/registry.ts:2205 — 22 duplicate lines / 72 tokens with dev/fixtures/registry.ts:4508
  • dev/fixtures/registry.ts:2844 — 21 duplicate lines / 65 tokens with dev/fixtures/registry.ts:2882
  • dev/fixtures/registry.ts:4052 — 20 duplicate lines / 65 tokens with dev/fixtures/registry.ts:4076
  • dev/fixtures/registry.ts:5378 — 20 duplicate lines / 82 tokens with dev/fixtures/registry.ts:5594
  • dev/fixtures/registry.ts:5387 — 20 duplicate lines / 61 tokens with dev/fixtures/registry.ts:5506
  • src/components/AddMoney/components/MantecaAddMoneyFlow.tsx:341 — small useEffect that only sets state from deps
  • src/utils/demo-api.ts:1263 — demoRespond: DLT 21 (calls 21 distinct functions — high context load)

…and 17 more.

📈 Painscore deltas (top movers)

File Before After Δ
src/components/AddMoney/hooks/useOpenMantecaDeposit.ts 0.0 4.0 +4.0

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

🧪 UI test report — ✅ all green

Suites

  • ✅ unit: 21966 ran, 0 failed, 0 skipped, 7.6m

📊 Coverage (unit)

metric %
statements 88.6%
branches 81.9%
functions 82.8%
lines 90.1%
⏱ 10 slowest test cases
time test
🐢 20.2s scripts/__tests__/screens-adapter.test.js › runs the existing synthetic screen adapter Node acceptance suite
🐢 10.2s src/features/deposit-accounts/__tests__/AddMoneyArgentinaCountry.acceptance.test.tsx › keeps unavailable Argentina searchable and opens its residence explanation with pointer
🐢 10.1s src/features/deposit-accounts/__tests__/AddMoneyArgentinaCountry.acceptance.test.tsx › keeps unavailable Argentina searchable and opens its residence explanation with Enter
🐢 10.1s src/features/deposit-accounts/__tests__/AddMoneyArgentinaCountry.acceptance.test.tsx › keeps unavailable Argentina searchable and opens its residence explanation with Space
🐢 9.0s src/app/(mobile-ui)/qr-pay/__tests__/qr-pay-states.test.tsx › Network failure keeps loading while retries remain, then shows the generic error
🐢 5.2s scripts/__tests__/signup-attribution-paths.test.ts › includes newly published articles and locale fallbacks without editing the manifest
🐢 5.1s src/features/deposit-accounts/__tests__/AddMoneyArgentinaCountry.acceptance.test.tsx › preserves ordinary Argentina selection for residence AR
🐢 5.0s scripts/__tests__/indexable-urls.test.ts › excludes missing locale files, drafts, redirects, and retired pages from crawl and submission lists
5.0s src/features/deposit-accounts/__tests__/AddMoneyArgentinaCountry.acceptance.test.tsx › preserves ordinary Argentina selection for residence null
4.0s src/app/(mobile-ui)/qr-pay/__tests__/qr-pay-states.test.tsx › MANTECA_MERCHANT_VOLUME_NEAR_CAP fails fast with copy that names the real cause
📍 Inline annotations are in the **Unit test report** check above. Coverage artifact: `coverage-unit`. Generated by `.github/workflows/tests.yml`.

…in the screen catalogue

The callout copy is cut to the essentials (callout words count twice in the
wordiness budget). The remaining growth on the regional add-money screen
(+42) is the new open-transfer notice itself, so the baseline moves with it.
The trusted capture catalogue now lists add-money-argentina-deposit-open.
@innolope-dev
innolope-dev marked this pull request as ready for review November 16, 2026 15:25

@chip-peanut-bot chip-peanut-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chip review — no blocking findings — this is not an approval

One major finding: the open-transfer prompt can offer an expired or replaced order until its lookup refreshes.

Findings

  • MAJOR · src/components/AddMoney/hooks/useOpenMantecaDeposit.ts:15 · Expired transfer can reappear as open
    The query remains mounted when the flow switches to depositDetails; disabling it does not clear its last data. If order A expires and the person taps Start a new deposit, the input step immediately renders cached A as “still open” while the refetch runs. On a slow or failed request they can reopen and share A’s expired bank details; the same stale window occurs after creating replacement order B. Clear or gate the cached open-order result when leaving/re-entering the amount step, and cover the expiry/replacement transition in a flow test.

  • MINOR · src/services/manteca.ts:340 · [claude-opus] GET /manteca/deposit/open does not exist yet in peanut-api-ts
    The new mantecaApi.getOpenDeposit calls GET /manteca/deposit/open?currency=ARS. It expects a body of { data: MantecaDepositResponseData | null }, with stages['1'].asset and stages['1'].thresholdAmount read by MantecaAddMoneyFlow. The pinned peanut-api-ts checkout registers only POST /manteca/deposit, PATCH /manteca/deposit/:depositId/cancel and GET /manteca/deposit/:depositId/status (src/routes/manteca/deposit.ts:218, 244, 295). No route answers /manteca/deposit/open, and none of the registered routes matches it by accident. That checkout is the policy branch, so the backend half is most likely an open PR that I cannot see. Nothing breaks if this merges first: the UI gets a 404, getOpenDeposit returns { error }, the hook returns null, and no callout appears. But the fix the commit describes (stopping duplicate orders that make Manteca cancel the open one) does nothing until the backend ships. Before merging, confirm the paired peanut-api-ts PR returns the same envelope ({ data: | null }, with data null when nothing is open) and the same stages shape as POST /manteca/deposit. Then merge or deploy the backend first.

Checked clean

  • Exact head and merge-base diff; trusted PR metadata matched the supplied author, base, and head.
  • New lookup, verified-user gate, amount-step callout, existing-order details and status polling, translations, fixture, design-system callout rules.
  • Head CI was still running when checked; completed backdoor scan and bot-approval checks succeeded.

Security review by moonshotai/kimi-k3: 0 finding(s), marked with the model name. It reads the diff only and answers only security, privacy and money, so treat its findings as advice.

Third opinion by claude-opus: 1 finding(s), marked with the model name. It answers only product truth, missing tests and the cross-repo contract, so treat its findings as advice.

Copy check by claude-haiku-5-5: 0 finding(s), titled "Copy now wrong". Every quoted passage was checked against the file.

Exact head: ec2ac9d1df19 · Context: repo, design · Took 2m

…eshes

The open-order query stays mounted on the details step, so going back to the
amount step showed the last answer (possibly an order that has since expired
or been replaced) until the refetch finished. The hook now returns an order
only from a settled lookup while enabled. Chip finding on
useOpenMantecaDeposit.ts:15; the new test fails without the fix.
@innolope-dev

Copy link
Copy Markdown
Collaborator Author

/chip review

@chip-peanut-bot chip-peanut-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chip review — no blocking findings — this is not an approval

No findings at this head. The cached-order issue is fixed; the API route is a documented paired-change dependency with a safe missing-route fallback.

Checked clean

  • Exact head, merge-base diff, trusted PR metadata, new hook guard and regression test.
  • P1: the hook hides retained data while disabled or fetching, then exposes only the settled lookup result; a failed API lookup yields null.
  • P2: the PR explicitly requires the paired API change to merge first; a missing route returns an error and the callout stays hidden.
  • Head CI completed guard, refs, review, analyze, deployment, and security scan successfully; screenshot capture remained in progress when checked.
  • Existing amount-step, details/polling, service error handling, localization, fixture, and design-system callout usage.

Security review by moonshotai/kimi-k3: 0 finding(s), marked with the model name. It reads the diff only and answers only security, privacy and money, so treat its findings as advice.

Third opinion: did not run — it reads only the first review of a pull request; the first reviewer checks later rounds. This review is one reviewer short.

Copy check by claude-haiku-5-5: 0 finding(s), titled "Copy now wrong". Every quoted passage was checked against the file.

Exact head: bffcf634263b · Context: repo, design · Took 5m

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

English

Open screen library dashboard

After merge: 78c0090 → dc838b1. Reviewable capture in English; newly registered states are marked in the report.

Before was captured with the base branch's own synthetic API because this PR changes it; differences can include synthetic-data changes.

The Screen Library capture answers every API call from demo-api or the API
OpenAPI snapshot, which does not have the new route yet, so every Argentine
add-money capture failed with "Missing synthetic responses: GET
/manteca/deposit/open" and the new copy never reached a captured state. The
demo answer is { data: null }; the open-order fixture overrides it.
@innolope-dev
innolope-dev merged commit dc838b1 into dev Nov 16, 2026
30 checks passed
@innolope-dev

Copy link
Copy Markdown
Collaborator Author

/chip review

This branch was successfully deployed

1 active deployment
Preview — aa53f7fb Deployed Nov 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant