/**
* 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 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 = {
popup_onopen_callback: function () {
checkoutPaymentParser.revolutpayment.initPayment();
},
all_hooks_content: function (content) {
},
after_load_callback: function() {
// Update card logos, by default only VISA is shown
if (typeof logo_path === "undefined") {
return;
}
let visa_logo = ``;
let mastercard_logo = `
`;
let amex_logo = ``;
$(`img[src="${logo_path}visa-logo.svg"] ~ .tc-rev-logos`).remove();
$(`img[src="${logo_path}visa-logo.svg"]`).after(`${visa_logo}${mastercard_logo}${amex_logo}`).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)) {
$.getScript(tcModuleBaseUrl+'/../revolutpayment/views/js/version17/revolut.payment.js');
}
},
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+/);
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('