@infrab4a/connect 5.1.0-beta.3 → 5.1.0-beta.4

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.
package/index.cjs.js CHANGED
@@ -8604,6 +8604,7 @@ class PagarMeV5RequestHelper {
8604
8604
  amount: Math.floor(item.pricePaid * 100),
8605
8605
  description: item.name,
8606
8606
  quantity: item.quantity,
8607
+ code: item.EAN,
8607
8608
  };
8608
8609
  });
8609
8610
  }
@@ -8617,7 +8618,7 @@ class PagarMeV5RequestHelper {
8617
8618
  mobile_phone: {
8618
8619
  country_code: '55',
8619
8620
  number: checkout.user.phone.slice(2),
8620
- area_code: checkout.user.phone.slice(0, 1),
8621
+ area_code: checkout.user.phone.slice(0, 2),
8621
8622
  },
8622
8623
  },
8623
8624
  address: {
@@ -9050,16 +9051,15 @@ class PagarmeV5BankSlipAxiosAdapter {
9050
9051
  return payment;
9051
9052
  }
9052
9053
  catch (error) {
9054
+ console.error('Full error: ', error);
9053
9055
  if (error instanceof axios.AxiosError) {
9054
- console.error(error.message);
9055
- console.error(error.response);
9056
- if ('data' in error.response)
9057
- console.error(error.response?.data);
9056
+ console.error('Error: ', error.message);
9057
+ console.error('Error response: ', error.response, 'error data: ', error.response?.data);
9058
9058
  }
9059
9059
  throw new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
9060
9060
  checkoutId: checkout.id,
9061
9061
  userEmail: checkout.user.email,
9062
- info: error.response.data,
9062
+ info: error.response?.data,
9063
9063
  });
9064
9064
  }
9065
9065
  }
@@ -9124,9 +9124,10 @@ class PagarmeV5CardAxiosAdapter {
9124
9124
  if (error instanceof PaymentError) {
9125
9125
  throw error;
9126
9126
  }
9127
+ console.error('Full error: ', error);
9127
9128
  if (error instanceof axios.AxiosError) {
9128
- console.error(error.message);
9129
- console.error(error.response.data);
9129
+ console.error('Error: ', error.message);
9130
+ console.error('Error response: ', error.response, 'error data: ', error.response?.data);
9130
9131
  }
9131
9132
  throw PagarmeBlockedOrderHelper.createGenericPaymentError(checkout, error.response?.data);
9132
9133
  }
@@ -9288,11 +9289,10 @@ class PagarmeV5PixAxiosAdapter {
9288
9289
  return payment;
9289
9290
  }
9290
9291
  catch (error) {
9292
+ console.error('Full error: ', error);
9291
9293
  if (error instanceof axios.AxiosError) {
9292
- console.error(error.message);
9293
- console.error(error.response);
9294
- if ('data' in error.response)
9295
- console.error(error.response?.data);
9294
+ console.error('Error: ', error.message);
9295
+ console.error('Error response: ', error.response, 'error data: ', error.response?.data);
9296
9296
  }
9297
9297
  throw new PaymentError('Houve uma falha ao processar pagamento com pix', {
9298
9298
  checkoutId: checkout.id,
package/index.esm.js CHANGED
@@ -8579,6 +8579,7 @@ class PagarMeV5RequestHelper {
8579
8579
  amount: Math.floor(item.pricePaid * 100),
8580
8580
  description: item.name,
8581
8581
  quantity: item.quantity,
8582
+ code: item.EAN,
8582
8583
  };
8583
8584
  });
8584
8585
  }
@@ -8592,7 +8593,7 @@ class PagarMeV5RequestHelper {
8592
8593
  mobile_phone: {
8593
8594
  country_code: '55',
8594
8595
  number: checkout.user.phone.slice(2),
8595
- area_code: checkout.user.phone.slice(0, 1),
8596
+ area_code: checkout.user.phone.slice(0, 2),
8596
8597
  },
8597
8598
  },
8598
8599
  address: {
@@ -9025,16 +9026,15 @@ class PagarmeV5BankSlipAxiosAdapter {
9025
9026
  return payment;
9026
9027
  }
9027
9028
  catch (error) {
9029
+ console.error('Full error: ', error);
9028
9030
  if (error instanceof AxiosError) {
9029
- console.error(error.message);
9030
- console.error(error.response);
9031
- if ('data' in error.response)
9032
- console.error(error.response?.data);
9031
+ console.error('Error: ', error.message);
9032
+ console.error('Error response: ', error.response, 'error data: ', error.response?.data);
9033
9033
  }
9034
9034
  throw new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
9035
9035
  checkoutId: checkout.id,
9036
9036
  userEmail: checkout.user.email,
9037
- info: error.response.data,
9037
+ info: error.response?.data,
9038
9038
  });
9039
9039
  }
9040
9040
  }
@@ -9099,9 +9099,10 @@ class PagarmeV5CardAxiosAdapter {
9099
9099
  if (error instanceof PaymentError) {
9100
9100
  throw error;
9101
9101
  }
9102
+ console.error('Full error: ', error);
9102
9103
  if (error instanceof AxiosError) {
9103
- console.error(error.message);
9104
- console.error(error.response.data);
9104
+ console.error('Error: ', error.message);
9105
+ console.error('Error response: ', error.response, 'error data: ', error.response?.data);
9105
9106
  }
9106
9107
  throw PagarmeBlockedOrderHelper.createGenericPaymentError(checkout, error.response?.data);
9107
9108
  }
@@ -9263,11 +9264,10 @@ class PagarmeV5PixAxiosAdapter {
9263
9264
  return payment;
9264
9265
  }
9265
9266
  catch (error) {
9267
+ console.error('Full error: ', error);
9266
9268
  if (error instanceof AxiosError) {
9267
- console.error(error.message);
9268
- console.error(error.response);
9269
- if ('data' in error.response)
9270
- console.error(error.response?.data);
9269
+ console.error('Error: ', error.message);
9270
+ console.error('Error response: ', error.response, 'error data: ', error.response?.data);
9271
9271
  }
9272
9272
  throw new PaymentError('Houve uma falha ao processar pagamento com pix', {
9273
9273
  checkoutId: checkout.id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "5.1.0-beta.3",
3
+ "version": "5.1.0-beta.4",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -34,6 +34,7 @@ export type PagarMeV5Orderitems = {
34
34
  amount: number;
35
35
  description: string;
36
36
  quantity: number;
37
+ code?: string;
37
38
  };
38
39
  export type PagarMeV5OrderPaymentInfo = {
39
40
  payment_method: 'boleto' | 'pix' | 'credit_card';