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

GraphQL addition #240

Merged
merged 7 commits into from
Jun 11, 2021
Merged

GraphQL addition #240

merged 7 commits into from
Jun 11, 2021

Conversation

ramth05
Copy link
Contributor

@ramth05 ramth05 commented Mar 12, 2021

Razorpay GraphQl Extension

Order flow for placing Magento Order using razorpay as payment method with graphql

  1. set Payment Method on Cart
mutation {
  setPaymentMethodOnCart(input: {
      cart_id: "{{cart_ID}}"
      payment_method: {
          code: "razorpay"
      }
  }) {
    cart {
      selected_payment_method {
        code
      }
    }
  }
}
  1. Create Razorpay Order ID against the cart
mutation {
  placeRazorpayOrder (
    cart_id: "{{cartid}}"
  ){
    success
    rzp_order_id
    order_quote_id
    amount
    currency
    message
  }
}
  1. Use rzp_order_id and other details from step-2 and create from the Frontend/React/using razorpay's checkout.js , complete the payment and obtain razorpay_payment_id & razorpay_signature
    https://razorpay.com/docs/payment-gateway/web-integration/standard/

  2. Save Razorpay Response Details against Cart after payment success

mutation {
  setRzpPaymentDetailsOnCart (
    input: {
      cart_id: "{{cart_ID}}"
      rzp_payment_id: "{{RAZORPAY_PAYMENT_ID}}"
      rzp_order_id: "{{RAZORPAY_ORDER_ID}}"
      rzp_signature: "{{RAZORPAY_SIGNATURE}}"
    }
  ){
  cart{
    id
  }
  }
}
  1. Finally Place Magento Order
mutation {
  placeOrder(input: {cart_id: "{{cart_ID}}"}) {
    order {
      order_number
    }
  }
}

@shreyas-codes
Copy link

Where are you validating razorpay signature here ?

@ramth05
Copy link
Contributor Author

ramth05 commented Mar 14, 2021

Where are you validating razorpay signature here ?

Where are you validating razorpay signature here ?

@shreyas-codes , As graphQL can be executed from any system, So signature validation can not be implemented here.
We are fetching the payment again from API and doing the validation.

@ramth05 ramth05 requested a review from ChetanGN March 15, 2021 07:50
@ramth05
Copy link
Contributor Author

ramth05 commented Mar 17, 2021

Where are you validating razorpay signature here ?

Where are you validating razorpay signature here ?

@shreyas-codes , As graphQL can be executed from any system, So signature validation can not be implemented here.
We are fetching the payment again from API and doing the validation.

@shreyas-codes , have you tested it,

@ramth05 ramth05 mentioned this pull request Mar 24, 2021
@ChetanGN
Copy link
Contributor

ChetanGN commented Jun 9, 2021

@ramth05 order history comment not coming properly please check

Model/PaymentMethod.php Outdated Show resolved Hide resolved
Copy link
Contributor

@ChetanGN ChetanGN left a comment

Choose a reason for hiding this comment

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

LGTM

@ramth05 ramth05 merged commit bfafca3 into master-2.x Jun 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants