Skip to content

Commit

Permalink
chore: replace format cpf
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusgnreis authored Apr 1, 2024
1 parent 175f99e commit 3e3e080
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion functions/routes/ecom/modules/create-transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ exports.post = async ({ appSdk }, req, res) => {
appmaxTransaction.payment = {
"CreditCard": {
"token": params.credit_card && params.credit_card.hash,
"document_number": buyer.doc_number,
"document_number": buyer.doc_number.length > 11
? buyer.doc_number.replace(/(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})/, '$1.$2.$3/$4-$5')
: buyer.doc_number.replace(/(\d{3})(\d{3})(\d{3})(\d{2})/, '$1.$2.$3-$4'),
"installments": installmentsNumber,
"soft_descriptor": config.soft_descriptor || (`${params.domain}_APPMAX`).substr(0, 13)
}
Expand Down

0 comments on commit 3e3e080

Please sign in to comment.