amzn / amazon-payments-magento-2-plugin

Extension to enable Amazon Pay on Magento 2
https://amzn.github.io/amazon-payments-magento-2-plugin/
Apache License 2.0
109 stars 76 forks source link

Mobile payments is not possible when Magento in production mode #216

Closed balex13 closed 4 years ago

balex13 commented 6 years ago

What I expected

It should be possible to use Amazon Pay on production mode.

JS compilation is enabled by default in Magento 2 production mode. Mobile device has touch screen so redirect is used.

What happened instead

After customer successfully logged in he redirected back to the store processAuthHash action. "You will be redirected shortly" message appears behind a spinner (processStart). But redirect never starts.

Steps to reproduce the issue

On server

Enable Production mode

On mobile device
  1. Add any product to the shopping cart
  2. Go to checkout
  3. Press Amazon Pay button. Customer redirected to Amazon Login page
  4. Enter correct login information. Customer redirected back to processAuthHash action
  5. Page with spinner and "You will be redirected shortly" message appears. Redirect does not start.
  6. Check console log for JS error Uncaught Error: Module name "Magento_Ui/js/lib/registry/registry" has not been loaded yet for context: _. Use require([])

Your setup

Additional info and possible hot-fix

It is not possible to remove amazonPayment property from window. Because it used in current version of Widgets.js and login1.js - these files on Amazon Pay side. And so it is present there despite it was moved to registry by Extension now uses uiRegistry feature. My comment here https://github.com/amzn/amazon-payments-magento-2-plugin/commit/d5d3d9fd72eaecfa15c2ed7000287a7c806b29cf#r28753669

Hot-fix:
  1. Return back amazonPayment property to window.
    1. Override amazon-widgets-loader.js and login-button-wrapper.js and correctly use dependency to uiRegistry. Or remove uiRegistry at all.
BabliDey commented 6 years ago

Hello @balex13, did you get any solution for this.. I am also having the same problem.

lemked commented 6 years ago

Hi @BabliDey and @balex13 ,

I'm very sorry for not having answered this sooner. Our support agency is currently looking into this. We will provide an update soon.

Kind regards, Daniel

lemked commented 6 years ago

Hi @BabliDey and @balex13 ,

We've got feedback from our support agency that the problem couldn't be reproduced with Magento 2.1.6, 2.2.3 or 2.2.4.

Can you please provide access to a staging environment per SSH where the problem can be reproduced? Please get in contact with us via payments-cp-devel@amazon.com regarding the access to the staging environment.

Kind regards, Daniel

lemked commented 6 years ago

We've been able to reproduce the problem and are currently looking into this.

Kind regards, Daniel

lemked commented 6 years ago

Hi @BabliDey and @balex13 ,

This issue should have been fixed by a change in our widgets.js library. Can you verify if you are still encountering this?

Kind regards, Daniel

lemked commented 5 years ago

Closing. Please re-open should this still apply with a more recent version of our extension.

suneet-magento commented 5 years ago

Hey @lemked, we are also getting the same issue on Magento Open Source 2.2.7. Can you please share the fix of this module?

We have installed v2.1.2.

lemked commented 5 years ago

Hi @suneet-magento ,

We have double checked this and I can confirm that this issues is solved partially only. The problem still persists when using sandbox mode and redirect authentication (on product details pages and when using a mobile device).

