@cloudcommerce/app-vindi 2.53.2 → 2.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -98,8 +98,9 @@ export default async (modBody) => {
98
98
  }
99
99
  vindiBill.payment_method_code = 'credit_card';
100
100
  vindiBill.installments = installmentsNumber;
101
+ } else if (params.payment_method.code === 'account_deposit') {
102
+ vindiBill.payment_method_code = 'pix';
101
103
  } else {
102
- // banking billet
103
104
  vindiBill.payment_method_code = appData.banking_billet?.is_yapay
104
105
  ? 'bank_slip_yapay' : 'bank_slip';
105
106
  }
@@ -222,7 +223,11 @@ export default async (modBody) => {
222
223
  transaction.banking_billet = {
223
224
  link: vindiCharge.print_url,
224
225
  };
226
+ } else if (params.payment_method.code === 'account_deposit') {
227
+ transaction.payment_link = vindiCharge.print_url || createdBill.url;
225
228
  }
229
+ } else if (params.payment_method.code === 'account_deposit' && createdBill.url) {
230
+ transaction.payment_link = createdBill.url;
226
231
  }
227
232
 
228
233
  const vindiTransaction = vindiCharge.last_transaction;
@@ -247,7 +252,10 @@ export default async (modBody) => {
247
252
  updated_at: vindiBillRes.updated_at || vindiBillRes.created_at || new Date().toISOString(),
248
253
  current: parseVindiStatus(vindiCharge.status),
249
254
  };
250
- return { transaction };
255
+ return {
256
+ redirect_to_payment: Boolean(transaction.payment_link),
257
+ transaction,
258
+ };
251
259
  } catch (error) {
252
260
  // try to debug request error
253
261
  const errCode = 'VINDI_BILL_ERR';
@@ -88,12 +88,22 @@ export default async (modBody) => {
88
88
  }
89
89
 
90
90
  // setup payment gateway objects
91
- ['credit_card', 'banking_billet'].forEach((paymentMethod) => {
91
+ ['credit_card', 'banking_billet', 'account_deposit'].forEach((paymentMethod) => {
92
92
  paymentTypes.forEach((type) => {
93
93
  const methodConfig = appData[paymentMethod] || {};
94
94
  if (!methodConfig.disable) {
95
95
  const isCreditCard = paymentMethod === 'credit_card';
96
- let label = methodConfig.label || (isCreditCard ? 'Cartão de crédito' : 'Boleto bancário');
96
+ const isPix = paymentMethod === 'account_deposit';
97
+ let label = methodConfig.label;
98
+ if (!label) {
99
+ if (isCreditCard) {
100
+ label = 'Cartão de crédito';
101
+ } else if (isPix) {
102
+ label = 'Pix';
103
+ } else {
104
+ label = 'Boleto bancário';
105
+ }
106
+ }
97
107
  if (type === 'recurrence' && appData.subscription_label) {
98
108
  label = appData.subscription_label + label;
99
109
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-vindi",
3
3
  "type": "module",
4
- "version": "2.53.2",
4
+ "version": "2.54.0",
5
5
  "description": "e-com.plus Cloud Commerce app to integrate Vindi Gateway",
6
6
  "main": "lib/vindi.js",
7
7
  "exports": {
@@ -30,11 +30,11 @@
30
30
  "axios": "^1.13.2",
31
31
  "firebase-admin": "^13.6.0",
32
32
  "firebase-functions": "^6.6.0",
33
- "@cloudcommerce/api": "2.53.2",
34
- "@cloudcommerce/firebase": "2.53.2"
33
+ "@cloudcommerce/api": "2.54.0",
34
+ "@cloudcommerce/firebase": "2.54.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@cloudcommerce/types": "2.53.2"
37
+ "@cloudcommerce/types": "2.54.0"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "bash ../../../scripts/build-lib.sh"