Commit fa52c827 authored by mattwire's avatar mattwire

Support ECMAScript 5.1. Support translating text strings in javascript

parent d59c2702
......@@ -24,6 +24,8 @@ Where:
* API3 Stripe.Listevents [!117](https://lab.civicrm.org/extensions/stripe/-/merge_requests/117) Provide additional information about stripe events.
* If a contribution status is `Failed` and it later receives a successful payment notification it is updated from `Failed` to `Completed`.
* Add system check for 'Is separate membership payment' on contribution pages which is not supported by the Stripe extension
* Fix [#225](https://lab.civicrm.org/extensions/stripe/-/issues/225) No credit card display in Internet Explorer 11 (Support ECMAScript 5.1 javascript syntax).
* Support translating text strings in javascript.
* Fix PHP notices:
* When a checking for an extension dependency that is not yet downloaded or installed.
......
......@@ -2,7 +2,7 @@
* This handles confirmation actions on the "Thankyou" pages for
* contribution/event workflows.
*/
(function($, CRM, _, undefined) {
(function($, ts) {
var confirm = {
scriptName: 'stripeconfirm',
......@@ -16,7 +16,7 @@
CRM.payment.debugging(confirm.scriptName, result.error.message);
confirm.swalFire({
title: result.error.message,
icon: 'error',
icon: 'error'
}, '', true);
}
else
......@@ -28,8 +28,8 @@
// All good, nothing more to do
CRM.payment.debugging(confirm.scriptName, 'success - payment captured');
confirm.swalFire({
title: 'Payment successful',
icon: 'success',
title: ts('Payment successful'),
icon: 'success'
}, '', true);
}
},
......@@ -71,11 +71,11 @@
handleCardConfirm: function() {
CRM.payment.debugging(confirm.scriptName, 'handle card confirm');
confirm.swalFire({
title: 'Please wait...',
title: ts('Please wait...'),
allowOutsideClick: false,
onBeforeOpen: () => {
onBeforeOpen: function() {
Swal.showLoading();
},
}
}, '', false);
// Send paymentMethod.id to server
var url = CRM.url('civicrm/stripe/confirm-payment');
......@@ -84,7 +84,7 @@
capture: true,
id: CRM.vars.stripe.id,
description: document.title,
csrfToken: CRM.vars.stripe.csrfToken,
csrfToken: CRM.vars.stripe.csrfToken
})
.done(function (result) {
confirm.swalClose();
......@@ -108,7 +108,7 @@
url: 'https://js.stripe.com/v3',
dataType: 'script',
cache: true,
timeout: 5000,
timeout: 5000
})
.done(function(data) {
confirm.stripeLoading = false;
......@@ -177,4 +177,4 @@
// Disable the browser "Leave Page Alert" which is triggered because we mess with the form submit function.
window.onbeforeunload = null;
}(jQuery, CRM, _));
}(CRM.$, CRM.ts('com.drastikbydesign.stripe')));
/**
* JS Integration between CiviCRM & Stripe.
*/
CRM.$(function($) {
(function($, ts) {
debugging("civicrm_stripe loaded, dom-ready function firing.");
if (window.civicrmStripeHandleReload) {
......@@ -99,14 +99,14 @@ CRM.$(function($) {
swalFire({
icon: 'error',
text: errorMessage,
title: '',
title: ''
}, '#card-element', true);
}
}
function getPaymentElements() {
return {
card: $('div#card-element'),
card: $('div#card-element')
};
}
......@@ -160,12 +160,12 @@ CRM.$(function($) {
// Send paymentMethod.id to server
debugging('Waiting for pre-auth');
swalFire({
title: 'Please wait',
text: ' while we pre-authorize your card...',
title: ts('Please wait'),
text: ts(' while we pre-authorize your card...'),
allowOutsideClick: false,
onBeforeOpen: () => {
onBeforeOpen: function() {
Swal.showLoading();
},
}
}, '', false);
var url = CRM.url('civicrm/stripe/confirm-payment');
$.post(url, {
......@@ -174,7 +174,7 @@ CRM.$(function($) {
currency: CRM.vars.stripe.currency,
id: CRM.vars.stripe.id,
description: document.title,
csrfToken: CRM.vars.stripe.csrfToken,
csrfToken: CRM.vars.stripe.csrfToken
})
.done(function (result) {
// Handle server response (see Step 3)
......@@ -251,7 +251,7 @@ CRM.$(function($) {
dataType: 'script',
cache: true,
timeout: 5000,
crossDomain: true,
crossDomain: true
})
.done(function(data) {
stripeLoading = false;
......@@ -295,8 +295,8 @@ CRM.$(function($) {
var style = {
base: {
fontSize: '20px',
},
fontSize: '20px'
}
};
var elementsCreateParams = {style: style, value: {}};
......@@ -410,7 +410,7 @@ CRM.$(function($) {
swalFire({
icon: 'error',
text: ts('Please check and fill in all required fields!'),
title: '',
title: ''
}, '#crm-container', true);
triggerEvent('crmBillingFormNotValid');
form.dataset.submitted = 'false';
......@@ -426,7 +426,7 @@ CRM.$(function($) {
swalFire({
icon: 'warning',
text: '',
title: cardError,
title: cardError
}, '#card-element', true);
triggerEvent('crmBillingFormNotValid');
form.dataset.submitted = 'false';
......@@ -441,7 +441,7 @@ CRM.$(function($) {
swalFire({
icon: 'error',
text: '',
title: cardError,
title: cardError
}, '#card-element', true);
triggerEvent('crmBillingFormNotValid');
form.dataset.submitted = 'false';
......@@ -568,7 +568,7 @@ CRM.$(function($) {
swalFire({
icon: 'warning',
text: '',
title: ts('Please complete the reCaptcha'),
title: ts('Please complete the reCaptcha')
}, '.recaptcha-section', true);
triggerEvent('crmBillingFormNotValid');
form.dataset.submitted = 'false';
......@@ -869,7 +869,7 @@ CRM.$(function($) {
function triggerEventCrmBillingFormReloadFailed() {
triggerEvent('crmBillingFormReloadFailed');
hidePaymentElements();
displayError('Could not load payment element - Is there a problem with your network connection?', true);
displayError(ts('Could not load payment element - Is there a problem with your network connection?'), true);
}
/**
......@@ -899,4 +899,4 @@ CRM.$(function($) {
}
}
});
}(CRM.$, CRM.ts('com.drastikbydesign.stripe')));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment