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] Paypal PayFlowPro store the payment details in myaccount for future #28821

Merged

Conversation

Usik2203
Copy link
Contributor

@Usik2203 Usik2203 commented Jun 21, 2020

Description (*)

This PR provide ability to store my Paypal (PayFlowPro) payment method details in myaccount.

Related Pull Requests

https://github.com/magento/partners-magento2-infrastructure/pull/15

Useful links:
PayFloPro Documentation
PayFloPro GraphQl Documentation
How to create test PayPal accout for testing
List of credit carts

Fixed Issues (if relevant)

  1. Fixes Implement the schema for PayPal PayFloPro #28520
  2. Implement the schema for PayPal PayFloPro #28558

Manual testing scenarios (*)

1. You should configure Payflowpro payment method.
2. Login as Customer
3. Add product to cart and go to payment step on checkout
Screenshot 2020-06-22 at 13 05 15
4. Get customer quote id by running request

{
  customerCart {
    id
    items {
      id
      product {
        name
        sku
      }
      quantity
    }
  }
}

Screenshot 2020-06-22 at 13 10 35

5. Set payment method for quote

  setPaymentMethodOnCart(
    input: {
    cart_id: "zqYVjMInihkXlKVJAfgbY2yQsVdc6qLR"
    payment_method: {
      code: "payflowpro"
      payflowpro: {
           is_active_payment_token_enabler: true
          cc_details: {
           cc_type: "VI"
           cc_exp_year: 2025
           cc_exp_month: 7
           cc_last_4: 1881
        }
      }
    }
  })
  {
    cart {
      id
      selected_payment_method {
        code
        purchase_order_number
      }
  }
  }
}

Screenshot 2020-06-22 at 13 14 32

6. Get secure tokens

mutation {
  createPayflowProToken(
    input: {
      cart_id: "zqYVjMInihkXlKVJAfgbY2yQsVdc6qLR"
      urls: {
        return_url: "paypal/transparent/return"
        cancel_url: "paypal/transparent/cancel"
        error_url: "paypal/transparent/error"
      }
      
    }
  ) {
    response_message
    result
    result_code
    secure_token
    secure_token_id
  }
}

Screenshot 2020-06-22 at 13 16 54

7. Run handlePayflowProResponse mutation
handlePayflowProResponse Documentation
You can get paypal_payload parameter from
Screenshot 2020-06-22 at 13 37 35

mutation {
  handlePayflowProResponse(
    input: {
      cart_id: "zqYVjMInihkXlKVJAfgbY2yQsVdc6qLR"
      paypal_payload: "BILLTOCITY=dcdcd&AMT=0.00&BILLTOEMAIL=o.usik%40atwix.com&BILLTOSTREET=dcdc%40gmail.com&CC_TYPE=VI&SHIPTOCITY=dcdcd&NAMETOSHIP=Oleh+Usik&ZIP=12345&BILLTOLASTNAME=Usik&BILLTOFIRSTNAME=Oleh&RESPMSG=Verified&PROCCVV2=M&STATETOSHIP=AK&NAME=Oleh+Usik&BILLTOZIP=12345&CVV2MATCH=Y&PNREF=A71AADB57BB0&ZIPTOSHIP=12345&SHIPTOCOUNTRY=US&SHIPTOSTREET=dcdc%40gmail.com&CITY=dcdcd&HOSTCODE=A&LASTNAME=Usik&STATE=AK&SECURETOKEN=7dTXlaJR3nkeJ356hXrIbMAhx&CITYTOSHIP=dcdcd&COUNTRYTOSHIP=US&AVSDATA=XXN&ACCT=5100&AUTHCODE=333PNI&FIRSTNAME=Oleh&RESULT=0&IAVS=X&POSTFPSMSG=No+Rules+Triggered&BILLTOSTATE=AK&BILLTOCOUNTRY=US&EXPDATE=0725&EMAIL=o.usik%40atwix.com&CARDTYPE=1&PREFPSMSG=No+Rules+Triggered&SHIPTOZIP=12345&PROCAVS=U&COUNTRY=US&AVSZIP=X&ADDRESS=dcdc%40gmail.com&BILLTONAME=Oleh+Usik&ADDRESSTOSHIP=dcdc%40gmail.com&AVSADDR=X&SECURETOKENID=hOidzKMVR3KMFeTS6UpLJVMacQ5GMuhk&SHIPTOSTATE=AK&TRANSTIME=2020-06-21+11%3A36%3A53"
      
    }
  ){
    cart {
      selected_payment_method {
        code
      }
    }
  }
}

