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:
55
modules/thecheckout/views/js/parsers/apaczka.js
Normal file
55
modules/thecheckout/views/js/parsers/apaczka.js
Normal file
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
* 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)
|
||||
*/
|
||||
|
||||
/* Last tested on 11.8.2023 with apaczka 1.1.0 by Apaczka.pl */
|
||||
|
||||
tc_confirmOrderValidations['apaczka'] = function() {
|
||||
if (
|
||||
/* $('.delivery-option.apaczka input[type=radio]').is(':checked') && */
|
||||
typeof apaczkaCarriers === 'object' &&
|
||||
$('.apaczka-no-point').is(':visible')
|
||||
) {
|
||||
// Legacy selector, replace from Thecheckout v3.3.8+ with version below
|
||||
// var shippingErrorMsg = $('#thecheckout-shipping > .inner-area > .error-msg');
|
||||
var shippingErrorMsg = $('#thecheckout-shipping .inner-wrapper > .error-msg');
|
||||
shippingErrorMsg.text('Wybierz punkt dostawy');
|
||||
shippingErrorMsg.show();
|
||||
scrollToElement(shippingErrorMsg);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
checkoutShippingParser.apaczka = {
|
||||
|
||||
after_load_callback: function(deliveryOptionIds) {
|
||||
if (typeof apaczkaCarriers === 'object') {
|
||||
// Apaczka would init map selector on window.load()
|
||||
dispatchEvent(new Event('load'));
|
||||
}
|
||||
},
|
||||
|
||||
init_once: function (elements) {
|
||||
if (debug_js_controller) {
|
||||
console.info('[thecheckout-apaczka.js] init_once()');
|
||||
}
|
||||
},
|
||||
|
||||
delivery_option: function (element) {
|
||||
if (debug_js_controller) {
|
||||
console.info('[thecheckout-apaczka.js] delivery_option()');
|
||||
}
|
||||
},
|
||||
|
||||
extra_content: function (element) {
|
||||
}
|
||||
|
||||
}
|
||||
36
modules/thecheckout/views/js/parsers/bongooglepay.js
Normal file
36
modules/thecheckout/views/js/parsers/bongooglepay.js
Normal file
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* 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)
|
||||
*/
|
||||
|
||||
/* tested with Google Pay v2.0.0 - by Bonpresta - on 8.4.2024 */
|
||||
checkoutPaymentParser.bongooglepay = {
|
||||
|
||||
container: function (element) {
|
||||
payment.setPopupPaymentType(element);
|
||||
element.find('input[name=payment-option]').addClass('binary'); // so that our 'pay' button in the popup disappears
|
||||
|
||||
// Add CSS rule to hide payment form in payment methods list
|
||||
var cssEl = document.createElement('style'),sheet;
|
||||
document.head.appendChild(cssEl);
|
||||
cssEl.sheet.insertRule(`
|
||||
.js-additional-information.bongooglepay > .bon-googlepay-required {
|
||||
display: none;
|
||||
}
|
||||
`);
|
||||
},
|
||||
|
||||
popup_onopen_callback: function () {
|
||||
if ($('#bon-google-checkout').length) {
|
||||
var script = document.createElement('script');
|
||||
script.src = tcModuleBaseUrl+'/../bongooglepay/views/js/bongooglepay-front.js';
|
||||
document.head.appendChild(script);
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
@@ -18,6 +18,9 @@ checkoutPaymentParser.braintreeofficial = {
|
||||
init_once: function(elements) {
|
||||
// Change original .additional-information block to js-payment-option-form
|
||||
const additionalInfoEl = elements.find('.additional-information');
|
||||
if (additionalInfoEl.length === 0) {
|
||||
return;
|
||||
}
|
||||
const formId = additionalInfoEl.attr('id').replace(/payment-option-(\d+)-.*/, 'pay-with-payment-option-$1-form');
|
||||
additionalInfoEl.attr('id', formId).attr('class', 'js-payment-option-form ps-hidden').hide();
|
||||
additionalInfoEl.find('.row > .col-md-10').removeClass('col-md-10');
|
||||
|
||||
26
modules/thecheckout/views/js/parsers/buckaroo3.js
Normal file
26
modules/thecheckout/views/js/parsers/buckaroo3.js
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* 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)
|
||||
*/
|
||||
|
||||
checkoutPaymentParser.buckaroo3 = {
|
||||
all_hooks_content: function (content) {
|
||||
|
||||
},
|
||||
|
||||
container: function (element) {
|
||||
var paymentOption = element.attr('id').match(/payment-option-\d+/)[0];
|
||||
var feeEl = element.find('label span.h6');
|
||||
if ('undefined' !== typeof feeEl && feeEl) {
|
||||
// parse out right-most number, in left side text, there can be number in 'B2B'
|
||||
var feeNumber = feeEl.text().replace(/^.*?([\d,.]+)[€ ]*$/,'$1');
|
||||
var fee = parseFloat(feeNumber.replace(',','.'));
|
||||
element.last().append('<div class="payment-option-fee hidden" id="'+paymentOption+'-fee">'+fee+'</div>');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,9 +13,9 @@ checkoutPaymentParser.codpro = {
|
||||
|
||||
},
|
||||
|
||||
container: function (element) {
|
||||
additionalInformation: function (element) {
|
||||
var paymentOption = element.attr('id').match(/payment-option-\d+/)[0];
|
||||
var feeEl = element.find('label span');
|
||||
var feeEl = element.find('#codpro_fee');
|
||||
if ('undefined' !== typeof feeEl && feeEl) {
|
||||
var fee = parseFloat(feeEl.text().replace(/[^\d,]/g,'').replace(',','.'));
|
||||
element.last().append('<div class="payment-option-fee hidden" id="'+paymentOption+'-fee">'+fee+'</div>');
|
||||
|
||||
@@ -8,7 +8,24 @@
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
*/
|
||||
|
||||
// Default props so that widget can load without errors
|
||||
colissimoDeliveryAddress = { 'address': '', 'zipcode': '', 'city': '' }
|
||||
colissimoPreparationTime = 1;
|
||||
|
||||
checkoutShippingParser.colissimo = {
|
||||
extra_content: function (element) {
|
||||
const input = element.html();
|
||||
// parse props and re-export to the window object
|
||||
const colissimo_props = input.matchAll(/const ([^=]+)=([^;]+);/g)
|
||||
|
||||
for (const x of colissimo_props) {
|
||||
[prop, value] = [x[1].trim(), x[2].trim()]
|
||||
// console.log(`prop:${prop}, value:${value}`);
|
||||
window[prop] = (value.indexOf('{') == 0) ?
|
||||
JSON.parse(value.replace(/(['"])?([a-z0-9A-Z_]+)(['"])?:/g, '"$2": ').replace(/'/g,'"'))
|
||||
: eval(value);
|
||||
}
|
||||
},
|
||||
on_ready: function() {
|
||||
setTimeout(function(){
|
||||
if ($('.iti').length == 0 && 'undefined' !== typeof initMobileField) {
|
||||
|
||||
17
modules/thecheckout/views/js/parsers/datatranscw.js
Normal file
17
modules/thecheckout/views/js/parsers/datatranscw.js
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* 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)
|
||||
*/
|
||||
|
||||
checkoutPaymentParser.datatranscw_mastercard = {
|
||||
after_load_callback: function() {
|
||||
prestashop.emit('steco_event_updated')
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* 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)
|
||||
*/
|
||||
|
||||
/* last tested 28.2.2024 with v4.0.193 - by customweb ltd */
|
||||
|
||||
checkoutPaymentParser.datatranscw_all = {
|
||||
|
||||
after_load_callback: function() {
|
||||
$.getScript(tcModuleBaseUrl+'/../datatranscw/js/frontend.js')
|
||||
.done(
|
||||
function() {
|
||||
setTimeout(function() { $('input[name=payment-option]:checked').click(); }, 500);
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
form: function (element) {
|
||||
|
||||
},
|
||||
|
||||
additionalInformation: function (element) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// One call even for multiple datatranscw payment modules is OK - events are attached for all of them at once
|
||||
checkoutPaymentParser.datatranscw_creditcard = checkoutPaymentParser.datatranscw_all;
|
||||
|
||||
276
modules/thecheckout/views/js/parsers/dhlassistant.js
Normal file
276
modules/thecheckout/views/js/parsers/dhlassistant.js
Normal file
@@ -0,0 +1,276 @@
|
||||
/**
|
||||
* 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)
|
||||
*/
|
||||
|
||||
/* Last tested on 10.1.2024 with dhlassistant v1.7 by DHL Parcel Polska */
|
||||
|
||||
tc_confirmOrderValidations['dhlassistant'] = function() {
|
||||
if (
|
||||
$('#dhlassistant_map_PL_CARRIER_POP').is(':visible') &&
|
||||
!$('#dhlassistant_messages > .current-address').is(':visible')
|
||||
) {
|
||||
var shippingErrorMsg = $('#thecheckout-shipping .inner-wrapper > .error-msg');
|
||||
$('.shipping-validation-details').remove();
|
||||
shippingErrorMsg.append('<span class="shipping-validation-details"> (DHL POP - punkt odbioru)</span>')
|
||||
shippingErrorMsg.show();
|
||||
scrollToElement(shippingErrorMsg);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
var tc_load_dhlassistant_script = function() {
|
||||
function shippingMethodChange() {
|
||||
var activeRadio = $(".delivery-options input[type='radio']:checked");
|
||||
var elValue = parseInt(activeRadio.val());
|
||||
var carrierCode = $("#dhlassistant_carrier_code_" + elValue).val();
|
||||
var requireSelection = $('#dhlassistant_need_selection_' + elValue).val();
|
||||
var parcelIdent = $('#dhlassistant_parcel_ident_value_' + carrierCode).val();
|
||||
if (requireSelection && (typeof parcelIdent === 'undefined' || "" === parcelIdent)) {
|
||||
$('button[name="confirmDeliveryOption"]').attr('disabled', true);
|
||||
console.log(carrierCode);
|
||||
}
|
||||
else if (carrierCode == ['PL_CARRIER_POP'] || carrierCode == ['PL_CARRIER_POP_COD'] || carrierCode == ['FOREIGN_CARRIER_PARCELSHOP']) {
|
||||
$('button[name="confirmDeliveryOption"]').attr('disabled', true);
|
||||
$( ".current-address" ).hide();
|
||||
}
|
||||
else {
|
||||
$('button[name="confirmDeliveryOption"]').attr('disabled', false);
|
||||
}
|
||||
}
|
||||
|
||||
function parcelMapChange() {
|
||||
$('button[name="confirmDeliveryOption"]').attr('disabled', true);
|
||||
$( ".current-address" ).hide();
|
||||
}
|
||||
|
||||
$(".delivery-options input[type='radio']").change(function (e) {
|
||||
shippingMethodChange();
|
||||
});
|
||||
|
||||
$('#dhlassistant_ps_checkbox').bind('change', parcelMapChange);
|
||||
$('#dhlassistant_pl_checkbox').bind('change', parcelMapChange);
|
||||
|
||||
shippingMethodChange();
|
||||
|
||||
MapPointSelectListenerPlCarrierPop = function(msg)
|
||||
{
|
||||
var point = JSON.parse(msg.data);
|
||||
$('#dhlassistant_parcel_ident_value_PL_CARRIER_POP').val(point.sap);
|
||||
$('#dhlassistant_parcel_postal_code_value').val(point.zip);
|
||||
$( "p.current-address" ).text(point.name+" "+point.street+" "+point.streetNo+" "+point.zip+" "+point.city);
|
||||
SaveDhlCarrierOptionsPlCarrierPop();
|
||||
}
|
||||
|
||||
SendToParcelShopChangePlCarrierPop = function()
|
||||
{
|
||||
$('#dhlassistant_ps_checkbox').parent().parent().removeClass('disabled');
|
||||
var val = $('#dhlassistant_ps_checkbox').prop('checked');
|
||||
if (val)
|
||||
{
|
||||
if (dhlassistant_require_postalcode_for_ps)
|
||||
{
|
||||
$('#dhlassistant_parcel_postal_code .label').html('Kod pocztowy Parcelshop:');
|
||||
$('#dhlassistant_parcel_postal_code').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#dhlassistant_parcel_postal_code').hide();
|
||||
}
|
||||
$('#dhlassistant_pl_checkbox').prop('checked', false);
|
||||
$('#dhlassistant_pl_checkbox').prop('disabled', true);
|
||||
SendToParcelLockerChangePlCarrierPop();
|
||||
$('#dhlassistant_parcel_ident').show();
|
||||
$('#dhlassistant_map_PL_CARRIER_POP').html('<object data="'+dhlassistant_map_for_pl_url+'" style="width:100%;height:813px;" frameborder="0" scrolling="no" id="myFrame"></object>');
|
||||
$('#dhlassistant_map_PL_CARRIER_POP').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!$('#dhlassistant_pl_checkbox').prop('checked'))
|
||||
{
|
||||
$('#dhlassistant_map_PL_CARRIER_POP').hide();
|
||||
$('#dhlassistant_parcel_ident').hide();
|
||||
$('#dhlassistant_parcel_postal_code').hide();
|
||||
}
|
||||
$('#dhlassistant_pl_checkbox').prop('disabled', false);
|
||||
$('#dhlassistant_pl_checkbox').parent().parent().removeClass('disabled');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
SendToParcelLockerChangePlCarrierPop = function()
|
||||
{
|
||||
$('#dhlassistant_pl_checkbox').parent().parent().removeClass('disabled');
|
||||
var val = $('#dhlassistant_pl_checkbox').prop('checked');
|
||||
if (val)
|
||||
{
|
||||
if (dhlassistant_require_postnummer_for_pl)
|
||||
{
|
||||
$('#dhlassistant_postnummer').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#dhlassistant_postnummer').hide();
|
||||
}
|
||||
if (dhlassistant_require_postalcode_for_pl)
|
||||
{
|
||||
$('#dhlassistant_parcel_postal_code .label').html('Kod pocztowy Parcelstation:');
|
||||
$('#dhlassistant_parcel_postal_code').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#dhlassistant_parcel_postal_code').hide();
|
||||
}
|
||||
$('#dhlassistant_ps_checkbox').prop('checked', false);
|
||||
$('#dhlassistant_ps_checkbox').prop('disabled', true);
|
||||
SendToParcelShopChangePlCarrierPop();
|
||||
$('#dhlassistant_parcel_ident').show();
|
||||
$('#dhlassistant_map_PL_CARRIER_POP').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!$('#dhlassistant_ps_checkbox').prop('checked'))
|
||||
{
|
||||
$('#dhlassistant_map_PL_CARRIER_POP').hide();
|
||||
$('#dhlassistant_parcel_ident').hide();
|
||||
$('#dhlassistant_parcel_postal_code').hide();
|
||||
}
|
||||
$('#dhlassistant_ps_checkbox').prop('disabled', false);
|
||||
$('#dhlassistant_ps_checkbox').parent().parent().removeClass('disabled');
|
||||
$('#dhlassistant_postnummer').hide();
|
||||
}
|
||||
|
||||
}
|
||||
SaveDhlCarrierOptionsPlCarrierPop = function()
|
||||
{
|
||||
|
||||
$('#dhlassistant_messages .success').hide();
|
||||
$('#dhlassistant_messages .error').hide();
|
||||
$('#HOOK_PAYMENT').html('');
|
||||
|
||||
var ajax_data = {};
|
||||
var val_ps = $('#dhlassistant_ps_checkbox').prop('checked');
|
||||
var val_pl = $('#dhlassistant_pl_checkbox').prop('checked');
|
||||
var val_parcel_ident = $('#dhlassistant_parcel_ident_value_PL_CARRIER_POP').val();
|
||||
var val_postnummer = $('#dhlassistant_postnummer_value').val();
|
||||
var val_parcel_postal_code = $('#dhlassistant_parcel_postal_code_value').val();
|
||||
|
||||
if (val_ps)
|
||||
ajax_data.ParcelShop = val_ps;
|
||||
if (val_pl)
|
||||
ajax_data.ParcelLocker = val_pl;
|
||||
if (val_parcel_ident)
|
||||
ajax_data.ParcelIdent = val_parcel_ident;
|
||||
if (val_postnummer)
|
||||
ajax_data.Postnummer = val_postnummer;
|
||||
if (val_parcel_postal_code)
|
||||
ajax_data.ParcelPostalCode = val_parcel_postal_code;
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
headers: { "cache-control": "no-cache" },
|
||||
url: dhlassistant_ajax_catcher_url,
|
||||
data: ajax_data,
|
||||
context: document.body,
|
||||
dataType : "json",
|
||||
success: function(message)
|
||||
{
|
||||
if (message == 'Success')
|
||||
$('#dhlassistant_messages .success').slideDown('slow');
|
||||
else
|
||||
$('#dhlassistant_messages .error').slideDown('slow');
|
||||
if (typeof(updatePaymentMethodsDisplay) !== "undefined")
|
||||
{
|
||||
$('#uniform-cgv').parent().show();
|
||||
if ($('#cgv').prop('checked'))
|
||||
updatePaymentMethodsDisplay();
|
||||
}
|
||||
$('button[name="confirmDeliveryOption"]').attr('disabled', false);
|
||||
|
||||
var scrollToMessage = document.getElementById("SCROLL_TO_PL_CARRIER_POP");
|
||||
scrollToMessage.scrollIntoView();
|
||||
},
|
||||
error: function()
|
||||
{
|
||||
scrollToMessage.slideDown('slow');
|
||||
scrollToMessage.scrollIntoView();
|
||||
}
|
||||
});
|
||||
}
|
||||
DhlOptionsInitPlCarrierPop = function(){
|
||||
dhlassistant_ajax_catcher_url = $("#PL_CARRIER_POP_dhlassistant_ajax_catcher_url").val();
|
||||
dhlassistant_carrier_id = $("#PL_CARRIER_POP_dhlassistant_carrier_id").val();
|
||||
dhlassistant_is_ps_available = !!+$("#PL_CARRIER_POP_dhlassistant_is_ps_available").val();
|
||||
dhlassistant_is_ps_only_service = !!+$("#PL_CARRIER_POP_dhlassistant_is_ps_only_service").val();
|
||||
dhlassistant_is_pl_available = !!+$("#PL_CARRIER_POP_dhlassistant_is_pl_available").val();
|
||||
dhlassistant_is_map_for_parcel_available = !!+$("#PL_CARRIER_POP_dhlassistant_is_map_for_parcel_available").val();
|
||||
dhlassistant_map_for_ps_url = $("#PL_CARRIER_POP_dhlassistant_map_for_ps_url").val();
|
||||
dhlassistant_map_for_pl_url = $("#PL_CARRIER_POP_dhlassistant_map_for_pl_url").val();
|
||||
dhlassistant_require_postnummer_for_pl = !!+$("#PL_CARRIER_POP_dhlassistant_require_postnummer_for_pl").val();
|
||||
dhlassistant_require_postalcode_for_ps = !!+$("#PL_CARRIER_POP_dhlassistant_require_postalcode_for_ps").val();
|
||||
dhlassistant_require_postalcode_for_pl = !!+$("#PL_CARRIER_POP_dhlassistant_require_postalcode_for_pl").val();
|
||||
dhlassistant_ok = ($('#delivery_option_' + dhlassistant_carrier_id).val() == (dhlassistant_carrier_id+','));
|
||||
if (dhlassistant_ok)
|
||||
{
|
||||
if (dhlassistant_is_ps_only_service) /* jeśli musi być podany nr. PS aby przejść dalej*/
|
||||
{
|
||||
$('#uniform-cgv').parent().hide();
|
||||
$('#HOOK_PAYMENT').html('');
|
||||
}
|
||||
if ((dhlassistant_is_ps_available || dhlassistant_is_pl_available) && dhlassistant_is_map_for_parcel_available)
|
||||
{
|
||||
if (window.addEventListener)
|
||||
{
|
||||
window.addEventListener("message", MapPointSelectListenerPlCarrierPop, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
window.attachEvent("onmessage", MapPointSelectListenerPlCarrierPop);
|
||||
}
|
||||
}
|
||||
SendToParcelShopChangePlCarrierPop();
|
||||
SendToParcelLockerChangePlCarrierPop();
|
||||
$('#dhlassistant_ps_checkbox').bind('change', SendToParcelShopChangePlCarrierPop);
|
||||
$('#dhlassistant_pl_checkbox').bind('change', SendToParcelLockerChangePlCarrierPop);
|
||||
$('#dhlassistant_PL_CARRIER_POP').show();
|
||||
|
||||
}
|
||||
};
|
||||
/* init */
|
||||
if (document.readyState !== 'complete')
|
||||
$(DhlOptionsInitPlCarrierPop);
|
||||
else
|
||||
DhlOptionsInitPlCarrierPop();
|
||||
}
|
||||
|
||||
checkoutShippingParser.dhlassistant = {
|
||||
|
||||
after_load_callback: function(deliveryOptionIds) {
|
||||
if (typeof tc_load_dhlassistant_script === 'function') {
|
||||
tc_load_dhlassistant_script();
|
||||
}
|
||||
},
|
||||
|
||||
init_once: function (elements) {
|
||||
if (debug_js_controller) {
|
||||
console.info('[thecheckout-dhlassistant.js] init_once()');
|
||||
}
|
||||
},
|
||||
|
||||
delivery_option: function (element) {
|
||||
if (debug_js_controller) {
|
||||
console.info('[thecheckout-dhlassistant.js] delivery_option()');
|
||||
}
|
||||
},
|
||||
|
||||
extra_content: function (element) {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,7 +17,7 @@ checkoutPaymentParser.dm_cashondelivery = {
|
||||
var paymentOption = element.attr('id').match(/payment-option-\d+/)[0];
|
||||
var feeHtml = element.find('label span').html();
|
||||
var fee = payment.parsePrice(feeHtml);
|
||||
if (!isNaN(fee)) {
|
||||
if (!isNaN(fee) && fee !== 0) {
|
||||
element.last().append('<div class="payment-option-fee hidden" id="'+paymentOption+'-fee">'+fee+'</div>');
|
||||
}
|
||||
},
|
||||
@@ -26,7 +26,7 @@ checkoutPaymentParser.dm_cashondelivery = {
|
||||
var paymentOption = element.attr('id').match(/payment-option-\d+/)[0];
|
||||
var feeHtml = element.find('section p').html();
|
||||
var fee = payment.parsePrice(feeHtml);
|
||||
if (!isNaN(fee)) {
|
||||
if (!isNaN(fee) && fee !== 0) {
|
||||
element.last().append('<div class="payment-option-fee hidden" id="' + paymentOption + '-fee">' + fee + '</div>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,10 @@ tc_confirmOrderValidations['dpdpoland'] = function() {
|
||||
|
||||
checkoutShippingParser.dpdpoland = {
|
||||
after_load_callback: function(deliveryOptionIds) {
|
||||
// nothing necessary here; just make an update to dpdpoland/views/templates/hook/pudo.tpl, placing code in <script> in condition:
|
||||
/*
|
||||
nothing necessary here; just make an update to dpdpoland/views/templates/hook/pudo.tpl,
|
||||
placing code in <script> (starting with 'const iframe = document.createElement("iframe");') in condition:
|
||||
*/
|
||||
// if ('undefined' === typeof iframe) { /* original code here */ }
|
||||
},
|
||||
}
|
||||
|
||||
19
modules/thecheckout/views/js/parsers/estimateddelivery.js
Normal file
19
modules/thecheckout/views/js/parsers/estimateddelivery.js
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* 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)
|
||||
*/
|
||||
|
||||
checkoutShippingParser.estimateddelivery= {
|
||||
init_once: function (elements) {
|
||||
// This variable is handled from estimateddelivery module
|
||||
if (typeof ed_refresh !== 'undefined' && dynamic_refresh === false)
|
||||
{
|
||||
dynamic_refresh = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
39
modules/thecheckout/views/js/parsers/floapay.js
Normal file
39
modules/thecheckout/views/js/parsers/floapay.js
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* 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)
|
||||
*
|
||||
* Last tested on 04.04.2024 with Floapay v1.2.4 by 202 ecommerce
|
||||
*/
|
||||
|
||||
checkoutPaymentParser.floapay = {
|
||||
|
||||
after_load_callback: function() {
|
||||
if (typeof floaDisplayPaymentSummary === 'function') {
|
||||
floaDisplayPaymentSummary();
|
||||
}
|
||||
if (typeof floaDisplayPaymentReportDateField === 'function') {
|
||||
floaDisplayPaymentReportDateField();
|
||||
}
|
||||
if (typeof setFloaEvents === 'function') {
|
||||
setFloaEvents();
|
||||
}
|
||||
},
|
||||
|
||||
form: function (element) {
|
||||
|
||||
let form = element.find('.payment-form');
|
||||
if (typeof form !== 'undefined' && form?.attr('action')?.search('floapay/eligibility'))
|
||||
{
|
||||
let onSubmitAction = 'return floaLaunchEligibility($("#confirm_order"));';
|
||||
form.attr('action', 'javascript:void(0);');
|
||||
form.attr('onsubmit', onSubmitAction);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
50
modules/thecheckout/views/js/parsers/fspickupatstore.js
Normal file
50
modules/thecheckout/views/js/parsers/fspickupatstore.js
Normal file
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* 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)
|
||||
*/
|
||||
|
||||
tc_confirmOrderValidations['fspickupatstore'] = function () {
|
||||
if (
|
||||
$('.fspas-information:visible').length > 0 && $('.fspas-information:visible').text().indexOf('-') > 3 && $('.fspas-information:visible').text().indexOf('-') < 15
|
||||
) {
|
||||
var shippingErrorMsg = $('#thecheckout-shipping .inner-wrapper > .error-msg');
|
||||
$('.shipping-validation-details').remove();
|
||||
shippingErrorMsg.append('<span class="shipping-validation-details"> (изберете офис)</span>')
|
||||
shippingErrorMsg.show();
|
||||
scrollToElement(shippingErrorMsg);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
checkoutShippingParser.fspickupatstore = {
|
||||
after_load_callback: function(deliveryOptionIds) {
|
||||
$.getScript(tcModuleBaseUrl + '/../fspickupatstore/views/js/carrier-extra.js');
|
||||
// Add CSS rule
|
||||
// var cssEl = document.createElement('style'),sheet;
|
||||
// document.head.appendChild(cssEl);
|
||||
// cssEl.sheet.insertRule(`
|
||||
// .delivery-option.latvijaspastsexpresspastspostterminalslv > label {
|
||||
// flex-wrap: wrap;
|
||||
// }
|
||||
// `);
|
||||
},
|
||||
|
||||
init_once: function (elements) {
|
||||
|
||||
},
|
||||
|
||||
delivery_option: function (element) {
|
||||
|
||||
},
|
||||
|
||||
extra_content: function (element) {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* 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)
|
||||
*/
|
||||
|
||||
checkoutPaymentParser.generic_iframe_parser = {
|
||||
|
||||
popup_onopen_callback: function (optionId) {
|
||||
$('.popup-payment-content .popup-embed').prop('src', '?p3i&option='+optionId);
|
||||
$('.popup-payment-content').addClass('iframe');
|
||||
},
|
||||
|
||||
popup_onclose_callback: function () {
|
||||
$('.popup-payment-content .popup-embed').prop('src', '');
|
||||
$('.popup-payment-content').removeClass('iframe');
|
||||
},
|
||||
|
||||
container: function(element) {
|
||||
payment.setPopupPaymentType(element);
|
||||
element.find('input[name=payment-option]').addClass('binary');
|
||||
},
|
||||
|
||||
}
|
||||
36
modules/thecheckout/views/js/parsers/geodisofficiel.js
Normal file
36
modules/thecheckout/views/js/parsers/geodisofficiel.js
Normal file
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* 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)
|
||||
*/
|
||||
|
||||
/* Last tested on 07.06.2024 with geodisofficiel v1.0.3 by GEODIS */
|
||||
|
||||
let geodisLoaded = false;
|
||||
|
||||
checkoutShippingParser.geodisofficiel = {
|
||||
|
||||
after_load_callback: function(deliveryOptionIds) {
|
||||
if (!geodisLoaded && typeof GeodisCarrierSelector === 'function') {
|
||||
$.getScript(tcModuleBaseUrl+'/../geodisofficiel/views/js/lib/intlTel/utils.js');
|
||||
$.getScript(tcModuleBaseUrl+'/../geodisofficiel/views/js/GeodisCarrierSelectorBootstrap.js');
|
||||
geodisLoaded = true;
|
||||
}
|
||||
},
|
||||
|
||||
init_once: function (elements) {
|
||||
|
||||
},
|
||||
|
||||
delivery_option: function (element) {
|
||||
|
||||
},
|
||||
|
||||
extra_content: function (element) {
|
||||
}
|
||||
|
||||
}
|
||||
35
modules/thecheckout/views/js/parsers/globkuriermodule.js
Normal file
35
modules/thecheckout/views/js/parsers/globkuriermodule.js
Normal file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* 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)
|
||||
*/
|
||||
|
||||
/* Last tested on 10.07.2024 with globkuriermodule v3.0.1 by GlobKurier.pl */
|
||||
|
||||
// let globKurierModuleLoaded = false;
|
||||
|
||||
checkoutShippingParser.globkuriermodule = {
|
||||
|
||||
after_load_callback: function(deliveryOptionIds) {
|
||||
if (!globKurierModuleLoaded && typeof inpost_carrier_id !== 'undefined') {
|
||||
$.getScript(tcModuleBaseUrl+'/../globkuriermodule/views/js/inpost-front-17.js');
|
||||
// globKurierModuleLoaded = true;
|
||||
}
|
||||
},
|
||||
|
||||
init_once: function (elements) {
|
||||
|
||||
},
|
||||
|
||||
delivery_option: function (element) {
|
||||
|
||||
},
|
||||
|
||||
extra_content: function (element) {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,10 +9,17 @@
|
||||
*/
|
||||
|
||||
|
||||
/* (!) IMPORTANT (!)
|
||||
It's necessary to comment-out following line in: modules/itellashipping/views/js/front.js, like this:
|
||||
// $master_container.find('#itella-ps17-extra').remove();
|
||||
*/
|
||||
|
||||
tc_confirmOrderValidations['itellashipping'] = function() {
|
||||
if (
|
||||
$('.delivery-option.itellashipping input[name^=delivery_option]').is(':checked') &&
|
||||
!$('#itella_pickup_point_id').val()
|
||||
$('.delivery-option.itellashipping input[name^=delivery_option]:checked').closest('.delivery-option.itellashipping').next('.carrier-extra-content.itellashipping').length > 0 &&
|
||||
$('.delivery-option.itellashipping input[name^=delivery_option]:checked').closest('.delivery-option.itellashipping').next('.carrier-extra-content.itellashipping').find('#itella_pickup_point_id').length > 0 &&
|
||||
$('.delivery-option.itellashipping input[name^=delivery_option]:checked').closest('.delivery-option.itellashipping').next('.carrier-extra-content.itellashipping').find('#itella_pickup_point_id').val() == ''
|
||||
) {
|
||||
var shippingErrorMsg = $('#thecheckout-shipping .inner-wrapper > .error-msg');
|
||||
shippingErrorMsg.show();
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* 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)
|
||||
*/
|
||||
|
||||
tc_confirmOrderValidations['latvijaspastsexpresspastspostterminalslv'] = function() {
|
||||
if (
|
||||
$('.latvijaspasts_carrier.terminals').is(':visible') &&
|
||||
$('[name=terminals]')?.val() == '0'
|
||||
) {
|
||||
var shippingErrorMsg = $('#thecheckout-shipping .inner-wrapper > .error-msg');
|
||||
shippingErrorMsg.text(shippingErrorMsg.text() + ' (piegādes punkts)');
|
||||
shippingErrorMsg.show();
|
||||
scrollToElement(shippingErrorMsg);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
checkoutShippingParser.latvijaspastsexpresspastspostterminalslv = {
|
||||
|
||||
after_load_callback: function(deliveryOptionIds) {
|
||||
$.getScript(tcModuleBaseUrl + '/../latvijaspasts/views/js/carrier_script.js');
|
||||
// Add CSS rule
|
||||
var cssEl = document.createElement('style'),sheet;
|
||||
document.head.appendChild(cssEl);
|
||||
cssEl.sheet.insertRule(`
|
||||
.delivery-option.latvijaspastsexpresspastspostterminalslv > label {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
`);
|
||||
},
|
||||
|
||||
init_once: function (elements) {
|
||||
|
||||
},
|
||||
|
||||
delivery_option: function (element) {
|
||||
|
||||
},
|
||||
|
||||
extra_content: function (element) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
23
modules/thecheckout/views/js/parsers/lpshipping.js
Normal file
23
modules/thecheckout/views/js/parsers/lpshipping.js
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* 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)
|
||||
*/
|
||||
|
||||
tc_confirmOrderValidations['lpshipping'] = function() {
|
||||
if (
|
||||
$('#lpshipping_express_terminal').is(':visible') &&
|
||||
( "" == $('#lpshipping_express_terminal').val() || '-1' === $('#lpshipping_express_terminal').val())
|
||||
) {
|
||||
var shippingErrorMsg = $('#thecheckout-shipping .inner-wrapper > .error-msg');
|
||||
shippingErrorMsg.show();
|
||||
scrollToElement(shippingErrorMsg);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
84
modules/thecheckout/views/js/parsers/mijoravenipak.js
Normal file
84
modules/thecheckout/views/js/parsers/mijoravenipak.js
Normal file
@@ -0,0 +1,84 @@
|
||||
/**
|
||||
* 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)
|
||||
*/
|
||||
|
||||
/* Last tested on 22.03.2024 with mijoravenipak v1.1.4 by mijora.lt */
|
||||
|
||||
// var tc_tmjs = null;
|
||||
|
||||
// var tc_venipak_custom_modal = function() {
|
||||
// let mjvp_map_container = document.getElementById('mjvp-pickup-select-modal');
|
||||
// let tmjs = null;
|
||||
|
||||
// if (typeof(mjvp_map_container) != 'undefined' && mjvp_map_container != null) {
|
||||
// tc_tmjs = new TerminalMappingMjvp('https://venipak.uat.megodata.com/ws');
|
||||
// tmjs = tc_tmjs;
|
||||
// tmjs.setImagesPath(mjvp_imgs_url);
|
||||
// tmjs.setTranslation(mjvp_terminal_select_translates);
|
||||
|
||||
// tmjs.dom.setContainerParent(document.getElementById('mjvp-pickup-select-modal'));
|
||||
// // tmjs.terminals_cache = null;
|
||||
// tmjs.init({
|
||||
// country_code: mjvp_country_code,
|
||||
// identifier: '',
|
||||
// isModal: true,
|
||||
// hideContainer: false,
|
||||
// hideSelectBtn: false,
|
||||
// postal_code: mjvp_postal_code,
|
||||
// city: mjvp_city
|
||||
// });
|
||||
|
||||
// tmjs.sub('tmjs-ready', function(data) {
|
||||
// let selected_terminal = document.getElementById("mjvp-selected-terminal")?.value;
|
||||
// let selected_location = tmjs.map?.getLocationById(parseInt(selected_terminal));
|
||||
// if (typeof(selected_location) != 'undefined' && selected_location != null) {
|
||||
// tmjs.publish('terminal-selected', selected_location);
|
||||
// document.querySelector('.tmjs-selected-terminal').innerHTML = '<span class="mjvp-tmjs-terminal-name">' + selected_location.name + '</span> <span class="mjvp-tmjs-terminal-address">(' + selected_location.address + ')</span> <span class="mjvp-tmjs-terminal-comment">' + selected_location.city + '.</span>';
|
||||
// }
|
||||
// });
|
||||
// tmjs.sub('terminal-selected', function(data) {
|
||||
// document.getElementById("mjvp-selected-terminal").value = data.id;
|
||||
// mjvp_registerSelection('mjvp-selected-terminal');
|
||||
// tmjs.publish('close-map-modal');
|
||||
// document.querySelector('.tmjs-selected-terminal').innerHTML = '<span class="mjvp-tmjs-terminal-name">' + data.name + '</span> <span class="mjvp-tmjs-terminal-address">(' + data.address + ')</span> <span class="mjvp-tmjs-terminal-comment">' + data.city + '.</span>';
|
||||
// });
|
||||
// }
|
||||
|
||||
// if (typeof window['venipak_custom_modal'] !== 'undefined') {
|
||||
// window['venipak_custom_modal'].tmjs = tmjs;
|
||||
// }
|
||||
// }
|
||||
|
||||
checkoutShippingParser.mijoravenipak = {
|
||||
|
||||
after_load_callback: function(deliveryOptionIds) {
|
||||
|
||||
// check every 500ms at most for 3 seconds when length > 0 and if so, call venipak_custom_modal()
|
||||
const conditionallyInitializeMJVP = () => {
|
||||
let counter = 0;
|
||||
let checkInterval = setInterval(function() {
|
||||
if (mjvp_terminals.length > 0) {
|
||||
venipak_custom_modal();
|
||||
clearInterval(checkInterval);
|
||||
} else {
|
||||
console.log('[tc-mijoravenipak] mjvp_terminals empty, wait 500ms...');
|
||||
counter++;
|
||||
if (counter >= 6) {
|
||||
clearInterval(checkInterval);
|
||||
}
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
|
||||
if (typeof venipak_custom_modal === 'function') {
|
||||
setTimeout(conditionallyInitializeMJVP, 500);
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
@@ -10,6 +10,33 @@
|
||||
|
||||
checkoutPaymentParser.mollie = {
|
||||
|
||||
container: function (element) {
|
||||
payment.setPopupPaymentType(element);
|
||||
|
||||
// Add CSS rule to hide payment form in payment methods list
|
||||
var cssEl = document.createElement('style'),sheet;
|
||||
document.head.appendChild(cssEl);
|
||||
cssEl.sheet.insertRule(`
|
||||
section#checkout-payment-step [data-payment-module=mollie] > .additional-information > .mollie-iframe-container {
|
||||
display: none!important;
|
||||
}
|
||||
`);
|
||||
cssEl.sheet.insertRule(`
|
||||
button.btn.btn-primary.center-block.disabled {
|
||||
pointer-events: all;
|
||||
opacity: 1;
|
||||
}
|
||||
`);
|
||||
},
|
||||
|
||||
popup_onopen_callback: function () {
|
||||
if ($('.additional-information.mollie > .mollie-iframe-container').length) {
|
||||
var script = document.createElement('script');
|
||||
script.src = tcModuleBaseUrl+'/../mollie/views/js/front/mollie_iframe.js';
|
||||
document.head.appendChild(script);
|
||||
}
|
||||
},
|
||||
|
||||
form: function (element) {
|
||||
var paymentOption = element.attr('id').match(/payment-option-\d+/)[0];
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
*/
|
||||
|
||||
/* Last tested on 13.7.2023 with mondialrelay 3.3.7 by ScaleDEV */
|
||||
|
||||
tc_confirmOrderValidations['mondialrelay'] = function() {
|
||||
if (
|
||||
/*$('#mondialrelay_widget').is(':visible')*/
|
||||
@@ -25,6 +27,17 @@ tc_confirmOrderValidations['mondialrelay'] = function() {
|
||||
}
|
||||
|
||||
checkoutShippingParser.mondialrelay = {
|
||||
|
||||
after_load_callback: function(deliveryOptionIds) {
|
||||
// reinit only when widget is already initialized = that means, mondialrelay module won't try to init it again, but we have to.
|
||||
if (typeof mondialrelayWidget !== 'undefined' && mondialrelayWidget.initialized === true) {
|
||||
$.getScript(tcModuleBaseUrl + '/../mondialrelay/views/js/front/checkout/checkout-17.js');
|
||||
if (typeof MONDIALRELAY_ADDRESS_OPC !== 'undefined') {
|
||||
MONDIALRELAY_ADDRESS_OPC = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
init_once: function (elements) {
|
||||
if (debug_js_controller) {
|
||||
console.info('[thecheckout-mondialrelay.js] init_once()');
|
||||
@@ -39,7 +52,7 @@ checkoutShippingParser.mondialrelay = {
|
||||
// Uncheck mondialrelay item, so that it can be manually selected
|
||||
//element.after("<script>$('.delivery-option.mondialrelay input[name^=delivery_option]').prop('checked', false)</script>");
|
||||
// Mondial v3.0+ by 202 ecommerce
|
||||
element.append("<script>$(document).ready(setTimeout(function(){$('#js-delivery').find('[name^=\"delivery_option\"]:checked').trigger('change');},500)); prestashop.emit(\"updatedDeliveryForm\",{dataForm:$('#js-delivery').serializeArray(),deliveryOption:$('#js-delivery').find('[name^=\"delivery_option\"]:checked')});</script>");
|
||||
// element.append("<script>$(document).ready(setTimeout(function(){$('#js-delivery').find('[name^=\"delivery_option\"]:checked').trigger('change');},500)); prestashop.emit(\"updatedDeliveryForm\",{dataForm:$('#js-delivery').serializeArray(),deliveryOption:$('#js-delivery').find('[name^=\"delivery_option\"]:checked')});</script>");
|
||||
},
|
||||
|
||||
extra_content: function (element) {
|
||||
|
||||
@@ -23,6 +23,25 @@ tc_confirmOrderValidations['packetery'] = function() {
|
||||
}
|
||||
|
||||
checkoutShippingParser.packetery = {
|
||||
|
||||
after_load_callback: function(deliveryOptionIds) {
|
||||
// if ('undefined' !== typeof initializePacketaWidget && $(".zas-box").length)
|
||||
// initializePacketaWidget();
|
||||
// if ('undefined' !== typeof tools){
|
||||
// tools.fixextracontent(country);
|
||||
// if ('undefined' !== typeof tools && 'undefined' !== typeof tools.readAjaxFields) {
|
||||
// tools.readAjaxFields();
|
||||
// }
|
||||
// var packeteryEl = $('.carrier-extra-content.packetery');
|
||||
// if (packeteryEl.length) {
|
||||
// var extra = packeteryEl.parent();
|
||||
// if ('undefined' !== typeof packetery && 'undefined' !== typeof packetery.widgetGetCities) {
|
||||
// packetery.widgetGetCities(extra);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
},
|
||||
|
||||
init_once: function (elements) {
|
||||
|
||||
},
|
||||
|
||||
@@ -8,7 +8,49 @@
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
*/
|
||||
|
||||
/**
|
||||
Modify please /modules/paynow/controllers/front/payment.php, remove lines:
|
||||
if ($id_customer != $this->context->customer->id) {
|
||||
Tools::redirect('index.php?controller=order&step=1');
|
||||
}
|
||||
*/
|
||||
|
||||
tc_confirmOrderValidations['paynow'] = function () {
|
||||
if (
|
||||
$('.paynow-payment-option-container #paynow_blik_code').is(':visible') &&
|
||||
$('.paynow-payment-option-container #paynow_blik_code').val() == ''
|
||||
) {
|
||||
var paymentErrorMsg = $('#thecheckout-payment .dynamic-content > .inner-wrapper > .error-msg');
|
||||
$('.payment-validation-details').remove();
|
||||
paymentErrorMsg.append('<span class="payment-validation-details"> (BLIK kod)</span>')
|
||||
paymentErrorMsg.show();
|
||||
scrollToElement(paymentErrorMsg);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
checkoutPaymentParser.paynow = {
|
||||
|
||||
container: function(element) {
|
||||
const isBlikPaymentOption = element.next('.js-payment-option-form').find('form.paynow-blik-form').length == 1
|
||||
|
||||
if (isBlikPaymentOption) {
|
||||
payment.setPopupPaymentType(element);
|
||||
}
|
||||
|
||||
// Add CSS rule to hide blik form in payment methods list when T&C checkbox is ticked;
|
||||
// but keep it visible in the popup
|
||||
var cssEl = document.createElement('style'),sheet;
|
||||
document.head.appendChild(cssEl);
|
||||
cssEl.sheet.insertRule(`
|
||||
section#checkout-payment-step .paynow-blik-form {
|
||||
display: none;
|
||||
}
|
||||
`);
|
||||
},
|
||||
|
||||
after_load_callback: function() {
|
||||
$.getScript(tcModuleBaseUrl+'/../paynow/views/js/front.js')
|
||||
.done(
|
||||
@@ -16,6 +58,9 @@ checkoutPaymentParser.paynow = {
|
||||
setTimeout(function() {
|
||||
if (typeof enableBlikSupport !== 'undefined') { enableBlikSupport(); }
|
||||
if (typeof enablePblSupport !== 'undefined') { enablePblSupport(); }
|
||||
if (typeof paynow !== 'undefined' && typeof paynow.config !== 'undefined') {
|
||||
paynow.config.validateTerms = false; // because if T&C are disabled in PS settings, BLIK will not confirm
|
||||
}
|
||||
}, 300);
|
||||
});
|
||||
// if ("undefined" !== typeof enableBlikSupport) {
|
||||
@@ -24,15 +69,16 @@ checkoutPaymentParser.paynow = {
|
||||
},
|
||||
|
||||
form: function (element) {
|
||||
var blikPayButtonSelector = "form.paynow-blik-form .paynow-payment-option-container button.btn-primary";
|
||||
if (element.find('.paynow-blik-form').length) {
|
||||
element.find('.payment-form').attr('onsubmit', '$("'+blikPayButtonSelector+'").click(); return false;');
|
||||
}
|
||||
|
||||
// Add CSS rule to hid blickPayButton
|
||||
var element = document.createElement('style'),sheet;
|
||||
document.head.appendChild(element);
|
||||
element.sheet.insertRule(blikPayButtonSelector + '{ display: none; }');
|
||||
// var blikPayButtonSelector = "form.paynow-blik-form .paynow-payment-option-container button.btn-primary";
|
||||
// if (element.find('.paynow-blik-form').length) {
|
||||
// element.find('.payment-form').attr('onsubmit', '$("'+blikPayButtonSelector+'").click(); return false;');
|
||||
// element.find(blikPayButtonSelector).prop('disabled', false);
|
||||
// }
|
||||
//
|
||||
// // Add CSS rule to hide blickPayButton
|
||||
// var element = document.createElement('style'),sheet;
|
||||
// document.head.appendChild(element);
|
||||
// element.sheet.insertRule(blikPayButtonSelector + '{ display: none; }');
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
/*
|
||||
IMPORTANT: In paypal v5.8.0, make sure to disable 'Put the PayPal button at the end of the order page' option!
|
||||
If using Giropay, Sofort, SEPA - also set in Paypal configuration 'Redirection' mode, instead of 'In-Context'
|
||||
*/
|
||||
|
||||
checkoutPaymentParser.paypal = {
|
||||
@@ -37,7 +38,7 @@ checkoutPaymentParser.paypal = {
|
||||
additionalInfoElement = $(containerElement).next('[id$=-additional-information]');
|
||||
// If embedded mode (=data-container-express-checkout button exists), set popup payment type and make it binary
|
||||
|
||||
if (additionalInfoElement.find('[data-container-express-checkout]').length || additionalInfoElement.find('[data-container-bnpl]').length) {
|
||||
if (additionalInfoElement.find('[data-container-express-checkout]').length || additionalInfoElement.find('[data-container-bnpl]').length || additionalInfoElement.find('[paypal-acdc-card-wrapper]').length) {
|
||||
payment.setPopupPaymentType($(containerElement), true);
|
||||
additionalInfoElement.addClass('paypal').addClass('paypal-hide-pp-info-and-button');
|
||||
additionalInfoElement.find('.pp-info').prependTo(additionalInfoElement);
|
||||
@@ -80,6 +81,11 @@ checkoutPaymentParser.paypal = {
|
||||
}
|
||||
|
||||
}
|
||||
// New Paypal (5.7+) card payment (acdc)
|
||||
if ($(paymentContent).find('[paypal-acdc-wrapper]').length) {
|
||||
var acdcRadio = $(paymentContent).find('.payment-option');
|
||||
payment.setPopupPaymentType(acdcRadio);
|
||||
}
|
||||
});
|
||||
|
||||
var express_checkout_make_visible = '<script>\
|
||||
@@ -130,6 +136,14 @@ checkoutPaymentParser.paypal = {
|
||||
element.append(additional_script_tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
popup_onopen_callback: function () {
|
||||
if ($('#bon-google-checkout').length) {
|
||||
var script = document.createElement('script');
|
||||
script.src = tcModuleBaseUrl+'/../bongooglepay/views/js/bongooglepay-front.js';
|
||||
document.head.appendChild(script);
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
34
modules/thecheckout/views/js/parsers/pm_applepay.js
Normal file
34
modules/thecheckout/views/js/parsers/pm_applepay.js
Normal file
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* 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)
|
||||
*/
|
||||
|
||||
checkoutPaymentParser.pm_applepay = {
|
||||
popup_onopen_callback: function () {
|
||||
console.info('[pm_applepay] popup_onopen_callback');
|
||||
if (typeof (pmApplePayPlugin) !== 'undefined' && typeof (initPmApplePayEventsListeners) !== 'undefined') {
|
||||
initPmApplePayEventsListeners();
|
||||
}
|
||||
},
|
||||
|
||||
after_load_callback: function() {
|
||||
$('.dynamic-content .pm-apple-pay-container').appendTo('#pm_applepay-popup-container');
|
||||
},
|
||||
|
||||
container: function(element) {
|
||||
// // Create additional information block, informing user that payment will be processed after confirmation
|
||||
// var paymentOptionId = element.attr('id').match(/payment-option-\d+/);
|
||||
//
|
||||
// if (paymentOptionId && 'undefined' !== typeof paymentOptionId[0]) {
|
||||
// paymentOptionId = paymentOptionId[0];
|
||||
// element.after('<div id="'+paymentOptionId+'-additional-information" class="stripe_official popup-notice js-additional-information definition-list additional-information ps-hidden" style="display: none;"><section><p>'+i18_popupPaymentNotice+'</p></section></div>')
|
||||
// }
|
||||
|
||||
payment.setPopupPaymentType(element);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,11 @@
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
*/
|
||||
|
||||
/** Important - change this:
|
||||
* in modules/pm_subscription/models/Dispatcher/MainCase.php, in method includeAssetsOfPaymentModules():
|
||||
$isOrderController = $this->context->controller instanceof OrderController || $this->context->controller instanceof OrderOpcController || $this->context->controller->page_name == "module-thecheckout-order";
|
||||
*/
|
||||
|
||||
checkoutPaymentParser.pm_subscription_popup = {
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
|
||||
/* (!)
|
||||
postfinancecheckout v1.2.3 - by Customweb
|
||||
Tested on 4.3.2024, with postfinancecheckout v1.2.34 - by Customweb
|
||||
in modules/postfinancecheckout/views/js/frontend/checkout.js, change (!) on 2 places:
|
||||
|
||||
if (current_method.data("module-name") == "postfinancecheckout") {
|
||||
|
||||
53
modules/thecheckout/views/js/parsers/przelewy24.js
Normal file
53
modules/thecheckout/views/js/parsers/przelewy24.js
Normal file
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* 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)
|
||||
*/
|
||||
|
||||
|
||||
/* Payment is done in popup, because since the Blik input initialization, we have a limitted time until the order must be finished, so we'd rather init in the popup */
|
||||
|
||||
checkoutPaymentParser.przelewy24 = {
|
||||
container: function(element) {
|
||||
const isBlikPaymentOption = element.find('[data-module-name=przelewy24-method-181]').length == 1;
|
||||
|
||||
if (isBlikPaymentOption) {
|
||||
payment.setPopupPaymentType(element);
|
||||
element.find('input[name=payment-option]').addClass('binary'); // so that our 'pay' button disappears
|
||||
}
|
||||
|
||||
// Add CSS rule to hide blik form in payment methods list when T&C checkbox is ticked;
|
||||
// but keep it visible in the popup
|
||||
var cssEl = document.createElement('style'),sheet;
|
||||
document.head.appendChild(cssEl);
|
||||
cssEl.sheet.insertRule(`
|
||||
section#checkout-payment-step #p24-blik-section {
|
||||
display: none!important;
|
||||
}
|
||||
`);
|
||||
},
|
||||
|
||||
popup_onopen_callback: function () {
|
||||
$.getScript(tcModuleBaseUrl+'/../przelewy24/views/js/p24_inside.js')
|
||||
.done(
|
||||
function() {
|
||||
setTimeout(function() {
|
||||
$('[name=payment-option]:checked').change(); // invoke blik code input initialization
|
||||
setTimeout(function() {
|
||||
const paymentFormEl = $('.popup-payment-form').find('.js-additional-information');
|
||||
$('#p24-blik-section').prependTo(paymentFormEl);
|
||||
}, 200);
|
||||
}, 300);
|
||||
});
|
||||
},
|
||||
|
||||
form: function (element) {
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
/* Tested with ps_checkout v2.21.0 (12.01.2023) */
|
||||
/* Tested with ps_checkout v8.4.0 - commented out payment form removal (29.04.2024) */
|
||||
window.tc_ps_checkout = {
|
||||
init: false
|
||||
};
|
||||
@@ -80,7 +81,7 @@ checkoutPaymentParser.ps_checkout = {
|
||||
}
|
||||
|
||||
// Disable weird 'click' emitted by _dev\js\front\src\components\1_7\payment-options.component.js in renderPaymentOptionItems() method
|
||||
$('body').off('click.ps_checkout').on('click.ps_checkout', '[data-module-name=ps_checkout-paypal]', (e) => {
|
||||
$('body').off('click.ps_checkout').on('click.ps_checkout', '[data-module-name^=ps_checkout-paypal]', (e) => {
|
||||
let stackTrace = JSON.stringify(Error().stack);
|
||||
if (stackTrace && stackTrace.match('modules/ps_checkout/views/js/front.js')) {
|
||||
console.log('triggered by ps_checkout paypal fundingSource HTMLElement.click(), skip selected payment toggle');
|
||||
@@ -115,12 +116,12 @@ checkoutPaymentParser.ps_checkout = {
|
||||
},
|
||||
|
||||
form: function (element, triggerElementName) {
|
||||
if (!payment.isConfirmationTrigger(triggerElementName)) {
|
||||
if (debug_js_controller) {
|
||||
console.info('[ps_checkout parser] Not confirmation trigger, removing payment form');
|
||||
}
|
||||
element.remove();
|
||||
}
|
||||
// if (!payment.isConfirmationTrigger(triggerElementName)) {
|
||||
// if (debug_js_controller) {
|
||||
// console.info('[ps_checkout parser] Not confirmation trigger, removing payment form');
|
||||
// }
|
||||
// element.remove();
|
||||
// }
|
||||
},
|
||||
|
||||
additionalInformation: function (element) {
|
||||
|
||||
29
modules/thecheckout/views/js/parsers/pshugls.js
Normal file
29
modules/thecheckout/views/js/parsers/pshugls.js
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* 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)
|
||||
*/
|
||||
|
||||
tc_confirmOrderValidations['pshugls'] = function() {
|
||||
if (
|
||||
$('.carrier-extra-content.pshugls:visible').is(':visible') &&
|
||||
$('.delivery-option.pshugls.selected').length === 1 &&
|
||||
(
|
||||
$('.delivery-option.pshugls.selected ~ .carrier-extra-content.pshugls').find('#gls-map-success-parcel-shop:visible').length === 0 &&
|
||||
$('.delivery-option.pshugls.selected ~ .carrier-extra-content.pshugls').find('#gls-map-success-parcel-locker:visible').length === 0
|
||||
)
|
||||
) {
|
||||
var shippingErrorMsg = $('#thecheckout-shipping .inner-wrapper > .error-msg');
|
||||
shippingErrorMsg.find('.err-pshugls').remove();
|
||||
shippingErrorMsg.append('<span class="err-pshugls"> (pickup point)</span>');
|
||||
shippingErrorMsg.show();
|
||||
scrollToElement(shippingErrorMsg);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
43
modules/thecheckout/views/js/parsers/redsysinsite.js
Normal file
43
modules/thecheckout/views/js/parsers/redsysinsite.js
Normal file
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* 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)
|
||||
*/
|
||||
|
||||
|
||||
checkoutPaymentParser.redsysinsite = {
|
||||
container: function(element) {
|
||||
payment.setPopupPaymentType(element);
|
||||
element.find('input[name=payment-option]').addClass('binary'); // so that our 'pay' button in the popup disappears
|
||||
|
||||
// Add CSS rule to hide payment form in payment methods list
|
||||
// but keep it visible in the popup
|
||||
var cssEl = document.createElement('style'),sheet;
|
||||
document.head.appendChild(cssEl);
|
||||
cssEl.sheet.insertRule(`
|
||||
section#checkout-payment-step .redsysinsite_form_container [id^='redsysinsite_card_form_container'] {
|
||||
display: none!important;
|
||||
}
|
||||
`);
|
||||
cssEl.sheet.insertRule(`
|
||||
.popup-payment-form [id^=ri-messages] {
|
||||
display: none;
|
||||
}
|
||||
`);
|
||||
},
|
||||
|
||||
popup_onopen_callback: function () {
|
||||
|
||||
},
|
||||
|
||||
|
||||
form: function (element) {
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,23 @@
|
||||
*/
|
||||
|
||||
/* popup mode last tested on 15.4.2023 with revolutpayment v2.2.4 */
|
||||
/* popup/direct(=embedded)/redirect modes tested on 1.5.2024 with revolutpayment v2.8.6 */
|
||||
/* Update please \revolutpayment\views\js\version17\revolut.payment.js, method initCheckoutUpsellBanner():
|
||||
function initCheckoutUpsellBanner() {
|
||||
let upsellBannerElement = document.getElementById("revolut-upsell-banner");
|
||||
// Thecheckout module update begin
|
||||
if (upsellBannerElement === null) { return; }
|
||||
// Thecheckout module udpate end
|
||||
|
||||
And for revolutpay button, also update stopLoading() method, like so:
|
||||
function stopLoading() {
|
||||
// Thecheckout module update BEGIN
|
||||
if (typeof $.unblockUI === 'function') {
|
||||
$.unblockUI();
|
||||
}
|
||||
// Thecheckout module update END
|
||||
}
|
||||
*/
|
||||
|
||||
checkoutPaymentParser.revolutpayment = {
|
||||
|
||||
@@ -20,6 +37,25 @@ checkoutPaymentParser.revolutpayment = {
|
||||
|
||||
},
|
||||
|
||||
after_load_callback: function() {
|
||||
// Update card logos, by default only VISA is shown
|
||||
if (typeof logo_path === "undefined") {
|
||||
return;
|
||||
}
|
||||
|
||||
let visa_logo = `<img class="visa-logo" src="${logo_path}visa-logo.svg"/>`;
|
||||
let mastercard_logo = `<img class="mastercard-logo" src="${logo_path}master-card-logo.svg">`;
|
||||
let amex_logo = `<img class="amex-logo" style="display:none" src="${logo_path}amex.svg">`;
|
||||
|
||||
$(`img[src="${logo_path}visa-logo.svg"] ~ .tc-rev-logos`).remove();
|
||||
$(`img[src="${logo_path}visa-logo.svg"]`).after(`${visa_logo}<span class="tc-rev-logos">${mastercard_logo}${amex_logo}</span>`).remove();
|
||||
$(`img[src="${revpay_logo}"]`).after(`${visa_logo}${mastercard_logo}${amex_logo}`).css({ width: "30px" });
|
||||
|
||||
if (amex_availability) {
|
||||
$(".amex-logo").show();
|
||||
}
|
||||
},
|
||||
|
||||
initPayment: function() {
|
||||
// revolut_card container present, but fields not yet initiated
|
||||
if ($('#revolut_card').length && !($('#revolut_card.rc-card-field').length)) {
|
||||
@@ -31,12 +67,28 @@ checkoutPaymentParser.revolutpayment = {
|
||||
// Create additional information block, informing user that payment will be processed after confirmation
|
||||
var paymentOptionId = element.attr('id').match(/payment-option-\d+/);
|
||||
|
||||
let isRevolutPay = element.next().find('#revolutPayForm').length === 1;
|
||||
let isRevolutCard = element.next().find('#revolutPay').length === 1; // not used now
|
||||
|
||||
if (isRevolutPay) {
|
||||
element.find('input[name=payment-option]').addClass('binary'); // so that our 'pay' button disappears
|
||||
}
|
||||
|
||||
if (paymentOptionId && 'undefined' !== typeof paymentOptionId[0]) {
|
||||
paymentOptionId = paymentOptionId[0];
|
||||
element.after('<div id="'+paymentOptionId+'-additional-information" class="stripe_official popup-notice js-additional-information definition-list additional-information ps-hidden" style="display: none;"><section><p>'+i18_popupPaymentNotice+'</p></section></div>')
|
||||
element.after('<div id="'+paymentOptionId+'-additional-information" class="revolutpayment popup-notice js-additional-information definition-list additional-information ps-hidden" style="display: none;"><section><p>'+i18_popupPaymentNotice+'</p></section></div>')
|
||||
}
|
||||
|
||||
payment.setPopupPaymentType(element);
|
||||
|
||||
// Add CSS rule
|
||||
var cssEl = document.createElement('style'),sheet;
|
||||
document.head.appendChild(cssEl);
|
||||
cssEl.sheet.insertRule(`
|
||||
[data-payment-module=revolutpayment] .amex-logo ~ .tc-rev-logos {
|
||||
display: none;
|
||||
}
|
||||
`);
|
||||
},
|
||||
|
||||
form: function (element, triggerElementName) {
|
||||
|
||||
@@ -8,6 +8,18 @@
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
*/
|
||||
|
||||
/*
|
||||
Tested with sendcloud v2.0.9 (09.05.2024)
|
||||
(!) important, update /modules/sendcloudv2/sendcloudv2.php, method hookDisplayHeader(..), change $allowedControllers to:
|
||||
$allowedControllers = [
|
||||
'HistoryController',
|
||||
'OrderConfirmationController',
|
||||
'OrderController',
|
||||
'OrderOpcController',
|
||||
'TheCheckoutModuleFrontController'
|
||||
];
|
||||
*/
|
||||
|
||||
tc_confirmOrderValidations['sendcloud'] = function() {
|
||||
if (
|
||||
/*$('#mondialrelay_widget').is(':visible')*/
|
||||
|
||||
@@ -11,6 +11,25 @@
|
||||
var shaim_shipping_modules_present = ('undefined' !== typeof exists_opc);
|
||||
|
||||
if (shaim_shipping_modules_present) {
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function(event) {
|
||||
|
||||
if (typeof CheckHardPplparcelshop === 'function') {
|
||||
prestashop.on('thecheckout_updateDeliveryOption', function () {
|
||||
setTimeout(function () {
|
||||
var ppl_parcelshop_iframe = document.getElementById('ppl_parcelshop_iframe');
|
||||
if (typeof ppl_parcelshop_iframe !== 'undefined' && ppl_parcelshop_iframe && typeof iframeListenerPplparcelshop === 'function') {
|
||||
var idoc_ppl_parcelshop = ppl_parcelshop_iframe.contentWindow || ppl_parcelshop_iframe.contentDocument;
|
||||
idoc_ppl_parcelshop.document.addEventListener('ppl-parcelshop-map', function (e) {
|
||||
iframeListenerPplparcelshop(e);
|
||||
});
|
||||
}
|
||||
}, 1500);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
tc_confirmOrderValidations['shaim_shipping_modules'] = function () {
|
||||
|
||||
/* openservis - WEDO - begin */
|
||||
@@ -95,5 +114,3 @@ if (shaim_shipping_modules_present) {
|
||||
/* openservis - Zásilkovna - end */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -8,52 +8,37 @@
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
*/
|
||||
|
||||
checkoutPaymentParser.stripejs_removed = {
|
||||
/* tested with Stripe Payment Pro v4.6.0 - by NTS - on 12.03.2024, when embedded payment is enabled */
|
||||
checkoutPaymentParser.stripejs = {
|
||||
|
||||
initiatePayment: function() {
|
||||
if (typeof StripePubKey !=='undefined') {
|
||||
var stripe = Stripe(StripePubKey,{locale: lang_iso_code});
|
||||
var stripe_pm = document.getElementById('selected_pm').value;
|
||||
var quickPay = ((stripe_pm!=1) ? 1 : 0);
|
||||
// after_load_callback: function() {
|
||||
// if (typeof initiateStripePayment !== 'undefined') {
|
||||
// initiateStripePayment();
|
||||
// }
|
||||
// },
|
||||
|
||||
$('input[name=payment-option]:checked').focus();
|
||||
$('#stripe-ajax-loader,#stripe-payment-form').toggle();
|
||||
$('#payment-confirmation button[type=submit]').prop("disabled", true);
|
||||
var toggle_selector = '#stripe-ajax-loader,#stripe-payment-form';
|
||||
var error_selector = '#card-errors';
|
||||
container: function (element) {
|
||||
payment.setPopupPaymentType(element);
|
||||
|
||||
handlePI('checkout', function(res_status){
|
||||
if(res_status.code==1) {
|
||||
$('#checkout-success').show();
|
||||
stripe.redirectToCheckout({
|
||||
sessionId: res_status.sess_id
|
||||
}).then(function (result) {
|
||||
$('#checkout-success').hide();
|
||||
var err_msg = showStripePayError(toggle_selector, 0, result.error.message, error_selector);
|
||||
alert(result.error.message);
|
||||
});
|
||||
}
|
||||
});
|
||||
// Add CSS rule to hide payment form in payment methods list
|
||||
var cssEl = document.createElement('style'),sheet;
|
||||
document.head.appendChild(cssEl);
|
||||
cssEl.sheet.insertRule(`
|
||||
section#checkout-payment-step [data-payment-module=stripejs] > .additional-information {
|
||||
display: none!important;
|
||||
}
|
||||
`);
|
||||
},
|
||||
|
||||
popup_onopen_callback: function () {
|
||||
if (typeof initiateStripePayment !== 'undefined') {
|
||||
|
||||
// out of some reason stripe_allow_prbutton is always false on initial page load
|
||||
if ($('[data-module-name^=stripePRButton]').length && typeof stripe_allow_prbutton !== 'undefined') {
|
||||
stripe_allow_prbutton = true;
|
||||
}
|
||||
initiateStripePayment();
|
||||
}
|
||||
},
|
||||
|
||||
after_load_callback: function() {
|
||||
// $.getScript(tcModuleBaseUrl + '/../stripejs/views/js/stripe-prestashop.js');
|
||||
|
||||
},
|
||||
|
||||
all_hooks_content: function (content) {
|
||||
|
||||
},
|
||||
|
||||
container: function (element) {
|
||||
|
||||
},
|
||||
|
||||
form: function (element) {
|
||||
let form = element.find('form');
|
||||
let onSubmitAction = 'javascript:checkoutPaymentParser.stripejs.initiatePayment()';
|
||||
form.attr('action', 'javascript:void(0);');
|
||||
form.attr('onsubmit', onSubmitAction);
|
||||
}
|
||||
}
|
||||
39
modules/thecheckout/views/js/parsers/tpay.js
Normal file
39
modules/thecheckout/views/js/parsers/tpay.js
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* 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)
|
||||
*/
|
||||
|
||||
tc_confirmOrderValidations['tpay'] = function () {
|
||||
if (
|
||||
$('ul.tpay-payment-gateways:visible').length &&
|
||||
$('[name=tpay_transfer_id]:checked').length == 0
|
||||
) {
|
||||
var paymentErrorMsg = $('#thecheckout-payment .dynamic-content > .inner-wrapper > .error-msg');
|
||||
$('.payment-validation-details').remove();
|
||||
paymentErrorMsg.append('<span class="payment-validation-details"> (Tpay channel)</span>')
|
||||
paymentErrorMsg.show();
|
||||
scrollToElement(paymentErrorMsg);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
checkoutPaymentParser.tpay = {
|
||||
after_load_callback: function() {
|
||||
$.getScript(tcModuleBaseUrl+'/../tpay/views/js/main.min.js')
|
||||
.done(
|
||||
function() {
|
||||
console.log('tpay loaded');
|
||||
});
|
||||
},
|
||||
|
||||
form: function (element) {
|
||||
// intentionally empty
|
||||
},
|
||||
}
|
||||
@@ -8,6 +8,14 @@
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
*/
|
||||
|
||||
/*
|
||||
Update file: /modules/upsservice/upsservice.php, change in hookDisplayHeader():
|
||||
from:
|
||||
if (($this->context->controller instanceof OrderController) || ($this->context->controller instanceof OrderOpcController)) {
|
||||
to:
|
||||
if (($this->context->controller instanceof OrderController) || ($this->context->controller instanceof OrderOpcController) || $this->context->controller instanceof TheCheckoutModuleFrontController) {
|
||||
*/
|
||||
|
||||
checkoutShippingParser.upsservice = {
|
||||
|
||||
after_load_callback: function(deliveryOptionIds) {
|
||||
|
||||
@@ -4,20 +4,41 @@
|
||||
* 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)
|
||||
* @author Veebipoed.ee | Peter Sliacky (Zelarg)
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
*/
|
||||
|
||||
tc_confirmOrderValidations['vp_omniva'] = function() {
|
||||
if (
|
||||
$('.vp_omniva select[name=terminals]').is(':visible') &&
|
||||
'0' == $('.vp_omniva select[name=terminals]').val()
|
||||
) {
|
||||
var shippingErrorMsg = $('#thecheckout-shipping .inner-wrapper > .error-msg');
|
||||
shippingErrorMsg.show();
|
||||
scrollToElement(shippingErrorMsg);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
tc_confirmOrderValidations['vp_omniva'] = function() {
|
||||
let selectedDeliveryOption = $('.delivery-option-row.selected');
|
||||
if (selectedDeliveryOption && 0 !== selectedDeliveryOption.length) {
|
||||
if (selectedDeliveryOption[0].classList.contains('vp_omniva') ||
|
||||
selectedDeliveryOption[0].classList.contains('vp_omniva_latvia') ||
|
||||
selectedDeliveryOption[0].classList.contains('vp_omniva_lietuva')) {
|
||||
let nextElement = selectedDeliveryOption[0].nextElementSibling;
|
||||
if (nextElement && 0 !== nextElement.children.length) {
|
||||
let selectElements = $(nextElement).find('select');
|
||||
if (2 === selectElements.length) {
|
||||
if (selectElements[1][0].selected) {
|
||||
var shippingErrorMsg = $('#thecheckout-shipping .inner-wrapper > .error-msg');
|
||||
shippingErrorMsg.show();
|
||||
scrollToElement(shippingErrorMsg);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (selectElements[0][0].selected) {
|
||||
var shippingErrorMsg = $('#thecheckout-shipping .inner-wrapper > .error-msg');
|
||||
shippingErrorMsg.show();
|
||||
scrollToElement(shippingErrorMsg);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true; // default when validations are not needed
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user