lyra / plugin-magento

An open source plugin that links Magento based e-commerce websites to PayZen secure payment gateway developed by Lyra Network.
https://lyra.com/fr/guides/magento/
Open Software License 3.0
10 stars 12 forks source link

Issue with krypton when REST is disabled #23

Closed Stigmi-Stephane closed 2 years ago

Stigmi-Stephane commented 3 years ago

Javascript error in the consol with systempay-standard.js when REST API is not activated:

VM14014:3 Uncaught ReferenceError: KR is not defined
    at Object.eval (eval at require.load (72789c4501585b4cc733f0855132abc1.min.js:181), <anonymous>:3:787)
    at fire (eval at require.load (72789c4501585b4cc733f0855132abc1.min.js:181), <anonymous>:214:223)
    at Object.fireWith [as resolveWith] (eval at require.load (72789c4501585b4cc733f0855132abc1.min.js:181), <anonymous>:220:181)
    at done (eval at require.load (72789c4501585b4cc733f0855132abc1.min.js:181), <anonymous>:630:95)
    at XMLHttpRequest.callback (eval at require.load (72789c4501585b4cc733f0855132abc1.min.js:181), <anonymous>:657:15)

Or getting Error 500 if REST keys are not set in the backoffice.

nberhouche commented 3 years ago

Hi Stéphane,

I couldn't reproduce this problem locally with the latest version of Systempay plugin (v2.5.9). What version of the plugin are you using? Do you use the default checkout process for your store or a One Step Checkout -type plugin? Could you also provide the log file pf the plugin (file /MAGENTO_FOLDER/var/log/systempa.log)?

Best regards.

Stigmi-Stephane commented 3 years ago

Hello,

We use the last version 2.5.9, with the default settings and the default One Step Checkout. You’ll find attached a anonymised sample of the log.

Best regards systempay.log

norgeindian commented 3 years ago

We are facing the same issue with lyra-standard.js, but can not really say why it happens on our side. Please let me know what I can check to debug further here.

sprankhub commented 2 years ago

We have that issue when using OneStepCheckout. I know that embedded forms are not supported in this case. However, even the option "Bank data acquisition on payment gateway" is currently broken. The issue is this code block:

https://github.com/lyra/plugin-magento/blob/c204e25685cb4bf056372ab402243e39f32dbad1/view/frontend/web/js/view/payment/method-renderer/payzen-standard.js#L30-L53

Here, REST-specific code is executed as soon as a specific DOM node is changed no matter if a REST-method or "Bank data acquisition on payment gateway" is used. In the core checkout, that DOM node is not changed, so that the code is not executed. However, with OneStepCheckout, the DOM node is indeed changed, so that the code is executed even if no REST-method is used. @nabil509, can you ensure that this code is only executed if a REST-method is actually used?

@Stigmi-Stephane what does "default One Step Checkout" mean for you? So really the core standard checkout or are you also talking about https://www.onestepcheckout.com/?

Stigmi-Stephane commented 2 years ago

The checkout is the Magento 2 default one, the core checkout.

nberhouche commented 2 years ago

@sprankhub Thank you for pointing out this issue, as we only test with the default Magento 2 checkout, we couldn't detect this problem. We'll fix that as soon as possible.

@Stigmi-Stephane Sorry for not answering sooner, I think you have the same problem with @sprankhub. I'll get back to you when it will be fixed. Thank you for your patience.

sprankhub commented 2 years ago

Thanks for your answer and that you are willing to fix this @nberhouche! Sorry for pushing, but our shop update depends on this. Do you have a rough time frame for this? Is this a matter of hours, days or weeks? Thanks again!

norgeindian commented 2 years ago

@nberhouche , any update on this ticket? We highly depend on this module to update the shop. Would be awesome, if a fix could be published soon.

nabil509 commented 2 years ago

Hi @norgeindian,

We fixed the problem in a coming 2.5.10 version. We will release it at the beginning of the next week. Our support team will come back to you with release candidate version very soon.

Have a nice day.

nabil509 commented 2 years ago

Hi @norgeindian,

I think there was a misunderstanding. The problem you report is about a conflict with your checkout plugin even the error message is the same. I want you know that we target the Magento standard checkout because it is impossible to make the plugin compatible with all third-party plugins since we cannot know how they work. Typically, in your case, I think our JS library is not loaded in your checkout page because your checkout layout is not the same as the Magento standard checkout layout.

The problem in this issue concerns the merchants taht are using the redirection and have the error message.

nabil509 commented 2 years ago

Hi @sprankhub, Hi @Stigmi-Stephane,

We fixed the error in case redirection is enabled and you have an error message relative to the KR object loading.

We will release the v2.5.10 tomorrow. Sorry for delay. We fixed some other issues in the same version.

nberhouche commented 2 years ago

Hi @sprankhub @Stigmi-Stephane,

Plugin version v2.5.10 containing the aforementionned fixes has been released.

Best regards.