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

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
  }
@@ -8614,10 +8615,15 @@ class PagarMeV5RequestHelper {
8614
8615
  type: 'individual',
8615
8616
  document: checkout.user.cpf,
8616
8617
  phones: {
8618
+ home_phone: {
8619
+ country_code: '55',
8620
+ number: checkout.user.phone.slice(2),
8621
+ area_code: checkout.user.phone.slice(0, 2),
8622
+ },
8617
8623
  mobile_phone: {
8618
8624
  country_code: '55',
8619
8625
  number: checkout.user.phone.slice(2),
8620
- area_code: checkout.user.phone.slice(0, 1),
8626
+ area_code: checkout.user.phone.slice(0, 2),
8621
8627
  },
8622
8628
  },
8623
8629
  address: {
@@ -8752,11 +8758,11 @@ class PagarMeV5ResponseHelper {
8752
8758
  acquirer_message: transaction.acquirer_message?.toString(),
8753
8759
  acquirer_return_code: transaction.acquirer_return_code?.toString(),
8754
8760
  installments: transaction.installments ?? null,
8755
- card_holder_name: transaction.card.holder_name?.toString(),
8756
- card_last_digits: transaction.card.last_four_digits?.toString(),
8757
- card_first_digits: transaction.card.first_six_digits?.toString(),
8758
- card_brand: transaction.card.brand?.toString(),
8759
- card_id: transaction.card.id?.toString(),
8761
+ card_holder_name: transaction.card?.holder_name?.toString(),
8762
+ card_last_digits: transaction.card?.last_four_digits?.toString(),
8763
+ card_first_digits: transaction.card?.first_six_digits?.toString(),
8764
+ card_brand: transaction.card?.brand?.toString(),
8765
+ card_id: transaction.card?.id?.toString(),
8760
8766
  };
8761
8767
  }
8762
8768
  }
@@ -9050,16 +9056,15 @@ class PagarmeV5BankSlipAxiosAdapter {
9050
9056
  return payment;
9051
9057
  }
9052
9058
  catch (error) {
9059
+ console.error('Full error: ', JSON.stringify(error));
9053
9060
  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);
9061
+ console.error('Error: ', error.message);
9062
+ console.error('Error response: ', error.response, 'error data: ', error.response?.data);
9058
9063
  }
9059
9064
  throw new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
9060
9065
  checkoutId: checkout.id,
9061
9066
  userEmail: checkout.user.email,
9062
- info: error.response.data,
9067
+ info: error.response?.data,
9063
9068
  });
9064
9069
  }
9065
9070
  }
@@ -9124,9 +9129,10 @@ class PagarmeV5CardAxiosAdapter {
9124
9129
  if (error instanceof PaymentError) {
9125
9130
  throw error;
9126
9131
  }
9132
+ console.error('Full error: ', JSON.stringify(error));
9127
9133
  if (error instanceof axios.AxiosError) {
9128
- console.error(error.message);
9129
- console.error(error.response.data);
9134
+ console.error('Error: ', error.message);
9135
+ console.error('Error response: ', error.response, 'error data: ', error.response?.data);
9130
9136
  }
9131
9137
  throw PagarmeBlockedOrderHelper.createGenericPaymentError(checkout, error.response?.data);
9132
9138
  }
@@ -9288,11 +9294,10 @@ class PagarmeV5PixAxiosAdapter {
9288
9294
  return payment;
9289
9295
  }
9290
9296
  catch (error) {
9297
+ console.error('Full error: ', JSON.stringify(error));
9291
9298
  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);
9299
+ console.error('Error: ', error.message);
9300
+ console.error('Error response: ', error.response, 'error data: ', error.response?.data);
9296
9301
  }
9297
9302
  throw new PaymentError('Houve uma falha ao processar pagamento com pix', {
9298
9303
  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
  }
@@ -8589,10 +8590,15 @@ class PagarMeV5RequestHelper {
8589
8590
  type: 'individual',
8590
8591
  document: checkout.user.cpf,
8591
8592
  phones: {
8593
+ home_phone: {
8594
+ country_code: '55',
8595
+ number: checkout.user.phone.slice(2),
8596
+ area_code: checkout.user.phone.slice(0, 2),
8597
+ },
8592
8598
  mobile_phone: {
8593
8599
  country_code: '55',
8594
8600
  number: checkout.user.phone.slice(2),
8595
- area_code: checkout.user.phone.slice(0, 1),
8601
+ area_code: checkout.user.phone.slice(0, 2),
8596
8602
  },
8597
8603
  },
8598
8604
  address: {
@@ -8727,11 +8733,11 @@ class PagarMeV5ResponseHelper {
8727
8733
  acquirer_message: transaction.acquirer_message?.toString(),
8728
8734
  acquirer_return_code: transaction.acquirer_return_code?.toString(),
8729
8735
  installments: transaction.installments ?? null,
8730
- card_holder_name: transaction.card.holder_name?.toString(),
8731
- card_last_digits: transaction.card.last_four_digits?.toString(),
8732
- card_first_digits: transaction.card.first_six_digits?.toString(),
8733
- card_brand: transaction.card.brand?.toString(),
8734
- card_id: transaction.card.id?.toString(),
8736
+ card_holder_name: transaction.card?.holder_name?.toString(),
8737
+ card_last_digits: transaction.card?.last_four_digits?.toString(),
8738
+ card_first_digits: transaction.card?.first_six_digits?.toString(),
8739
+ card_brand: transaction.card?.brand?.toString(),
8740
+ card_id: transaction.card?.id?.toString(),
8735
8741
  };
8736
8742
  }
8737
8743
  }
@@ -9025,16 +9031,15 @@ class PagarmeV5BankSlipAxiosAdapter {
9025
9031
  return payment;
9026
9032
  }
9027
9033
  catch (error) {
9034
+ console.error('Full error: ', JSON.stringify(error));
9028
9035
  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);
9036
+ console.error('Error: ', error.message);
9037
+ console.error('Error response: ', error.response, 'error data: ', error.response?.data);
9033
9038
  }
9034
9039
  throw new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
9035
9040
  checkoutId: checkout.id,
9036
9041
  userEmail: checkout.user.email,
9037
- info: error.response.data,
9042
+ info: error.response?.data,
9038
9043
  });
9039
9044
  }
9040
9045
  }
@@ -9099,9 +9104,10 @@ class PagarmeV5CardAxiosAdapter {
9099
9104
  if (error instanceof PaymentError) {
9100
9105
  throw error;
9101
9106
  }
9107
+ console.error('Full error: ', JSON.stringify(error));
9102
9108
  if (error instanceof AxiosError) {
9103
- console.error(error.message);
9104
- console.error(error.response.data);
9109
+ console.error('Error: ', error.message);
9110
+ console.error('Error response: ', error.response, 'error data: ', error.response?.data);
9105
9111
  }
9106
9112
  throw PagarmeBlockedOrderHelper.createGenericPaymentError(checkout, error.response?.data);
9107
9113
  }
@@ -9263,11 +9269,10 @@ class PagarmeV5PixAxiosAdapter {
9263
9269
  return payment;
9264
9270
  }
9265
9271
  catch (error) {
9272
+ console.error('Full error: ', JSON.stringify(error));
9266
9273
  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);
9274
+ console.error('Error: ', error.message);
9275
+ console.error('Error response: ', error.response, 'error data: ', error.response?.data);
9271
9276
  }
9272
9277
  throw new PaymentError('Houve uma falha ao processar pagamento com pix', {
9273
9278
  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.5",
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';