Skip to content

feat(connector): [barclaycard] Implement 3DS flow for cards#8936

Merged
likhinbopanna merged 8 commits intomainfrom
barclaycard-3ds-flow
Aug 21, 2025
Merged

feat(connector): [barclaycard] Implement 3DS flow for cards#8936
likhinbopanna merged 8 commits intomainfrom
barclaycard-3ds-flow

Conversation

@Vani-1107
Copy link
Contributor

@Vani-1107 Vani-1107 commented Aug 13, 2025

Type of Change

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

Description

Added 3DS flow for cards.

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?

Payments Create

Request
{
    "amount": 6540,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "connector":["barclaycard"],
    "customer_id": "customer_123",
    "email": "guest@example.com",
    "description": "Its my first payment request",
    "authentication_type": "three_ds",
    "return_url": "https://duck.com",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "card_number": "4000000000001091",
            "card_exp_month": "01",
            "card_exp_year": "2027",
            "card_holder_name": "joseph Doe",
            "card_cvc": "100"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "John"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "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": "128.0.0.1"
    }
}

Response
{
    "payment_id": "pay_5hNPtnaAhcQtSJRJPu2f",
    "merchant_id": "merchant_1755068373",
    "status": "requires_customer_action",
    "amount": 6540,
    "net_amount": 6540,
    "shipping_cost": null,
    "amount_capturable": 6540,
    "amount_received": null,
    "connector": "barclaycard",
    "client_secret": "pay_5hNPtnaAhcQtSJRJPu2f_secret_ZHbfJrVKRWAVtOaindOz",
    "created": "2025-08-13T07:00:03.840Z",
    "currency": "USD",
    "customer_id": "customer_123",
    "customer": {
        "id": "customer_123",
        "name": null,
        "email": "guest@example.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1091",
            "card_type": "CREDIT",
            "card_network": "Visa",
            "card_issuer": "INTL HDQTRS-CENTER OWNED",
            "card_issuing_country": "UNITEDSTATES",
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "01",
            "card_exp_year": "2027",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_qY543nleGWdZmdwjqp5J",
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": null,
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": null,
    "phone": null,
    "return_url": "https://duck.com/",
    "authentication_type": "three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": {
        "type": "redirect_to_url",
        "redirect_to_url": "http://localhost:8080/payments/redirect/pay_5hNPtnaAhcQtSJRJPu2f/merchant_1755068373/pay_5hNPtnaAhcQtSJRJPu2f_1"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "customer_123",
        "created_at": 1755068403,
        "expires": 1755072003,
        "secret": "epk_6e9902b6971c475c9e2ce103d8eb21f9"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": null,
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_5hNPtnaAhcQtSJRJPu2f_1",
    "payment_link": null,
    "profile_id": "pro_GGDcCtQm3esdj2E8IQtN",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_nCQxbxIhRsZJkWHCReZx",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-13T07:15:03.839Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "128.0.0.1",
        "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",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-13T07:00:08.368Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "enable_partial_authorization": null
}

Screenshot 2025-08-13 at 12 30 57 PM Screenshot 2025-08-13 at 12 31 12 PM

Psync call

Response Screenshot 2025-08-13 at 12 42 07 PM

Manual Capture

Request Screenshot 2025-08-14 at 3 22 49 PM
Response Screenshot 2025-08-14 at 3 22 19 PM Screenshot 2025-08-14 at 3 24 05 PM

Void

Response

{
    "payment_id": "pay_ZRt7ZPKq81NKO3OBSPSN",
    "merchant_id": "merchant_1755164596",
    "status": "cancelled",
    "amount": 6544,
    "net_amount": 6544,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": "barclaycard",
    "client_secret": "pay_ZRt7ZPKq81NKO3OBSPSN_secret_5VRKkOWWHuv1NkFvZ7yy",
    "created": "2025-08-14T09:43:40.392Z",
    "currency": "USD",
    "customer_id": "customer_123",
    "customer": {
        "id": "customer_123",
        "name": null,
        "email": "guest@example.com",
        "phone": null,
        "phone_country_code": null
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1091",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "01",
            "card_exp_year": "2027",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "avs_response": {
                    "code": "Y",
                    "codeRaw": "Y"
                },
                "card_verification": {
                    "resultCode": "M",
                    "resultCodeRaw": "M"
                }
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_IF0cVtMJuLBwgtZ2NxC9",
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "PiX",
            "last_name": null,
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": null,
    "phone": null,
    "return_url": "https://duck.com/",
    "authentication_type": "three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": "mistake",
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": null,
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "7551647749496875004805",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_ZRt7ZPKq81NKO3OBSPSN_1",
    "payment_link": null,
    "profile_id": "pro_ZrxucPy12jJRn5yqlneZ",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_ULnoz4qQLpwBwBozYvIr",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-14T09:58:40.390Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "128.0.0.1",
        "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",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-14T09:46:15.320Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}


Refund Screenshot 2025-08-14 at 3 38 09 PM
RSync Screenshot 2025-08-14 at 3 39 51 PM

Cypress test Screenshot 2025-08-20 at 6 33 35 PM

Some tests are failing because of redirection timeout:

Screenshot 2025-08-20 at 6 34 11 PM

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

@Vani-1107 Vani-1107 requested review from a team as code owners August 13, 2025 08:11
@semanticdiff-com
Copy link

semanticdiff-com bot commented Aug 13, 2025

@Vani-1107 Vani-1107 self-assigned this Aug 13, 2025
@Vani-1107 Vani-1107 force-pushed the barclaycard-3ds-flow branch from 60f2bc2 to 1eb82d8 Compare August 13, 2025 09:57
sahkal
sahkal previously approved these changes Aug 18, 2025
Comment on lines +387 to +398
// let currency = req.request.currency.ok_or(errors::ConnectorError::MissingRequiredField {
// field_name: "currency",
// })?;
// let amount = req.request.amount.ok_or(errors::ConnectorError::MissingRequiredField {
// field_name: "amount",
// })?;
// let connector_router_data = barclaycard::BarclaycardRouterData::try_from((
// &self.get_currency_unit(),
// currency,
// amount,
// req,
// ))?;
Copy link
Contributor

Choose a reason for hiding this comment

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

is this commented code required?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, missed it.
Removed.

@Vani-1107 Vani-1107 dismissed stale reviews from sahkal and deepanshu-iiitu via 7f3ad71 August 18, 2025 08:43
sahkal
sahkal previously approved these changes Aug 18, 2025
ShankarSinghC
ShankarSinghC previously approved these changes Aug 18, 2025
@likhinbopanna likhinbopanna added this pull request to the merge queue Aug 20, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 20, 2025
@Vani-1107 Vani-1107 requested a review from a team as a code owner August 20, 2025 13:38
@Vani-1107 Vani-1107 requested a review from sahkal August 20, 2025 13:48
@likhinbopanna likhinbopanna added this pull request to the merge queue Aug 21, 2025
Merged via the queue into main with commit 19db2b5 Aug 21, 2025
21 of 25 checks passed
@likhinbopanna likhinbopanna deleted the barclaycard-3ds-flow branch August 21, 2025 10:39
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.

5 participants