@infrab4a/connect 5.1.0-beta.1 → 5.1.0-beta.11
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 +102 -116
- package/index.esm.js +103 -117
- package/package.json +1 -1
- package/src/domain/shopping/enums/index.d.ts +1 -0
- package/src/domain/shopping/enums/transaction-payment-methods.enum.d.ts +5 -0
- package/src/domain/shopping/interfaces/payment-provider-card.interface.d.ts +3 -1
- package/src/domain/shopping/models/payment-transaction.d.ts +3 -2
- package/src/domain/shopping/models/payment.d.ts +1 -1
- package/src/domain/shopping/types/pagarme-credentials.type.d.ts +9 -3
- package/src/infra/pagarme/adapters/helpers/pagarme-v5-request.helper.d.ts +1 -1
- package/src/infra/pagarme/adapters/helpers/pagarme-v5-response.helper.d.ts +3 -2
- package/src/infra/pagarme/adapters/v4/pagarme-card-payment-axios.adapter.d.ts +2 -1
- package/src/infra/pagarme/adapters/v5/pagarmev5-card-payment-axios.adapter.d.ts +4 -2
- package/src/infra/pagarme/types/v5/pagarmev5-order-request-payload.type.d.ts +32 -28
- package/src/infra/pagarme/types/v5/pagarmev5-order-response.type.d.ts +6 -6
package/index.cjs.js
CHANGED
|
@@ -115,6 +115,13 @@ exports.PaymentProviders = void 0;
|
|
|
115
115
|
PaymentProviders["GLAMPOINTS"] = "glampoints";
|
|
116
116
|
})(exports.PaymentProviders || (exports.PaymentProviders = {}));
|
|
117
117
|
|
|
118
|
+
exports.TransactionPaymentMethods = void 0;
|
|
119
|
+
(function (TransactionPaymentMethods) {
|
|
120
|
+
TransactionPaymentMethods["CARD"] = "credit_card";
|
|
121
|
+
TransactionPaymentMethods["BANKSLIP"] = "boleto";
|
|
122
|
+
TransactionPaymentMethods["PIX"] = "pix";
|
|
123
|
+
})(exports.TransactionPaymentMethods || (exports.TransactionPaymentMethods = {}));
|
|
124
|
+
|
|
118
125
|
class BasePaymentMethodFactory {
|
|
119
126
|
constructor(methods) {
|
|
120
127
|
this.methods = methods;
|
|
@@ -8588,20 +8595,23 @@ class PagarmePaymentOperationsHelper {
|
|
|
8588
8595
|
}
|
|
8589
8596
|
|
|
8590
8597
|
class PagarMeV5RequestHelper {
|
|
8591
|
-
static build(checkout,
|
|
8598
|
+
static build(checkout, method, card) {
|
|
8592
8599
|
return {
|
|
8593
8600
|
items: this.buildItems(checkout),
|
|
8594
8601
|
customer: this.buildCustomer(checkout),
|
|
8595
8602
|
shipping: this.buildShipping(checkout),
|
|
8596
|
-
payments: this.buildPayment(checkout,
|
|
8603
|
+
payments: this.buildPayment(checkout, method, card),
|
|
8597
8604
|
};
|
|
8598
8605
|
}
|
|
8599
8606
|
static buildItems(checkout) {
|
|
8600
|
-
return checkout.lineItems
|
|
8607
|
+
return checkout.lineItems
|
|
8608
|
+
.filter((item) => !item.isGift)
|
|
8609
|
+
.map((item) => {
|
|
8601
8610
|
return {
|
|
8602
8611
|
amount: Math.floor(item.pricePaid * 100),
|
|
8603
8612
|
description: item.name,
|
|
8604
8613
|
quantity: item.quantity,
|
|
8614
|
+
code: item.EAN,
|
|
8605
8615
|
};
|
|
8606
8616
|
});
|
|
8607
8617
|
}
|
|
@@ -8612,10 +8622,15 @@ class PagarMeV5RequestHelper {
|
|
|
8612
8622
|
type: 'individual',
|
|
8613
8623
|
document: checkout.user.cpf,
|
|
8614
8624
|
phones: {
|
|
8625
|
+
home_phone: {
|
|
8626
|
+
country_code: '55',
|
|
8627
|
+
number: checkout.user.phone.slice(2),
|
|
8628
|
+
area_code: checkout.user.phone.slice(0, 2),
|
|
8629
|
+
},
|
|
8615
8630
|
mobile_phone: {
|
|
8616
8631
|
country_code: '55',
|
|
8617
8632
|
number: checkout.user.phone.slice(2),
|
|
8618
|
-
area_code: checkout.user.phone.slice(0,
|
|
8633
|
+
area_code: checkout.user.phone.slice(0, 2),
|
|
8619
8634
|
},
|
|
8620
8635
|
},
|
|
8621
8636
|
address: {
|
|
@@ -8624,14 +8639,14 @@ class PagarMeV5RequestHelper {
|
|
|
8624
8639
|
zip_code: checkout.shippingAddress.zip,
|
|
8625
8640
|
city: checkout.billingAddress.city,
|
|
8626
8641
|
state: checkout.billingAddress.state,
|
|
8627
|
-
country:
|
|
8642
|
+
country: 'BR',
|
|
8628
8643
|
},
|
|
8629
8644
|
};
|
|
8630
8645
|
}
|
|
8631
8646
|
static buildShipping(checkout) {
|
|
8632
8647
|
return {
|
|
8633
|
-
amount: checkout.shipping.ShippingPrice,
|
|
8634
|
-
description:
|
|
8648
|
+
amount: Math.floor(checkout.shipping.ShippingPrice * 100),
|
|
8649
|
+
description: `${checkout.shipping.ShippingCompanyName} - ${checkout.shipping.description}`,
|
|
8635
8650
|
recipient_name: checkout.shippingAddress.recipient,
|
|
8636
8651
|
recipient_phone: checkout.user.phone,
|
|
8637
8652
|
address: {
|
|
@@ -8640,22 +8655,22 @@ class PagarMeV5RequestHelper {
|
|
|
8640
8655
|
zip_code: checkout.shippingAddress.zip,
|
|
8641
8656
|
city: checkout.shippingAddress.city,
|
|
8642
8657
|
state: checkout.shippingAddress.state,
|
|
8643
|
-
country:
|
|
8658
|
+
country: 'BR',
|
|
8644
8659
|
},
|
|
8645
8660
|
};
|
|
8646
8661
|
}
|
|
8647
|
-
static buildPayment(checkout,
|
|
8662
|
+
static buildPayment(checkout, method, card) {
|
|
8648
8663
|
return [
|
|
8649
8664
|
{
|
|
8650
|
-
payment_method:
|
|
8665
|
+
payment_method: method,
|
|
8651
8666
|
amount: Math.floor(checkout.totalPrice * 100),
|
|
8652
|
-
...(
|
|
8667
|
+
...(method === 'pix' && {
|
|
8653
8668
|
pix: this.getPixOrder(),
|
|
8654
8669
|
}),
|
|
8655
|
-
...(
|
|
8670
|
+
...(method === 'boleto' && {
|
|
8656
8671
|
boleto: this.getBoletoOrder(),
|
|
8657
8672
|
}),
|
|
8658
|
-
...(
|
|
8673
|
+
...(method === 'credit_card' && {
|
|
8659
8674
|
credit_card: this.getCardOrder(checkout, card),
|
|
8660
8675
|
}),
|
|
8661
8676
|
},
|
|
@@ -8681,13 +8696,20 @@ class PagarMeV5RequestHelper {
|
|
|
8681
8696
|
card_id: card.cardId,
|
|
8682
8697
|
card: {
|
|
8683
8698
|
cvv: card.cardCvv,
|
|
8699
|
+
billing_address: {
|
|
8700
|
+
line_1: `${checkout.billingAddress.number}, ${checkout.billingAddress.street}, ${checkout.billingAddress.district}`,
|
|
8701
|
+
zip_code: checkout.billingAddress.zip,
|
|
8702
|
+
city: checkout.billingAddress.city,
|
|
8703
|
+
state: checkout.billingAddress.state,
|
|
8704
|
+
country: 'BR',
|
|
8705
|
+
},
|
|
8684
8706
|
},
|
|
8685
8707
|
};
|
|
8686
8708
|
}
|
|
8687
8709
|
}
|
|
8688
8710
|
|
|
8689
8711
|
class PagarMeV5ResponseHelper {
|
|
8690
|
-
static build(checkout, response) {
|
|
8712
|
+
static build(method, checkout, response) {
|
|
8691
8713
|
return Payment.toInstance({
|
|
8692
8714
|
createdAt: new Date(),
|
|
8693
8715
|
updatedAt: new Date(),
|
|
@@ -8696,10 +8718,10 @@ class PagarMeV5ResponseHelper {
|
|
|
8696
8718
|
totalPrice: checkout.totalPrice,
|
|
8697
8719
|
paymentProvider: exports.PaymentProviders.PAGARME,
|
|
8698
8720
|
pagarMeOrderId: response.id,
|
|
8699
|
-
transaction: this.buildPaymentTransaction(response),
|
|
8721
|
+
transaction: this.buildPaymentTransaction(method, response),
|
|
8700
8722
|
});
|
|
8701
8723
|
}
|
|
8702
|
-
static buildPaymentTransaction(response) {
|
|
8724
|
+
static buildPaymentTransaction(method, response) {
|
|
8703
8725
|
const charger = response.charges.at(0);
|
|
8704
8726
|
const transaction = charger.last_transaction;
|
|
8705
8727
|
return PaymentTransaction.toInstance({
|
|
@@ -8707,20 +8729,28 @@ class PagarMeV5ResponseHelper {
|
|
|
8707
8729
|
amount: charger.amount,
|
|
8708
8730
|
currency: charger.currency,
|
|
8709
8731
|
gateway_id: charger.gateway_id,
|
|
8710
|
-
status:
|
|
8732
|
+
status: this.getPaymentStatus(transaction.status),
|
|
8711
8733
|
payment_method: charger.payment_method,
|
|
8712
8734
|
date_created: charger.created_at,
|
|
8713
8735
|
date_updated: charger.updated_at,
|
|
8714
8736
|
paid_amount: charger.paid_amount,
|
|
8715
8737
|
paid_at: charger.paid_at,
|
|
8716
8738
|
order_id: response.id,
|
|
8717
|
-
|
|
8718
|
-
|
|
8719
|
-
|
|
8720
|
-
...this.
|
|
8721
|
-
...this.
|
|
8739
|
+
charger_id: charger.id,
|
|
8740
|
+
tid: charger.id,
|
|
8741
|
+
id: charger.id,
|
|
8742
|
+
...(method == exports.TransactionPaymentMethods.BANKSLIP && this.getBoletoReponse(transaction)),
|
|
8743
|
+
...(method == exports.TransactionPaymentMethods.PIX && this.getPixReponse(transaction)),
|
|
8744
|
+
...(method == exports.TransactionPaymentMethods.CARD && this.getCardReponse(transaction)),
|
|
8722
8745
|
});
|
|
8723
8746
|
}
|
|
8747
|
+
static getPaymentStatus(status) {
|
|
8748
|
+
if (status == exports.PagarMeV5PaymentStatus.Gerado)
|
|
8749
|
+
return exports.PagarMeV5PaymentStatus['Aguardando pagamento'];
|
|
8750
|
+
if (status == exports.PagarMeV5PaymentStatus.Capturada)
|
|
8751
|
+
return exports.PagarMeV5PaymentStatus.Pago;
|
|
8752
|
+
return status;
|
|
8753
|
+
}
|
|
8724
8754
|
static getBoletoReponse(transaction) {
|
|
8725
8755
|
return {
|
|
8726
8756
|
boleto_url: transaction.url?.toString(),
|
|
@@ -8750,11 +8780,11 @@ class PagarMeV5ResponseHelper {
|
|
|
8750
8780
|
acquirer_message: transaction.acquirer_message?.toString(),
|
|
8751
8781
|
acquirer_return_code: transaction.acquirer_return_code?.toString(),
|
|
8752
8782
|
installments: transaction.installments ?? null,
|
|
8753
|
-
card_holder_name: transaction.card
|
|
8754
|
-
card_last_digits: transaction.card
|
|
8755
|
-
card_first_digits: transaction.card
|
|
8756
|
-
card_brand: transaction.card
|
|
8757
|
-
card_id: transaction.card
|
|
8783
|
+
card_holder_name: transaction.card?.holder_name?.toString(),
|
|
8784
|
+
card_last_digits: transaction.card?.last_four_digits?.toString(),
|
|
8785
|
+
card_first_digits: transaction.card?.first_six_digits?.toString(),
|
|
8786
|
+
card_brand: transaction.card?.brand?.toString(),
|
|
8787
|
+
card_id: transaction.card?.id?.toString(),
|
|
8758
8788
|
};
|
|
8759
8789
|
}
|
|
8760
8790
|
}
|
|
@@ -8815,8 +8845,9 @@ class PagarmeCardAxiosAdapter {
|
|
|
8815
8845
|
});
|
|
8816
8846
|
}
|
|
8817
8847
|
}
|
|
8818
|
-
async createCardHash(bu) {
|
|
8819
|
-
const
|
|
8848
|
+
async createCardHash(bu, shop) {
|
|
8849
|
+
const credentials = shop && shop == exports.Shops.MENSMARKET ? this.credentials[exports.Shops.MENSMARKET] : this.credentials[exports.Shops.GLAMSHOP];
|
|
8850
|
+
const key = bu === exports.BusinessUnitEnum.SHOP ? credentials.SHOP_API_KEY : credentials.SUBSCRIPTION_API_KEY;
|
|
8820
8851
|
try {
|
|
8821
8852
|
const { data } = await axios__default["default"]({
|
|
8822
8853
|
method: 'GET',
|
|
@@ -8998,26 +9029,28 @@ class PagarmeV5BankSlipAxiosAdapter {
|
|
|
8998
9029
|
data: payload,
|
|
8999
9030
|
});
|
|
9000
9031
|
console.warn('[PAGARME RESPONSE BOLETO DATA]', JSON.stringify(data));
|
|
9001
|
-
if (data.
|
|
9002
|
-
data.charges.at(0).status
|
|
9032
|
+
if (data.status === exports.PagarMeV5OrderStatus.Falha ||
|
|
9033
|
+
data.charges.at(0).status === exports.PagarMeV5OrderStatus.Falha ||
|
|
9034
|
+
(data.charges.at(0).last_transaction.status !== exports.PagarMeV5PaymentStatus.Gerado &&
|
|
9035
|
+
data.charges.at(0).last_transaction.status !== exports.PagarMeV5PaymentStatus['Em processamento'])) {
|
|
9003
9036
|
return Promise.reject(new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
|
|
9004
9037
|
checkoutId: checkout.id,
|
|
9005
9038
|
userEmail: checkout.user.email,
|
|
9006
|
-
info: data,
|
|
9039
|
+
info: data.charges.at(0).last_transaction?.gateway_response,
|
|
9007
9040
|
}));
|
|
9008
9041
|
}
|
|
9009
|
-
const
|
|
9010
|
-
const payment = await this.paymentRepository.create(paymentData);
|
|
9042
|
+
const payment = await this.paymentRepository.create(PagarMeV5ResponseHelper.build(exports.TransactionPaymentMethods.BANKSLIP, checkout, data));
|
|
9011
9043
|
return payment;
|
|
9012
9044
|
}
|
|
9013
9045
|
catch (error) {
|
|
9014
|
-
console.
|
|
9015
|
-
|
|
9016
|
-
|
|
9046
|
+
console.error('Full error: ', JSON.stringify(error));
|
|
9047
|
+
if (error instanceof axios.AxiosError) {
|
|
9048
|
+
console.error('Error response: ', error.response, 'error data: ', error.response?.data);
|
|
9049
|
+
}
|
|
9017
9050
|
throw new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
|
|
9018
9051
|
checkoutId: checkout.id,
|
|
9019
9052
|
userEmail: checkout.user.email,
|
|
9020
|
-
info: error.response
|
|
9053
|
+
info: error.response?.data,
|
|
9021
9054
|
});
|
|
9022
9055
|
}
|
|
9023
9056
|
}
|
|
@@ -9032,7 +9065,7 @@ class PagarmeV5BankSlipAxiosAdapter {
|
|
|
9032
9065
|
},
|
|
9033
9066
|
});
|
|
9034
9067
|
const payment = await this.paymentRepository.get({
|
|
9035
|
-
id:
|
|
9068
|
+
id: data.id,
|
|
9036
9069
|
});
|
|
9037
9070
|
return payment.transaction;
|
|
9038
9071
|
}
|
|
@@ -9065,8 +9098,9 @@ class PagarmeV5CardAxiosAdapter {
|
|
|
9065
9098
|
data: payload,
|
|
9066
9099
|
});
|
|
9067
9100
|
console.warn('[RESPONSE PAGARME CARD DATA]', JSON.stringify(data));
|
|
9068
|
-
if (data.
|
|
9069
|
-
data.charges.at(0).status !== exports.
|
|
9101
|
+
if (data.status == exports.PagarMeV5OrderStatus.Falha ||
|
|
9102
|
+
data.charges.at(0).status !== exports.PagarMeV5OrderStatus.Pago ||
|
|
9103
|
+
data.charges.at(0).last_transaction.status !== exports.PagarMeV5PaymentStatus.Capturada) {
|
|
9070
9104
|
await PagarmeBlockedOrderHelper.createBlockedOrderForUnauthorizedCard({
|
|
9071
9105
|
checkout,
|
|
9072
9106
|
card,
|
|
@@ -9074,63 +9108,26 @@ class PagarmeV5CardAxiosAdapter {
|
|
|
9074
9108
|
});
|
|
9075
9109
|
throw PagarmeBlockedOrderHelper.createPaymentError(checkout, data);
|
|
9076
9110
|
}
|
|
9077
|
-
const
|
|
9078
|
-
const payment = await this.paymentRepository.create(paymentData);
|
|
9111
|
+
const payment = await this.paymentRepository.create(PagarMeV5ResponseHelper.build(exports.TransactionPaymentMethods.CARD, checkout, data));
|
|
9079
9112
|
return payment;
|
|
9080
9113
|
}
|
|
9081
9114
|
catch (error) {
|
|
9082
9115
|
if (error instanceof PaymentError) {
|
|
9083
9116
|
throw error;
|
|
9084
9117
|
}
|
|
9085
|
-
console.
|
|
9086
|
-
|
|
9087
|
-
|
|
9118
|
+
console.error('Full error: ', JSON.stringify(error));
|
|
9119
|
+
if (error instanceof axios.AxiosError) {
|
|
9120
|
+
console.error('Error response: ', error.response, 'error data: ', error.response?.data);
|
|
9121
|
+
}
|
|
9088
9122
|
throw PagarmeBlockedOrderHelper.createGenericPaymentError(checkout, error.response?.data);
|
|
9089
9123
|
}
|
|
9090
9124
|
}
|
|
9091
|
-
// Dúvidas: preciso criar um cliente? como faz na mens?
|
|
9092
9125
|
async addCard(card) {
|
|
9093
|
-
|
|
9094
|
-
const { data } = await axios__default["default"]({
|
|
9095
|
-
method: 'POST',
|
|
9096
|
-
url: `${this.credentials.URL}/cards`,
|
|
9097
|
-
data: {
|
|
9098
|
-
api_key: this.credentials.API_KEY,
|
|
9099
|
-
card_number: card.number,
|
|
9100
|
-
card_expiration_date: card.expirationDate.replace('/', ''),
|
|
9101
|
-
card_holder_name: card.name,
|
|
9102
|
-
card_cvv: card.cvv,
|
|
9103
|
-
// number: '4000000000000010',
|
|
9104
|
-
// holder_name: 'Tony Stark',
|
|
9105
|
-
// holder_document: '93095135270',
|
|
9106
|
-
// exp_month: 1,
|
|
9107
|
-
// exp_year: 30,
|
|
9108
|
-
// cvv: '351',
|
|
9109
|
-
// brand: 'Mastercard',
|
|
9110
|
-
// label: 'Sua bandeira',
|
|
9111
|
-
// billing_address: {
|
|
9112
|
-
// line_1: '375, Av. General Osorio, Centro',
|
|
9113
|
-
// line_2: '7º Andar',
|
|
9114
|
-
// zip_code: '220000111',
|
|
9115
|
-
// city: 'Rio de Janeiro',
|
|
9116
|
-
// state: 'RJ',
|
|
9117
|
-
// country: 'BR',
|
|
9118
|
-
// },
|
|
9119
|
-
// options: {
|
|
9120
|
-
// verify_card: true,
|
|
9121
|
-
// },
|
|
9122
|
-
},
|
|
9123
|
-
});
|
|
9124
|
-
return data;
|
|
9125
|
-
}
|
|
9126
|
-
catch (error) {
|
|
9127
|
-
throw new BusinessError('Houve uma falha adicionar o cartão', {
|
|
9128
|
-
info: error.response.data,
|
|
9129
|
-
});
|
|
9130
|
-
}
|
|
9126
|
+
return;
|
|
9131
9127
|
}
|
|
9132
|
-
async createCardHash(bu) {
|
|
9133
|
-
const
|
|
9128
|
+
async createCardHash(bu, shop) {
|
|
9129
|
+
const credentials = shop && shop == exports.Shops.MENSMARKET ? this.credentials[exports.Shops.MENSMARKET] : this.credentials[exports.Shops.GLAMSHOP];
|
|
9130
|
+
const key = bu === exports.BusinessUnitEnum.SHOP ? credentials.SHOP_API_KEY : credentials.SUBSCRIPTION_API_KEY;
|
|
9134
9131
|
try {
|
|
9135
9132
|
const { data } = await axios__default["default"]({
|
|
9136
9133
|
method: 'GET',
|
|
@@ -9150,11 +9147,11 @@ class PagarmeV5CardAxiosAdapter {
|
|
|
9150
9147
|
});
|
|
9151
9148
|
}
|
|
9152
9149
|
}
|
|
9153
|
-
async getCardByToken(
|
|
9150
|
+
async getCardByToken(customerId, token) {
|
|
9154
9151
|
try {
|
|
9155
9152
|
const { data } = await axios__default["default"]({
|
|
9156
|
-
method: '
|
|
9157
|
-
url: `${this.credentials.URL}/cards/${
|
|
9153
|
+
method: 'GET',
|
|
9154
|
+
url: `${this.credentials.URL}/cards/${token}`,
|
|
9158
9155
|
data: {
|
|
9159
9156
|
api_key: this.credentials.API_KEY,
|
|
9160
9157
|
},
|
|
@@ -9162,32 +9159,13 @@ class PagarmeV5CardAxiosAdapter {
|
|
|
9162
9159
|
return data;
|
|
9163
9160
|
}
|
|
9164
9161
|
catch (error) {
|
|
9165
|
-
throw new BusinessError('Houve uma falha buscar o cartão com id: ' +
|
|
9162
|
+
throw new BusinessError('Houve uma falha buscar o cartão com id: ' + token, {
|
|
9166
9163
|
info: error.response.data,
|
|
9167
9164
|
});
|
|
9168
9165
|
}
|
|
9169
9166
|
}
|
|
9170
9167
|
async createTransaction(info) {
|
|
9171
|
-
|
|
9172
|
-
const { data } = await axios__default["default"]({
|
|
9173
|
-
method: 'POST',
|
|
9174
|
-
url: `${this.credentials.URL}/transactions`,
|
|
9175
|
-
headers: {
|
|
9176
|
-
Authorization: 'Basic ' + Buffer.from(this.credentials.API_KEY).toString('base64'),
|
|
9177
|
-
'Content-Type': 'application/json',
|
|
9178
|
-
},
|
|
9179
|
-
data: {
|
|
9180
|
-
...info,
|
|
9181
|
-
api_key: this.credentials.API_KEY,
|
|
9182
|
-
},
|
|
9183
|
-
});
|
|
9184
|
-
return data;
|
|
9185
|
-
}
|
|
9186
|
-
catch (error) {
|
|
9187
|
-
throw new BusinessError('Houve uma falha ao criar a transação', {
|
|
9188
|
-
info: error.response.data,
|
|
9189
|
-
});
|
|
9190
|
-
}
|
|
9168
|
+
return;
|
|
9191
9169
|
}
|
|
9192
9170
|
}
|
|
9193
9171
|
|
|
@@ -9210,14 +9188,22 @@ class PagarmeV5PixAxiosAdapter {
|
|
|
9210
9188
|
data: payload,
|
|
9211
9189
|
});
|
|
9212
9190
|
console.warn('[RESPONSE PAGARME PIX DATA]', JSON.stringify(data));
|
|
9213
|
-
|
|
9214
|
-
|
|
9191
|
+
if (data.status == exports.PagarMeV5OrderStatus.Falha || data.status == exports.PagarMeV5OrderStatus.Cancelado) {
|
|
9192
|
+
throw new PaymentError('Houve uma falha ao processar pagamento com pix', {
|
|
9193
|
+
checkoutId: checkout.id,
|
|
9194
|
+
userEmail: checkout.user.email,
|
|
9195
|
+
info: data.charges.at(0).last_transaction?.gateway_response,
|
|
9196
|
+
});
|
|
9197
|
+
}
|
|
9198
|
+
const payment = await this.paymentRepository.create(PagarMeV5ResponseHelper.build(exports.TransactionPaymentMethods.PIX, checkout, data));
|
|
9215
9199
|
return payment;
|
|
9216
9200
|
}
|
|
9217
9201
|
catch (error) {
|
|
9218
|
-
console.
|
|
9219
|
-
|
|
9220
|
-
|
|
9202
|
+
console.error('Full error: ', JSON.stringify(error));
|
|
9203
|
+
if (error instanceof axios.AxiosError) {
|
|
9204
|
+
console.error('Error: ', error.message);
|
|
9205
|
+
console.error('Error response: ', error.response, 'error data: ', error.response?.data);
|
|
9206
|
+
}
|
|
9221
9207
|
throw new PaymentError('Houve uma falha ao processar pagamento com pix', {
|
|
9222
9208
|
checkoutId: checkout.id,
|
|
9223
9209
|
userEmail: checkout.user.email,
|
package/index.esm.js
CHANGED
|
@@ -90,6 +90,13 @@ var PaymentProviders;
|
|
|
90
90
|
PaymentProviders["GLAMPOINTS"] = "glampoints";
|
|
91
91
|
})(PaymentProviders || (PaymentProviders = {}));
|
|
92
92
|
|
|
93
|
+
var TransactionPaymentMethods;
|
|
94
|
+
(function (TransactionPaymentMethods) {
|
|
95
|
+
TransactionPaymentMethods["CARD"] = "credit_card";
|
|
96
|
+
TransactionPaymentMethods["BANKSLIP"] = "boleto";
|
|
97
|
+
TransactionPaymentMethods["PIX"] = "pix";
|
|
98
|
+
})(TransactionPaymentMethods || (TransactionPaymentMethods = {}));
|
|
99
|
+
|
|
93
100
|
class BasePaymentMethodFactory {
|
|
94
101
|
constructor(methods) {
|
|
95
102
|
this.methods = methods;
|
|
@@ -8563,20 +8570,23 @@ class PagarmePaymentOperationsHelper {
|
|
|
8563
8570
|
}
|
|
8564
8571
|
|
|
8565
8572
|
class PagarMeV5RequestHelper {
|
|
8566
|
-
static build(checkout,
|
|
8573
|
+
static build(checkout, method, card) {
|
|
8567
8574
|
return {
|
|
8568
8575
|
items: this.buildItems(checkout),
|
|
8569
8576
|
customer: this.buildCustomer(checkout),
|
|
8570
8577
|
shipping: this.buildShipping(checkout),
|
|
8571
|
-
payments: this.buildPayment(checkout,
|
|
8578
|
+
payments: this.buildPayment(checkout, method, card),
|
|
8572
8579
|
};
|
|
8573
8580
|
}
|
|
8574
8581
|
static buildItems(checkout) {
|
|
8575
|
-
return checkout.lineItems
|
|
8582
|
+
return checkout.lineItems
|
|
8583
|
+
.filter((item) => !item.isGift)
|
|
8584
|
+
.map((item) => {
|
|
8576
8585
|
return {
|
|
8577
8586
|
amount: Math.floor(item.pricePaid * 100),
|
|
8578
8587
|
description: item.name,
|
|
8579
8588
|
quantity: item.quantity,
|
|
8589
|
+
code: item.EAN,
|
|
8580
8590
|
};
|
|
8581
8591
|
});
|
|
8582
8592
|
}
|
|
@@ -8587,10 +8597,15 @@ class PagarMeV5RequestHelper {
|
|
|
8587
8597
|
type: 'individual',
|
|
8588
8598
|
document: checkout.user.cpf,
|
|
8589
8599
|
phones: {
|
|
8600
|
+
home_phone: {
|
|
8601
|
+
country_code: '55',
|
|
8602
|
+
number: checkout.user.phone.slice(2),
|
|
8603
|
+
area_code: checkout.user.phone.slice(0, 2),
|
|
8604
|
+
},
|
|
8590
8605
|
mobile_phone: {
|
|
8591
8606
|
country_code: '55',
|
|
8592
8607
|
number: checkout.user.phone.slice(2),
|
|
8593
|
-
area_code: checkout.user.phone.slice(0,
|
|
8608
|
+
area_code: checkout.user.phone.slice(0, 2),
|
|
8594
8609
|
},
|
|
8595
8610
|
},
|
|
8596
8611
|
address: {
|
|
@@ -8599,14 +8614,14 @@ class PagarMeV5RequestHelper {
|
|
|
8599
8614
|
zip_code: checkout.shippingAddress.zip,
|
|
8600
8615
|
city: checkout.billingAddress.city,
|
|
8601
8616
|
state: checkout.billingAddress.state,
|
|
8602
|
-
country:
|
|
8617
|
+
country: 'BR',
|
|
8603
8618
|
},
|
|
8604
8619
|
};
|
|
8605
8620
|
}
|
|
8606
8621
|
static buildShipping(checkout) {
|
|
8607
8622
|
return {
|
|
8608
|
-
amount: checkout.shipping.ShippingPrice,
|
|
8609
|
-
description:
|
|
8623
|
+
amount: Math.floor(checkout.shipping.ShippingPrice * 100),
|
|
8624
|
+
description: `${checkout.shipping.ShippingCompanyName} - ${checkout.shipping.description}`,
|
|
8610
8625
|
recipient_name: checkout.shippingAddress.recipient,
|
|
8611
8626
|
recipient_phone: checkout.user.phone,
|
|
8612
8627
|
address: {
|
|
@@ -8615,22 +8630,22 @@ class PagarMeV5RequestHelper {
|
|
|
8615
8630
|
zip_code: checkout.shippingAddress.zip,
|
|
8616
8631
|
city: checkout.shippingAddress.city,
|
|
8617
8632
|
state: checkout.shippingAddress.state,
|
|
8618
|
-
country:
|
|
8633
|
+
country: 'BR',
|
|
8619
8634
|
},
|
|
8620
8635
|
};
|
|
8621
8636
|
}
|
|
8622
|
-
static buildPayment(checkout,
|
|
8637
|
+
static buildPayment(checkout, method, card) {
|
|
8623
8638
|
return [
|
|
8624
8639
|
{
|
|
8625
|
-
payment_method:
|
|
8640
|
+
payment_method: method,
|
|
8626
8641
|
amount: Math.floor(checkout.totalPrice * 100),
|
|
8627
|
-
...(
|
|
8642
|
+
...(method === 'pix' && {
|
|
8628
8643
|
pix: this.getPixOrder(),
|
|
8629
8644
|
}),
|
|
8630
|
-
...(
|
|
8645
|
+
...(method === 'boleto' && {
|
|
8631
8646
|
boleto: this.getBoletoOrder(),
|
|
8632
8647
|
}),
|
|
8633
|
-
...(
|
|
8648
|
+
...(method === 'credit_card' && {
|
|
8634
8649
|
credit_card: this.getCardOrder(checkout, card),
|
|
8635
8650
|
}),
|
|
8636
8651
|
},
|
|
@@ -8656,13 +8671,20 @@ class PagarMeV5RequestHelper {
|
|
|
8656
8671
|
card_id: card.cardId,
|
|
8657
8672
|
card: {
|
|
8658
8673
|
cvv: card.cardCvv,
|
|
8674
|
+
billing_address: {
|
|
8675
|
+
line_1: `${checkout.billingAddress.number}, ${checkout.billingAddress.street}, ${checkout.billingAddress.district}`,
|
|
8676
|
+
zip_code: checkout.billingAddress.zip,
|
|
8677
|
+
city: checkout.billingAddress.city,
|
|
8678
|
+
state: checkout.billingAddress.state,
|
|
8679
|
+
country: 'BR',
|
|
8680
|
+
},
|
|
8659
8681
|
},
|
|
8660
8682
|
};
|
|
8661
8683
|
}
|
|
8662
8684
|
}
|
|
8663
8685
|
|
|
8664
8686
|
class PagarMeV5ResponseHelper {
|
|
8665
|
-
static build(checkout, response) {
|
|
8687
|
+
static build(method, checkout, response) {
|
|
8666
8688
|
return Payment.toInstance({
|
|
8667
8689
|
createdAt: new Date(),
|
|
8668
8690
|
updatedAt: new Date(),
|
|
@@ -8671,10 +8693,10 @@ class PagarMeV5ResponseHelper {
|
|
|
8671
8693
|
totalPrice: checkout.totalPrice,
|
|
8672
8694
|
paymentProvider: PaymentProviders.PAGARME,
|
|
8673
8695
|
pagarMeOrderId: response.id,
|
|
8674
|
-
transaction: this.buildPaymentTransaction(response),
|
|
8696
|
+
transaction: this.buildPaymentTransaction(method, response),
|
|
8675
8697
|
});
|
|
8676
8698
|
}
|
|
8677
|
-
static buildPaymentTransaction(response) {
|
|
8699
|
+
static buildPaymentTransaction(method, response) {
|
|
8678
8700
|
const charger = response.charges.at(0);
|
|
8679
8701
|
const transaction = charger.last_transaction;
|
|
8680
8702
|
return PaymentTransaction.toInstance({
|
|
@@ -8682,20 +8704,28 @@ class PagarMeV5ResponseHelper {
|
|
|
8682
8704
|
amount: charger.amount,
|
|
8683
8705
|
currency: charger.currency,
|
|
8684
8706
|
gateway_id: charger.gateway_id,
|
|
8685
|
-
status:
|
|
8707
|
+
status: this.getPaymentStatus(transaction.status),
|
|
8686
8708
|
payment_method: charger.payment_method,
|
|
8687
8709
|
date_created: charger.created_at,
|
|
8688
8710
|
date_updated: charger.updated_at,
|
|
8689
8711
|
paid_amount: charger.paid_amount,
|
|
8690
8712
|
paid_at: charger.paid_at,
|
|
8691
8713
|
order_id: response.id,
|
|
8692
|
-
|
|
8693
|
-
|
|
8694
|
-
|
|
8695
|
-
...this.
|
|
8696
|
-
...this.
|
|
8714
|
+
charger_id: charger.id,
|
|
8715
|
+
tid: charger.id,
|
|
8716
|
+
id: charger.id,
|
|
8717
|
+
...(method == TransactionPaymentMethods.BANKSLIP && this.getBoletoReponse(transaction)),
|
|
8718
|
+
...(method == TransactionPaymentMethods.PIX && this.getPixReponse(transaction)),
|
|
8719
|
+
...(method == TransactionPaymentMethods.CARD && this.getCardReponse(transaction)),
|
|
8697
8720
|
});
|
|
8698
8721
|
}
|
|
8722
|
+
static getPaymentStatus(status) {
|
|
8723
|
+
if (status == PagarMeV5PaymentStatus.Gerado)
|
|
8724
|
+
return PagarMeV5PaymentStatus['Aguardando pagamento'];
|
|
8725
|
+
if (status == PagarMeV5PaymentStatus.Capturada)
|
|
8726
|
+
return PagarMeV5PaymentStatus.Pago;
|
|
8727
|
+
return status;
|
|
8728
|
+
}
|
|
8699
8729
|
static getBoletoReponse(transaction) {
|
|
8700
8730
|
return {
|
|
8701
8731
|
boleto_url: transaction.url?.toString(),
|
|
@@ -8725,11 +8755,11 @@ class PagarMeV5ResponseHelper {
|
|
|
8725
8755
|
acquirer_message: transaction.acquirer_message?.toString(),
|
|
8726
8756
|
acquirer_return_code: transaction.acquirer_return_code?.toString(),
|
|
8727
8757
|
installments: transaction.installments ?? null,
|
|
8728
|
-
card_holder_name: transaction.card
|
|
8729
|
-
card_last_digits: transaction.card
|
|
8730
|
-
card_first_digits: transaction.card
|
|
8731
|
-
card_brand: transaction.card
|
|
8732
|
-
card_id: transaction.card
|
|
8758
|
+
card_holder_name: transaction.card?.holder_name?.toString(),
|
|
8759
|
+
card_last_digits: transaction.card?.last_four_digits?.toString(),
|
|
8760
|
+
card_first_digits: transaction.card?.first_six_digits?.toString(),
|
|
8761
|
+
card_brand: transaction.card?.brand?.toString(),
|
|
8762
|
+
card_id: transaction.card?.id?.toString(),
|
|
8733
8763
|
};
|
|
8734
8764
|
}
|
|
8735
8765
|
}
|
|
@@ -8790,8 +8820,9 @@ class PagarmeCardAxiosAdapter {
|
|
|
8790
8820
|
});
|
|
8791
8821
|
}
|
|
8792
8822
|
}
|
|
8793
|
-
async createCardHash(bu) {
|
|
8794
|
-
const
|
|
8823
|
+
async createCardHash(bu, shop) {
|
|
8824
|
+
const credentials = shop && shop == Shops.MENSMARKET ? this.credentials[Shops.MENSMARKET] : this.credentials[Shops.GLAMSHOP];
|
|
8825
|
+
const key = bu === BusinessUnitEnum.SHOP ? credentials.SHOP_API_KEY : credentials.SUBSCRIPTION_API_KEY;
|
|
8795
8826
|
try {
|
|
8796
8827
|
const { data } = await axios({
|
|
8797
8828
|
method: 'GET',
|
|
@@ -8973,26 +9004,28 @@ class PagarmeV5BankSlipAxiosAdapter {
|
|
|
8973
9004
|
data: payload,
|
|
8974
9005
|
});
|
|
8975
9006
|
console.warn('[PAGARME RESPONSE BOLETO DATA]', JSON.stringify(data));
|
|
8976
|
-
if (data.
|
|
8977
|
-
data.charges.at(0).status
|
|
9007
|
+
if (data.status === PagarMeV5OrderStatus.Falha ||
|
|
9008
|
+
data.charges.at(0).status === PagarMeV5OrderStatus.Falha ||
|
|
9009
|
+
(data.charges.at(0).last_transaction.status !== PagarMeV5PaymentStatus.Gerado &&
|
|
9010
|
+
data.charges.at(0).last_transaction.status !== PagarMeV5PaymentStatus['Em processamento'])) {
|
|
8978
9011
|
return Promise.reject(new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
|
|
8979
9012
|
checkoutId: checkout.id,
|
|
8980
9013
|
userEmail: checkout.user.email,
|
|
8981
|
-
info: data,
|
|
9014
|
+
info: data.charges.at(0).last_transaction?.gateway_response,
|
|
8982
9015
|
}));
|
|
8983
9016
|
}
|
|
8984
|
-
const
|
|
8985
|
-
const payment = await this.paymentRepository.create(paymentData);
|
|
9017
|
+
const payment = await this.paymentRepository.create(PagarMeV5ResponseHelper.build(TransactionPaymentMethods.BANKSLIP, checkout, data));
|
|
8986
9018
|
return payment;
|
|
8987
9019
|
}
|
|
8988
9020
|
catch (error) {
|
|
8989
|
-
console.
|
|
8990
|
-
|
|
8991
|
-
|
|
9021
|
+
console.error('Full error: ', JSON.stringify(error));
|
|
9022
|
+
if (error instanceof AxiosError) {
|
|
9023
|
+
console.error('Error response: ', error.response, 'error data: ', error.response?.data);
|
|
9024
|
+
}
|
|
8992
9025
|
throw new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
|
|
8993
9026
|
checkoutId: checkout.id,
|
|
8994
9027
|
userEmail: checkout.user.email,
|
|
8995
|
-
info: error.response
|
|
9028
|
+
info: error.response?.data,
|
|
8996
9029
|
});
|
|
8997
9030
|
}
|
|
8998
9031
|
}
|
|
@@ -9007,7 +9040,7 @@ class PagarmeV5BankSlipAxiosAdapter {
|
|
|
9007
9040
|
},
|
|
9008
9041
|
});
|
|
9009
9042
|
const payment = await this.paymentRepository.get({
|
|
9010
|
-
id:
|
|
9043
|
+
id: data.id,
|
|
9011
9044
|
});
|
|
9012
9045
|
return payment.transaction;
|
|
9013
9046
|
}
|
|
@@ -9040,8 +9073,9 @@ class PagarmeV5CardAxiosAdapter {
|
|
|
9040
9073
|
data: payload,
|
|
9041
9074
|
});
|
|
9042
9075
|
console.warn('[RESPONSE PAGARME CARD DATA]', JSON.stringify(data));
|
|
9043
|
-
if (data.
|
|
9044
|
-
data.charges.at(0).status !==
|
|
9076
|
+
if (data.status == PagarMeV5OrderStatus.Falha ||
|
|
9077
|
+
data.charges.at(0).status !== PagarMeV5OrderStatus.Pago ||
|
|
9078
|
+
data.charges.at(0).last_transaction.status !== PagarMeV5PaymentStatus.Capturada) {
|
|
9045
9079
|
await PagarmeBlockedOrderHelper.createBlockedOrderForUnauthorizedCard({
|
|
9046
9080
|
checkout,
|
|
9047
9081
|
card,
|
|
@@ -9049,63 +9083,26 @@ class PagarmeV5CardAxiosAdapter {
|
|
|
9049
9083
|
});
|
|
9050
9084
|
throw PagarmeBlockedOrderHelper.createPaymentError(checkout, data);
|
|
9051
9085
|
}
|
|
9052
|
-
const
|
|
9053
|
-
const payment = await this.paymentRepository.create(paymentData);
|
|
9086
|
+
const payment = await this.paymentRepository.create(PagarMeV5ResponseHelper.build(TransactionPaymentMethods.CARD, checkout, data));
|
|
9054
9087
|
return payment;
|
|
9055
9088
|
}
|
|
9056
9089
|
catch (error) {
|
|
9057
9090
|
if (error instanceof PaymentError) {
|
|
9058
9091
|
throw error;
|
|
9059
9092
|
}
|
|
9060
|
-
console.
|
|
9061
|
-
|
|
9062
|
-
|
|
9093
|
+
console.error('Full error: ', JSON.stringify(error));
|
|
9094
|
+
if (error instanceof AxiosError) {
|
|
9095
|
+
console.error('Error response: ', error.response, 'error data: ', error.response?.data);
|
|
9096
|
+
}
|
|
9063
9097
|
throw PagarmeBlockedOrderHelper.createGenericPaymentError(checkout, error.response?.data);
|
|
9064
9098
|
}
|
|
9065
9099
|
}
|
|
9066
|
-
// Dúvidas: preciso criar um cliente? como faz na mens?
|
|
9067
9100
|
async addCard(card) {
|
|
9068
|
-
|
|
9069
|
-
const { data } = await axios({
|
|
9070
|
-
method: 'POST',
|
|
9071
|
-
url: `${this.credentials.URL}/cards`,
|
|
9072
|
-
data: {
|
|
9073
|
-
api_key: this.credentials.API_KEY,
|
|
9074
|
-
card_number: card.number,
|
|
9075
|
-
card_expiration_date: card.expirationDate.replace('/', ''),
|
|
9076
|
-
card_holder_name: card.name,
|
|
9077
|
-
card_cvv: card.cvv,
|
|
9078
|
-
// number: '4000000000000010',
|
|
9079
|
-
// holder_name: 'Tony Stark',
|
|
9080
|
-
// holder_document: '93095135270',
|
|
9081
|
-
// exp_month: 1,
|
|
9082
|
-
// exp_year: 30,
|
|
9083
|
-
// cvv: '351',
|
|
9084
|
-
// brand: 'Mastercard',
|
|
9085
|
-
// label: 'Sua bandeira',
|
|
9086
|
-
// billing_address: {
|
|
9087
|
-
// line_1: '375, Av. General Osorio, Centro',
|
|
9088
|
-
// line_2: '7º Andar',
|
|
9089
|
-
// zip_code: '220000111',
|
|
9090
|
-
// city: 'Rio de Janeiro',
|
|
9091
|
-
// state: 'RJ',
|
|
9092
|
-
// country: 'BR',
|
|
9093
|
-
// },
|
|
9094
|
-
// options: {
|
|
9095
|
-
// verify_card: true,
|
|
9096
|
-
// },
|
|
9097
|
-
},
|
|
9098
|
-
});
|
|
9099
|
-
return data;
|
|
9100
|
-
}
|
|
9101
|
-
catch (error) {
|
|
9102
|
-
throw new BusinessError('Houve uma falha adicionar o cartão', {
|
|
9103
|
-
info: error.response.data,
|
|
9104
|
-
});
|
|
9105
|
-
}
|
|
9101
|
+
return;
|
|
9106
9102
|
}
|
|
9107
|
-
async createCardHash(bu) {
|
|
9108
|
-
const
|
|
9103
|
+
async createCardHash(bu, shop) {
|
|
9104
|
+
const credentials = shop && shop == Shops.MENSMARKET ? this.credentials[Shops.MENSMARKET] : this.credentials[Shops.GLAMSHOP];
|
|
9105
|
+
const key = bu === BusinessUnitEnum.SHOP ? credentials.SHOP_API_KEY : credentials.SUBSCRIPTION_API_KEY;
|
|
9109
9106
|
try {
|
|
9110
9107
|
const { data } = await axios({
|
|
9111
9108
|
method: 'GET',
|
|
@@ -9125,11 +9122,11 @@ class PagarmeV5CardAxiosAdapter {
|
|
|
9125
9122
|
});
|
|
9126
9123
|
}
|
|
9127
9124
|
}
|
|
9128
|
-
async getCardByToken(
|
|
9125
|
+
async getCardByToken(customerId, token) {
|
|
9129
9126
|
try {
|
|
9130
9127
|
const { data } = await axios({
|
|
9131
|
-
method: '
|
|
9132
|
-
url: `${this.credentials.URL}/cards/${
|
|
9128
|
+
method: 'GET',
|
|
9129
|
+
url: `${this.credentials.URL}/cards/${token}`,
|
|
9133
9130
|
data: {
|
|
9134
9131
|
api_key: this.credentials.API_KEY,
|
|
9135
9132
|
},
|
|
@@ -9137,32 +9134,13 @@ class PagarmeV5CardAxiosAdapter {
|
|
|
9137
9134
|
return data;
|
|
9138
9135
|
}
|
|
9139
9136
|
catch (error) {
|
|
9140
|
-
throw new BusinessError('Houve uma falha buscar o cartão com id: ' +
|
|
9137
|
+
throw new BusinessError('Houve uma falha buscar o cartão com id: ' + token, {
|
|
9141
9138
|
info: error.response.data,
|
|
9142
9139
|
});
|
|
9143
9140
|
}
|
|
9144
9141
|
}
|
|
9145
9142
|
async createTransaction(info) {
|
|
9146
|
-
|
|
9147
|
-
const { data } = await axios({
|
|
9148
|
-
method: 'POST',
|
|
9149
|
-
url: `${this.credentials.URL}/transactions`,
|
|
9150
|
-
headers: {
|
|
9151
|
-
Authorization: 'Basic ' + Buffer.from(this.credentials.API_KEY).toString('base64'),
|
|
9152
|
-
'Content-Type': 'application/json',
|
|
9153
|
-
},
|
|
9154
|
-
data: {
|
|
9155
|
-
...info,
|
|
9156
|
-
api_key: this.credentials.API_KEY,
|
|
9157
|
-
},
|
|
9158
|
-
});
|
|
9159
|
-
return data;
|
|
9160
|
-
}
|
|
9161
|
-
catch (error) {
|
|
9162
|
-
throw new BusinessError('Houve uma falha ao criar a transação', {
|
|
9163
|
-
info: error.response.data,
|
|
9164
|
-
});
|
|
9165
|
-
}
|
|
9143
|
+
return;
|
|
9166
9144
|
}
|
|
9167
9145
|
}
|
|
9168
9146
|
|
|
@@ -9185,14 +9163,22 @@ class PagarmeV5PixAxiosAdapter {
|
|
|
9185
9163
|
data: payload,
|
|
9186
9164
|
});
|
|
9187
9165
|
console.warn('[RESPONSE PAGARME PIX DATA]', JSON.stringify(data));
|
|
9188
|
-
|
|
9189
|
-
|
|
9166
|
+
if (data.status == PagarMeV5OrderStatus.Falha || data.status == PagarMeV5OrderStatus.Cancelado) {
|
|
9167
|
+
throw new PaymentError('Houve uma falha ao processar pagamento com pix', {
|
|
9168
|
+
checkoutId: checkout.id,
|
|
9169
|
+
userEmail: checkout.user.email,
|
|
9170
|
+
info: data.charges.at(0).last_transaction?.gateway_response,
|
|
9171
|
+
});
|
|
9172
|
+
}
|
|
9173
|
+
const payment = await this.paymentRepository.create(PagarMeV5ResponseHelper.build(TransactionPaymentMethods.PIX, checkout, data));
|
|
9190
9174
|
return payment;
|
|
9191
9175
|
}
|
|
9192
9176
|
catch (error) {
|
|
9193
|
-
console.
|
|
9194
|
-
|
|
9195
|
-
|
|
9177
|
+
console.error('Full error: ', JSON.stringify(error));
|
|
9178
|
+
if (error instanceof AxiosError) {
|
|
9179
|
+
console.error('Error: ', error.message);
|
|
9180
|
+
console.error('Error response: ', error.response, 'error data: ', error.response?.data);
|
|
9181
|
+
}
|
|
9196
9182
|
throw new PaymentError('Houve uma falha ao processar pagamento com pix', {
|
|
9197
9183
|
checkoutId: checkout.id,
|
|
9198
9184
|
userEmail: checkout.user.email,
|
|
@@ -9355,4 +9341,4 @@ class ProductsVertexSearch {
|
|
|
9355
9341
|
}
|
|
9356
9342
|
}
|
|
9357
9343
|
|
|
9358
|
-
export { AccessoryImportances, Address, AdyenCardAxiosAdapter, AdyenPaymentMethodFactory, AntifraudBankSlipService, AntifraudCardService, AntifraudGlampointsService, AntifraudPixService, AntifraudProviderFactory, AntifraudProviders, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, BrandEquityOptions, BusinessError, BusinessUnitEnum, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, CategoryProduct, CategoryProductHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, ConnectBaseDocumentSnapshot, ConnectCollectionService, ConnectDocumentService, ConnectFirestoreService, Coupon, CouponCategories, CouponCategory, CouponChannels, CouponFirestoreRepository, CouponOldCategories, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FirebaseFileUploaderService, FragranceImportances, FraudValidationError, GenderDestination, GlampointsPaymentMethodFactory, GlampointsPaymentService, Group, GroupFirestoreRepository, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, LogDocument, LogFirestoreRepository, Logger, NotFoundError, ObsEmitter, OfficePosition, Order, OrderBlocked, OrderBlockedFirestoreRepository, OrderBlockedType, OrderFirestoreRepository, OrderStatus, PagarMeV5OrderStatus, PagarMeV5PaymentStatus, PagarmeBankSlipAxiosAdapter, PagarmeCardAxiosAdapter, PagarmePaymentMethodFactory, PagarmePaymentStatus, PagarmePixAxiosAdapter, PagarmeV5BankSlipAxiosAdapter, PagarmeV5CardAxiosAdapter, PagarmeV5PixAxiosAdapter, Payment, PaymentError, PaymentFirestoreRepository, PaymentMethods, PaymentProviderFactory, PaymentProviders, PaymentTransaction, PaymentType, PersonTypes, Plans, Product, ProductErrors, ProductErrorsHasuraGraphQL, ProductErrorsHasuraGraphQLRepository, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductLabelEnum, ProductReview, ProductReviewHasuraGraphQLRepository, ProductSpents, ProductStockNotification, ProductStockNotificationHasuraGraphQLRepository, ProductVariantFirestoreRepository, ProductsIndex, ProductsVertexSearch, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RestCacheAdapter, RoundProductPricesHelper, Sequence, SequenceFirestoreRepository, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, StockLimitError, StockOutError, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionMaterialization, SubscriptionMaterializationFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionSummary, SubscriptionSummaryFirestoreRepository, Trace, UnauthorizedError, UpdateOptionActions, UpdateUserImage, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, VertexAxiosAdapter, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, WishlistLogType, deserialize, getClass, is, isDebuggable, isUUID, parseDateTime, registerClass, resolveClass, serialize, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
|
|
9344
|
+
export { AccessoryImportances, Address, AdyenCardAxiosAdapter, AdyenPaymentMethodFactory, AntifraudBankSlipService, AntifraudCardService, AntifraudGlampointsService, AntifraudPixService, AntifraudProviderFactory, AntifraudProviders, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, BrandEquityOptions, BusinessError, BusinessUnitEnum, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, CategoryProduct, CategoryProductHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, ConnectBaseDocumentSnapshot, ConnectCollectionService, ConnectDocumentService, ConnectFirestoreService, Coupon, CouponCategories, CouponCategory, CouponChannels, CouponFirestoreRepository, CouponOldCategories, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FirebaseFileUploaderService, FragranceImportances, FraudValidationError, GenderDestination, GlampointsPaymentMethodFactory, GlampointsPaymentService, Group, GroupFirestoreRepository, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, LogDocument, LogFirestoreRepository, Logger, NotFoundError, ObsEmitter, OfficePosition, Order, OrderBlocked, OrderBlockedFirestoreRepository, OrderBlockedType, OrderFirestoreRepository, OrderStatus, PagarMeV5OrderStatus, PagarMeV5PaymentStatus, PagarmeBankSlipAxiosAdapter, PagarmeCardAxiosAdapter, PagarmePaymentMethodFactory, PagarmePaymentStatus, PagarmePixAxiosAdapter, PagarmeV5BankSlipAxiosAdapter, PagarmeV5CardAxiosAdapter, PagarmeV5PixAxiosAdapter, Payment, PaymentError, PaymentFirestoreRepository, PaymentMethods, PaymentProviderFactory, PaymentProviders, PaymentTransaction, PaymentType, PersonTypes, Plans, Product, ProductErrors, ProductErrorsHasuraGraphQL, ProductErrorsHasuraGraphQLRepository, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductLabelEnum, ProductReview, ProductReviewHasuraGraphQLRepository, ProductSpents, ProductStockNotification, ProductStockNotificationHasuraGraphQLRepository, ProductVariantFirestoreRepository, ProductsIndex, ProductsVertexSearch, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RestCacheAdapter, RoundProductPricesHelper, Sequence, SequenceFirestoreRepository, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, StockLimitError, StockOutError, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionMaterialization, SubscriptionMaterializationFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionSummary, SubscriptionSummaryFirestoreRepository, Trace, TransactionPaymentMethods, UnauthorizedError, UpdateOptionActions, UpdateUserImage, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, VertexAxiosAdapter, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, WishlistLogType, deserialize, getClass, is, isDebuggable, isUUID, parseDateTime, registerClass, resolveClass, serialize, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
|
package/package.json
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Shops } from '../../catalog';
|
|
1
2
|
import { BusinessUnitEnum } from '../enums';
|
|
2
3
|
import { PaymentTransaction } from '../models';
|
|
3
4
|
import { Checkout } from '../models/checkout';
|
|
@@ -8,6 +9,7 @@ export interface PaymentProviderCard<Card extends BaseCard = BaseCard> {
|
|
|
8
9
|
pay(checkout: Checkout, card: PaymentCardInfo): Promise<Payment>;
|
|
9
10
|
addCard(card: CardInfo): Promise<Card>;
|
|
10
11
|
getCardByToken(token: string): Promise<Card>;
|
|
11
|
-
|
|
12
|
+
getCardByToken(customerId: string, token: string): Promise<Card>;
|
|
13
|
+
createCardHash<T>(bu: BusinessUnitEnum, shop: Shops, card?: CardInfo): Promise<string | T>;
|
|
12
14
|
createTransaction(info: any): Promise<PaymentTransaction>;
|
|
13
15
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { BaseModel } from '../../generic/model/base.model';
|
|
2
2
|
import { PaymentBilling, PaymentCard, PaymentCustomer, PaymentItem, PaymentShipping } from './types';
|
|
3
3
|
export declare class PaymentTransaction extends BaseModel<PaymentTransaction> {
|
|
4
|
-
id?:
|
|
4
|
+
id?: string;
|
|
5
5
|
object?: string;
|
|
6
6
|
status?: string;
|
|
7
|
-
tid?:
|
|
7
|
+
tid?: string;
|
|
8
8
|
gateway_id?: string;
|
|
9
9
|
nsu?: number;
|
|
10
10
|
amount: number;
|
|
@@ -72,6 +72,7 @@ export declare class PaymentTransaction extends BaseModel<PaymentTransaction> {
|
|
|
72
72
|
fraudCovered?: boolean;
|
|
73
73
|
fraud_reimbursed?: string;
|
|
74
74
|
order_id?: string;
|
|
75
|
+
charger_id?: string;
|
|
75
76
|
risk_level?: string;
|
|
76
77
|
receipt_url?: string;
|
|
77
78
|
private_label?: string;
|
|
@@ -2,7 +2,7 @@ import { BaseModel, GenericIdentifier } from '../../generic/model/base.model';
|
|
|
2
2
|
import { PaymentProvider } from '../types';
|
|
3
3
|
import { PaymentTransaction } from './payment-transaction';
|
|
4
4
|
export declare class Payment extends BaseModel<Payment> {
|
|
5
|
-
id: number;
|
|
5
|
+
id: string | number;
|
|
6
6
|
checkoutId: string;
|
|
7
7
|
orderId?: string;
|
|
8
8
|
pagarMeOrderId?: string;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
export type PagarmeCredentials = {
|
|
2
2
|
URL: string;
|
|
3
|
-
URL_POSTBACK
|
|
3
|
+
URL_POSTBACK?: string;
|
|
4
4
|
API_KEY: string;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
Glamshop: {
|
|
6
|
+
SUBSCRIPTION_API_KEY: string;
|
|
7
|
+
SHOP_API_KEY: string;
|
|
8
|
+
};
|
|
9
|
+
mensmarket: {
|
|
10
|
+
SUBSCRIPTION_API_KEY: string;
|
|
11
|
+
SHOP_API_KEY: string;
|
|
12
|
+
};
|
|
7
13
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Checkout, PaymentCardInfo } from '../../../../domain';
|
|
2
2
|
import { PagarMeV5RequestPayload } from '../../types';
|
|
3
3
|
export declare class PagarMeV5RequestHelper {
|
|
4
|
-
static build(checkout: Checkout,
|
|
4
|
+
static build(checkout: Checkout, method: 'pix' | 'boleto' | 'credit_card', card?: PaymentCardInfo): PagarMeV5RequestPayload;
|
|
5
5
|
private static buildItems;
|
|
6
6
|
private static buildCustomer;
|
|
7
7
|
private static buildShipping;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Checkout, Payment } from '../../../../domain';
|
|
1
|
+
import { Checkout, Payment, TransactionPaymentMethods } from '../../../../domain';
|
|
2
2
|
import { PagarMeV5Response } from '../../types';
|
|
3
3
|
export declare class PagarMeV5ResponseHelper {
|
|
4
|
-
static build(checkout: Checkout, response: PagarMeV5Response): Payment;
|
|
4
|
+
static build(method: TransactionPaymentMethods, checkout: Checkout, response: PagarMeV5Response): Payment;
|
|
5
5
|
private static buildPaymentTransaction;
|
|
6
|
+
private static getPaymentStatus;
|
|
6
7
|
private static getBoletoReponse;
|
|
7
8
|
private static getPixReponse;
|
|
8
9
|
private static getCardReponse;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Shops } from '../../../../domain/catalog';
|
|
1
2
|
import { BusinessUnitEnum } from '../../../../domain/shopping/enums';
|
|
2
3
|
import { PaymentProviderCard } from '../../../../domain/shopping/interfaces';
|
|
3
4
|
import { Checkout, Payment, PaymentTransaction } from '../../../../domain/shopping/models';
|
|
@@ -10,7 +11,7 @@ export declare class PagarmeCardAxiosAdapter implements PaymentProviderCard<Paga
|
|
|
10
11
|
constructor(credentials: PagarmeCredentials, paymentRepository: PaymentRepository, orderBlockedRepository: OrderBlockedRepository);
|
|
11
12
|
pay(checkout: Checkout, card: PaymentCardInfo): Promise<Payment>;
|
|
12
13
|
addCard(card: CardInfo): Promise<PagarMeCard>;
|
|
13
|
-
createCardHash<PagarMeCardManualHash>(bu: BusinessUnitEnum): Promise<PagarMeCardManualHash>;
|
|
14
|
+
createCardHash<PagarMeCardManualHash>(bu: BusinessUnitEnum, shop?: Shops): Promise<PagarMeCardManualHash>;
|
|
14
15
|
getCardByToken(id: string): Promise<PagarMeCard>;
|
|
15
16
|
createTransaction(info: any): Promise<PaymentTransaction>;
|
|
16
17
|
private createCardPayment;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Shops } from '../../../../domain';
|
|
1
2
|
import { BusinessUnitEnum } from '../../../../domain/shopping/enums';
|
|
2
3
|
import { PaymentProviderCard } from '../../../../domain/shopping/interfaces';
|
|
3
4
|
import { Checkout, Payment, PaymentTransaction } from '../../../../domain/shopping/models';
|
|
@@ -10,7 +11,8 @@ export declare class PagarmeV5CardAxiosAdapter implements PaymentProviderCard<Pa
|
|
|
10
11
|
constructor(credentials: PagarmeCredentials, paymentRepository: PaymentRepository, orderBlockedRepository: OrderBlockedRepository);
|
|
11
12
|
pay(checkout: Checkout, card: PaymentCardInfo): Promise<Payment>;
|
|
12
13
|
addCard(card: CardInfo): Promise<PagarMeCard>;
|
|
13
|
-
createCardHash<PagarMeCardManualHash>(bu: BusinessUnitEnum): Promise<PagarMeCardManualHash>;
|
|
14
|
-
getCardByToken(
|
|
14
|
+
createCardHash<PagarMeCardManualHash>(bu: BusinessUnitEnum, shop?: Shops): Promise<PagarMeCardManualHash>;
|
|
15
|
+
getCardByToken(token: string): Promise<PagarMeCard>;
|
|
16
|
+
getCardByToken(customerId: string, token: string): Promise<PagarMeCard>;
|
|
15
17
|
createTransaction(info: any): Promise<PaymentTransaction>;
|
|
16
18
|
}
|
|
@@ -34,38 +34,42 @@ 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';
|
|
40
41
|
amount: number;
|
|
41
|
-
pix?:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
42
|
+
pix?: PagarMeV5OrderPaymentPixInfo;
|
|
43
|
+
boleto?: PagarMeV5OrderPaymentBoletoInfo;
|
|
44
|
+
credit_card?: PagarMeV5OrderPaymentCardInfo;
|
|
45
|
+
};
|
|
46
|
+
export type PagarMeV5OrderPaymentPixInfo = {
|
|
47
|
+
expires_at: string;
|
|
48
|
+
additional_information?: [
|
|
49
|
+
{
|
|
50
|
+
name: string;
|
|
51
|
+
value: string;
|
|
52
|
+
}
|
|
53
|
+
];
|
|
54
|
+
};
|
|
55
|
+
export type PagarMeV5OrderPaymentBoletoInfo = {
|
|
56
|
+
instructions: string;
|
|
57
|
+
due_at: string;
|
|
58
|
+
type: 'DM' | 'BDP';
|
|
59
|
+
document_number?: string;
|
|
60
|
+
};
|
|
61
|
+
export type PagarMeV5OrderPaymentCardInfo = {
|
|
62
|
+
installments: number;
|
|
63
|
+
statement_descriptor: string;
|
|
64
|
+
card_id: string;
|
|
65
|
+
card: {
|
|
66
|
+
cvv: string;
|
|
67
|
+
billing_address?: {
|
|
68
|
+
line_1: string;
|
|
69
|
+
zip_code: string;
|
|
70
|
+
city: string;
|
|
71
|
+
state: string;
|
|
72
|
+
country: string;
|
|
69
73
|
};
|
|
70
74
|
};
|
|
71
75
|
};
|
|
@@ -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;
|
|
@@ -65,7 +65,7 @@ export type PagarMeV5Transaction = {
|
|
|
65
65
|
transaction_type?: string;
|
|
66
66
|
gateway_id?: string;
|
|
67
67
|
amount: number;
|
|
68
|
-
status?:
|
|
68
|
+
status?: PagarMeV5PaymentStatus;
|
|
69
69
|
success: boolean;
|
|
70
70
|
installments: number;
|
|
71
71
|
installment_type?: string;
|
|
@@ -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
|
};
|