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 77 forks source link

GraphQL in 5.13.0 omitting payload and signature fields #1129

Closed youanden closed 2 years ago

youanden commented 2 years ago

What I expected

When calling checkoutSessionConfig I expected to see the Amazon _payload and _signature fields, but they were null for my cart.

What happened instead

Upon investigating, the Resolver located at vendor/amzn/amazon-payments-magento-2-plugin/Model/Resolver/CheckoutSessionConfig.php is not passing false as the second parameter, which in turn doesn't merge the result array with the _payload and _signature data.

Steps to reproduce the issue

curl -X "POST" "https://magento/graphql" \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
    "query": "query checkoutSessionConfig($cartId:String){checkoutSessionConfig(cartId:$cartId){button_color checkout_payload checkout_signature currency sandbox language login_payload login_signature merchant_id pay_only paynow_payload paynow_signature public_key_id}}",
    "variables": {
        "cartId": "1234567890"
    }
}'

Your setup

sgabhart22 commented 2 years ago

Hello @youanden ,

Thank you for raising the issue, that was a bit of unfortunate timing regarding the release of GraphQL functionality at the same time we had been working on refactoring the button rendering logic in a standard Magento frontend... We may decide to take a different approach than the temporary solution I'm providing, but for now, the attached patch file should resolve the issue you found. This is simply adding another optional parameter to the config query (omitPayloads) that will default to false if not provided, which is the same way the rest endpoint currently behaves.

Please let us know if this helps, and thank you again for bringing it up! gh-1129.patch.txt

zichicc commented 2 years ago

fixed released on 5.13.1: https://github.com/amzn/amazon-payments-magento-2-plugin/releases/tag/5.13.1