@infrab4a/connect 5.6.5-beta.3 → 5.6.5
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,16 +9954,31 @@ class MercadoPagoBaseAxiosAdapter {
|
|
|
9954
9954
|
});
|
|
9955
9955
|
console.warn('[RESPONSE MERCADO PAGO REFUND]', JSON.stringify(data));
|
|
9956
9956
|
return {
|
|
9957
|
-
status: data.status,
|
|
9957
|
+
status: this.getRefundStatus(data.status),
|
|
9958
9958
|
success: [
|
|
9959
9959
|
exports.MercadoPagoStatusEnum.approved,
|
|
9960
9960
|
exports.MercadoPagoStatusEnum.refunded,
|
|
9961
9961
|
exports.MercadoPagoStatusEnum.cancelled,
|
|
9962
|
+
exports.MercadoPagoStatusEnum.authorized,
|
|
9962
9963
|
].includes(data.status)
|
|
9963
9964
|
? true
|
|
9964
9965
|
: false,
|
|
9965
9966
|
};
|
|
9966
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
|
+
}
|
|
9967
9982
|
}
|
|
9968
9983
|
|
|
9969
9984
|
class MercadoPagoCardAxiosAdapter extends MercadoPagoBaseAxiosAdapter {
|
|
@@ -10960,7 +10975,7 @@ class PagarmeV5BaseAxiosAdapter {
|
|
|
10960
10975
|
transaction: data,
|
|
10961
10976
|
});
|
|
10962
10977
|
return {
|
|
10963
|
-
status: data.status,
|
|
10978
|
+
status: this.getRefundStatus(data.status),
|
|
10964
10979
|
success: [exports.PagarMeV5OrderStatus.Pago, exports.PagarMeV5OrderStatus.Cancelado].includes(data.status) ? true : false,
|
|
10965
10980
|
};
|
|
10966
10981
|
}
|
|
@@ -10969,6 +10984,15 @@ class PagarmeV5BaseAxiosAdapter {
|
|
|
10969
10984
|
throw error;
|
|
10970
10985
|
}
|
|
10971
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
|
+
}
|
|
10972
10996
|
}
|
|
10973
10997
|
|
|
10974
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,16 +9930,31 @@ class MercadoPagoBaseAxiosAdapter {
|
|
|
9930
9930
|
});
|
|
9931
9931
|
console.warn('[RESPONSE MERCADO PAGO REFUND]', JSON.stringify(data));
|
|
9932
9932
|
return {
|
|
9933
|
-
status: data.status,
|
|
9933
|
+
status: this.getRefundStatus(data.status),
|
|
9934
9934
|
success: [
|
|
9935
9935
|
MercadoPagoStatusEnum.approved,
|
|
9936
9936
|
MercadoPagoStatusEnum.refunded,
|
|
9937
9937
|
MercadoPagoStatusEnum.cancelled,
|
|
9938
|
+
MercadoPagoStatusEnum.authorized,
|
|
9938
9939
|
].includes(data.status)
|
|
9939
9940
|
? true
|
|
9940
9941
|
: false,
|
|
9941
9942
|
};
|
|
9942
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
|
+
}
|
|
9943
9958
|
}
|
|
9944
9959
|
|
|
9945
9960
|
class MercadoPagoCardAxiosAdapter extends MercadoPagoBaseAxiosAdapter {
|
|
@@ -10936,7 +10951,7 @@ class PagarmeV5BaseAxiosAdapter {
|
|
|
10936
10951
|
transaction: data,
|
|
10937
10952
|
});
|
|
10938
10953
|
return {
|
|
10939
|
-
status: data.status,
|
|
10954
|
+
status: this.getRefundStatus(data.status),
|
|
10940
10955
|
success: [PagarMeV5OrderStatus.Pago, PagarMeV5OrderStatus.Cancelado].includes(data.status) ? true : false,
|
|
10941
10956
|
};
|
|
10942
10957
|
}
|
|
@@ -10945,6 +10960,15 @@ class PagarmeV5BaseAxiosAdapter {
|
|
|
10945
10960
|
throw error;
|
|
10946
10961
|
}
|
|
10947
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
|
+
}
|
|
10948
10972
|
}
|
|
10949
10973
|
|
|
10950
10974
|
class PagarmeV5CardAxiosAdapter extends PagarmeV5BaseAxiosAdapter {
|
package/package.json
CHANGED