alma / alma-monthlypayments-magento2

Magento 2 Payment Gateway integration for Alma
Other
6 stars 9 forks source link

Issue with payment 3 month and badge.js #39

Closed Minirock closed 2 years ago

Minirock commented 2 years ago

Hi there,

I would like to report a couple issues that i'm currently facing :

var qtyNode = document.getElementById('qty');
qtyNode.addEventListener("input",function(){updateWidget()});

In some cases it looks like it is triggering a js error when the script loads before the dom

image

As a fix attempt, I would suggest to add domReady! for this js file ?

=========================================================================

As you can see, two times works fine

image

But not the 3 times

image

I've been trying to dig by myself but I can't find where this values are generated; so I don't really know what is happening.

=========================================================================

image

Did I missed something in the database ? Thanks for attention

Francois-Gomis commented 2 years ago

Hi, thanks for you report. This issue is caused by old external Javascript librairie who change JS object prototype. Is you use prototype.js in version 1.6 you can update them for resolving the issue. Old jquery version (jquery-watch) may also cause the same issue.

Thanks. For more help you can use the email : support@getalma.eu

Minirock commented 2 years ago

Hi @Francois-Gomis

Thanks for your update. Looking at my magento libs, looks like our prototype.js is version 1.7

And jquery version is : jQuery JavaScript Library v1.12.4

So I think we are not falling into the use case you just specified.

Francois-Gomis commented 2 years ago

Hi, Do you have un URL with an active Alma Badge ? Thanks

Minirock commented 2 years ago

No sorry only a restricted sandbox right now. Running on a magento 2.2.6 instance.

Francois-Gomis commented 2 years ago

Hi Minirock,

we have identified the library : it's "legacy-build.min.js"

Minirock commented 2 years ago

@Francois-Gomis For the update, what was causing us the issue was a third party js call is one of our custom code.

From app/design/frontend/Website/default/Makarovsoft_Callback/templates/form.phtml

    require(
        [
            'jquery',
            'Magento_Ui/js/modal/modal',
            'prototype'
            'Magento_Ui/js/modal/modal'
        ],
        function(
            jQuery,
            modal,
            prototype
            modal
        ) {

Removing the call to prototype fixed it. So strongly related to what you were saying about the prototype library. In our case the prototype object wasn't even used so we just had to remove it to make it work.

Francois-Gomis commented 2 years ago

@Minirock Thanks for the update !