@infrab4a/connect 5.1.0-beta.5 → 5.1.0-beta.6
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
|
@@ -9005,8 +9005,9 @@ class PagarmeV5BankSlipAxiosAdapter {
|
|
|
9005
9005
|
data: payload,
|
|
9006
9006
|
});
|
|
9007
9007
|
console.warn('[PAGARME RESPONSE BOLETO DATA]', JSON.stringify(data));
|
|
9008
|
-
if (data.
|
|
9009
|
-
data.charges.at(0).status
|
|
9008
|
+
if (data.status == exports.PagarMeV5OrderStatus.Falha ||
|
|
9009
|
+
data.charges.at(0).status === exports.PagarMeV5OrderStatus.Falha ||
|
|
9010
|
+
data.charges.at(0).last_transaction.status !== exports.PagarMeV5PaymentStatus.Gerado) {
|
|
9010
9011
|
return Promise.reject(new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
|
|
9011
9012
|
// checkoutId: checkout.id,
|
|
9012
9013
|
// userEmail: checkout.user.email,
|
|
@@ -9043,22 +9044,21 @@ class PagarmeV5BankSlipAxiosAdapter {
|
|
|
9043
9044
|
data: payload,
|
|
9044
9045
|
});
|
|
9045
9046
|
console.warn('[PAGARME RESPONSE BOLETO DATA]', JSON.stringify(data));
|
|
9046
|
-
if (data.
|
|
9047
|
-
data.charges.at(0).status
|
|
9047
|
+
if (data.status == exports.PagarMeV5OrderStatus.Falha ||
|
|
9048
|
+
data.charges.at(0).status === exports.PagarMeV5OrderStatus.Falha ||
|
|
9049
|
+
data.charges.at(0).last_transaction.status !== exports.PagarMeV5PaymentStatus.Gerado) {
|
|
9048
9050
|
return Promise.reject(new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
|
|
9049
9051
|
checkoutId: checkout.id,
|
|
9050
9052
|
userEmail: checkout.user.email,
|
|
9051
|
-
info: data,
|
|
9053
|
+
info: data.charges.at(0).last_transaction?.gateway_response,
|
|
9052
9054
|
}));
|
|
9053
9055
|
}
|
|
9054
|
-
const
|
|
9055
|
-
const payment = await this.paymentRepository.create(paymentData);
|
|
9056
|
+
const payment = await this.paymentRepository.create(PagarMeV5ResponseHelper.build(checkout, data));
|
|
9056
9057
|
return payment;
|
|
9057
9058
|
}
|
|
9058
9059
|
catch (error) {
|
|
9059
9060
|
console.error('Full error: ', JSON.stringify(error));
|
|
9060
9061
|
if (error instanceof axios.AxiosError) {
|
|
9061
|
-
console.error('Error: ', error.message);
|
|
9062
9062
|
console.error('Error response: ', error.response, 'error data: ', error.response?.data);
|
|
9063
9063
|
}
|
|
9064
9064
|
throw new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
|
|
@@ -9112,8 +9112,9 @@ class PagarmeV5CardAxiosAdapter {
|
|
|
9112
9112
|
data: payload,
|
|
9113
9113
|
});
|
|
9114
9114
|
console.warn('[RESPONSE PAGARME CARD DATA]', JSON.stringify(data));
|
|
9115
|
-
if (data.
|
|
9116
|
-
data.charges.at(0).status !== exports.PagarMeV5PaymentStatus.
|
|
9115
|
+
if (data.status == exports.PagarMeV5OrderStatus.Falha ||
|
|
9116
|
+
data.charges.at(0).last_transaction.status !== exports.PagarMeV5PaymentStatus.Pago ||
|
|
9117
|
+
data.charges.at(0).last_transaction.status !== exports.PagarMeV5PaymentStatus.Capturada) {
|
|
9117
9118
|
await PagarmeBlockedOrderHelper.createBlockedOrderForUnauthorizedCard({
|
|
9118
9119
|
checkout,
|
|
9119
9120
|
card,
|
|
@@ -9121,8 +9122,7 @@ class PagarmeV5CardAxiosAdapter {
|
|
|
9121
9122
|
});
|
|
9122
9123
|
throw PagarmeBlockedOrderHelper.createPaymentError(checkout, data);
|
|
9123
9124
|
}
|
|
9124
|
-
const
|
|
9125
|
-
const payment = await this.paymentRepository.create(paymentData);
|
|
9125
|
+
const payment = await this.paymentRepository.create(PagarMeV5ResponseHelper.build(checkout, data));
|
|
9126
9126
|
return payment;
|
|
9127
9127
|
}
|
|
9128
9128
|
catch (error) {
|
|
@@ -9131,7 +9131,6 @@ class PagarmeV5CardAxiosAdapter {
|
|
|
9131
9131
|
}
|
|
9132
9132
|
console.error('Full error: ', JSON.stringify(error));
|
|
9133
9133
|
if (error instanceof axios.AxiosError) {
|
|
9134
|
-
console.error('Error: ', error.message);
|
|
9135
9134
|
console.error('Error response: ', error.response, 'error data: ', error.response?.data);
|
|
9136
9135
|
}
|
|
9137
9136
|
throw PagarmeBlockedOrderHelper.createGenericPaymentError(checkout, error.response?.data);
|
|
@@ -9289,8 +9288,14 @@ class PagarmeV5PixAxiosAdapter {
|
|
|
9289
9288
|
data: payload,
|
|
9290
9289
|
});
|
|
9291
9290
|
console.warn('[RESPONSE PAGARME PIX DATA]', JSON.stringify(data));
|
|
9292
|
-
|
|
9293
|
-
|
|
9291
|
+
if (data.status == exports.PagarMeV5OrderStatus.Falha || data.status == exports.PagarMeV5OrderStatus.Cancelado) {
|
|
9292
|
+
throw new PaymentError('Houve uma falha ao processar pagamento com pix', {
|
|
9293
|
+
checkoutId: checkout.id,
|
|
9294
|
+
userEmail: checkout.user.email,
|
|
9295
|
+
info: data.charges.at(0).last_transaction?.gateway_response,
|
|
9296
|
+
});
|
|
9297
|
+
}
|
|
9298
|
+
const payment = await this.paymentRepository.create(PagarMeV5ResponseHelper.build(checkout, data));
|
|
9294
9299
|
return payment;
|
|
9295
9300
|
}
|
|
9296
9301
|
catch (error) {
|
package/index.esm.js
CHANGED
|
@@ -8980,8 +8980,9 @@ class PagarmeV5BankSlipAxiosAdapter {
|
|
|
8980
8980
|
data: payload,
|
|
8981
8981
|
});
|
|
8982
8982
|
console.warn('[PAGARME RESPONSE BOLETO DATA]', JSON.stringify(data));
|
|
8983
|
-
if (data.
|
|
8984
|
-
data.charges.at(0).status
|
|
8983
|
+
if (data.status == PagarMeV5OrderStatus.Falha ||
|
|
8984
|
+
data.charges.at(0).status === PagarMeV5OrderStatus.Falha ||
|
|
8985
|
+
data.charges.at(0).last_transaction.status !== PagarMeV5PaymentStatus.Gerado) {
|
|
8985
8986
|
return Promise.reject(new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
|
|
8986
8987
|
// checkoutId: checkout.id,
|
|
8987
8988
|
// userEmail: checkout.user.email,
|
|
@@ -9018,22 +9019,21 @@ class PagarmeV5BankSlipAxiosAdapter {
|
|
|
9018
9019
|
data: payload,
|
|
9019
9020
|
});
|
|
9020
9021
|
console.warn('[PAGARME RESPONSE BOLETO DATA]', JSON.stringify(data));
|
|
9021
|
-
if (data.
|
|
9022
|
-
data.charges.at(0).status
|
|
9022
|
+
if (data.status == PagarMeV5OrderStatus.Falha ||
|
|
9023
|
+
data.charges.at(0).status === PagarMeV5OrderStatus.Falha ||
|
|
9024
|
+
data.charges.at(0).last_transaction.status !== PagarMeV5PaymentStatus.Gerado) {
|
|
9023
9025
|
return Promise.reject(new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
|
|
9024
9026
|
checkoutId: checkout.id,
|
|
9025
9027
|
userEmail: checkout.user.email,
|
|
9026
|
-
info: data,
|
|
9028
|
+
info: data.charges.at(0).last_transaction?.gateway_response,
|
|
9027
9029
|
}));
|
|
9028
9030
|
}
|
|
9029
|
-
const
|
|
9030
|
-
const payment = await this.paymentRepository.create(paymentData);
|
|
9031
|
+
const payment = await this.paymentRepository.create(PagarMeV5ResponseHelper.build(checkout, data));
|
|
9031
9032
|
return payment;
|
|
9032
9033
|
}
|
|
9033
9034
|
catch (error) {
|
|
9034
9035
|
console.error('Full error: ', JSON.stringify(error));
|
|
9035
9036
|
if (error instanceof AxiosError) {
|
|
9036
|
-
console.error('Error: ', error.message);
|
|
9037
9037
|
console.error('Error response: ', error.response, 'error data: ', error.response?.data);
|
|
9038
9038
|
}
|
|
9039
9039
|
throw new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
|
|
@@ -9087,8 +9087,9 @@ class PagarmeV5CardAxiosAdapter {
|
|
|
9087
9087
|
data: payload,
|
|
9088
9088
|
});
|
|
9089
9089
|
console.warn('[RESPONSE PAGARME CARD DATA]', JSON.stringify(data));
|
|
9090
|
-
if (data.
|
|
9091
|
-
data.charges.at(0).status !== PagarMeV5PaymentStatus.
|
|
9090
|
+
if (data.status == PagarMeV5OrderStatus.Falha ||
|
|
9091
|
+
data.charges.at(0).last_transaction.status !== PagarMeV5PaymentStatus.Pago ||
|
|
9092
|
+
data.charges.at(0).last_transaction.status !== PagarMeV5PaymentStatus.Capturada) {
|
|
9092
9093
|
await PagarmeBlockedOrderHelper.createBlockedOrderForUnauthorizedCard({
|
|
9093
9094
|
checkout,
|
|
9094
9095
|
card,
|
|
@@ -9096,8 +9097,7 @@ class PagarmeV5CardAxiosAdapter {
|
|
|
9096
9097
|
});
|
|
9097
9098
|
throw PagarmeBlockedOrderHelper.createPaymentError(checkout, data);
|
|
9098
9099
|
}
|
|
9099
|
-
const
|
|
9100
|
-
const payment = await this.paymentRepository.create(paymentData);
|
|
9100
|
+
const payment = await this.paymentRepository.create(PagarMeV5ResponseHelper.build(checkout, data));
|
|
9101
9101
|
return payment;
|
|
9102
9102
|
}
|
|
9103
9103
|
catch (error) {
|
|
@@ -9106,7 +9106,6 @@ class PagarmeV5CardAxiosAdapter {
|
|
|
9106
9106
|
}
|
|
9107
9107
|
console.error('Full error: ', JSON.stringify(error));
|
|
9108
9108
|
if (error instanceof AxiosError) {
|
|
9109
|
-
console.error('Error: ', error.message);
|
|
9110
9109
|
console.error('Error response: ', error.response, 'error data: ', error.response?.data);
|
|
9111
9110
|
}
|
|
9112
9111
|
throw PagarmeBlockedOrderHelper.createGenericPaymentError(checkout, error.response?.data);
|
|
@@ -9264,8 +9263,14 @@ class PagarmeV5PixAxiosAdapter {
|
|
|
9264
9263
|
data: payload,
|
|
9265
9264
|
});
|
|
9266
9265
|
console.warn('[RESPONSE PAGARME PIX DATA]', JSON.stringify(data));
|
|
9267
|
-
|
|
9268
|
-
|
|
9266
|
+
if (data.status == PagarMeV5OrderStatus.Falha || data.status == PagarMeV5OrderStatus.Cancelado) {
|
|
9267
|
+
throw new PaymentError('Houve uma falha ao processar pagamento com pix', {
|
|
9268
|
+
checkoutId: checkout.id,
|
|
9269
|
+
userEmail: checkout.user.email,
|
|
9270
|
+
info: data.charges.at(0).last_transaction?.gateway_response,
|
|
9271
|
+
});
|
|
9272
|
+
}
|
|
9273
|
+
const payment = await this.paymentRepository.create(PagarMeV5ResponseHelper.build(checkout, data));
|
|
9269
9274
|
return payment;
|
|
9270
9275
|
}
|
|
9271
9276
|
catch (error) {
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PagarMeV5OrderStatus
|
|
1
|
+
import { PagarMeV5OrderStatus } from '../../../../domain';
|
|
2
2
|
export type PagarMeV5Response = {
|
|
3
3
|
id: string;
|
|
4
4
|
code: string;
|
|
@@ -41,7 +41,7 @@ export type PagarMeV5Charger = {
|
|
|
41
41
|
code: string;
|
|
42
42
|
gateway_id: string;
|
|
43
43
|
amount: number;
|
|
44
|
-
status:
|
|
44
|
+
status: PagarMeV5OrderStatus;
|
|
45
45
|
currency: string;
|
|
46
46
|
payment_method: string;
|
|
47
47
|
paid_amount: number;
|
|
@@ -103,7 +103,7 @@ export type PagarMeV5Transaction = {
|
|
|
103
103
|
type: string;
|
|
104
104
|
created_at: string;
|
|
105
105
|
updated_at: string;
|
|
106
|
-
billing_address
|
|
106
|
+
billing_address?: {
|
|
107
107
|
zip_code: string;
|
|
108
108
|
city: string;
|
|
109
109
|
state: string;
|
|
@@ -112,10 +112,10 @@ export type PagarMeV5Transaction = {
|
|
|
112
112
|
};
|
|
113
113
|
};
|
|
114
114
|
gateway_response?: {
|
|
115
|
-
code:
|
|
116
|
-
errors
|
|
115
|
+
code: string;
|
|
116
|
+
errors?: [
|
|
117
117
|
{
|
|
118
|
-
message
|
|
118
|
+
message?: string;
|
|
119
119
|
}
|
|
120
120
|
];
|
|
121
121
|
};
|