Repository navigation
Conversation
…uction Tested on a Cielo merchant in production (Bom Ar), the card never reached the transaction: - The SOP script posted the card to Braspag, which answers 500 to Cielo merchants. The card client now sets `provider: 'cielo'` when the Cielo SOP script is on the page, which `list_payments` loads only for `is_cielo` in production, so stores on previous releases are fixed by the CDN script. - The 3DS MPI refused with 102 "Invalid field value": empty `bpmpi_merchant_url` (`storefront.settings` is empty on the v3 checkout), phone without country code, empty fields and `clearsale` as device provider. Only values in the documented format are sent now. - The SOP access token is single use, but `list_payments` shared it for two minutes through Firestore: another buyer or a reload got a spent token (500). Each `list_payments` gets a new one, and a second attempt on the same page asks the buyer to reload instead of a generic card error. - The CVV was never sent to the SOP (`bp-sop-cardcvvc` class and a broken quote in the form HTML). The form is built with DOM inputs now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Revisão adversarialEscopoO PR deveria: fazer cartão + 3DS funcionar para lojistas Cielo em produção (provider do SOP, campos do MPI, token SOP single-use, classe do CVV). Não deveria mudar: fluxo Pix/boleto, contrato browser↔servidor do hash ( Referência comparada: o app legado ( Verificado localmente (worktree do branch): 19/19 testes passando, ESLint sem erros novos (2 warnings AchadosCriticalNenhum. Pontos centrais refutados sem sucesso: o default RequiredR1. Zero teste automatizado para a lógica nova do card client — R2. Retry de 429 rejeita antes de tentar — OptionalO1. O2. Cielo em sandbox fica com O3. Skew de versão: a mensagem "recarregue" mente em loja com servidor antigo — o client novo chega via CDN Nit
Eixos sem achados
Veredito: APROVAR COM RESSALVASAs ressalvas são R1 (testes de regressão do card client — a infra já existe, é barato) e R2 (retry quebrado num endpoint que o próprio PR tornou por-cotação). Nenhuma bloqueia: o caminho feliz e os caminhos de falha principais foram verificados em produção com cartão real segundo a descrição do PR. Ficou sem verificar: comportamento num lojista Braspag não-Cielo real com o client novo (a premissa "token SOP é single-use" foi generalizada a partir do caso Cielo — se para Braspag puro ele fosse reutilizável, a guarda do client força reload onde antes retry imediato funcionava); sandbox Cielo (O2); se todos os checkouts (v2 legado e v3 🤖 Revisão gerada com Claude Code |
…ts token requests The OAuth and SOP token requests scheduled a retry on 429/5xx but rejected right away, so the retry never saved the request. With a new SOP token on every `list_payments`, a rate limit would unlist the credit card on that quote. `requestWithRetry` waits and tries once more before rejecting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…o the store `bpmpi_merchant_newcustomer` was true for returning buyers and false for first orders: now true only with no previous orders, left out when the orders are unknown. `bpmpi_billto_customerid` is sent only as CPF (11 digits) or CNPJ (14). The card client gets unit tests on the minified asset served by the CDN, run in `vm` with a minimal DOM: SOP provider by the loaded script, CVV on the SOP form, 3DS fields in the documented format with empty ones left out, spent SOP token never sent again, and the 3DS refusal message equal to the server one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Ajustes do review em c9324fc e fbbe11d. R1, testes do card client:
R2, retry de 429: extraí
Mantive os 7 s do original. O módulo tem 20 s de limite, então sobra folga para o retry. O1: Nit, Sem mudança de código, com justificativa:
Testes: 🤖 Generated with Claude Code |
First credit card test on a Cielo merchant in production (Bom Ar Condicionado,
is_cielo, required 3DS since v2.65.0). The card never got to the transaction. Each fix below was confirmed in the buyer's browser on production before being written here (console overrides on the live checkout).What failed and what changed
providerand defaults to Braspag (www.pagador.com.br), which answers 500 without CORS headers to a Cielo merchant with a real card. The checkout only showed "invalid card".provider: 'cielo'when the Cielo SOP script is on the page.list_paymentsloads it only foris_cieloin production. No newwindowvariable, so stores still on the onload expression of v2.65.0 are fixed through the CDN (@2).102 "Invalid field value"before reaching the bank. Fields out of format:bpmpi_merchant_urlwas empty, becausestorefront.settingsis empty on the v3 checkout (/app/). It falls back to the page origin.55+ area code + number, or is left out.bpmpi_device_1_provider: 'clearsale'is not an MPI provider (onlycardinal,inauth,threatmetrix), sobpmpi_device_1_*is removed. The ClearSale session ID is for the antifraud.list_paymentsshared it for 2 minutes through Firestore (braspagAdmin/sop_*). Another buyer, or a reload, got a spent token and the same 500.list_paymentsgets a new token. The OAuth token behind it stays cached. ThedocSOP.delete()calls increate_transactionare gone.REFUSAL_MESSAGE, kept in sync with the client) now says the same.bp-sop-cardcvvc, and a missing quote in the form HTML swallowed that input. This was left from feat(braspag): Require 3DS on credit card purchases and show the result on the order #855 for its own PR. The SOP form is now built with DOM inputs, which also avoids breaking on quotes in the holder name.Tests
create_transactionwas called withExternalAuthentication.transaction.cieloecommerce.cielo.com.br→ 201, now withSecurityCode;merchant_urlfrom the origin;node --test packages/apps/braspag/tests-unit/→ 19 passing.Not fixed here
Cielo then refused the transaction with
ReturnCode 002 "Credenciais Invalidas"(Status 0, no TID). Test-card authorizations without 3DS and without SOP get the same code. It is the merchant's enablement at Cielo, not code, and the merchant is handling it with Cielo support.🤖 Generated with Claude Code