Mohit Verma
Mohit Verma

Reputation: 79

Extend Graphql Mutation Magento 2

I want to extend graphql mutation so that I can make one field optional in the input params in braintree module. Below is the file path

Core GraphQL Schema File: vendor\paypal\module-braintree-graph-ql\etc\schema.graphqls

Input Params: BraintreeInput

If you see there are payment nonce mandatory in the Input params. We have requirement to by pass that and make payment nonce optional. I have written my own module for the same. I just want to know how I can do that?

Upvotes: 1

Views: 847

Answers (1)

Abid Malik
Abid Malik

Reputation: 157

Copy the following code into your module schema.graphql and remove the ! exclamation mark (!).

input BraintreeInput {
    payment_method_nonce: String! @doc(description:"The one-time payment token generated by Braintree payment gateway based on card details. Required field to make sale transaction.")
    is_active_payment_token_enabler: Boolean! @doc(description:"States whether an entered by a customer credit/debit card should be tokenized for later usage. Required only if Vault is enabled for Braintree payment integration.")
    device_data: String @doc(description:"Contains a fingerprint provided by Braintree JS SDK and should be sent with sale transaction details to the Braintree payment gateway. Should be specified only in a case if Kount (advanced fraud protection) is enabled for Braintree payment integration.")
}

Make Sure you add the following to your module.xml

<sequence>
            <module name="PayPal_BraintreeGraphQl"/>
        </sequence>

Upvotes: 1

Related Questions