Merged
Conversation
…andling
the bridge KYC state handling in transfer flows (withdraw, deposit, claim, qr-pay)
had multiple issues: wrong priority order, missing ToS checks, redirects instead of
inline flows, and broken rejection handling.
changes:
- new `useBridgeTransferReadiness` hook: unified pre-transfer gate with correct
priority (hard rejection → tos → fixable rejection → enrollment → ready)
- `useBridgeTosStatus`: expanded to check `tos_acceptance`/`tos_v2_acceptance` in
rail `additionalRequirements` metadata, not just `REQUIRES_INFORMATION` status
- `InitiateKycModal`: added `blocked` variant (contact support CTA), `error` prop
for failed self-heal attempts
- withdraw/bank, add-money/bank, AddWithdrawCountriesList: replaced fragmented
`needsBridgeEnrollment` + `guardWithTos` + `bridgeRejection` checks with unified gate
- BankFlowManager (claim flow): added ToS guard + rejection handling for non-guest paths
- qr-pay: replaced redirect-based KYC (`router.push('/profile/identity-verification')`)
with inline sumsub SDK initiation (`handleInitiateKyc('LATAM')`)
- BridgeTosStep: show confirmation modal before iframe, prevent modal flash during
confirmation with `isConfirming` state
- KycProviderRejection, ActivationCTAs, RegionsVerification: replaced broken
`$crisp.push` calls with `setIsSupportModalOpen`
- useSumsubKycFlow: fixed race condition where `fetchCurrentStatus` closes SDK wrapper
on first attempt by guarding with `showWrapperRef`
- useProviderRejectionStatus: permanent rejections now show generic support message
instead of misleading "upload a clearer photo"
- DynamicBankAccountForm: `__silent__` sentinel to prevent form navigation when gate blocks
- close kyc modal via `sumsubFlow.showWrapper` effect instead of in `onVerify` callback
…ata cast, gate fallthrough - BridgeTosStep: wrap confirmBridgeTosAndAwaitRails in try/catch to prevent isConfirming getting stuck on error - useBridgeTosStatus: use Array.isArray guard for additionalRequirements metadata - all gate checks: always return when gate is not ready, even if guardWithTos returns false (defensive)
…lt, dedup variant mapping
- useSumsubKycFlow: save/restore prevStatusRef on crossRegion failure to prevent
suppressing subsequent legitimate APPROVED transitions
- DynamicBankAccountForm: replace __silent__ magic string with typed { silent: true }
- useBridgeTransferReadiness: extract getKycModalVariant() and getGateProviderMessage()
helpers to deduplicate gate→modal mapping across 4 files
- BankFlowManager: only close kyc modal if sdk opened (check showWrapper), preserving
error visibility on failure
…minate SDK auto-close race the fetchCurrentStatus effect could still race with handleInitiateKyc in rare cases — initiatingRef resets in the finally block before React batches the showWrapper state update. adding userInitiatedRef as a guard permanently disables the background fetch after any user-initiated flow, since the SDK and websocket handle status updates from that point.
Users paying with a Pix QR were told to ask the merchant for a Mercado Pago QR, which is wrong and confusing. Branch the message on qrType so Pix scans get Pix-specific guidance. Also capture qr_decoding_error_shown so we can measure how often this fallback fires and which rails are most affected.
Per CodeRabbit review on #1948: ARGENTINA_QR3 was hitting the default branch and getting told to ask the merchant for a Mercado Pago QR — QR3 and Mercado Pago are distinct Argentine standards, so the copy was actively misleading. Now branches PIX, ARGENTINA_QR3, and the MP default explicitly.
In Argentina, Mercado Pago is the dominant rail and a workable fallback when a QR3 code fails to decode — so suggesting "ask for a Mercado Pago QR" is the most useful guidance for QR3 users too. Only Pix needs the rail-specific copy because Brazil has no equivalent fallback. Reverts the previous QR3-specific message; adds a comment explaining the regional reasoning so future readers don't trip on the same point CodeRabbit raised.
…hine fix: bridge KYC state machine — unified gate, inline ToS, rejection handling
Signed-off-by: Juan José Ramírez <70615692+jjramirezn@users.noreply.github.com>
…rror-message [TASK-19529] fix(qr-pay): Pix-specific copy on QR decoding error + capture event
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Sister change to peanut-api-ts hotfix/bridge-developer-fee-zero. With the backend no longer attaching developer_fee_percent on Bridge transfers, the UI's "amount you will receive" math must stop deducting the same 50bps locally — otherwise we under-quote. Setting BRIDGE_DEVELOPER_FEE_RATE to 0 turns applyBridgeCrossCurrencyFee and reverseBridgeCrossCurrencyFee into identity functions, which matches what Bridge actually delivers. The hardcoded "Fee: $ 0.00" PaymentInfoRows in withdraw/bank-claim flows now become truthful. Tests are reparameterized against the constant so they stay correct when the FX-spread followup re-enables a margin.
…fee-zero hotfix(bridge): zero-out cross-currency dev fee to match backend
ci: fix auto-bump PR base + add pull_request trigger to Tests
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Branch Sync
main is 17 commits ahead of dev.
Commits to sync:
• fix: bridge KYC state machine — unified gate, inline ToS, rejection handling
• chore: format with prettier
• chore: format manteca page and sumsub action
• fix: address review comments — try/catch in BridgeTosStep, safe metadata cast, gate fallthrough
• fix: add error for missing bank account id in claim flow
• fix: address hugo's review — prevStatusRef restore, typed silent result, dedup variant mapping
• test: add unit tests for useBridgeTransferReadiness hook
• fix: strengthen fetchCurrentStatus guard with userInitiatedRef to eliminate SDK auto-close race
• fix: revert temp balance check bypasses for withdraw and manteca pages
• chore: format manteca withdraw page
• fix(qr-pay): Pix-specific copy on QR decoding error + capture event
• fix(qr-pay): rail-specific decoding-error copy for QR3 too
• revert(qr-pay): keep MP fallback copy for ARGENTINA_QR3
• Merge pull request #1943 from peanutprotocol/fix/bridge-kyc-state-machine
• fix: format
• Merge branch 'main' into hotfix/qr-pix-decoding-error-message
• Merge pull request #1948 from peanutprotocol/hotfix/qr-pix-decoding-error-message
Auto-generated by Chip 🐿️