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

feat(router): add support for googlepay step up flow #2744

Merged
merged 16 commits into from
Jun 24, 2024

Conversation

vspecky
Copy link
Member

@vspecky vspecky commented Oct 31, 2023

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

add support for googlepay step up flow

  1. add assurance_details_required in session response, to collect assurance details from googlepay
  2. accept assurance_details which has card_holder_authenticated and account_verified flags which would help to decide the authentication type (to step up or not)
  3. step up when card_holder_authenticated or account_verified is not true and make the authentication type three_ds

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

When given as true, this field motivates stripe to include verification results in the session token flow. If the verification is failed here, we want to detect it and step up the payment to a 3DS payment.

How did you test it?

Tested Manually
Payments Create CURL

curl --location --request POST 'localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_xZkXV8ICQLlmvTiVilpCYbs0MsfpTCBekqt5YTxkaFIR69j5qsFvoFtk9AL59J6H' \
--data-raw '{
    "request_external_three_ds_authentication": false,
    "request_incremental_authorization": false,
    "amount": 123,
    "currency": "USD",
    "confirm": false,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "customer_id": "stripecustomer",
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "routing": {
        "type": "single",
        "data": "adyen",
        "timestamp": 1719237972
    },
    "setup_future_usage": "off_session",
    "mandate_data": {
        "customer_acceptance": {
            "acceptance_type": "offline",
            "accepted_at": "1963-05-03T04:07:52.723Z",
            "online": {
                "ip_address": "125.0.0.1",
                "user_agent": "amet irure esse"
            }
        },
        "mandate_type": {
            "multi_use": {
                "amount": 1000,
                "currency": "USD",
                "start_date": "2023-04-21T00:00:00Z",
                "end_date": "2023-05-21T00:00:00Z",
                "metadata": {
                    "frequency": "13"
                }
            }
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "CA",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        },
         "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "CA",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        },
         "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
      "connector_metadata": {
        "noon": {
            "order_category": "pay"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {},
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity":1,
            "amount": 0,
            "account_name": "transaction_processing"
        }
    ]
}'

Payments Confirm CURL with google_pay payment_method assurance_details

curl --location --request POST 'localhost:8080/payments/pay_tFCBfda5GbeExvLThI32/confirm' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_xZkXV8ICQLlmvTiVilpCYbs0MsfpTCBekqt5YTxkaFIR69j5qsFvoFtk9AL59J6H' \
--data-raw '{
    "payment_method_data": {
        "wallet": {
        "google_pay": {
            "type": "CARD",
            "description": "Mastercard •••• 4444",
            "info": {
                "card_details": "4444",
                "card_network": "MASTERCARD",
                "assurance_details": {
                    "account_verified": true,
                    "card_holder_authenticated": true
                }
            },
            "tokenization_data": {
                "type": "PAYMENT_GATEWAY",
                "token": "{\"signature\":\"MEQCIGWP325ZzDIZqu7w6QDVppDUjJPizVZ/7BO06ma9qUMPAiBT4qYFqulmHxligg4s4KZq2qb/o26aieJlkbquBSxM8g\\u003d\\u003d\",\"protocolVersion\":\"ECv1\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"dC7MrbxI7He9XqOP+Inr1ikTUqlCAEoDQUqSomajT16vhPTxLqNlcqfNiYeUu527NaLjXCZdSWcIZCbIi6/L9mx1+KuZSrkzYRFLIc+LLQfZIUVoLo5zuq8ESNH+e9CUAhYBy2DEJ5Ja3MC6T7E+ybr5EF8BM0OYOGW6ZZbF1RVjWAh3C75dFEcLvwtrXVhNboDzO89u1ZgVQXcTXj100yXlggwz12bgMRZSU7RZwjHyk5/rAdzjUjS27W0D/gb0ZmetHeNQGOqewqyHd0inDwYoGo5ilL/zhgwhg0HTMaxiyINIs9pnY4L5NCsMwW+UFiSgnPcaDmliCtD9bKA6fbZXIYEWifzocrn/Lw6phsvHo1nFS+9jUYf4uLBeSZ0TrljfKomBpziNZK3ARmhcKGCNoDPwXuNc/ClLRZgFHr/Bltb38tlDeYmjC17kwYmLuOhf08jefH+I0heeNZn12snOhoCT+V2gdWVDGXJ5Mi2yp7qO7/rUvUo5oR149pKzlykMjb6wtQ2JXx1yHnzgjAuQ/cxx2pCVArmoBHDTMO8C\\\",\\\"ephemeralPublicKey\\\":\\\"BASySRhh0CVccSm7EHZqS5XHPXmLbBqpjxilDw07HLnbNbEcxa8UsfxPejI1xEmzbnqXybjEe8GlH1LkcgsZ65k\\\\u003d\\\",\\\"tag\\\":\\\"TrzIrHLnwglAAzjsaOVUfnfrbWVmQY2KakROFOQVIjQ\\\\u003d\\\"}\"}"
            }
        }}
    },
    "payment_method": "wallet",
    "payment_method_type":"google_pay",
    "browser_info": {
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "125.0.0.1"
    },
    "customer_acceptance": null
}'
  1. Create a payment with authentication_type as no_three_ds, then make a googlepay payment with card_holder_authenticated as false and observe the payment has been forced to authentication_type three_ds
    image
    image
    image
    image
    image

  2. Create a payment with authentication_type as no_three_ds, when both card_holder_authenticated and account_verified are true, it'll proceed with no_three_ds without step up
    image
    image

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible
  • I added a CHANGELOG entry if applicable

