@infrab4a/connect 5.6.4 → 5.6.5-beta.1
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 +136 -51
- package/index.esm.js +136 -52
- package/package.json +1 -1
- package/src/domain/shopping/models/order.d.ts +8 -0
- package/src/infra/mercado-pago/adapters/mercado-pago-base-axios.d.ts +10 -0
- package/src/infra/mercado-pago/adapters/mercado-pago-card-payment-axios.adapter.d.ts +5 -4
- package/src/infra/mercado-pago/adapters/mercado-pago-pix-payment-axios.adapter.d.ts +4 -3
- package/src/infra/mercado-pago/types/mercado-pago-response.type.d.ts +23 -0
- package/src/infra/pagarme/adapters/v5/index.d.ts +1 -0
- package/src/infra/pagarme/adapters/v5/pagarmev5-base-axios.d.ts +10 -0
- package/src/infra/pagarme/adapters/v5/pagarmev5-card-payment-axios.adapter.d.ts +5 -4
- package/src/infra/pagarme/adapters/v5/pagarmev5-pix-payment-axios.adapter.d.ts +4 -3
- package/src/infra/pagarme/types/v5/pagarmev5-order-response.type.d.ts +116 -0
package/index.cjs.js
CHANGED
|
@@ -9877,8 +9877,92 @@ class MercadoPagoBankSlipAxiosAdapter {
|
|
|
9877
9877
|
}
|
|
9878
9878
|
}
|
|
9879
9879
|
|
|
9880
|
-
|
|
9880
|
+
exports.MercadoPagoStatusDetailEnum = void 0;
|
|
9881
|
+
(function (MercadoPagoStatusDetailEnum) {
|
|
9882
|
+
MercadoPagoStatusDetailEnum["accredited"] = "accredited";
|
|
9883
|
+
MercadoPagoStatusDetailEnum["partially_refunded"] = "partially_refunded";
|
|
9884
|
+
MercadoPagoStatusDetailEnum["pending_capture"] = "pending_capture";
|
|
9885
|
+
MercadoPagoStatusDetailEnum["offline_process"] = "offline_process";
|
|
9886
|
+
MercadoPagoStatusDetailEnum["pending_contingency"] = "pending_contingency";
|
|
9887
|
+
MercadoPagoStatusDetailEnum["pending_review_manual"] = "pending_review_manual";
|
|
9888
|
+
MercadoPagoStatusDetailEnum["pending_waiting_transfer"] = "pending_waiting_transfer";
|
|
9889
|
+
MercadoPagoStatusDetailEnum["pending_waiting_payment"] = "pending_waiting_payment";
|
|
9890
|
+
MercadoPagoStatusDetailEnum["pending_challenge"] = "pending_challenge";
|
|
9891
|
+
MercadoPagoStatusDetailEnum["bank_error"] = "bank_error";
|
|
9892
|
+
MercadoPagoStatusDetailEnum["cc_rejected_3ds_mandatory"] = "cc_rejected_3ds_mandatory";
|
|
9893
|
+
MercadoPagoStatusDetailEnum["cc_rejected_bad_filled_card_number"] = "cc_rejected_bad_filled_card_number";
|
|
9894
|
+
MercadoPagoStatusDetailEnum["cc_rejected_bad_filled_date"] = "cc_rejected_bad_filled_date";
|
|
9895
|
+
MercadoPagoStatusDetailEnum["cc_rejected_bad_filled_other"] = "cc_rejected_bad_filled_other";
|
|
9896
|
+
MercadoPagoStatusDetailEnum["cc_rejected_bad_filled_security_code"] = "cc_rejected_bad_filled_security_code";
|
|
9897
|
+
MercadoPagoStatusDetailEnum["cc_rejected_blacklist"] = "cc_rejected_blacklist";
|
|
9898
|
+
MercadoPagoStatusDetailEnum["cc_rejected_call_for_authorize"] = "cc_rejected_call_for_authorize";
|
|
9899
|
+
MercadoPagoStatusDetailEnum["cc_rejected_card_disabled"] = "cc_rejected_card_disabled";
|
|
9900
|
+
MercadoPagoStatusDetailEnum["cc_rejected_card_error"] = "cc_rejected_card_error";
|
|
9901
|
+
MercadoPagoStatusDetailEnum["cc_rejected_duplicated_payment"] = "cc_rejected_duplicated_payment";
|
|
9902
|
+
MercadoPagoStatusDetailEnum["cc_rejected_high_risk"] = "cc_rejected_high_risk";
|
|
9903
|
+
MercadoPagoStatusDetailEnum["cc_rejected_insufficient_amount"] = "cc_rejected_insufficient_amount";
|
|
9904
|
+
MercadoPagoStatusDetailEnum["cc_rejected_invalid_installments"] = "cc_rejected_invalid_installments";
|
|
9905
|
+
MercadoPagoStatusDetailEnum["cc_rejected_max_attempts"] = "cc_rejected_max_attempts";
|
|
9906
|
+
MercadoPagoStatusDetailEnum["cc_rejected_other_reason"] = "cc_rejected_other_reason";
|
|
9907
|
+
MercadoPagoStatusDetailEnum["cc_amount_rate_limit_exceeded"] = "cc_amount_rate_limit_exceeded";
|
|
9908
|
+
MercadoPagoStatusDetailEnum["rejected_insufficient_data"] = "rejected_insufficient_data";
|
|
9909
|
+
MercadoPagoStatusDetailEnum["rejected_by_bank"] = "rejected_by_bank";
|
|
9910
|
+
MercadoPagoStatusDetailEnum["rejected_by_regulations"] = "rejected_by_regulations";
|
|
9911
|
+
MercadoPagoStatusDetailEnum["insufficient_amount"] = "insufficient_amount";
|
|
9912
|
+
MercadoPagoStatusDetailEnum["cc_rejected_card_type_not_allowed"] = "cc_rejected_card_type_not_allowed";
|
|
9913
|
+
})(exports.MercadoPagoStatusDetailEnum || (exports.MercadoPagoStatusDetailEnum = {}));
|
|
9914
|
+
|
|
9915
|
+
exports.MercadoPagoStatusEnum = void 0;
|
|
9916
|
+
(function (MercadoPagoStatusEnum) {
|
|
9917
|
+
MercadoPagoStatusEnum["approved"] = "approved";
|
|
9918
|
+
MercadoPagoStatusEnum["authorized"] = "authorized";
|
|
9919
|
+
MercadoPagoStatusEnum["pending"] = "pending";
|
|
9920
|
+
MercadoPagoStatusEnum["in_process"] = "in_process";
|
|
9921
|
+
MercadoPagoStatusEnum["rejected"] = "rejected";
|
|
9922
|
+
MercadoPagoStatusEnum["cancelled"] = "cancelled";
|
|
9923
|
+
MercadoPagoStatusEnum["refunded"] = "refunded";
|
|
9924
|
+
MercadoPagoStatusEnum["charged_back"] = "charged_back";
|
|
9925
|
+
})(exports.MercadoPagoStatusEnum || (exports.MercadoPagoStatusEnum = {}));
|
|
9926
|
+
|
|
9927
|
+
class MercadoPagoBaseAxiosAdapter {
|
|
9928
|
+
constructor(credentials, paymentRepository) {
|
|
9929
|
+
this.credentials = credentials;
|
|
9930
|
+
this.paymentRepository = paymentRepository;
|
|
9931
|
+
}
|
|
9932
|
+
async refund(order, amount) {
|
|
9933
|
+
const { data } = await axios__default["default"]({
|
|
9934
|
+
method: 'POST',
|
|
9935
|
+
url: `${this.credentials.url}/payments/${order.payment.id}/refunds`,
|
|
9936
|
+
headers: {
|
|
9937
|
+
'X-Idempotency-Key': `${order.payment.charger_id}-${new Date().getTime()}`,
|
|
9938
|
+
Authorization: `Bearer ${this.credentials.api_key}`,
|
|
9939
|
+
'Content-Type': 'application/json',
|
|
9940
|
+
},
|
|
9941
|
+
data: {
|
|
9942
|
+
amount: +amount.toFixed(2),
|
|
9943
|
+
},
|
|
9944
|
+
});
|
|
9945
|
+
await this.paymentRepository.create({
|
|
9946
|
+
createdAt: new Date(),
|
|
9947
|
+
updatedAt: new Date(),
|
|
9948
|
+
userId: order.user.id,
|
|
9949
|
+
orderId: order.id,
|
|
9950
|
+
totalPrice: amount,
|
|
9951
|
+
paymentProvider: exports.PaymentProviders.MERCADOPAGO,
|
|
9952
|
+
mercadoPagoId: data.id,
|
|
9953
|
+
transaction: data,
|
|
9954
|
+
});
|
|
9955
|
+
console.warn('[RESPONSE MERCADO PAGO REFUND]', JSON.stringify(data));
|
|
9956
|
+
return {
|
|
9957
|
+
status: data.status,
|
|
9958
|
+
success: data.status === exports.MercadoPagoStatusEnum.approved ? true : false,
|
|
9959
|
+
};
|
|
9960
|
+
}
|
|
9961
|
+
}
|
|
9962
|
+
|
|
9963
|
+
class MercadoPagoCardAxiosAdapter extends MercadoPagoBaseAxiosAdapter {
|
|
9881
9964
|
constructor(credentials, paymentRepository, orderBlockedRepository) {
|
|
9965
|
+
super(credentials, paymentRepository);
|
|
9882
9966
|
this.credentials = credentials;
|
|
9883
9967
|
this.paymentRepository = paymentRepository;
|
|
9884
9968
|
this.orderBlockedRepository = orderBlockedRepository;
|
|
@@ -10007,8 +10091,9 @@ class MercadoPagoCardAxiosAdapter {
|
|
|
10007
10091
|
}
|
|
10008
10092
|
}
|
|
10009
10093
|
|
|
10010
|
-
class MercadoPagoPixAxiosAdapter {
|
|
10094
|
+
class MercadoPagoPixAxiosAdapter extends MercadoPagoBaseAxiosAdapter {
|
|
10011
10095
|
constructor(credentials, paymentRepository) {
|
|
10096
|
+
super(credentials, paymentRepository);
|
|
10012
10097
|
this.credentials = credentials;
|
|
10013
10098
|
this.paymentRepository = paymentRepository;
|
|
10014
10099
|
}
|
|
@@ -10047,53 +10132,6 @@ class MercadoPagoPixAxiosAdapter {
|
|
|
10047
10132
|
}
|
|
10048
10133
|
}
|
|
10049
10134
|
|
|
10050
|
-
exports.MercadoPagoStatusDetailEnum = void 0;
|
|
10051
|
-
(function (MercadoPagoStatusDetailEnum) {
|
|
10052
|
-
MercadoPagoStatusDetailEnum["accredited"] = "accredited";
|
|
10053
|
-
MercadoPagoStatusDetailEnum["partially_refunded"] = "partially_refunded";
|
|
10054
|
-
MercadoPagoStatusDetailEnum["pending_capture"] = "pending_capture";
|
|
10055
|
-
MercadoPagoStatusDetailEnum["offline_process"] = "offline_process";
|
|
10056
|
-
MercadoPagoStatusDetailEnum["pending_contingency"] = "pending_contingency";
|
|
10057
|
-
MercadoPagoStatusDetailEnum["pending_review_manual"] = "pending_review_manual";
|
|
10058
|
-
MercadoPagoStatusDetailEnum["pending_waiting_transfer"] = "pending_waiting_transfer";
|
|
10059
|
-
MercadoPagoStatusDetailEnum["pending_waiting_payment"] = "pending_waiting_payment";
|
|
10060
|
-
MercadoPagoStatusDetailEnum["pending_challenge"] = "pending_challenge";
|
|
10061
|
-
MercadoPagoStatusDetailEnum["bank_error"] = "bank_error";
|
|
10062
|
-
MercadoPagoStatusDetailEnum["cc_rejected_3ds_mandatory"] = "cc_rejected_3ds_mandatory";
|
|
10063
|
-
MercadoPagoStatusDetailEnum["cc_rejected_bad_filled_card_number"] = "cc_rejected_bad_filled_card_number";
|
|
10064
|
-
MercadoPagoStatusDetailEnum["cc_rejected_bad_filled_date"] = "cc_rejected_bad_filled_date";
|
|
10065
|
-
MercadoPagoStatusDetailEnum["cc_rejected_bad_filled_other"] = "cc_rejected_bad_filled_other";
|
|
10066
|
-
MercadoPagoStatusDetailEnum["cc_rejected_bad_filled_security_code"] = "cc_rejected_bad_filled_security_code";
|
|
10067
|
-
MercadoPagoStatusDetailEnum["cc_rejected_blacklist"] = "cc_rejected_blacklist";
|
|
10068
|
-
MercadoPagoStatusDetailEnum["cc_rejected_call_for_authorize"] = "cc_rejected_call_for_authorize";
|
|
10069
|
-
MercadoPagoStatusDetailEnum["cc_rejected_card_disabled"] = "cc_rejected_card_disabled";
|
|
10070
|
-
MercadoPagoStatusDetailEnum["cc_rejected_card_error"] = "cc_rejected_card_error";
|
|
10071
|
-
MercadoPagoStatusDetailEnum["cc_rejected_duplicated_payment"] = "cc_rejected_duplicated_payment";
|
|
10072
|
-
MercadoPagoStatusDetailEnum["cc_rejected_high_risk"] = "cc_rejected_high_risk";
|
|
10073
|
-
MercadoPagoStatusDetailEnum["cc_rejected_insufficient_amount"] = "cc_rejected_insufficient_amount";
|
|
10074
|
-
MercadoPagoStatusDetailEnum["cc_rejected_invalid_installments"] = "cc_rejected_invalid_installments";
|
|
10075
|
-
MercadoPagoStatusDetailEnum["cc_rejected_max_attempts"] = "cc_rejected_max_attempts";
|
|
10076
|
-
MercadoPagoStatusDetailEnum["cc_rejected_other_reason"] = "cc_rejected_other_reason";
|
|
10077
|
-
MercadoPagoStatusDetailEnum["cc_amount_rate_limit_exceeded"] = "cc_amount_rate_limit_exceeded";
|
|
10078
|
-
MercadoPagoStatusDetailEnum["rejected_insufficient_data"] = "rejected_insufficient_data";
|
|
10079
|
-
MercadoPagoStatusDetailEnum["rejected_by_bank"] = "rejected_by_bank";
|
|
10080
|
-
MercadoPagoStatusDetailEnum["rejected_by_regulations"] = "rejected_by_regulations";
|
|
10081
|
-
MercadoPagoStatusDetailEnum["insufficient_amount"] = "insufficient_amount";
|
|
10082
|
-
MercadoPagoStatusDetailEnum["cc_rejected_card_type_not_allowed"] = "cc_rejected_card_type_not_allowed";
|
|
10083
|
-
})(exports.MercadoPagoStatusDetailEnum || (exports.MercadoPagoStatusDetailEnum = {}));
|
|
10084
|
-
|
|
10085
|
-
exports.MercadoPagoStatusEnum = void 0;
|
|
10086
|
-
(function (MercadoPagoStatusEnum) {
|
|
10087
|
-
MercadoPagoStatusEnum["approved"] = "approved";
|
|
10088
|
-
MercadoPagoStatusEnum["authorized"] = "authorized";
|
|
10089
|
-
MercadoPagoStatusEnum["pending"] = "pending";
|
|
10090
|
-
MercadoPagoStatusEnum["in_process"] = "in_process";
|
|
10091
|
-
MercadoPagoStatusEnum["rejected"] = "rejected";
|
|
10092
|
-
MercadoPagoStatusEnum["cancelled"] = "cancelled";
|
|
10093
|
-
MercadoPagoStatusEnum["refunded"] = "refunded";
|
|
10094
|
-
MercadoPagoStatusEnum["charged_back"] = "charged_back";
|
|
10095
|
-
})(exports.MercadoPagoStatusEnum || (exports.MercadoPagoStatusEnum = {}));
|
|
10096
|
-
|
|
10097
10135
|
class PagarmeBankSlipAxiosAdapter {
|
|
10098
10136
|
constructor(credentials, paymentRepository) {
|
|
10099
10137
|
this.credentials = credentials;
|
|
@@ -10883,8 +10921,53 @@ class PagarmeV5BankSlipAxiosAdapter {
|
|
|
10883
10921
|
}
|
|
10884
10922
|
}
|
|
10885
10923
|
|
|
10886
|
-
class
|
|
10924
|
+
class PagarmeV5BaseAxiosAdapter {
|
|
10925
|
+
constructor(credentials, paymentRepository) {
|
|
10926
|
+
this.credentials = credentials;
|
|
10927
|
+
this.paymentRepository = paymentRepository;
|
|
10928
|
+
}
|
|
10929
|
+
async refund(order, amount) {
|
|
10930
|
+
try {
|
|
10931
|
+
console.warn('[PAGARME REFUND] Starting refund process for order', order.id, order.payment, 'with amount', amount);
|
|
10932
|
+
const amountToSend = +amount.toFixed(2) * 100;
|
|
10933
|
+
console.warn('[PAGARME REFUND] Amount to send in cents', amountToSend);
|
|
10934
|
+
const { data } = await axios__default["default"]({
|
|
10935
|
+
method: 'DELETE',
|
|
10936
|
+
url: `${this.credentials.URL}/charges/${order.payment.charger_id}`,
|
|
10937
|
+
headers: {
|
|
10938
|
+
Authorization: 'Basic ' + Buffer.from(`${this.credentials.API_KEY}:`).toString('base64'),
|
|
10939
|
+
'Content-Type': 'application/json',
|
|
10940
|
+
},
|
|
10941
|
+
data: {
|
|
10942
|
+
amount: amountToSend,
|
|
10943
|
+
},
|
|
10944
|
+
});
|
|
10945
|
+
console.warn('[RESPONSE PAGARME REFUND]', JSON.stringify(data));
|
|
10946
|
+
await this.paymentRepository.create({
|
|
10947
|
+
createdAt: new Date(),
|
|
10948
|
+
updatedAt: new Date(),
|
|
10949
|
+
userId: order.user.id,
|
|
10950
|
+
orderId: order.id,
|
|
10951
|
+
totalPrice: amount,
|
|
10952
|
+
paymentProvider: exports.PaymentProviders.PAGARME,
|
|
10953
|
+
pagarMeOrderId: data.id,
|
|
10954
|
+
transaction: data,
|
|
10955
|
+
});
|
|
10956
|
+
return {
|
|
10957
|
+
status: data.status,
|
|
10958
|
+
success: data.success,
|
|
10959
|
+
};
|
|
10960
|
+
}
|
|
10961
|
+
catch (error) {
|
|
10962
|
+
console.error('Error during refund process for order', order.id, 'with error', error);
|
|
10963
|
+
throw error;
|
|
10964
|
+
}
|
|
10965
|
+
}
|
|
10966
|
+
}
|
|
10967
|
+
|
|
10968
|
+
class PagarmeV5CardAxiosAdapter extends PagarmeV5BaseAxiosAdapter {
|
|
10887
10969
|
constructor(credentials, paymentRepository, orderBlockedRepository) {
|
|
10970
|
+
super(credentials, paymentRepository);
|
|
10888
10971
|
this.credentials = credentials;
|
|
10889
10972
|
this.paymentRepository = paymentRepository;
|
|
10890
10973
|
this.orderBlockedRepository = orderBlockedRepository;
|
|
@@ -11054,8 +11137,9 @@ class PagarmeV5CardAxiosAdapter {
|
|
|
11054
11137
|
}
|
|
11055
11138
|
}
|
|
11056
11139
|
|
|
11057
|
-
class PagarmeV5PixAxiosAdapter {
|
|
11140
|
+
class PagarmeV5PixAxiosAdapter extends PagarmeV5BaseAxiosAdapter {
|
|
11058
11141
|
constructor(credentials, paymentRepository) {
|
|
11142
|
+
super(credentials, paymentRepository);
|
|
11059
11143
|
this.credentials = credentials;
|
|
11060
11144
|
this.paymentRepository = paymentRepository;
|
|
11061
11145
|
}
|
|
@@ -11471,6 +11555,7 @@ exports.PagarmeCardAxiosAdapter = PagarmeCardAxiosAdapter;
|
|
|
11471
11555
|
exports.PagarmePaymentMethodFactory = PagarmePaymentMethodFactory;
|
|
11472
11556
|
exports.PagarmePixAxiosAdapter = PagarmePixAxiosAdapter;
|
|
11473
11557
|
exports.PagarmeV5BankSlipAxiosAdapter = PagarmeV5BankSlipAxiosAdapter;
|
|
11558
|
+
exports.PagarmeV5BaseAxiosAdapter = PagarmeV5BaseAxiosAdapter;
|
|
11474
11559
|
exports.PagarmeV5CardAxiosAdapter = PagarmeV5CardAxiosAdapter;
|
|
11475
11560
|
exports.PagarmeV5PixAxiosAdapter = PagarmeV5PixAxiosAdapter;
|
|
11476
11561
|
exports.Payment = Payment;
|
package/index.esm.js
CHANGED
|
@@ -9853,8 +9853,92 @@ class MercadoPagoBankSlipAxiosAdapter {
|
|
|
9853
9853
|
}
|
|
9854
9854
|
}
|
|
9855
9855
|
|
|
9856
|
-
|
|
9856
|
+
var MercadoPagoStatusDetailEnum;
|
|
9857
|
+
(function (MercadoPagoStatusDetailEnum) {
|
|
9858
|
+
MercadoPagoStatusDetailEnum["accredited"] = "accredited";
|
|
9859
|
+
MercadoPagoStatusDetailEnum["partially_refunded"] = "partially_refunded";
|
|
9860
|
+
MercadoPagoStatusDetailEnum["pending_capture"] = "pending_capture";
|
|
9861
|
+
MercadoPagoStatusDetailEnum["offline_process"] = "offline_process";
|
|
9862
|
+
MercadoPagoStatusDetailEnum["pending_contingency"] = "pending_contingency";
|
|
9863
|
+
MercadoPagoStatusDetailEnum["pending_review_manual"] = "pending_review_manual";
|
|
9864
|
+
MercadoPagoStatusDetailEnum["pending_waiting_transfer"] = "pending_waiting_transfer";
|
|
9865
|
+
MercadoPagoStatusDetailEnum["pending_waiting_payment"] = "pending_waiting_payment";
|
|
9866
|
+
MercadoPagoStatusDetailEnum["pending_challenge"] = "pending_challenge";
|
|
9867
|
+
MercadoPagoStatusDetailEnum["bank_error"] = "bank_error";
|
|
9868
|
+
MercadoPagoStatusDetailEnum["cc_rejected_3ds_mandatory"] = "cc_rejected_3ds_mandatory";
|
|
9869
|
+
MercadoPagoStatusDetailEnum["cc_rejected_bad_filled_card_number"] = "cc_rejected_bad_filled_card_number";
|
|
9870
|
+
MercadoPagoStatusDetailEnum["cc_rejected_bad_filled_date"] = "cc_rejected_bad_filled_date";
|
|
9871
|
+
MercadoPagoStatusDetailEnum["cc_rejected_bad_filled_other"] = "cc_rejected_bad_filled_other";
|
|
9872
|
+
MercadoPagoStatusDetailEnum["cc_rejected_bad_filled_security_code"] = "cc_rejected_bad_filled_security_code";
|
|
9873
|
+
MercadoPagoStatusDetailEnum["cc_rejected_blacklist"] = "cc_rejected_blacklist";
|
|
9874
|
+
MercadoPagoStatusDetailEnum["cc_rejected_call_for_authorize"] = "cc_rejected_call_for_authorize";
|
|
9875
|
+
MercadoPagoStatusDetailEnum["cc_rejected_card_disabled"] = "cc_rejected_card_disabled";
|
|
9876
|
+
MercadoPagoStatusDetailEnum["cc_rejected_card_error"] = "cc_rejected_card_error";
|
|
9877
|
+
MercadoPagoStatusDetailEnum["cc_rejected_duplicated_payment"] = "cc_rejected_duplicated_payment";
|
|
9878
|
+
MercadoPagoStatusDetailEnum["cc_rejected_high_risk"] = "cc_rejected_high_risk";
|
|
9879
|
+
MercadoPagoStatusDetailEnum["cc_rejected_insufficient_amount"] = "cc_rejected_insufficient_amount";
|
|
9880
|
+
MercadoPagoStatusDetailEnum["cc_rejected_invalid_installments"] = "cc_rejected_invalid_installments";
|
|
9881
|
+
MercadoPagoStatusDetailEnum["cc_rejected_max_attempts"] = "cc_rejected_max_attempts";
|
|
9882
|
+
MercadoPagoStatusDetailEnum["cc_rejected_other_reason"] = "cc_rejected_other_reason";
|
|
9883
|
+
MercadoPagoStatusDetailEnum["cc_amount_rate_limit_exceeded"] = "cc_amount_rate_limit_exceeded";
|
|
9884
|
+
MercadoPagoStatusDetailEnum["rejected_insufficient_data"] = "rejected_insufficient_data";
|
|
9885
|
+
MercadoPagoStatusDetailEnum["rejected_by_bank"] = "rejected_by_bank";
|
|
9886
|
+
MercadoPagoStatusDetailEnum["rejected_by_regulations"] = "rejected_by_regulations";
|
|
9887
|
+
MercadoPagoStatusDetailEnum["insufficient_amount"] = "insufficient_amount";
|
|
9888
|
+
MercadoPagoStatusDetailEnum["cc_rejected_card_type_not_allowed"] = "cc_rejected_card_type_not_allowed";
|
|
9889
|
+
})(MercadoPagoStatusDetailEnum || (MercadoPagoStatusDetailEnum = {}));
|
|
9890
|
+
|
|
9891
|
+
var MercadoPagoStatusEnum;
|
|
9892
|
+
(function (MercadoPagoStatusEnum) {
|
|
9893
|
+
MercadoPagoStatusEnum["approved"] = "approved";
|
|
9894
|
+
MercadoPagoStatusEnum["authorized"] = "authorized";
|
|
9895
|
+
MercadoPagoStatusEnum["pending"] = "pending";
|
|
9896
|
+
MercadoPagoStatusEnum["in_process"] = "in_process";
|
|
9897
|
+
MercadoPagoStatusEnum["rejected"] = "rejected";
|
|
9898
|
+
MercadoPagoStatusEnum["cancelled"] = "cancelled";
|
|
9899
|
+
MercadoPagoStatusEnum["refunded"] = "refunded";
|
|
9900
|
+
MercadoPagoStatusEnum["charged_back"] = "charged_back";
|
|
9901
|
+
})(MercadoPagoStatusEnum || (MercadoPagoStatusEnum = {}));
|
|
9902
|
+
|
|
9903
|
+
class MercadoPagoBaseAxiosAdapter {
|
|
9904
|
+
constructor(credentials, paymentRepository) {
|
|
9905
|
+
this.credentials = credentials;
|
|
9906
|
+
this.paymentRepository = paymentRepository;
|
|
9907
|
+
}
|
|
9908
|
+
async refund(order, amount) {
|
|
9909
|
+
const { data } = await axios({
|
|
9910
|
+
method: 'POST',
|
|
9911
|
+
url: `${this.credentials.url}/payments/${order.payment.id}/refunds`,
|
|
9912
|
+
headers: {
|
|
9913
|
+
'X-Idempotency-Key': `${order.payment.charger_id}-${new Date().getTime()}`,
|
|
9914
|
+
Authorization: `Bearer ${this.credentials.api_key}`,
|
|
9915
|
+
'Content-Type': 'application/json',
|
|
9916
|
+
},
|
|
9917
|
+
data: {
|
|
9918
|
+
amount: +amount.toFixed(2),
|
|
9919
|
+
},
|
|
9920
|
+
});
|
|
9921
|
+
await this.paymentRepository.create({
|
|
9922
|
+
createdAt: new Date(),
|
|
9923
|
+
updatedAt: new Date(),
|
|
9924
|
+
userId: order.user.id,
|
|
9925
|
+
orderId: order.id,
|
|
9926
|
+
totalPrice: amount,
|
|
9927
|
+
paymentProvider: PaymentProviders.MERCADOPAGO,
|
|
9928
|
+
mercadoPagoId: data.id,
|
|
9929
|
+
transaction: data,
|
|
9930
|
+
});
|
|
9931
|
+
console.warn('[RESPONSE MERCADO PAGO REFUND]', JSON.stringify(data));
|
|
9932
|
+
return {
|
|
9933
|
+
status: data.status,
|
|
9934
|
+
success: data.status === MercadoPagoStatusEnum.approved ? true : false,
|
|
9935
|
+
};
|
|
9936
|
+
}
|
|
9937
|
+
}
|
|
9938
|
+
|
|
9939
|
+
class MercadoPagoCardAxiosAdapter extends MercadoPagoBaseAxiosAdapter {
|
|
9857
9940
|
constructor(credentials, paymentRepository, orderBlockedRepository) {
|
|
9941
|
+
super(credentials, paymentRepository);
|
|
9858
9942
|
this.credentials = credentials;
|
|
9859
9943
|
this.paymentRepository = paymentRepository;
|
|
9860
9944
|
this.orderBlockedRepository = orderBlockedRepository;
|
|
@@ -9983,8 +10067,9 @@ class MercadoPagoCardAxiosAdapter {
|
|
|
9983
10067
|
}
|
|
9984
10068
|
}
|
|
9985
10069
|
|
|
9986
|
-
class MercadoPagoPixAxiosAdapter {
|
|
10070
|
+
class MercadoPagoPixAxiosAdapter extends MercadoPagoBaseAxiosAdapter {
|
|
9987
10071
|
constructor(credentials, paymentRepository) {
|
|
10072
|
+
super(credentials, paymentRepository);
|
|
9988
10073
|
this.credentials = credentials;
|
|
9989
10074
|
this.paymentRepository = paymentRepository;
|
|
9990
10075
|
}
|
|
@@ -10023,53 +10108,6 @@ class MercadoPagoPixAxiosAdapter {
|
|
|
10023
10108
|
}
|
|
10024
10109
|
}
|
|
10025
10110
|
|
|
10026
|
-
var MercadoPagoStatusDetailEnum;
|
|
10027
|
-
(function (MercadoPagoStatusDetailEnum) {
|
|
10028
|
-
MercadoPagoStatusDetailEnum["accredited"] = "accredited";
|
|
10029
|
-
MercadoPagoStatusDetailEnum["partially_refunded"] = "partially_refunded";
|
|
10030
|
-
MercadoPagoStatusDetailEnum["pending_capture"] = "pending_capture";
|
|
10031
|
-
MercadoPagoStatusDetailEnum["offline_process"] = "offline_process";
|
|
10032
|
-
MercadoPagoStatusDetailEnum["pending_contingency"] = "pending_contingency";
|
|
10033
|
-
MercadoPagoStatusDetailEnum["pending_review_manual"] = "pending_review_manual";
|
|
10034
|
-
MercadoPagoStatusDetailEnum["pending_waiting_transfer"] = "pending_waiting_transfer";
|
|
10035
|
-
MercadoPagoStatusDetailEnum["pending_waiting_payment"] = "pending_waiting_payment";
|
|
10036
|
-
MercadoPagoStatusDetailEnum["pending_challenge"] = "pending_challenge";
|
|
10037
|
-
MercadoPagoStatusDetailEnum["bank_error"] = "bank_error";
|
|
10038
|
-
MercadoPagoStatusDetailEnum["cc_rejected_3ds_mandatory"] = "cc_rejected_3ds_mandatory";
|
|
10039
|
-
MercadoPagoStatusDetailEnum["cc_rejected_bad_filled_card_number"] = "cc_rejected_bad_filled_card_number";
|
|
10040
|
-
MercadoPagoStatusDetailEnum["cc_rejected_bad_filled_date"] = "cc_rejected_bad_filled_date";
|
|
10041
|
-
MercadoPagoStatusDetailEnum["cc_rejected_bad_filled_other"] = "cc_rejected_bad_filled_other";
|
|
10042
|
-
MercadoPagoStatusDetailEnum["cc_rejected_bad_filled_security_code"] = "cc_rejected_bad_filled_security_code";
|
|
10043
|
-
MercadoPagoStatusDetailEnum["cc_rejected_blacklist"] = "cc_rejected_blacklist";
|
|
10044
|
-
MercadoPagoStatusDetailEnum["cc_rejected_call_for_authorize"] = "cc_rejected_call_for_authorize";
|
|
10045
|
-
MercadoPagoStatusDetailEnum["cc_rejected_card_disabled"] = "cc_rejected_card_disabled";
|
|
10046
|
-
MercadoPagoStatusDetailEnum["cc_rejected_card_error"] = "cc_rejected_card_error";
|
|
10047
|
-
MercadoPagoStatusDetailEnum["cc_rejected_duplicated_payment"] = "cc_rejected_duplicated_payment";
|
|
10048
|
-
MercadoPagoStatusDetailEnum["cc_rejected_high_risk"] = "cc_rejected_high_risk";
|
|
10049
|
-
MercadoPagoStatusDetailEnum["cc_rejected_insufficient_amount"] = "cc_rejected_insufficient_amount";
|
|
10050
|
-
MercadoPagoStatusDetailEnum["cc_rejected_invalid_installments"] = "cc_rejected_invalid_installments";
|
|
10051
|
-
MercadoPagoStatusDetailEnum["cc_rejected_max_attempts"] = "cc_rejected_max_attempts";
|
|
10052
|
-
MercadoPagoStatusDetailEnum["cc_rejected_other_reason"] = "cc_rejected_other_reason";
|
|
10053
|
-
MercadoPagoStatusDetailEnum["cc_amount_rate_limit_exceeded"] = "cc_amount_rate_limit_exceeded";
|
|
10054
|
-
MercadoPagoStatusDetailEnum["rejected_insufficient_data"] = "rejected_insufficient_data";
|
|
10055
|
-
MercadoPagoStatusDetailEnum["rejected_by_bank"] = "rejected_by_bank";
|
|
10056
|
-
MercadoPagoStatusDetailEnum["rejected_by_regulations"] = "rejected_by_regulations";
|
|
10057
|
-
MercadoPagoStatusDetailEnum["insufficient_amount"] = "insufficient_amount";
|
|
10058
|
-
MercadoPagoStatusDetailEnum["cc_rejected_card_type_not_allowed"] = "cc_rejected_card_type_not_allowed";
|
|
10059
|
-
})(MercadoPagoStatusDetailEnum || (MercadoPagoStatusDetailEnum = {}));
|
|
10060
|
-
|
|
10061
|
-
var MercadoPagoStatusEnum;
|
|
10062
|
-
(function (MercadoPagoStatusEnum) {
|
|
10063
|
-
MercadoPagoStatusEnum["approved"] = "approved";
|
|
10064
|
-
MercadoPagoStatusEnum["authorized"] = "authorized";
|
|
10065
|
-
MercadoPagoStatusEnum["pending"] = "pending";
|
|
10066
|
-
MercadoPagoStatusEnum["in_process"] = "in_process";
|
|
10067
|
-
MercadoPagoStatusEnum["rejected"] = "rejected";
|
|
10068
|
-
MercadoPagoStatusEnum["cancelled"] = "cancelled";
|
|
10069
|
-
MercadoPagoStatusEnum["refunded"] = "refunded";
|
|
10070
|
-
MercadoPagoStatusEnum["charged_back"] = "charged_back";
|
|
10071
|
-
})(MercadoPagoStatusEnum || (MercadoPagoStatusEnum = {}));
|
|
10072
|
-
|
|
10073
10111
|
class PagarmeBankSlipAxiosAdapter {
|
|
10074
10112
|
constructor(credentials, paymentRepository) {
|
|
10075
10113
|
this.credentials = credentials;
|
|
@@ -10859,8 +10897,53 @@ class PagarmeV5BankSlipAxiosAdapter {
|
|
|
10859
10897
|
}
|
|
10860
10898
|
}
|
|
10861
10899
|
|
|
10862
|
-
class
|
|
10900
|
+
class PagarmeV5BaseAxiosAdapter {
|
|
10901
|
+
constructor(credentials, paymentRepository) {
|
|
10902
|
+
this.credentials = credentials;
|
|
10903
|
+
this.paymentRepository = paymentRepository;
|
|
10904
|
+
}
|
|
10905
|
+
async refund(order, amount) {
|
|
10906
|
+
try {
|
|
10907
|
+
console.warn('[PAGARME REFUND] Starting refund process for order', order.id, order.payment, 'with amount', amount);
|
|
10908
|
+
const amountToSend = +amount.toFixed(2) * 100;
|
|
10909
|
+
console.warn('[PAGARME REFUND] Amount to send in cents', amountToSend);
|
|
10910
|
+
const { data } = await axios({
|
|
10911
|
+
method: 'DELETE',
|
|
10912
|
+
url: `${this.credentials.URL}/charges/${order.payment.charger_id}`,
|
|
10913
|
+
headers: {
|
|
10914
|
+
Authorization: 'Basic ' + Buffer.from(`${this.credentials.API_KEY}:`).toString('base64'),
|
|
10915
|
+
'Content-Type': 'application/json',
|
|
10916
|
+
},
|
|
10917
|
+
data: {
|
|
10918
|
+
amount: amountToSend,
|
|
10919
|
+
},
|
|
10920
|
+
});
|
|
10921
|
+
console.warn('[RESPONSE PAGARME REFUND]', JSON.stringify(data));
|
|
10922
|
+
await this.paymentRepository.create({
|
|
10923
|
+
createdAt: new Date(),
|
|
10924
|
+
updatedAt: new Date(),
|
|
10925
|
+
userId: order.user.id,
|
|
10926
|
+
orderId: order.id,
|
|
10927
|
+
totalPrice: amount,
|
|
10928
|
+
paymentProvider: PaymentProviders.PAGARME,
|
|
10929
|
+
pagarMeOrderId: data.id,
|
|
10930
|
+
transaction: data,
|
|
10931
|
+
});
|
|
10932
|
+
return {
|
|
10933
|
+
status: data.status,
|
|
10934
|
+
success: data.success,
|
|
10935
|
+
};
|
|
10936
|
+
}
|
|
10937
|
+
catch (error) {
|
|
10938
|
+
console.error('Error during refund process for order', order.id, 'with error', error);
|
|
10939
|
+
throw error;
|
|
10940
|
+
}
|
|
10941
|
+
}
|
|
10942
|
+
}
|
|
10943
|
+
|
|
10944
|
+
class PagarmeV5CardAxiosAdapter extends PagarmeV5BaseAxiosAdapter {
|
|
10863
10945
|
constructor(credentials, paymentRepository, orderBlockedRepository) {
|
|
10946
|
+
super(credentials, paymentRepository);
|
|
10864
10947
|
this.credentials = credentials;
|
|
10865
10948
|
this.paymentRepository = paymentRepository;
|
|
10866
10949
|
this.orderBlockedRepository = orderBlockedRepository;
|
|
@@ -11030,8 +11113,9 @@ class PagarmeV5CardAxiosAdapter {
|
|
|
11030
11113
|
}
|
|
11031
11114
|
}
|
|
11032
11115
|
|
|
11033
|
-
class PagarmeV5PixAxiosAdapter {
|
|
11116
|
+
class PagarmeV5PixAxiosAdapter extends PagarmeV5BaseAxiosAdapter {
|
|
11034
11117
|
constructor(credentials, paymentRepository) {
|
|
11118
|
+
super(credentials, paymentRepository);
|
|
11035
11119
|
this.credentials = credentials;
|
|
11036
11120
|
this.paymentRepository = paymentRepository;
|
|
11037
11121
|
}
|
|
@@ -11225,4 +11309,4 @@ class ProductsVertexSearch {
|
|
|
11225
11309
|
}
|
|
11226
11310
|
}
|
|
11227
11311
|
|
|
11228
|
-
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, BrandCategory, BrandCategoryFirestoreRepository, 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, ErrorsCode, 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, InvalidCheckoutError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, LogDocument, LogFirestoreRepository, Logger, MercadoPagoBankSlipAxiosAdapter, MercadoPagoCardAxiosAdapter, MercadoPagoErrorHelper, MercadoPagoPaymentMethodFactory, MercadoPagoPixAxiosAdapter, MercadoPagoRequestHelper, MercadoPagoResponseHelper, MercadoPagoStatusDetailEnum, MercadoPagoStatusEnum, NotFoundError, ObsEmitter, OfficePosition, Order, OrderBlocked, OrderBlockedFirestoreRepository, OrderBlockedType, OrderFirestoreRepository, OrderPaymentStatus, OrderStatus, PagarMeV5OrderStatus, PagarMeV5PaymentStatus, PagarmeBankSlipAxiosAdapter, PagarmeCardAxiosAdapter, PagarmePaymentMethodFactory, PagarmePaymentStatus, PagarmePixAxiosAdapter, PagarmeV5BankSlipAxiosAdapter, PagarmeV5CardAxiosAdapter, PagarmeV5PixAxiosAdapter, Payment, PaymentError, PaymentFirestoreRepository, PaymentMethods, PaymentProviderFactory, PaymentProviders, PaymentTransaction, PaymentType, PersonTypes, Plans, Product, ProductCatalogHasuraGraphQL, ProductCatalogHasuraGraphQLRepository, ProductErrors, ProductErrorsHasuraGraphQL, ProductErrorsHasuraGraphQLRepository, ProductFirestoreRepository, ProductGroup, ProductGroupHasuraGraphQLRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductLabelEnum, ProductPriceLog, ProductPriceLogHasuraGraphQLRepository, ProductReview, ProductReviewHasuraGraphQLRepository, ProductSpents, ProductStockEntry, ProductStockEntryHasuraGraphQL, ProductStockEntryHasuraGraphQLRepository, ProductStockNotification, ProductStockNotificationHasuraGraphQLRepository, ProductVariantFirestoreRepository, ProductsIndex, ProductsVertexSearch, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RestCacheAdapter, RoundProductPricesHelper, Sequence, SequenceFirestoreRepository, ShippingMethod, ShopConfigs, ShopConfigsFirestoreRepository, 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 };
|
|
11312
|
+
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, BrandCategory, BrandCategoryFirestoreRepository, 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, ErrorsCode, 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, InvalidCheckoutError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, LogDocument, LogFirestoreRepository, Logger, MercadoPagoBankSlipAxiosAdapter, MercadoPagoCardAxiosAdapter, MercadoPagoErrorHelper, MercadoPagoPaymentMethodFactory, MercadoPagoPixAxiosAdapter, MercadoPagoRequestHelper, MercadoPagoResponseHelper, MercadoPagoStatusDetailEnum, MercadoPagoStatusEnum, NotFoundError, ObsEmitter, OfficePosition, Order, OrderBlocked, OrderBlockedFirestoreRepository, OrderBlockedType, OrderFirestoreRepository, OrderPaymentStatus, OrderStatus, PagarMeV5OrderStatus, PagarMeV5PaymentStatus, PagarmeBankSlipAxiosAdapter, PagarmeCardAxiosAdapter, PagarmePaymentMethodFactory, PagarmePaymentStatus, PagarmePixAxiosAdapter, PagarmeV5BankSlipAxiosAdapter, PagarmeV5BaseAxiosAdapter, PagarmeV5CardAxiosAdapter, PagarmeV5PixAxiosAdapter, Payment, PaymentError, PaymentFirestoreRepository, PaymentMethods, PaymentProviderFactory, PaymentProviders, PaymentTransaction, PaymentType, PersonTypes, Plans, Product, ProductCatalogHasuraGraphQL, ProductCatalogHasuraGraphQLRepository, ProductErrors, ProductErrorsHasuraGraphQL, ProductErrorsHasuraGraphQLRepository, ProductFirestoreRepository, ProductGroup, ProductGroupHasuraGraphQLRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductLabelEnum, ProductPriceLog, ProductPriceLogHasuraGraphQLRepository, ProductReview, ProductReviewHasuraGraphQLRepository, ProductSpents, ProductStockEntry, ProductStockEntryHasuraGraphQL, ProductStockEntryHasuraGraphQLRepository, ProductStockNotification, ProductStockNotificationHasuraGraphQLRepository, ProductVariantFirestoreRepository, ProductsIndex, ProductsVertexSearch, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RestCacheAdapter, RoundProductPricesHelper, Sequence, SequenceFirestoreRepository, ShippingMethod, ShopConfigs, ShopConfigsFirestoreRepository, 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
|
@@ -22,4 +22,12 @@ export declare class Order extends Checkout {
|
|
|
22
22
|
plataform?: string;
|
|
23
23
|
origin?: string;
|
|
24
24
|
};
|
|
25
|
+
updatedBy?: {
|
|
26
|
+
id?: string;
|
|
27
|
+
name: string;
|
|
28
|
+
email?: string;
|
|
29
|
+
origin: string;
|
|
30
|
+
updatedAt: Date;
|
|
31
|
+
};
|
|
32
|
+
reshipmentCancellationReason?: string;
|
|
25
33
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MercadoPagoCredentials, Order, PaymentRepository } from '../../../domain';
|
|
2
|
+
export declare class MercadoPagoBaseAxiosAdapter {
|
|
3
|
+
protected credentials: MercadoPagoCredentials;
|
|
4
|
+
protected paymentRepository: PaymentRepository;
|
|
5
|
+
constructor(credentials: MercadoPagoCredentials, paymentRepository: PaymentRepository);
|
|
6
|
+
refund(order: Order, amount: number): Promise<{
|
|
7
|
+
status: string;
|
|
8
|
+
success: boolean;
|
|
9
|
+
}>;
|
|
10
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { BusinessUnitEnum, CardInfo, Checkout, MercadoPagoCard, MercadoPagoCardTokenResponse, MercadoPagoCredentials, OrderBlockedRepository, Payment, PaymentCardInfo, PaymentProviderCard, PaymentRepository, PaymentTransaction, Shops, User, UserAddress } from '../../../domain';
|
|
2
2
|
import { MercadoPagoResponse } from '../types';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { MercadoPagoBaseAxiosAdapter } from './mercado-pago-base-axios';
|
|
4
|
+
export declare class MercadoPagoCardAxiosAdapter extends MercadoPagoBaseAxiosAdapter implements PaymentProviderCard<MercadoPagoCard> {
|
|
5
|
+
protected credentials: MercadoPagoCredentials;
|
|
6
|
+
protected paymentRepository: PaymentRepository;
|
|
7
|
+
protected orderBlockedRepository: OrderBlockedRepository;
|
|
7
8
|
constructor(credentials: MercadoPagoCredentials, paymentRepository: PaymentRepository, orderBlockedRepository: OrderBlockedRepository);
|
|
8
9
|
pay(checkout: Checkout, card: PaymentCardInfo): Promise<Payment>;
|
|
9
10
|
requestPayment(checkout: Checkout, payload: any): Promise<MercadoPagoResponse>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Checkout, MercadoPagoCredentials, Payment, PaymentProviderPix, PaymentRepository } from '../../../domain';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { MercadoPagoBaseAxiosAdapter } from './mercado-pago-base-axios';
|
|
3
|
+
export declare class MercadoPagoPixAxiosAdapter extends MercadoPagoBaseAxiosAdapter implements PaymentProviderPix {
|
|
4
|
+
protected credentials: MercadoPagoCredentials;
|
|
5
|
+
protected paymentRepository: PaymentRepository;
|
|
5
6
|
constructor(credentials: MercadoPagoCredentials, paymentRepository: PaymentRepository);
|
|
6
7
|
pay(checkout: Checkout): Promise<Payment>;
|
|
7
8
|
}
|
|
@@ -186,3 +186,26 @@ export type MercadoPagoResponse = {
|
|
|
186
186
|
accounts_info?: any;
|
|
187
187
|
tags?: any;
|
|
188
188
|
};
|
|
189
|
+
export type MercadoPagoRefundResponse = {
|
|
190
|
+
id: number;
|
|
191
|
+
payment_id: number;
|
|
192
|
+
amount: number;
|
|
193
|
+
metadata: Array<Record<string, unknown>>;
|
|
194
|
+
source: Array<{
|
|
195
|
+
name: {
|
|
196
|
+
en: string;
|
|
197
|
+
pt: string;
|
|
198
|
+
es: string;
|
|
199
|
+
};
|
|
200
|
+
id: string;
|
|
201
|
+
type: string;
|
|
202
|
+
}>;
|
|
203
|
+
date_created: string;
|
|
204
|
+
unique_sequence_number: string | null;
|
|
205
|
+
refund_mode: string;
|
|
206
|
+
adjustment_amount: number;
|
|
207
|
+
status: MercadoPagoStatus;
|
|
208
|
+
reason: string | null;
|
|
209
|
+
label: Array<Record<string, unknown>>;
|
|
210
|
+
partition_details: Array<Record<string, unknown>>;
|
|
211
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Order, PagarmeCredentialsV5, PaymentRepository } from '../../../../domain';
|
|
2
|
+
export declare class PagarmeV5BaseAxiosAdapter {
|
|
3
|
+
protected credentials: PagarmeCredentialsV5;
|
|
4
|
+
protected paymentRepository: PaymentRepository;
|
|
5
|
+
constructor(credentials: PagarmeCredentialsV5, paymentRepository: PaymentRepository);
|
|
6
|
+
refund(order: Order, amount: number): Promise<{
|
|
7
|
+
status: string;
|
|
8
|
+
success: boolean;
|
|
9
|
+
}>;
|
|
10
|
+
}
|
|
@@ -5,10 +5,11 @@ import { Checkout, Payment, PaymentTransaction } from '../../../../domain/shoppi
|
|
|
5
5
|
import { OrderBlockedRepository, PaymentRepository } from '../../../../domain/shopping/repositories';
|
|
6
6
|
import { CardInfo, PagarMeCard, PagarmeCredentialsV5, PaymentCardInfo } from '../../../../domain/shopping/types';
|
|
7
7
|
import { PagarMeV5Customer } from '../../types';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
import { PagarmeV5BaseAxiosAdapter } from './pagarmev5-base-axios';
|
|
9
|
+
export declare class PagarmeV5CardAxiosAdapter extends PagarmeV5BaseAxiosAdapter implements PaymentProviderCard<PagarMeCard> {
|
|
10
|
+
protected credentials: PagarmeCredentialsV5;
|
|
11
|
+
protected paymentRepository: PaymentRepository;
|
|
12
|
+
protected orderBlockedRepository: OrderBlockedRepository;
|
|
12
13
|
constructor(credentials: PagarmeCredentialsV5, paymentRepository: PaymentRepository, orderBlockedRepository: OrderBlockedRepository);
|
|
13
14
|
pay(checkout: Checkout, card: PaymentCardInfo): Promise<Payment>;
|
|
14
15
|
addCard(card: CardInfo, customer: User & {
|
|
@@ -2,9 +2,10 @@ import { PagarmeCredentialsV5 } from '../../../../domain';
|
|
|
2
2
|
import { PaymentProviderPix } from '../../../../domain/shopping/interfaces';
|
|
3
3
|
import { Checkout, Payment } from '../../../../domain/shopping/models';
|
|
4
4
|
import { PaymentRepository } from '../../../../domain/shopping/repositories';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import { PagarmeV5BaseAxiosAdapter } from './pagarmev5-base-axios';
|
|
6
|
+
export declare class PagarmeV5PixAxiosAdapter extends PagarmeV5BaseAxiosAdapter implements PaymentProviderPix {
|
|
7
|
+
protected credentials: PagarmeCredentialsV5;
|
|
8
|
+
protected paymentRepository: PaymentRepository;
|
|
8
9
|
constructor(credentials: PagarmeCredentialsV5, paymentRepository: PaymentRepository);
|
|
9
10
|
pay(checkout: Checkout): Promise<Payment>;
|
|
10
11
|
}
|
|
@@ -124,3 +124,119 @@ export type PagarMeV5Transaction = {
|
|
|
124
124
|
created_at: string;
|
|
125
125
|
updated_at: string;
|
|
126
126
|
};
|
|
127
|
+
export type PagarMeV5RefundResponse = {
|
|
128
|
+
id: string;
|
|
129
|
+
code: string;
|
|
130
|
+
gateway_id: string;
|
|
131
|
+
amount: number;
|
|
132
|
+
paid_amount: number;
|
|
133
|
+
canceled_amount: number;
|
|
134
|
+
status: PagarMeV5OrderStatus;
|
|
135
|
+
success: boolean;
|
|
136
|
+
currency: string;
|
|
137
|
+
payment_method: string;
|
|
138
|
+
paid_at: string;
|
|
139
|
+
canceled_at: string;
|
|
140
|
+
created_at: string;
|
|
141
|
+
updated_at: string;
|
|
142
|
+
order: {
|
|
143
|
+
id: string;
|
|
144
|
+
code: string;
|
|
145
|
+
amount: number;
|
|
146
|
+
closed: boolean;
|
|
147
|
+
created_at: string;
|
|
148
|
+
updated_at: string;
|
|
149
|
+
closed_at: string;
|
|
150
|
+
currency: string;
|
|
151
|
+
status: PagarMeV5OrderStatus;
|
|
152
|
+
customer_id: string;
|
|
153
|
+
};
|
|
154
|
+
customer: {
|
|
155
|
+
id: string;
|
|
156
|
+
name: string;
|
|
157
|
+
email: string;
|
|
158
|
+
code: string;
|
|
159
|
+
document: string;
|
|
160
|
+
document_type: string;
|
|
161
|
+
type: string;
|
|
162
|
+
delinquent: boolean;
|
|
163
|
+
address: {
|
|
164
|
+
id: string;
|
|
165
|
+
line_1: string;
|
|
166
|
+
line_2: string;
|
|
167
|
+
zip_code: string;
|
|
168
|
+
city: string;
|
|
169
|
+
state: string;
|
|
170
|
+
country: string;
|
|
171
|
+
status: string;
|
|
172
|
+
created_at: string;
|
|
173
|
+
updated_at: string;
|
|
174
|
+
};
|
|
175
|
+
created_at: string;
|
|
176
|
+
updated_at: string;
|
|
177
|
+
birthdate: string;
|
|
178
|
+
phones: {
|
|
179
|
+
home_phone: {
|
|
180
|
+
country_code: string;
|
|
181
|
+
number: string;
|
|
182
|
+
area_code: string;
|
|
183
|
+
};
|
|
184
|
+
mobile_phone: {
|
|
185
|
+
country_code: string;
|
|
186
|
+
number: string;
|
|
187
|
+
area_code: string;
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
last_transaction: {
|
|
192
|
+
brand_id: string;
|
|
193
|
+
id: string;
|
|
194
|
+
transaction_type: string;
|
|
195
|
+
gateway_id: string;
|
|
196
|
+
amount: number;
|
|
197
|
+
status: PagarMeV5PaymentStatus;
|
|
198
|
+
success: boolean;
|
|
199
|
+
installments: number;
|
|
200
|
+
statement_descriptor: string;
|
|
201
|
+
acquirer_name: string;
|
|
202
|
+
acquirer_tid: string;
|
|
203
|
+
acquirer_nsu: string;
|
|
204
|
+
acquirer_auth_code: string;
|
|
205
|
+
acquirer_message: string;
|
|
206
|
+
acquirer_return_code: string;
|
|
207
|
+
operation_type: string;
|
|
208
|
+
card: {
|
|
209
|
+
id: string;
|
|
210
|
+
first_six_digits: string;
|
|
211
|
+
last_four_digits: string;
|
|
212
|
+
brand: string;
|
|
213
|
+
holder_name: string;
|
|
214
|
+
holder_document: string;
|
|
215
|
+
exp_month: number;
|
|
216
|
+
exp_year: number;
|
|
217
|
+
status: string;
|
|
218
|
+
type: string;
|
|
219
|
+
created_at: string;
|
|
220
|
+
updated_at: string;
|
|
221
|
+
billing_address: {
|
|
222
|
+
zip_code: string;
|
|
223
|
+
city: string;
|
|
224
|
+
state: string;
|
|
225
|
+
country: string;
|
|
226
|
+
line_1: string;
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
funding_source: string;
|
|
230
|
+
created_at: string;
|
|
231
|
+
updated_at: string;
|
|
232
|
+
gateway_response: {
|
|
233
|
+
code: string;
|
|
234
|
+
};
|
|
235
|
+
antifraud_response: {
|
|
236
|
+
status: string;
|
|
237
|
+
score: string;
|
|
238
|
+
provider_name: string;
|
|
239
|
+
};
|
|
240
|
+
metadata: Record<string, unknown>;
|
|
241
|
+
};
|
|
242
|
+
};
|