This file contains 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
export const bb = async (data) => { | |
try { | |
const { cl_folio, cl_referencia, dl_monto, servicio, cl_concepto } = data | |
const concatText = `${cl_folio}|${cl_referencia}|${dl_monto}|${cl_concepto}|${servicio}|` | |
const hash = signData(concatText, './private_key.pem') | |
const response = await axios.post(process.env.ENDPOINT_BB, { | |
//los parseInt estan de mas, los agregue porque js es js |
This file contains 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
import crypto from "node:crypto" | |
import fs from "node:fs" | |
const signData = (concatText, routePKEY) => { | |
//decodifica la private key del usuario | |
const privateKey = fs.readFileSync(routePKEY, 'utf-8') | |
//crea un hash md5 basado en la concatenacion que recomienda banbajio | |
const md5 = crypto.createHash('md5').update(concatText).digest('hex') |