Created
June 7, 2023 11:53
-
-
Save Daniel-Rafique/3be1f0276ca0861bed620da443301239 to your computer and use it in GitHub Desktop.
Rename my previous file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require([ | |
'jquery', | |
'ko', | |
'mage/url', | |
'Magento_Checkout/js/model/quote', | |
'Superpayments_SuperPayment/js/view/payment/method-renderer/super_payment_gateway' | |
], function ($, ko, url, quote, SuperPaymentGateway) { | |
'use strict'; | |
var quoteTotals = ko.observable(quote.totals()); | |
quote.totals.subscribe(function () { | |
$('#top-super-banner').load(window.location.href + ' #top-super-banner'); | |
var offerurl = url.build('superpayment/discount/offerbanner'); | |
$.ajax({ | |
url: offerurl, | |
dataType : 'json', | |
type : 'POST', | |
async: false, | |
cache: false, | |
beforeSend: function() { | |
$('body').trigger('processStart'); | |
}, | |
success: function(data, status, xhr) { | |
$('body').trigger('processStop'); | |
$(".superpaymentmethod").show(); | |
var description = data.description; | |
var title = data.title; | |
var banner = data.banner; | |
$(".superblockcontent").html(description); | |
$(".superpayment_title").html(title); | |
}, | |
error: function (xhr, status, errorThrown) { | |
console.log('Error happens. Try again.'); | |
console.log(errorThrown); | |
$('body').trigger('processStop'); | |
} | |
}); | |
}); | |
return { | |
quoteTotals: quoteTotals | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment