@infrab4a/connect 5.4.0-beta.26 → 5.4.0-beta.27

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
@@ -8843,6 +8843,8 @@ class MercadoPagoRequestHelper {
8843
8843
  return {
8844
8844
  installments: card.installments,
8845
8845
  token: card.cardId,
8846
+ binary_mode: true,
8847
+ capture: true,
8846
8848
  };
8847
8849
  }
8848
8850
  static buildPixPayment() {
@@ -8985,9 +8987,13 @@ class MercadoPagoBankSlipAxiosAdapter {
8985
8987
  }
8986
8988
  catch (error) {
8987
8989
  if (error instanceof axios.AxiosError) {
8988
- console.warn(JSON.stringify(error.response.data.cause));
8990
+ console.warn(JSON.stringify(error.response.data.message));
8989
8991
  }
8990
- throw error;
8992
+ throw new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
8993
+ checkoutId: checkout.id,
8994
+ userEmail: checkout.user.email,
8995
+ info: error.response.data?.message || error.message?.toString(),
8996
+ });
8991
8997
  }
8992
8998
  }
8993
8999
  getBoletoTransaction(paymentId) {
@@ -9035,9 +9041,13 @@ class MercadoPagoCardAxiosAdapter {
9035
9041
  }
9036
9042
  catch (error) {
9037
9043
  if (error instanceof axios.AxiosError) {
9038
- console.warn(JSON.stringify(error.response.data.cause));
9044
+ console.warn(JSON.stringify(error.response.data.message));
9039
9045
  }
9040
- throw error;
9046
+ throw new PaymentError('Seu pagamento com cartão não foi autorizado. Para não perder seus produtos, pague com PIX ou outro cartão de crédito', {
9047
+ checkoutId: checkout.id,
9048
+ userEmail: checkout.user.email,
9049
+ info: error.response.data?.message || error.message?.toString(),
9050
+ });
9041
9051
  }
9042
9052
  }
9043
9053
  async getPaymentPayload(checkout, card) {
@@ -9139,9 +9149,13 @@ class MercadoPagoPixAxiosAdapter {
9139
9149
  }
9140
9150
  catch (error) {
9141
9151
  if (error instanceof axios.AxiosError) {
9142
- console.warn(JSON.stringify(error.response.data.cause));
9152
+ console.warn(JSON.stringify(error.response.data.message));
9143
9153
  }
9144
- throw error;
9154
+ throw new PaymentError('Houve uma falha ao processar pagamento com pix', {
9155
+ checkoutId: checkout.id,
9156
+ userEmail: checkout.user.email,
9157
+ info: error.response.data?.message || error.message?.toString(),
9158
+ });
9145
9159
  }
9146
9160
  }
9147
9161
  }
package/index.esm.js CHANGED
@@ -8819,6 +8819,8 @@ class MercadoPagoRequestHelper {
8819
8819
  return {
8820
8820
  installments: card.installments,
8821
8821
  token: card.cardId,
8822
+ binary_mode: true,
8823
+ capture: true,
8822
8824
  };
8823
8825
  }
8824
8826
  static buildPixPayment() {
@@ -8961,9 +8963,13 @@ class MercadoPagoBankSlipAxiosAdapter {
8961
8963
  }
8962
8964
  catch (error) {
8963
8965
  if (error instanceof AxiosError) {
8964
- console.warn(JSON.stringify(error.response.data.cause));
8966
+ console.warn(JSON.stringify(error.response.data.message));
8965
8967
  }
8966
- throw error;
8968
+ throw new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
8969
+ checkoutId: checkout.id,
8970
+ userEmail: checkout.user.email,
8971
+ info: error.response.data?.message || error.message?.toString(),
8972
+ });
8967
8973
  }
8968
8974
  }
8969
8975
  getBoletoTransaction(paymentId) {
@@ -9011,9 +9017,13 @@ class MercadoPagoCardAxiosAdapter {
9011
9017
  }
9012
9018
  catch (error) {
9013
9019
  if (error instanceof AxiosError) {
9014
- console.warn(JSON.stringify(error.response.data.cause));
9020
+ console.warn(JSON.stringify(error.response.data.message));
9015
9021
  }
9016
- throw error;
9022
+ throw new PaymentError('Seu pagamento com cartão não foi autorizado. Para não perder seus produtos, pague com PIX ou outro cartão de crédito', {
9023
+ checkoutId: checkout.id,
9024
+ userEmail: checkout.user.email,
9025
+ info: error.response.data?.message || error.message?.toString(),
9026
+ });
9017
9027
  }
9018
9028
  }
9019
9029
  async getPaymentPayload(checkout, card) {
@@ -9115,9 +9125,13 @@ class MercadoPagoPixAxiosAdapter {
9115
9125
  }
9116
9126
  catch (error) {
9117
9127
  if (error instanceof AxiosError) {
9118
- console.warn(JSON.stringify(error.response.data.cause));
9128
+ console.warn(JSON.stringify(error.response.data.message));
9119
9129
  }
9120
- throw error;
9130
+ throw new PaymentError('Houve uma falha ao processar pagamento com pix', {
9131
+ checkoutId: checkout.id,
9132
+ userEmail: checkout.user.email,
9133
+ info: error.response.data?.message || error.message?.toString(),
9134
+ });
9121
9135
  }
9122
9136
  }
9123
9137
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "5.4.0-beta.26",
3
+ "version": "5.4.0-beta.27",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -31,6 +31,8 @@ export declare class MercadoPagoRequestHelper {
31
31
  };
32
32
  installments: any;
33
33
  token: any;
34
+ binary_mode: boolean;
35
+ capture: boolean;
34
36
  transaction_amount: number;
35
37
  notification_url: string;
36
38
  metadata: {