Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v24.2.0 #4

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Changelog

## [24.2.0] - 2024-03-18

### Added
- Added error messages (remedies) to payers and sellers
- Added new iframe for payment with 3DS


## [24.1.0] - 2024-01-23

### Added
- Added information about interest on installments
- Added information about interest on installments

Original file line number Diff line number Diff line change
Expand Up @@ -476,46 +476,40 @@ function submitPayment(paymentMethodId, mpToken, defer) {
return p; // eslint-disable-line
},

/**
* Challenge URL.
*
*/
buildChallengeURL: function (threeDsData) {
return threeDsData.external_resource_url + '?creq=' + threeDsData.creq;
},

/**
* Challenge service call.
*
*/
loadChallengeInfo: function (threeDsData) {
$.ajax({
type: "POST",
async: false,
url: members.buildChallengeURL(threeDsData),
beforeSend: function (xhr) {
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
},
success: function (data) {
setTimeout(function () {
$('body').on('click', '.three-ds-modal-box .modal-button-close', function () {
$('body').trigger('checkout:close3dsModal', $('.three-ds-modal-box'));
members.showErrorMessage(threeDsData.mpErrorMessage);
});
members.modalVisibilityMode('.loading-area', true);
members.modalVisibilityMode('.validation-area', false);
members.createIframe();
var iframeDoc = document.querySelector('#iframe-challenge').contentWindow.document;
iframeDoc.open('text/html', 'replace');
iframeDoc.write(data);
iframeDoc.close();
}, 5000)
},
error: function (error) {
const message = error.message || error;
try {
var iframe = document.createElement("iframe");
iframe.name = "myframe";
iframe.id = "myframe";
iframe.height = "500px";
iframe.width = "600px";
document.body.appendChild(iframe);

var idocument = iframe.contentWindow.document;

var myform = idocument.createElement("form");
myform.name = "myform";
myform.setAttribute("target", "myframe");
myform.setAttribute("method", "post");
myform.setAttribute("action", threeDsData.external_resource_url);

var hiddenField = idocument.createElement("input");
hiddenField.setAttribute("type", "hidden");
hiddenField.setAttribute("name", "creq");
hiddenField.setAttribute("value", threeDsData.creq);
myform.appendChild(hiddenField);
iframe.appendChild(myform);

myform.submit();

} catch (error) {
const message = error.message || error;
members.sendMetric('mp_3ds_sales_error_load_challenge_info', message, threeDsData);
}
});
}
},

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,14 @@ function validateAmountPaid(order, paymentInfo) {
* @param {*} paymentInfo - Object containing the payment information sent by MercadoPago
*/
function updatePaymentInfo(order, paymentInfo) {
const msgErrorDefault = Resource.msg("seller_status_detail.cc_rejected_default", "mercadopago", null);
const lastDetail = paymentInfo.payments_details.pop();
const msgPaymentStatus = Resource.msg("status." + paymentInfo.status, "mercadopago", null);
const msgPaymentReport = Resource.msg("status_detail." + lastDetail.status_detail, "mercadopago", null);
const msgPaymentReport = Resource.msg(
"seller_status_detail." + lastDetail.status_detail,
"mercadopago",
Resource.msg("status_detail." + lastDetail.status_detail, "mercadopago", msgErrorDefault)
);

Transaction.wrap(() => {
order.addNote("Mercadopago Notification status: ", paymentInfo.status);
Expand Down Expand Up @@ -244,7 +249,7 @@ function paymentNotifications(req, res, next) {
const localeID = req.locale.id;
savePaymentInformation(order, paymentInfo, localeID);
Transaction.wrap(() => {
order.addNote("Mercadopago notification: ", JSON.stringify(paymentInfo));
order.addNote("Mercadopago notification: ", JSON.stringify(paymentInfo, null, 2));
});
} else {
log.info("Order not found!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,19 @@ function savePaymentInformation(paymentInstrument, paymentResponse, order) {
}

function authorizationErrorHandler(statusDetail) {
const msgErrorDefault = Resource.msg("seller_status_detail.cc_rejected_default", "mercadopago", null);

return {
fieldErrors: [],
serverErrors: [Resource.msg(
"status_detail." + statusDetail,
"mercadopago",
null
msgErrorDefault
)],
message: Resource.msg(
"status_detail." + statusDetail,
"mercadopago",
null
msgErrorDefault
),
detailedError: statusDetail,
error: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,7 @@ MercadopagoHelpers.prototype.createPreferencePayload = (
},
payment_method_id: paymentMethodId.toLowerCase(),
transaction_amount: transactionAmount.value,
auto_return: "all",
notification_url: URLUtils.https(
"MercadopagoNotification-PaymentNotifications"
).toString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,39 @@ status_detail.accredited=The payment was credited.
status_detail.pending_contingency=The payment is being processed.
status_detail.pending_waiting_transfer=Waiting for payment.
status_detail.pending_review_manual=The payment is under review.
status_detail.cc_rejected_bad_filled_date=The card details are incorrect.
status_detail.cc_rejected_bad_filled_other=The card details are incorrect.
status_detail.cc_rejected_bad_filled_security_code=The card details are incorrect.
status_detail.cc_rejected_blacklist=The payment was rejected due to suspicion of fraud.
status_detail.cc_rejected_call_for_authorize=The payment method used requires prior authorization of the purchase amount.
status_detail.cc_rejected_card_disabled=This card is blocked.
status_detail.cc_rejected_duplicated_payment=You made a similar payment a short time ago. Please use another payment method.
status_detail.cc_rejected_high_risk=Something went wrong with the payment. Please use another card or choose a different payment method.
status_detail.cc_rejected_insufficient_amount=Something went wrong with the payment. Please use another card or choose a different payment method.
status_detail.cc_rejected_invalid_installments=The number of installments chosen is invalid.
status_detail.cc_rejected_max_attempts=The maximum number of attempts was reached.
status_detail.cc_rejected_other_reason=Something went wrong. Please try again.
status_detail.cc_rejected_bad_filled_date=One or more of the card details were entered incorrectly. Please enter them again exactly as they appear on the card to complete the payment.
status_detail.cc_rejected_bad_filled_other=One or more of the card details were entered incorrectly. Please enter them again exactly as they appear on the card to complete the payment.
status_detail.cc_rejected_bad_filled_card_number=One or more of the card details were entered incorrectly. Please enter them again exactly as they appear on the card to complete the payment.
status_detail.cc_rejected_bad_filled_security_code=One or more of the card details were entered incorrectly. Please enter them again exactly as they appear on the card to complete the payment.
status_detail.cc_rejected_blacklist=For safety reasons, the card issuing bank declined the payment. We recommend paying with your usual payment method and device for online purchases.
status_detail.cc_rejected_call_for_authorize=Your bank needs you to authorize the payment. Please call the telephone number on your card or pay with another method.
status_detail.cc_rejected_card_disabled=You have to activate your card. Please contact your bank by calling the number on the back of your card or choose another payment method.
status_detail.cc_rejected_duplicated_payment=Your payment was declined because you already paid for this purchase. Please check your card transactions to verify it.
status_detail.cc_rejected_high_risk=For safety reasons, your payment was declined. We recommend paying with your usual payment method and device for online purchases.
status_detail.cc_rejected_insufficient_amount=Your card has no available limit or insufficient funds. Please choose a different card or another payment method.
status_detail.cc_rejected_invalid_installments=Your card does not accept the number of installments selected. Please choose a different number of installments or use another payment method.
status_detail.cc_rejected_max_attempts=You reached the limit of payment attempts with this card. Please pay with another card or choose another payment method.
status_detail.cc_rejected_other_reason=The card issuing bank declined your payment. We recommend paying with another payment method or contacting your bank.
status_detail.cc_rejected_default=Your payment was declined because something went wrong. We recommend trying again or paying with another payment method.
status_detail.expired=Payment canceled. The deadline for the payment using the Pix code generated by the customer has expired.
status_detail.refunded=The payment was returned to the customer.
status_detail.partially_refunded=The payment was partially returned to the customer.

seller_status_detail.cc_rejected_bad_filled_date=Your customer entered one or more incorrect card details. Please ask them to enter them again exactly as they appear on the card or on their bank app to complete the payment.
seller_status_detail.cc_rejected_bad_filled_other=Your customer entered one or more incorrect card details. Please ask them to enter them again exactly as they appear on the card or on their bank app to complete the payment.
seller_status_detail.cc_rejected_bad_filled_card_number=Your customer entered one or more incorrect card details. Please ask them to enter them again exactly as they appear on the card or on their bank app to complete the payment.
seller_status_detail.cc_rejected_bad_filled_security_code=Your customer entered one or more incorrect card details. Please ask them to enter them again exactly as they appear on the card or on their bank app to complete the payment.
seller_status_detail.cc_rejected_blacklist=For safety reasons, the card issuing bank declined the payment. Recommend your customer to pay with their usual payment method and device for online purchases.
seller_status_detail.cc_rejected_call_for_authorize=Your customer needs to authorize the payment through their bank. Please ask them to call the telephone number on their card or to pay with another method.
seller_status_detail.cc_rejected_card_disabled=Your customers card was is not activated yet. Please ask them to contact their bank by calling the number on the back of their card or to pay with another method.
seller_status_detail.cc_rejected_duplicated_payment=The payment was declined because your customer already paid for this purchase. Check your approved payments to verify it.
seller_status_detail.cc_rejected_high_risk=We protected you from a suspicious payment. Recommend your customer to pay with their usual payment method and device for online purchases.
seller_status_detail.cc_rejected_insufficient_amount=Your customers card has no available limit or insufficient funds. Please ask them to pay with a different card or choose another payment method.
seller_status_detail.cc_rejected_invalid_installments=Your customers card does not accept the number of installments selected. Please ask them to choose a different number of installments or to pay with another method.
seller_status_detail.cc_rejected_max_attempts=Your customer reached the limit of payment attempts with this card. Please ask them to pay with another card or to choose another payment method.
seller_status_detail.cc_rejected_other_reason=The card issuing bank declined the payment. Please recommend your customer to pay with another payment method or to contact their bank.
seller_status_detail.cc_rejected_default=Something went wrong and the payment was declined. Please recommend your customer to try again or to pay with another payment method.

# Error codes
error.106=It is not possible to transfer payments to other countries.
error.109=It is not possible to pay in installments with the payment method you chose. Please use another card or choose a different payment method.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Preferences for Mercado Pago
int_mercadopago.version=24.1.0
int_mercadopago.version=24.2.0
service.name=mercadopagoPayment
mercadopago.platformId=dev_77f425c3400311ed81390242ac130004
mercadopago.productId=CD2MQQ9S64TEI0NRJHP0
Expand Down
Loading