Repository navigation
fix(braspag): Send the card security code to the bank on card payments - #868
Merged
Merged
Conversation
The CVV input never reached Silent Order Post: a missing quote on the previous hidden input swallowed it, and its class was `bp-sop-cardcvvc` (typo from Braspag docs) while the official SOP script reads `.bp-sop-cardcvv`. Card tokens were created without `SecurityCode`. Both fixed; verified by running the official `silentorderpost-1.0.js` on the generated form: the POST now includes `SecurityCode`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011YfvCxVikTh42WGmNu6chf
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.
Problema
O CVV nunca chegava ao Silent Order Post (SOP), e os tokens de cartão eram gerados sem
SecurityCode. O defeito veio do app legado (ecomplus/app-braspag,hosting/card-client.js) e tem duas causas:style="display: none;>). Os parsers (jsdom e Chromium) engolem o input seguinte, o do CVV, e o form fica com 4 inputs em vez de 5.bp-sop-cardcvvc, que é a classe listada na documentação da Cielo/Braspag. O script oficial do SOP (silentorderpost-1.0.js) lê.bp-sop-cardcvv, a mesma classe usada nos módulos oficiais de WooCommerce e Magento. Por isso, corrigir só a aspa não mudaria nada.Correção
Aspa corrigida e classe trocada para
bp-sop-cardcvv. Ocvvrequired: falsecontinua: com o campo presente e válido, o SOP envia oSecurityCode.Validação
Rodei o
silentorderpost-1.0.jsoficial (jsdom) sobre o form gerado pelo app, interceptando o XHR:HolderName=…&RawNumber=…&Expiration=…&EnableVerifyCard=true&CardType=creditCard&AccessToken=……&Expiration=…&SecurityCode=123&EnableVerifyCard=true&…Ainda não houve teste no sandbox da Cielo. Hoje nenhuma loja do cloud-commerce usa Braspag.
Impacto
Com o CVV indo para o emissor, um CVV errado passa a ser recusado na autorização. Um CVV malformado (menos de 3 dígitos) cai no
onInvaliddo SOP e o envio do cartão é rejeitado no cliente.🤖 Generated with Claude Code
https://claude.ai/code/session_011YfvCxVikTh42WGmNu6chf