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(api_models): add api_models for external 3ds authentication flow #3858

Merged
merged 18 commits into from
Mar 5, 2024

Conversation

sai-harsha-vardhan
Copy link
Contributor

@sai-harsha-vardhan sai-harsha-vardhan commented Feb 27, 2024

Type of Change

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

Description

add api_models for external 3ds authentication flow

Hyperswitch currently uses the "Processor driven approach" for 3DS and is now looking to move towards "Third Party 3DS provider approach" - Using a specialized 3DS provider for checking card enrollment and 3DS authentication
Eg: Cardinal, Netcetra

The 3DS authentication can be done once and the authentication response that we get can be sent to any processor to authorize the payment.

API contract changes
Business profile API

"authentication_details": {
      "authentication_connectors": ["threedsecureio"],
      "three_ds_requestor_url": "https://google.com"
  }

Payments API
Request
"request_external_three_ds_authentication": true / false

Response

"next_action": {
        "type": "three_ds_invoke",
        "three_ds_data": {
            "three_ds_authentication_url": "http://localhost:8080/payments/pay_CmrJbRTEDIgKbdlEriy7/3ds/authentication",
            "three_ds_authorize_url": "http://localhost:8080/payments/pay_CmrJbRTEDIgKbdlEriy7/postman_merchant_GHAction_b6352424-0155-4a1f-a639-75b59d679f74/authorize/checkout",
            "three_ds_method_details": {
                "three_ds_method_key": "threeDSMethodData",
                "three_ds_method_data_submission": true,
                "three_ds_method_data": "eyJ0aHJlZURTU2VydmVyVHJhbnNJRCI6ImFiN2RmYzkxLTdjYWYtNDkwZi1iY2E5LWQ2ZWJiODE5MGQyZiJ9",
                "three_ds_method_url": "https://acs35.sandbox.3dsecure.io/3dsmethod"
            }
        }
    }
"external_authentication_details": {
       "authentication_flow": "challenge",
        "electronic_commerce_indicator": "05",
        "status": "success",
        "ds_transaction_id": "2.1.0",
        "version": "dda51c42-3843-4e7c-a44a-23557e29f586"
    }

Authentication API
Request

{
    "device_channel": "BRW",
    "sdk_information": {
        "sdk_app_id": "92deb809-a452-47af-ac3b-301978a9e9e0",
        "sdk_enc_data": "eyJraW…",
        "sdk_ephem_pub_key": {
            "kty": "EC",
            "x": "P5zWKpoAZoUlrtUoe6Xzvia3zgCX1mSmpGj5XlV9R0w",
            "y": "ov2s2HF_HVwf2vzZMPOLjGwFASSmEGxeSUEuyMcrhLI",
            "crv": "P-256"
        },
        "sdk_trans_id": "4fa7696e-ca08-42cc-806f-1081287a1b9b",
        "sdk_reference_number": "3DS_LOA_SDK_JTPL_020200_00788",
        "sdk_max_timeout": "05"
    }
}

Response

{
    "trans_status": "C",
    "acs_url": "https://acs35.sandbox.3dsecure.io/browser/challenge/manual",
    "challenge_request": "eyJ0aHJlZ..",
    "acs_reference_number": "3dsecureio-standin-acs",
    "acs_trans_id": "71770ded-1daf-4d3b-b390-c79e7f37fe51",
    "three_dsserver_trans_id": "dda51c42-3843-4e7c-a44a-23557e29f586",
    "acs_signed_content": null
}

Additional Changes

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

Motivation and Context

How did you test it?

Compiler guided and Sanity testing to make sure it's backward compatible

This PR cannot be tested until core changes are done.

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

@sai-harsha-vardhan sai-harsha-vardhan added A-core Area: Core flows C-feature Category: Feature request or enhancement labels Feb 27, 2024
@sai-harsha-vardhan sai-harsha-vardhan self-assigned this Feb 27, 2024
@sai-harsha-vardhan sai-harsha-vardhan requested a review from a team as a code owner February 27, 2024 14:24
.typos.toml Outdated Show resolved Hide resolved
crates/api_models/src/payments.rs Outdated Show resolved Hide resolved
crates/api_models/src/payments.rs Outdated Show resolved Hide resolved
crates/api_models/src/payments.rs Show resolved Hide resolved
crates/api_models/src/payments.rs Outdated Show resolved Hide resolved
crates/api_models/src/payments.rs Outdated Show resolved Hide resolved
crates/api_models/src/payments.rs Outdated Show resolved Hide resolved
crates/api_models/src/payments.rs Outdated Show resolved Hide resolved
crates/api_models/src/payments.rs Outdated Show resolved Hide resolved
crates/api_models/src/payments.rs Outdated Show resolved Hide resolved
Copy link
Member

@SanchithHegde SanchithHegde left a comment

Choose a reason for hiding this comment

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

Other than that, looks good to me!

crates/api_models/src/payments.rs Outdated Show resolved Hide resolved
crates/api_models/src/payments.rs Outdated Show resolved Hide resolved
@SanchithHegde SanchithHegde added M-api-contract-changes Metadata: This PR involves API contract changes S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Feb 28, 2024
crates/api_models/src/admin.rs Outdated Show resolved Hide resolved
crates/api_models/src/admin.rs Outdated Show resolved Hide resolved
crates/api_models/src/admin.rs Outdated Show resolved Hide resolved
crates/api_models/src/payments.rs Outdated Show resolved Hide resolved
crates/api_models/src/payments.rs Outdated Show resolved Hide resolved
crates/api_models/src/payments.rs Show resolved Hide resolved
ivor11
ivor11 previously approved these changes Mar 4, 2024
crates/api_models/src/payments.rs Outdated Show resolved Hide resolved
crates/api_models/src/payments.rs Outdated Show resolved Hide resolved
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Mar 5, 2024
Merged via the queue into main with commit 0a43ceb Mar 5, 2024
13 of 15 checks passed
@Gnanasundari24 Gnanasundari24 deleted the api_models_changes_for_external_authentication branch March 5, 2024 08:12
@SanchithHegde SanchithHegde removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Mar 10, 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 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.

6 participants