Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Bug#pwa 3029::[bug]: Selecting payment method causing graphql error #4115

Merged
merged 4 commits into from
May 16, 2023

Conversation

glo82145
Copy link
Collaborator

Description

Describe the bug

In 12.7 a fix was made to visually select the method of payment that is saved as selected on the quote. However it also added an onChange function that executes a mutation to save the payment method.

https://github.com/magento/pwa-studio/pull/3969/files#diff-b3bc0e73e1c57b4b69ad1d1cc59b3d3e60021bd9ec46a399b73305079e2ebb11R54

This causes a graphql error for custom payment methods that require additional information. This can be seen by the need to pass in braintree data, which wouldn't be needed for non-braintree payment methods. Other payment methods require their own "braintree equivalent" data in order to be set

Example for our custom payment method for Moneris (code: mht), we now get an error when selecting the payment method radio button:
message: "Required parameter "mht" for "payment_method" is missing."

Data sent to graphql endpoint:
``{{
variables: {
cartId: "ZSNL4bWFnEaYmrtCcinryj76gCvoDcho"
paymentMethod: {
code: "mht",
braintree :

{ is_active_payment_token_enabler: false payment_method_nonce: "mht" }
}
}
}}`{{

Expected behavior

No graphql error when changing radios for payment method

Possible solutions

Don't call setPaymentMethodOnCart at a higher level than the payment method. Leave saving the payment method to the payment method (usually when going to review step, not when selecting the radio)

Related Issue

Closes https://jira.corp.adobe.com/browse/PWA-3029

Acceptance

Verification Stakeholders

Specification

Verification Steps

Test scenario(s) for direct fix/feature

Test scenario(s) for any existing impacted features/areas

Test scenario(s) for any Magento Backend Supported Configurations

Is Browser/Device testing needed?

Any ad-hoc/edge case scenarios that need to be considered?

Screenshots / Screen Captures (if appropriate)

Breaking Changes (if any)

Checklist

  • I have added tests to cover my changes, if necessary.
  • I have added translations for new strings, if necessary.
  • I have updated the documentation accordingly, if necessary.

@pwa-studio-bot
Copy link
Collaborator

pwa-studio-bot commented May 11, 2023

Messages
📖

Associated JIRA tickets: PWA-3029.

📖 DangerCI Failures related to missing labels/description/linked issues/etc will persist until the next push or next pr-test build run (assuming they are fixed).
📖

Access a deployed version of this PR here. Make sure to wait for the "pwa-pull-request-deploy" job to complete.

Generated by 🚫 dangerJS against 382a0a2

@glo82145 glo82145 added the version: Minor This changeset includes functionality added in a backwards compatible manner. label May 11, 2023
@glo82145
Copy link
Collaborator Author

run lighthouse-mobile

@pwa-test-bot
Copy link

pwa-test-bot bot commented May 16, 2023

Successfully started codebuild job for lighthouse-mobile

@glo82145
Copy link
Collaborator Author

run lighthouse-desktop

@pwa-test-bot
Copy link

pwa-test-bot bot commented May 16, 2023

Successfully started codebuild job for lighthouse-desktop

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
pkg:peregrine Progress: done version: Minor This changeset includes functionality added in a backwards compatible manner.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants