LittleDemon WebShell


Linux hosting5.siteguarding.com 3.10.0-962.3.2.lve1.5.88.el7.x86_64 #1 SMP Fri Sep 26 14:06:42 UTC 2025 x86_64
Path : /home/devsafetybis/verd.dev.safetybis.com/js/brippopaymentsfrontend/minicart/
File Upload :
Command :
Current File : /home/devsafetybis/verd.dev.safetybis.com/js/brippopaymentsfrontend/minicart/express-minicart.js

var BrippoExpressMiniCart = Class.create();

BrippoExpressMiniCart.prototype = {
    stripe: null,
    pkey: null,
    elements: null,
    currentTotals: null,
    paymentMethodCode: "brippopayments_express",
    paymentRequest: null,
    config: null,
    isPlaceOrderActionAllowed: false,

    initialize: function(config) {
        let self = this;
        this.config = config;

        if (typeof BrippoExpressCheckout === 'undefined') {
            let listener = function() {
                self.onLoad();
                window.removeEventListener('BrippoExpressCheckoutLoaded', listener);
            };
            window.addEventListener('BrippoExpressCheckoutLoaded', listener);
        } else {
            self.onLoad();
        }
    },

    onLoad: function() {
        let self = this;

        window.addEventListener('brippoPlaceOrderLockEnabled', (event) => {
            $('stripeconnect-express-minicart-button').addClassName('brippoButtonDisabled');
        });
        window.addEventListener('brippoPlaceOrderLockDisabled', (event) => {
            $('stripeconnect-express-minicart-button').removeClassName('brippoButtonDisabled');
        });

        this.onRenderedHandler();
    },

    onRenderedHandler: function() {
        let self = this;
        console.log("BrippoExpress - Minicart rendered");
        self.initRequest();
    },

    initRequest: function() {
        const self = this;

        if (!this.config.enabledInMiniCart) {
            return;
        }

        if (BrippoExpressCheckout.prototype.isOSC()) {
            return;
        }

        BrippoExpressCheckout.prototype.onCanMakePaymentHandlers.push(function () {
        });

        BrippoExpressCheckout.prototype.initPaymentRequest(
            this.config,
            {
                source: 'minicart',
                elementId: 'stripeconnect-express-minicart-button'
            },
            function (prButton) {
                self.onButtonReadyHandler(prButton);
            },
            function (canMakePayment, paymentRequest) {
                self.paymentRequest = paymentRequest;
                self.isPlaceOrderActionAllowed = canMakePayment;
                if (canMakePayment && paymentRequest) {
                    paymentRequest.on('cancel', function (ev) {
                        console.log("paymentRequest.cancel executed");
                        self.isPlaceOrderActionAllowed = true;
                    });
                }
            }
        );
    },

    onButtonReadyHandler: function(prButton) {
        const self = this;

        prButton.on('click', function (ev) {
            if (!self.validate()) {
                ev.preventDefault();
            }
        });
    },
    validate: function() {
        if (BrippoExpressCheckout.prototype.placeOrderLock === true) {
            return false;
        } else {
            return true;
        }
    },
};

Event.observe(window, 'load', function () {
    window.dispatchEvent(new Event('BrippoExpressMiniCartLoaded'));
});


LittleDemon - FACEBOOK
[ KELUAR ]