diff --git a/functions/lib/banrisul/auth/create-access.js b/functions/lib/banrisul/auth/create-access.js index dd7cd98..a5e1652 100644 --- a/functions/lib/banrisul/auth/create-access.js +++ b/functions/lib/banrisul/auth/create-access.js @@ -5,7 +5,6 @@ module.exports = function (clientId, clientSecret, storeId, firestoreColl = 'ban const self = this let documentRef - // const hashLogin = Buffer.from(`${galaxpayId}:${galaxpayHash}`).toString('base64') if (firestoreColl) { documentRef = require('firebase-admin') @@ -16,7 +15,7 @@ module.exports = function (clientId, clientSecret, storeId, firestoreColl = 'ban this.preparing = new Promise((resolve, reject) => { const authenticate = (accessToken, documentRef) => { self.axios = createAxios(accessToken) - self.documentRef = documentRef + // self.documentRef = documentRef if (documentRef) { documentRef .set({ accessToken }, { merge: true }) diff --git a/functions/lib/banrisul/auth/create-axios.js b/functions/lib/banrisul/auth/create-axios.js index 156b364..56b0631 100644 --- a/functions/lib/banrisul/auth/create-axios.js +++ b/functions/lib/banrisul/auth/create-axios.js @@ -1,6 +1,6 @@ const axios = require('axios') module.exports = (accessToken, isGetToken) => { - const isSandbox = false // TODO: + const isSandbox = false // TODO: false const headers = { 'Content-Type': 'application/json' diff --git a/functions/routes/ecom/modules/create-transaction.js b/functions/routes/ecom/modules/create-transaction.js index 53418d4..0b67d03 100644 --- a/functions/routes/ecom/modules/create-transaction.js +++ b/functions/routes/ecom/modules/create-transaction.js @@ -33,18 +33,20 @@ exports.post = async ({ appSdk, admin }, req, res) => { } if (params.payment_method.code === 'banking_billet') { - const banrisul = new Banrisul(appData.client_id, appData.client_secret, storeId) try { + const banrisul = new Banrisul(appData.client_id, appData.client_secret, storeId) + console.log('>> s: ', storeId, ' beneficiary Code: ', appData.beneficiary_code) if (appData.beneficiary_code) { await banrisul.preparing - const documentRef = banrisul.documentRef && await banrisul.documentRef.get() - const docAuthBarisul = documentRef?.data() - const lastBilletNumber = (docAuthBarisul?.lastBilletNumber || 0) + 1 + // + // const documentRef = banrisul.documentRef && await banrisul.documentRef.get() + // const docAuthBarisul = documentRef?.data() + // const lastBilletNumber = (docAuthBarisul?.lastBilletNumber || 0) + 1 const banrisulAxios = banrisul.axios - const ourNumber = getOurNumber(lastBilletNumber) - const body = createBodyToBillet(appData, params, ourNumber) + // const ourNumber = getOurNumber(lastBilletNumber) + const body = createBodyToBillet(appData, params) console.log('>>body ', JSON.stringify(body)) redirectToPayment = false @@ -72,8 +74,8 @@ exports.post = async ({ appSdk, admin }, req, res) => { await collectionBillet.doc(orderId).set({ ...data, storeId, isHomologation: appData.is_homologation }) - banrisul.documentRef.set({ lastBilletNumber }, { merge: true }) - .catch(console.error) + // banrisul.documentRef.set({ lastBilletNumber }, { merge: true }) + // .catch(console.error) res.send({ redirect_to_payment: redirectToPayment,