Can you confirm that the issue that you are referring to is the redirect to the Amazon Pay checkout after login not working (so being stuck on the page that shows "You will be redirected shortly)? Please also specify the region you are using our extension with as this doesn't appear to affect US for example.

Kind regards, Daniel

zsco commented 5 years ago

Hi @lemked,

I can confirm that the issue (being stuck on the page that shows "You will be redirected shortly) still persists. We just upgraded to Magento Version 2.2.8 using region "Eurozone". Also, the issue is also present in production mode in our case.

Regards

lemked commented 5 years ago

Hi @zsco ,

Can you share the website where this is reproducible? If the website is not public, please share the required access information with us via payments-cp-devel@amazon.com.

Kind regards, Daniel

zsco commented 5 years ago

Hi @lemked,

please try https://test2856.handyhuellen-24.de/.

Regards

lemked commented 5 years ago

Hi @zsco ,

Can you disable the sandbox mode for the website mentioned above? That way we can test it in production/live mode.

Kind regards, Daniel

zsco commented 5 years ago

Hi @lemked,

please refer to https://www.xxxx/. It's in live mode and not working. Curiously, when switching to live mode on our test site, the redirect is working, so it may be a problem with JS compression.

Regards

Edit: Nevermind, this seems to be a problem with a third party module/ third party theme. I just updated the live server code after everything worked on test and the redirect works.

I especially updated the amazon payment module to 2.1.4.

The problem seems to only occur in sandbox mode now.

Thanks for the help anyways.

Edit2: Further tests confirmed a problem with javascript compression.

lemked commented 5 years ago

Thanks for confirming. Leaving this issue open until we have fixed this on sandbox as well.

johnvanrees commented 5 years ago

I am having this same problem with Magento 2.2.8 and Amazon 2.1.3. The production, US region does not allow the mobile user to move past the "You will be redirected shortly" screen.

tarishah commented 5 years ago

We are looking into this issue. I will provide an update as soon as I have one.

Thanks for reaching out. Tarini

johnvanrees commented 5 years ago

When in private mode, the checkout loads fine. I think the issue is when the browser tried to use Amazon Checkout when it wasn't working or when used on the M1 integration. The problem only appears for the customers that have used the Amazon Checkout in the past and have not cleared their browser.

tarishah commented 5 years ago

@johnvanrees Our team is looking into this and we should have a fix in next couple of weeks. I will update you once we have the fix released.

Thanks, Tarini

hoangtuan21193 commented 5 years ago

We stuck with same problem about 2 weeks, any update on this problem? In my case, when user login, logout and login again, the "You will be redirected shortly" message appears and not redirect.

tarishah commented 5 years ago

@hoangtuan21193 Magento 2.3.2 and 2.2.9 contains a short term fix for the issue you have mentioned. We are working on an ideal solution and should have the fix out sometime in late July. I will provide na update here once we roll out the patch.

Sorry for any inconvenience this may cause. Tarini

hoangtuan21193 commented 5 years ago

@tarishah Thank you for your fast reply! We are using Magento 2.2.8 and can not update to 2.2.9 right now. Would you mind if I can have a link of commit about that short term fix for the issue. Thank you so much!

vincent-wantomo commented 5 years ago

We have the same issue on 2.2.9 : stuck on redirection page (+ english message not translated).

Only works on private mode or with a cleaned browser (safari, iOS). Desktop is working fine. Also, we're using the JPN region.

hoangtuan21193 commented 5 years ago

@vincent-wantomo seem like we have same problem, I’m trying to copy some js code from master branch. I will let you know if it work. Also, we’re are using JPN too.

tarishah commented 5 years ago

@vincent-wantomo Apologies for the behavior you're running into. Can you please direct me to the site url the issue is on? Please email us at payments-cp-devel@amazon.com with the information.

Thanks!

nitin-bc commented 5 years ago

Hi @tarishah I am also facing exact same issue in Magento 2.2.7 with Amazon-pay version 2.1.2. My site URL is https://www.sfcable.com/. Earliest response would be highly appreciated. My site is already live and I am loosing the customers. Please help asap.

Thanks

tarishah commented 5 years ago

@nitin-bc Thanks for reaching out. I was not able to locate Amazon Pay button at https://www.sfcable.com/. However, we have already started looking into this issue. We will provide an update as soon as we have a fix ready to share.

Thank you for your patience. Tarini

vincent-wantomo commented 5 years ago

Hello,

Any updates regarding this issue ? Do you have an ETA for a fix?

It's very critical for all of us. It's unlikely that we'll let Amazon Pay activated on live servers if customers will get stuck on a redirect page. If we can help debugging by providing more information, we'll be more than happy to help.

Thank you in advance.

tarishah commented 5 years ago

@vincent-wantomo We are looking into this issue. I should be able to provide an update by end of this week.

Thank you for your patience. Tarini

lemked commented 5 years ago

Fixed in current master branch, will be available with next Magento 2 release.

nitin-bc commented 5 years ago

Hi @lemked Thank for your response. Can I get commit number to implement this patch in my current website instead of waiting for new Magento release?

Thanks

lemked commented 5 years ago

Hi @nitin-bc ,

Sure! Here you go: https://github.com/amzn/amazon-payments-magento-2-plugin/commit/18b88a4e1a5bcd4700b0d3a1dec011c05c37c643

Kind regards, Daniel

vincent-wantomo commented 5 years ago

Thank you for the fix.

However, could you give us a clear procedure to update from latest magento update (2.2.9/2.3.2) ? Master branch is the same for 2.2.x and 2.3.x ?

We just can't wait for next magento 2 update as it's very critical. But the latest update of Amazon pay module is from April 5th, and this pull request is including some files that are not existing in 2.2.9 (src/Core/Model/AmazonConfig.php for example).

Thank you in advance.

vincent-wantomo commented 5 years ago

If 2.3.2 is on master, and 2.2.x is on 2.1.x, it means your patch is not available for Magento 2.2.x (Latest commit b2961b7 19 days ago) ?

Can we get any update soon please ?

lemked commented 5 years ago

Hi @vincent-wantomo ,

We will prepare a patch file with update instructions and report back here.

Kind regards, Daniel

vincent-wantomo commented 5 years ago

Thank you Daniel. Do you have an ETA for this ?

Thank you in advance.

lemked commented 5 years ago

Yes, we should be able to share this by tomorrow.

lemked commented 5 years ago

Update instructions for Magento 2.3.2

  1. Install the "composer-patches" tool via composer:
composer require cweagans/composer-patches
  1. Update the "extra" section in composer.json (or add it if it does not exist) with the module name, a patch description, and location of the patch to be applied.

        "patches": {
            "amzn/amazon-pay-and-login-with-amazon-core-module": {
                "3.2.9->3.2.11": "https://raw.githubusercontent.com/bear-mmartin/patchmatrix/master/patches/Magento2.3/amzn/amazon-pay-and-login-with-amazon-core-module/3.2.9-3.2.11.patch"
            },
            "amzn/amazon-pay-module": {
                "3.2.9->3.2.11": "https://raw.githubusercontent.com/bear-mmartin/patchmatrix/master/patches/Magento2.3/amzn/amazon-pay-module/3.2.9-3.2.11.patch"
            },
            "amzn/login-with-amazon-module": {
                "3.2.9->3.2.11": "https://raw.githubusercontent.com/bear-mmartin/patchmatrix/master/patches/Magento2.3/amzn/login-with-amazon-module/3.2.9-3.2.11.patch"
            }
        }
  2. Install the patch via composer:

    composer -v install
    composer update --lock
  3. Apply the change within Magento:

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:clean
lemked commented 5 years ago

Update instructions for Magento 2.2.9 will follow soon.

ladle3000 commented 5 years ago

Just curious if Amazon pay will ever leave beta phase?

tarishah commented 5 years ago

@vincent-wantomo We will have the update instructions for Magento 2.2.9 to share, by EOD tomorrow.

tarishah commented 5 years ago

@vincent-wantomo, update instructions for Magento 2.2.9, are as below:

  1. Install the "composer-patches" tool via composer:

composer require cweagans/composer-patches

  1. Update the "extra" section in composer.json (or add it if it does not exist) with the module name, a patch description, and location of the patch to be applied.

    "patches": {
        "amzn/amazon-pay-and-login-with-amazon-core-module": {
            "2.2.14->2.2.16": "https://raw.githubusercontent.com/bear-mmartin/patchmatrix/master/patches/Magento2.2/amzn/amazon-pay-and-login-with-amazon-core-module/2.2.14-2.2.16.patch"
        },
        "amzn/amazon-pay-module": {
            "2.2.14->2.2.16": "https://raw.githubusercontent.com/bear-mmartin/patchmatrix/master/patches/Magento2.2/amzn/amazon-pay-module/2.2.14-2.2.16.patch"
        },
        "amzn/login-with-amazon-module": {
            "2.2.14->2.2.16": "https://raw.githubusercontent.com/bear-mmartin/patchmatrix/master/patches/Magento2.2/amzn/login-with-amazon-module/2.2.14-2.2.16.patch"
        }
    }
  2. Install the patch via composer:
    
    composer -v install
    composer update --lock
4. Apply the change within Magento:

php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento cache:clean

kruegge82 commented 5 years ago

i have install the patch, but the problem is not deleted on not mobile pages...

lemked commented 5 years ago

Hi @kruegge82 ,

Can you provide a screenshot of the "intermediate" page? Please make sure the browser console is visible so that we can see debug/error output.

Kind regards, Daniel

kruegge82 commented 5 years ago
Bildschirmfoto 2019-07-23 um 10 18 24
lemked commented 5 years ago

Thanks for the screenshot @kruegge82 . Can you share details (URL, access credentials if required) with payments-cp-devel@amazon.com so that we can investigate the issue?

Kind regards, Daniel

vincent-wantomo commented 5 years ago

Thank you for the fix and procedure. The installation was successful. We are now testing on our staging servers and will give an update probably by tomorrow.

We faced some issues related to Japanese localisation : https://github.com/amzn/amazon-payments-magento-2-plugin/issues/233 (mainly because there's no city field in Amazon Japan, + no firstname/lastname, only one grouping both).

lemked commented 5 years ago

Thanks @vincent-wantomo . I've provided feedback on the JP address issue in #233 .

tarishah commented 5 years ago

@vincent-wantomo Were you able to test the redirect fix provided?

vincent-wantomo commented 5 years ago

Yes it’s just deployed and working so far. I am still monitoring to see if there’s any issues for some customers and will reply back here if it’s the case.

Thank you !

tarishah commented 5 years ago

@vincent-wantomo Glad to hear this! Please let us know if there are any issues.