/** * NOTICE OF LICENSE * * This source file is subject to the Software License Agreement * that is bundled with this package in the file LICENSE.txt. * * @author Peter Sliacky (Zelarg) * @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 */ checkoutPaymentParser.stripe_official_inline = { all_hooks_content: function (content) { }, 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(''); }, 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) { $('
').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 = ` // // `; // https://babeljs.io/repl var stripe_orig_script_tag = "\n \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 \n "; // element.append(stripe_orig_script_tag); // checkoutPaymentParser.stripe_official_popup.initPayment(); } return; } } // Default Stripe parser //checkoutPaymentParser.stripe_official = checkoutPaymentParser.stripe_official_inline; checkoutPaymentParser.stripe_official = checkoutPaymentParser.stripe_official_popup;