@vspecky vspecky added A-core Area: Core flows S-waiting-on-review Status: This PR has been implemented and needs to be reviewed C-refactor Category: Refactor R-waiting-on-L1 Review: Waiting on L1 reviewer A-payments Area: payments labels Oct 31, 2023
@vspecky vspecky added this to the October 2023 Milestone milestone Oct 31, 2023
@vspecky vspecky self-assigned this Oct 31, 2023
@vspecky vspecky requested review from a team as code owners October 31, 2023 12:40
@prasunna09 prasunna09 requested a review from a team as a code owner November 7, 2023 09:38
@prasunna09 prasunna09 self-assigned this Nov 7, 2023
Narayanbhat166
Narayanbhat166 previously approved these changes Nov 7, 2023
@Narayanbhat166
Copy link
Member

Please fix the openapi check

@bernard-eugine bernard-eugine added this to the May 2024 milestone May 3, 2024
@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label Jun 21, 2024
@sai-harsha-vardhan sai-harsha-vardhan self-assigned this Jun 23, 2024
@sai-harsha-vardhan sai-harsha-vardhan changed the title refactor(router): add assurance details requirement field to google pay metadata refactor(router): add support for googlepay step up flow Jun 23, 2024
@sai-harsha-vardhan sai-harsha-vardhan changed the title refactor(router): add support for googlepay step up flow feat(router): add support for googlepay step up flow Jun 23, 2024
@sai-harsha-vardhan sai-harsha-vardhan added C-feature Category: Feature request or enhancement and removed C-refactor Category: Refactor labels Jun 23, 2024
if !assurance_details.card_holder_authenticated
|| !assurance_details.account_verified
{
self.auth_type = diesel_models::enums::AuthenticationType::ThreeDs;
Copy link
Member

Choose a reason for hiding this comment

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

can you add a comment here to inform that 3ds has been stepped up

if !assurance_details.card_holder_authenticated
|| !assurance_details.account_verified
{
self.auth_type = diesel_models::enums::AuthenticationType::ThreeDs;
Copy link
Member

Choose a reason for hiding this comment

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

same here, can you add a comment here to inform that 3ds has been stepped up?

Copy link
Member

Choose a reason for hiding this comment

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

same here, can you add a comment here to inform that 3ds has been stepped up?

I meant logs in this case

Copy link
Contributor

@swangi-kumari swangi-kumari left a comment

Choose a reason for hiding this comment

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

Reviewed connector changes.

@likhinbopanna likhinbopanna added this pull request to the merge queue Jun 24, 2024
Merged via the queue into main with commit ff84d78 Jun 24, 2024
15 checks passed
@likhinbopanna likhinbopanna deleted the add-assurance-details-in-gpay-metadata branch June 24, 2024 14:25
pixincreate added a commit that referenced this pull request Jun 24, 2024
…ough-hyperswitch-cypress

* 'main' of github.com:juspay/hyperswitch:
  feat(router): add support for googlepay step up flow (#2744)
  fix(access_token): use `merchant_connector_id` in access token (#5106)
  feat: added kafka events for authentication create and update (#4991)
  feat(ci): add vector to handle logs pipeline (#5021)
  feat(users): Decision manager flow changes for SSO (#4995)
  ci(cypress): Fix payment method id for non supported connectors (#5075)
  refactor(core): introduce an interface to switch between old and new connector integration implementations on the connectors (#5013)
  refactor(events): populate object identifiers in outgoing webhooks analytics events during retries (#5067)
  Refactor: [Fiserv] Remove Default Case Handling (#4767)
  chore(version): 2024.06.24.0
  fix(router): avoid considering pre-routing results during `perform_session_token_routing` (#5076)
  refactor(redis): spawn one subscriber thread for handling all the published messages to different channel (#5064)
  feat(users): setup user authentication methods schema and apis (#4999)
  feat(payment_methods): Implement Process tracker workflow for Payment method Status update (#4668)
  chore(version): 2024.06.20.1
  chore(postman): update Postman collection files
  fix(payment_methods): support last used for off session token payments (#5039)
  ci(postman): add net_amount field test cases (#3286)
  refactor(connector): [Mifinity]dynamic fields for mifinity (#5056)
  refactor(payment_method): [Klarna] store and populate payment_type for klarna_sdk Paylater in response (#4956)
sai-harsha-vardhan added a commit that referenced this pull request Jun 27, 2024
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Prasunna Soppa <[email protected]>
Co-authored-by: Prasunna Soppa <[email protected]>
Co-authored-by: sai-harsha-vardhan <[email protected]>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
@SanchithHegde SanchithHegde removed S-waiting-on-author Status: This PR is incomplete or needs to address review comments S-waiting-on-review Status: This PR has been implemented and needs to be reviewed R-waiting-on-L1 Review: Waiting on L1 reviewer labels Jun 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core flows A-payments Area: payments C-feature Category: Feature request or enhancement M-api-contract-changes Metadata: This PR involves API contract changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants