Add new payment and shipping parsers for various integrations

- Implemented Google Pay parser in bongooglepay.js
- Added Buckaroo 3 payment parser in buckaroo3.js
- Introduced DataTrans CW Mastercard parser in datatranscw.js
- Created DataTrans CW Credit Card parser in datatranscw_creditcard.js
- Developed DHL Assistant shipping parser in dhlassistant.js
- Added Estimated Delivery parser in estimateddelivery.js
- Implemented Floapay payment parser in floapay.js
- Created FS Pickup at Store shipping parser in fspickupatstore.js
- Developed Generic Iframe parser in generic_iframe_parser.js
- Added Geodis Officiel shipping parser in geodisofficiel.js
- Implemented Glob Kurier module shipping parser in globkuriermodule.js
- Created Latvija Post Express Pickup Terminal parser in latvijaspastsexpresspastspostterminalslv.js
- Developed LP Shipping parser in lpshipping.js
- Added Mijora Venipak parser in mijoravenipak.js
- Implemented Apple Pay parser in pm_applepay.js
- Created Przelewy24 payment parser in przelewy24.js
- Developed Pshugls shipping parser in pshugls.js
- Added Redsys Insite payment parser in redsysinsite.js
- Implemented Tpay payment parser in tpay.js
- Updated third-party integration documentation for FedEx DotCom
This commit is contained in:
2025-08-04 23:10:27 +02:00
parent 037a6c5551
commit d39433f0d4
125 changed files with 4986 additions and 1772 deletions

View File

@@ -8,10 +8,12 @@
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
/* popup mode last tested on 15.4.2023 with stripe_official v3.0.2 */
/* popup mode last tested on 15.03.2024 with stripe_official v3.2.0 */
/* (!) Set 'Payment Form Position' to 'With the Prestashop payment methods' in Stripe configuration
/* redirect mode last tested on 12.12.2023 with stripe_official v3.1.3 (removed JS redirect, it's supported now natively in stripe_official module through config option) */
checkoutPaymentParser.stripe_official_inline = {
checkoutPaymentParser.stripe_official_redirect = {
all_hooks_content: function (content) {
@@ -19,76 +21,10 @@ checkoutPaymentParser.stripe_official_inline = {
container: function (element) {
//payment.setPopupPaymentType(element);
// Add logos to payment method
// Img path:
var stripe_base_url = '';
if ('undefined' !== typeof prestashop && 'undefined' !== prestashop.urls && 'undefined' !== prestashop.urls.base_url) {
stripe_base_url = prestashop.urls.base_url;
}
element.find('label').append('<img src="' + stripe_base_url + '/modules/stripe_official/views/img/logo-payment.png">');
},
form: function (element) {
// First, set the 'form' action to be our background confirmation button click
// On this background confirmation button, stripe action is hooked
let form = element.find('form');
let onSubmitAction = '$(\'#payment-confirmation button\').click();';
form.attr('action', 'javascript:void(0);');
form.attr('onsubmit', onSubmitAction);
// And now, let's put Stripe's form into static container, so that it's not being refreshed
var paymentOptionForm = element;
var staticContentContainer = $('#thecheckout-payment .static-content');
// Now create new block with original Id and place it inside of static-content block
if (!staticContentContainer.find('.stripe-payment-form').length) {
$('<div class="stripe-payment-form"></div>').appendTo(staticContentContainer);
paymentOptionForm.clone().appendTo(staticContentContainer.find('.stripe-payment-form'));
staticContentContainer.find('.stripe-payment-form script').remove();
// Formatted version - KEEP it
// Init only once - when we're first time moving CC form
// let stripe_orig_script_tag = `
// <script>
// if ($('#stripe-card-element').length && !$('#stripe-card-element.StripeElement').length) {
// var stripe_base_url = '';
// if ('undefined' !== typeof prestashop && 'undefined' !== prestashop.urls && 'undefined' !== prestashop.urls.base_url) {
// stripe_base_url = prestashop.urls.base_url;
// }
// $.getScript(stripe_base_url + '/modules/stripe_official/views/js/payments.js');
// }
// </script>
// `;
// https://babeljs.io/repl
var stripe_orig_script_tag = "\n <script>\n if (($('#stripe-card-element').length && !$('#stripe-card-element.StripeElement').length) || ($('#stripe-card-number').length && !$('#stripe-card-number.StripeElement').length)) {\n var stripe_base_url = '';\n if ('undefined' !== typeof prestashop && 'undefined' !== prestashop.urls && 'undefined' !== prestashop.urls.base_url) {\n stripe_base_url = prestashop.urls.base_url;\n }\n $.getScript(stripe_base_url + '/modules/stripe_official/views/js/payments.js');\n }\n </script>\n ";
//
staticContentContainer.find('.stripe-payment-form').append(stripe_orig_script_tag);
}
// Remove stripe payment form from actual .js-payment-option-form container and keep only "dynamic" part,
// which is <script> tag with dynamically created variables
var scriptTag = paymentOptionForm.find('script');
// stripe_official can have multiple payment options, make sure move only card payment to static-container
if (paymentOptionForm.find('#stripe-card-payment').length) {
paymentOptionForm.find('*').remove();
paymentOptionForm.prepend(scriptTag);
// Update ID of fixed form, so that it's displayed/hidden automatically with payment method selection
var origId = paymentOptionForm.attr('id');
staticContentContainer.find('.stripe-payment-form .js-payment-option-form').attr('id', origId);
// Remove tag ID and class from original form
paymentOptionForm.attr('id', 'stripe-script-tag-container');
paymentOptionForm.removeClass('js-payment-option-form');
}
}
}
@@ -108,12 +44,36 @@ checkoutPaymentParser.stripe_official_popup = {
if (($('#stripe-card-element').length && !$('#stripe-card-element.StripeElement').length) ||
($('#stripe-card-number').length && !$('#stripe-card-number.StripeElement').length) ||
($('#js-stripe-payment-element').length && !$('#js-stripe-payment-element.StripeElement').length)) {
// var stripe_base_url = '';
// if ('undefined' !== typeof prestashop && 'undefined' !== prestashop.urls && 'undefined' !== prestashop.urls.base_url) {
// stripe_base_url = prestashop.urls.base_url;
// }
$.getScript(tcModuleBaseUrl+'/../stripe_official/views/js/checkout.js');
// $.getScript(stripe_base_url + '/modules/stripe_official/views/js/payments.js');
// $.getScript(tcModuleBaseUrl+'/../stripe_official/views/js/checkout.js');
var script = document.createElement('script');
script.src = tcModuleBaseUrl+'/../stripe_official/views/js/checkout.js';
// If we unselect payment option, checkout.js would click it by its own when loaded - it would click 1st option, I guess they
// somehow made sure they're always at first position; but, it is necessary only when there are multiple payment methods!
if (document.querySelectorAll('input[name="payment-option"]').length > 1) {
document.querySelector('input[name="payment-option"]:checked').checked = false;
}
script.addEventListener('load', function() {
setTimeout(function() {
// If #js-stripe-payment-form is located outside of payment-form (this can be set in Stripe options - 'Payment Form Position'
// This is only workaround, if preferably set 'Payment Form Position' to 'With the Prestashop payment methods'
const stripeForm = $('.payment-options > #js-stripe-payment-form');
if (stripeForm.length) {
$('.popup-payment-content[data-payment-module=stripe_official] .js-payment-option-form').append(stripeForm);
}
},1000);
// console.log(' -- checkout.js loaded, now lets dispatch change event to payment option');
// var radioButton = document.querySelector('input[name="payment-option"]:checked');
// if (radioButton) {
// radioButton.dispatchEvent(new Event('change'));
// console.log('dispatched change event to payment option', radioButton);
// }
});
document.head.appendChild(script);
}
},
@@ -136,20 +96,27 @@ checkoutPaymentParser.stripe_official_popup = {
payment.setPopupPaymentType(element);
var cssEl = document.createElement('style'),sheet;
document.head.appendChild(cssEl);
cssEl.sheet.insertRule(`
.popup-payment-content[data-payment-module=stripe_official] .js-payment-option-form {
display: block!important;
}
`);
},
form: function (element, triggerElementName) {
if (!payment.isConfirmationTrigger(triggerElementName)) {
if (debug_js_controller) {
console.info('[stripe_official parser] Not confirmation trigger, removing payment form');
}
element.remove();
} else {
// var stripe_orig_script_tag = "\n <script>\n if (($('#stripe-card-element').length && !$('#stripe-card-element.StripeElement').length) || ($('#stripe-card-number').length && !$('#stripe-card-number.StripeElement').length)) {\n var stripe_base_url = '';\n if ('undefined' !== typeof prestashop && 'undefined' !== prestashop.urls && 'undefined' !== prestashop.urls.base_url) {\n stripe_base_url = prestashop.urls.base_url;\n }\n $.getScript(stripe_base_url + '/modules/stripe_official/views/js/payments.js');\n }\n </script>\n ";
// element.append(stripe_orig_script_tag);
// checkoutPaymentParser.stripe_official_popup.initPayment();
}
// if (!payment.isConfirmationTrigger(triggerElementName)) {
// // Integrated payment form
// if (debug_js_controller) {
// console.info('[stripe_official parser] Not confirmation trigger, removing payment form');
// }
// element.remove();
// } else {
// // empty
// }
return;
}
@@ -157,7 +124,8 @@ checkoutPaymentParser.stripe_official_popup = {
}
// Default Stripe parser
//checkoutPaymentParser.stripe_official = checkoutPaymentParser.stripe_official_inline;
checkoutPaymentParser.stripe_official = checkoutPaymentParser.stripe_official_popup;
if (typeof stripe_payment_elements_enabled !== "undefined" && stripe_payment_elements_enabled === "1") {
checkoutPaymentParser.stripe_official = checkoutPaymentParser.stripe_official_popup;
} else {
checkoutPaymentParser.stripe_official = checkoutPaymentParser.stripe_official_redirect;
}