Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

BraintreeGraphQl Workflow #4915

Merged
merged 4 commits into from
Aug 19, 2019
Merged

Conversation

pmclain
Copy link
Contributor

@pmclain pmclain commented Jul 9, 2019

Purpose of this pull request

Corresponds with magento/graphql-ce#392

This PR adds workflow documentation for queries and mutations rtequired for setting quote payment methods to Braintree and Braintree CC Vault.

whatsnew
Added the Braintree and Braintree Vault payment methods.

@devops-devdocs
Copy link
Collaborator

An admin must run tests on this PR before it can be merged.

@pmclain pmclain force-pushed the feature/braintree-graphql branch from a8e045f to e493d08 Compare July 9, 2019 21:49
@keharper keharper self-assigned this Jul 9, 2019
@keharper keharper added xx2.3.3 Magento 2.3.3 changes Community Docs impacted by community code contribution New Topic A major update published as an entirely new document labels Jul 9, 2019
@pmclain pmclain force-pushed the feature/braintree-graphql branch from e493d08 to 1f3ed3a Compare July 9, 2019 21:57
Copy link
Contributor

@keharper keharper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pmclain Thanks for opening this PR. A lot has changed since you submitted it, most notably:

  • We've been migrating topics from the reference directory to the mutations and queries directories. I need you to mover the createBraintreeClientToken topic to the mutations directory.

  • After going through 5 or 6 PayPal payments methods, I figured out what I want the documentation to look like. Make sure your Braintree and Braintree workflows account for each hop between the client, Magento, and Braintree. The first workflow I wrote for Express Checkout combined multiple hops in a single step because I was mimicking the PayPal docs. I need to create infographics for the two Braintree payment methods, and so the workflow needs to be highly granular. You can view the PayPal infographics in the common/images/graphql directory.


## Braintree Vault workflow

1. Fetch vault payment method for customer with [`customerPaymentTokens`]({{page.baseurl}}/graphql/reference/vault.html)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. Fetch vault payment method for customer with [`customerPaymentTokens`]({{page.baseurl}}/graphql/reference/vault.html)
1. Use the [`customerPaymentTokens`]({{page.baseurl}}/graphql/queries/customer-payment-tokens.html) query to retrieve the payment tokens the customer has stored in the vault.

## Braintree Vault workflow

1. Fetch vault payment method for customer with [`customerPaymentTokens`]({{page.baseurl}}/graphql/reference/vault.html)
query.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
query.
1. Magento returns an array of payment tokens.

1. Fetch vault payment method for customer with [`customerPaymentTokens`]({{page.baseurl}}/graphql/reference/vault.html)
query.

2. Customer selects stored Braintree payment method.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
2. Customer selects stored Braintree payment method.
1. The client renders the token information, and the customer selects a payment method.


2. Customer selects stored Braintree payment method.

3. When the customer clicks **Place Order**, the PWA uses the [`setPaymentMethodOnCart`]({{page.baseurl}}/graphql/reference/quote-payment-method.html)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
3. When the customer clicks **Place Order**, the PWA uses the [`setPaymentMethodOnCart`]({{page.baseurl}}/graphql/reference/quote-payment-method.html)
1. When the customer clicks **Place Order**, the PWA uses the [`setPaymentMethodOnCart`]({{page.baseurl}}/graphql/reference/quote-payment-method.html)

1. Generate Braintree Client token using the [`createBraintreeClientToken`]({{page.baseurl}}/graphql/reference/braintree-create-client-token.html)
mutation

2. Initial [Braintree hosted fields](https://developers.braintreepayments.com/guides/hosted-fields/overview/javascript/v3)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
2. Initial [Braintree hosted fields](https://developers.braintreepayments.com/guides/hosted-fields/overview/javascript/v3)
1. Initialize the [Braintree hosted fields](https://developers.braintreepayments.com/guides/hosted-fields/overview/javascript/v3)

Is this direct communication between the PWA client and Braintree?

2. Initial [Braintree hosted fields](https://developers.braintreepayments.com/guides/hosted-fields/overview/javascript/v3)
using the client token to collect and tokenize payment information via a secure iframe.

3. On the checkout page, the customer selects **Credit Card** as the payment method and enters the credit card
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe mention that the credit card information is in the hosted fields section, while the billing/shipping addresses are on the merchant's storefront?


9. Magento creates an order and sends an order ID in response to the `placeOrder` mutation.

## Additional Payment information
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Additional Payment information
## `setPaymentMethodOnCart` mutation

`is_active_payment_token_enabler` | Boolean! | Required input dictating if payment should be stored in `Magento_Vault`
`device_data` | String | Optional input json encoded device data for Kount integration

## Example setPaymentMethodOnCart mutation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Example setPaymentMethodOnCart mutation
## Example usage

--- | --- | ---
`payment_method_nonce` | String! | Required input for Braintree client-side generated nonce
`is_active_payment_token_enabler` | Boolean! | Required input dictating if payment should be stored in `Magento_Vault`
`device_data` | String | Optional input json encoded device data for Kount integration
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`device_data` | String | Optional input json encoded device data for Kount integration
`device_data` | String | Optional. JSON-encoded device data for Kount integration

@keharper
Copy link
Contributor

running tests

@keharper keharper merged commit e819382 into magento:develop Aug 19, 2019
@ghost
Copy link

ghost commented Aug 19, 2019

Hi @pmclain, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@keharper
Copy link
Contributor

Thanks @pmclain for this major contribution. I'll contact you within a couple of days to shore up the infographics for the workflows.

@keharper keharper added Special achievement High-value contributions that earn higher rewards and special attention and removed In progress labels Aug 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community Docs impacted by community code contribution New Topic A major update published as an entirely new document Partner: Something Digital partners-contribution PR created by Magento partner Special achievement High-value contributions that earn higher rewards and special attention xx2.3.3 Magento 2.3.3 changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants