@infrab4a/connect 5.6.5-beta.2 → 5.6.5-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js
CHANGED
|
@@ -9932,7 +9932,7 @@ class MercadoPagoBaseAxiosAdapter {
|
|
|
9932
9932
|
async refund(order, amount) {
|
|
9933
9933
|
const { data } = await axios__default["default"]({
|
|
9934
9934
|
method: 'POST',
|
|
9935
|
-
url: `${this.credentials.url}/payments/${order.payment.id}/refunds`,
|
|
9935
|
+
url: `${this.credentials.url}/v1/payments/${order.payment.id}/refunds`,
|
|
9936
9936
|
headers: {
|
|
9937
9937
|
'X-Idempotency-Key': `${order.payment.charger_id}-${new Date().getTime()}`,
|
|
9938
9938
|
Authorization: `Bearer ${this.credentials.api_key}`,
|
|
@@ -9954,10 +9954,31 @@ class MercadoPagoBaseAxiosAdapter {
|
|
|
9954
9954
|
});
|
|
9955
9955
|
console.warn('[RESPONSE MERCADO PAGO REFUND]', JSON.stringify(data));
|
|
9956
9956
|
return {
|
|
9957
|
-
status: data.status,
|
|
9958
|
-
success:
|
|
9957
|
+
status: this.getRefundStatus(data.status),
|
|
9958
|
+
success: [
|
|
9959
|
+
exports.MercadoPagoStatusEnum.approved,
|
|
9960
|
+
exports.MercadoPagoStatusEnum.refunded,
|
|
9961
|
+
exports.MercadoPagoStatusEnum.cancelled,
|
|
9962
|
+
exports.MercadoPagoStatusEnum.authorized,
|
|
9963
|
+
].includes(data.status)
|
|
9964
|
+
? true
|
|
9965
|
+
: false,
|
|
9959
9966
|
};
|
|
9960
9967
|
}
|
|
9968
|
+
getRefundStatus(status) {
|
|
9969
|
+
if ([exports.MercadoPagoStatusEnum.in_process, exports.MercadoPagoStatusEnum.pending].includes(status)) {
|
|
9970
|
+
return 'processing';
|
|
9971
|
+
}
|
|
9972
|
+
if ([
|
|
9973
|
+
exports.MercadoPagoStatusEnum.approved,
|
|
9974
|
+
exports.MercadoPagoStatusEnum.refunded,
|
|
9975
|
+
exports.MercadoPagoStatusEnum.cancelled,
|
|
9976
|
+
exports.MercadoPagoStatusEnum.authorized,
|
|
9977
|
+
].includes(status)) {
|
|
9978
|
+
return 'success';
|
|
9979
|
+
}
|
|
9980
|
+
return 'unknown';
|
|
9981
|
+
}
|
|
9961
9982
|
}
|
|
9962
9983
|
|
|
9963
9984
|
class MercadoPagoCardAxiosAdapter extends MercadoPagoBaseAxiosAdapter {
|
|
@@ -10954,8 +10975,8 @@ class PagarmeV5BaseAxiosAdapter {
|
|
|
10954
10975
|
transaction: data,
|
|
10955
10976
|
});
|
|
10956
10977
|
return {
|
|
10957
|
-
status: data.status,
|
|
10958
|
-
success:
|
|
10978
|
+
status: this.getRefundStatus(data.status),
|
|
10979
|
+
success: [exports.PagarMeV5OrderStatus.Pago, exports.PagarMeV5OrderStatus.Cancelado].includes(data.status) ? true : false,
|
|
10959
10980
|
};
|
|
10960
10981
|
}
|
|
10961
10982
|
catch (error) {
|
|
@@ -10963,6 +10984,15 @@ class PagarmeV5BaseAxiosAdapter {
|
|
|
10963
10984
|
throw error;
|
|
10964
10985
|
}
|
|
10965
10986
|
}
|
|
10987
|
+
getRefundStatus(status) {
|
|
10988
|
+
if ([exports.PagarMeV5PaymentStatus['Em processamento']].includes(status)) {
|
|
10989
|
+
return 'processing';
|
|
10990
|
+
}
|
|
10991
|
+
if ([exports.PagarMeV5OrderStatus.Pago, exports.PagarMeV5OrderStatus.Cancelado].includes(status)) {
|
|
10992
|
+
return 'success';
|
|
10993
|
+
}
|
|
10994
|
+
return 'unknown';
|
|
10995
|
+
}
|
|
10966
10996
|
}
|
|
10967
10997
|
|
|
10968
10998
|
class PagarmeV5CardAxiosAdapter extends PagarmeV5BaseAxiosAdapter {
|
package/index.esm.js
CHANGED
|
@@ -9908,7 +9908,7 @@ class MercadoPagoBaseAxiosAdapter {
|
|
|
9908
9908
|
async refund(order, amount) {
|
|
9909
9909
|
const { data } = await axios({
|
|
9910
9910
|
method: 'POST',
|
|
9911
|
-
url: `${this.credentials.url}/payments/${order.payment.id}/refunds`,
|
|
9911
|
+
url: `${this.credentials.url}/v1/payments/${order.payment.id}/refunds`,
|
|
9912
9912
|
headers: {
|
|
9913
9913
|
'X-Idempotency-Key': `${order.payment.charger_id}-${new Date().getTime()}`,
|
|
9914
9914
|
Authorization: `Bearer ${this.credentials.api_key}`,
|
|
@@ -9930,10 +9930,31 @@ class MercadoPagoBaseAxiosAdapter {
|
|
|
9930
9930
|
});
|
|
9931
9931
|
console.warn('[RESPONSE MERCADO PAGO REFUND]', JSON.stringify(data));
|
|
9932
9932
|
return {
|
|
9933
|
-
status: data.status,
|
|
9934
|
-
success:
|
|
9933
|
+
status: this.getRefundStatus(data.status),
|
|
9934
|
+
success: [
|
|
9935
|
+
MercadoPagoStatusEnum.approved,
|
|
9936
|
+
MercadoPagoStatusEnum.refunded,
|
|
9937
|
+
MercadoPagoStatusEnum.cancelled,
|
|
9938
|
+
MercadoPagoStatusEnum.authorized,
|
|
9939
|
+
].includes(data.status)
|
|
9940
|
+
? true
|
|
9941
|
+
: false,
|
|
9935
9942
|
};
|
|
9936
9943
|
}
|
|
9944
|
+
getRefundStatus(status) {
|
|
9945
|
+
if ([MercadoPagoStatusEnum.in_process, MercadoPagoStatusEnum.pending].includes(status)) {
|
|
9946
|
+
return 'processing';
|
|
9947
|
+
}
|
|
9948
|
+
if ([
|
|
9949
|
+
MercadoPagoStatusEnum.approved,
|
|
9950
|
+
MercadoPagoStatusEnum.refunded,
|
|
9951
|
+
MercadoPagoStatusEnum.cancelled,
|
|
9952
|
+
MercadoPagoStatusEnum.authorized,
|
|
9953
|
+
].includes(status)) {
|
|
9954
|
+
return 'success';
|
|
9955
|
+
}
|
|
9956
|
+
return 'unknown';
|
|
9957
|
+
}
|
|
9937
9958
|
}
|
|
9938
9959
|
|
|
9939
9960
|
class MercadoPagoCardAxiosAdapter extends MercadoPagoBaseAxiosAdapter {
|
|
@@ -10930,8 +10951,8 @@ class PagarmeV5BaseAxiosAdapter {
|
|
|
10930
10951
|
transaction: data,
|
|
10931
10952
|
});
|
|
10932
10953
|
return {
|
|
10933
|
-
status: data.status,
|
|
10934
|
-
success:
|
|
10954
|
+
status: this.getRefundStatus(data.status),
|
|
10955
|
+
success: [PagarMeV5OrderStatus.Pago, PagarMeV5OrderStatus.Cancelado].includes(data.status) ? true : false,
|
|
10935
10956
|
};
|
|
10936
10957
|
}
|
|
10937
10958
|
catch (error) {
|
|
@@ -10939,6 +10960,15 @@ class PagarmeV5BaseAxiosAdapter {
|
|
|
10939
10960
|
throw error;
|
|
10940
10961
|
}
|
|
10941
10962
|
}
|
|
10963
|
+
getRefundStatus(status) {
|
|
10964
|
+
if ([PagarMeV5PaymentStatus['Em processamento']].includes(status)) {
|
|
10965
|
+
return 'processing';
|
|
10966
|
+
}
|
|
10967
|
+
if ([PagarMeV5OrderStatus.Pago, PagarMeV5OrderStatus.Cancelado].includes(status)) {
|
|
10968
|
+
return 'success';
|
|
10969
|
+
}
|
|
10970
|
+
return 'unknown';
|
|
10971
|
+
}
|
|
10942
10972
|
}
|
|
10943
10973
|
|
|
10944
10974
|
class PagarmeV5CardAxiosAdapter extends PagarmeV5BaseAxiosAdapter {
|
package/package.json
CHANGED