Screenshot 2020-06-22 at 13 20 23

8. Place order

 
mutation {
  placeOrder(
    input: {
      cart_id: "zqYVjMInihkXlKVJAfgbY2yQsVdc6qLR"
    }
  ) {
    order {
      order_number
    }
  }
}

Screenshot 2020-06-22 at 13 21 41

Result
Screenshot 2020-06-22 at 13 23 28
Screenshot 2020-06-22 at 13 24 02

@m2-assistant
Copy link

m2-assistant bot commented Jun 21, 2020

Hi @Usik2203. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names. Allowed build names are:

  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE,
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests

You can find more information about the builds here

ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review.

For more details, please, review the Magento Contributor Guide documentation.

@magento-engcom-team magento-engcom-team added Component: PaypalGraphQl Release Line: 2.4 Partner: Atwix Pull Request is created by partner Atwix partners-contribution Pull Request is created by Magento Partner labels Jun 21, 2020
@Usik2203
Copy link
Contributor Author

@magento run all tests

@Usik2203
Copy link
Contributor Author

@magento run Integration Tests

@Usik2203
Copy link
Contributor Author

@magento run all tests

@Usik2203
Copy link
Contributor Author

@magento run all tests

@rogyar rogyar self-assigned this Jun 23, 2020
@Usik2203
Copy link
Contributor Author

@magento run all tests

@Usik2203
Copy link
Contributor Author

@magento run Unit Tests , Functional Tests CE

$paymentModel->setData(self::IS_ACTIVE_PAYMENT_TOKEN_ENABLER, false);
}

foreach ($additionalData['cc_details'] as $ccKey => $ccValue) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you provide more info, please, on what exact data will be saved to the payment model?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm asking since we need to make sure that no unnecessary data is being written to the database accidentally. It might be tricky from the security perspective

Copy link
Contributor Author

@Usik2203 Usik2203 Jun 24, 2020

Choose a reason for hiding this comment

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

Hi @rogyar
I have changed foreach to

        $paymentModel->setCcType($ccData['cc_type']);
        $paymentModel->setCcExpYear($ccData['cc_exp_year']);
        $paymentModel->setCcExpMonth($ccData['cc_exp_month']);
        $paymentModel->setCcLast4($ccData['cc_last_4']);

Is it right ?
Thank you for advice !

@avattam06 avattam06 changed the title [GraphQL] PayFloPro store the payment details in myaccount for future [GraphQL] Paypal PayFlowPro store the payment details in myaccount for future Jul 31, 2020
@prabhuram93 prabhuram93 self-requested a review July 31, 2020 21:41
@avattam06
Copy link
Contributor

@magento run Functional Tests B2B

@avattam06
Copy link
Contributor

Does the vault still have the tokenDetails even after the vault_enabler is set to 0
(or disabled)?

Yes, Data is stored but not visible. @ dthampy

@prabhuram93
Copy link
Contributor

@avattam06 The issue changes are in, but the Pr status is not merged yet because your last 2.4 merge commit db47d6c didn't get in. We should bundle it with next Pr to have this merged. cc: @Usik2203

@avattam06
Copy link
Contributor

@avattam06 The issue changes are in, but the Pr status is not merged yet because your last 2.4 merge commit db47d6c didn't get in. We should bundle it with next Pr to have this merged. cc: @Usik2203

Okay, Thanks, @prabhuram93.

@Usik2203
Copy link
Contributor Author

Hi @prabhuram93 @avattam06
Could I kindly ask you about the fate of this PR .
Will this PR be merged ?
Thanks !

@avattam06
Copy link
Contributor

Hi @prabhuram93 @avattam06
Could I kindly ask you about the fate of this PR .
Will this PR be merged ?
Thanks !

Hi @Usik2203 , We are waiting on bundling it with the next PR which is ready to be merged. It will be merged soon.

Thanks!

@magento-engcom-team magento-engcom-team merged commit ccc4e7e into magento:2.4-develop Aug 27, 2020
@m2-assistant
Copy link

m2-assistant bot commented Aug 27, 2020

Hi @Usik2203, 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Implement the schema for PayPal PayFloPro Implement the schema for PayPal PayFloPro
10 participants