Skip to content

feat(core): Added Capture flow support for Hyperswitch <> UCS Integration #9735

Merged
likhinbopanna merged 10 commits intomainfrom
hs_ucs_capture
Oct 27, 2025
Merged

feat(core): Added Capture flow support for Hyperswitch <> UCS Integration #9735
likhinbopanna merged 10 commits intomainfrom
hs_ucs_capture

Conversation

@Saptak88
Copy link
Contributor

@Saptak88 Saptak88 commented Oct 8, 2025

Type of Change

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

Description

This PR implements UCS(Unified Connector Service) Integration for Capture flow.

Tested for Stripe and Cybersource using DIff check fix branch in UCS:
juspay/connector-service#226

If tested using UCS main branch it will show diffs

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?

Curl Testing for Fiuu vis UCS

Create Payment Fiuu
{
    "amount":100,
    "currency": "MYR",
    "confirm": true,
    "payment_link" : false,
    "capture_method": "manual",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 100,
    "customer_id": "StripeCustomer",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "5105105105105100",
            "card_exp_month": "12",
            "card_exp_year": "2029",
            "card_holder_name": "Max Mustermann",
            "card_cvc": "123",
            "card_network": "VISA"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "CA",
            "line3": "CA",
            "city": "Musterhausen",
            "state": "California",
            "zip": "12345",
            "country": "MY",
            "first_name": "Max",
            "last_name": "Mustermann"
        },
        "email": "test@novalnet.de",
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "shipping": {
        "address": {
            "line1": "Musterstr",
            "line2": "CA",
            "line3": "CA",
            "city": "Musterhausen",
            "state": "California",
            "zip": "94122",
            "country": "MY",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "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,
        "ip_address": "103.77.139.95",
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true
    },
    
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}

Response

{
    "payment_id": "pay_Yw8BEg1MtB3fxTQiGEbK",
    "merchant_id": "merchant_1759845271",
    "status": "requires_capture",
    "amount": 100,
    "net_amount": 100,
    "shipping_cost": null,
    "amount_capturable": 100,
    "amount_received": null,
    "connector": "fiuu",
    "client_secret": "pay_Yw8BEg1MtB3fxTQiGEbK_secret_qKYBcIK9HGhObfH3WR0b",
    "created": "2025-10-08T05:21:32.383Z",
    "currency": "MYR",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "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": "5100",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "510510",
            "card_extended_bin": null,
            "card_exp_month": "12",
            "card_exp_year": "2029",
            "card_holder_name": "Max Mustermann",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "Musterhausen",
            "country": "MY",
            "line1": "Musterstr",
            "line2": "CA",
            "line3": "CA",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "Musterhausen",
            "country": "MY",
            "line1": "1467",
            "line2": "CA",
            "line3": "CA",
            "zip": "12345",
            "state": "California",
            "first_name": "Max",
            "last_name": "Mustermann",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "test@novalnet.de"
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "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": "StripeCustomer",
        "created_at": 1759900892,
        "expires": 1759904492,
        "secret": "epk_434f4a935459447abb2d51f03ad751d0"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": "31054437",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "unified_connector_service"
    },
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_vf3FxmC3YhXkNfcUpo8v",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_SgM7weRWVGcYHmuRvLWi",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-10-08T05:36:32.383Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "103.77.139.95",
        "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-10-08T05:21:34.083Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "request_extended_authorization": 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": "{\"MerchantID\":\"SBpp\",\"ReferenceNo\":\"pay_Yw8BEg1MtB3fxTQiGEbK_1\",\"TxnID\":\"31054437\",\"TxnType\":\"AUTS\",\"TxnCurrency\":\"MYR\",\"TxnAmount\":\"1.00\",\"TxnChannel\":\"CREDITAN\",\"TxnData\":{\"RequestURL\":\"\",\"RequestMethod\":\"\",\"RequestType\":\"RESPONSE\",\"RequestData\":{\"skey\":\"130f1b95224f5cbb5359f5cd96600ff3\",\"tranID\":\"31054437\",\"domain\":\"SB_zurichgdpp\",\"status\":\"00\",\"amount\":\"1.00\",\"currency\":\"MYR\",\"paydate\":\"2025-10-08 13:21:34\",\"orderid\":\"pay_Yw8BEg1MtB3fxTQiGEbK_1\",\"appcode\":728349,\"channel\":\"CREDIT\",\"extraP\":{\"ccbrand\":\"MASTERCARD\",\"cclast4\":\"5100\",\"cctype\":\"CREDIT\",\"token\":\"TK_2902_35512301472677909531\"}}}}",
    "enable_partial_authorization": null,
    "enable_overcapture": null,
    "is_overcapture_enabled": null,
    "network_details": null,
    "is_stored_credential": null,
    "mit_category": null
}
Capture Payment Fiuu
{
  "amount_to_capture": 100,
  "statement_descriptor_name": "Joseph",
  "statement_descriptor_prefix" :"joseph",
  "statement_descriptor_suffix": "JS"
}

Response

{
    "payment_id": "pay_Yw8BEg1MtB3fxTQiGEbK",
    "merchant_id": "merchant_1759845271",
    "status": "succeeded",
    "amount": 100,
    "net_amount": 100,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 100,
    "connector": "fiuu",
    "client_secret": "pay_Yw8BEg1MtB3fxTQiGEbK_secret_qKYBcIK9HGhObfH3WR0b",
    "created": "2025-10-08T05:21:32.383Z",
    "currency": "MYR",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "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": "5100",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "510510",
            "card_extended_bin": null,
            "card_exp_month": "12",
            "card_exp_year": "2029",
            "card_holder_name": "Max Mustermann",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "Musterhausen",
            "country": "MY",
            "line1": "Musterstr",
            "line2": "CA",
            "line3": "CA",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "Musterhausen",
            "country": "MY",
            "line1": "1467",
            "line2": "CA",
            "line3": "CA",
            "zip": "12345",
            "state": "California",
            "first_name": "Max",
            "last_name": "Mustermann",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "test@novalnet.de"
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "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": null,
    "manual_retry_allowed": null,
    "connector_transaction_id": "31054437",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "unified_connector_service"
    },
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_vf3FxmC3YhXkNfcUpo8v",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_SgM7weRWVGcYHmuRvLWi",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-10-08T05:36:32.383Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "103.77.139.95",
        "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-10-08T05:21:42.989Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "request_extended_authorization": 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,
    "enable_overcapture": null,
    "is_overcapture_enabled": null,
    "network_details": null,
    "is_stored_credential": null,
    "mit_category": null
}

Cypress test for auth.net via UCS gateway
Screenshot 2025-10-08 at 10 37 56 AM
The payment checks fail fix will be fixed in another PR for authorize flow, it is not related to this PR
Screenshot 2025-10-27 at 4 50 10 PM
Test results from fix branch ucs-authorizedotnet-fix
Screenshot 2025-10-27 at 6 42 48 PM

Cypress test for auth.net Integ Direct gateway
Screenshot 2025-10-27 at 4 27 18 PM

Diff check for stripe
Request
Screenshot 2025-10-20 at 10 11 01 PM
RouterData(Integrity check is handled at UCS, separate PR for connector_customer fix)
Screenshot 2025-10-20 at 10 48 27 PM

Diff check for Cybersource
Request: Only Timestamp & hence Signature is different, request body is Identical
Screenshot 2025-10-21 at 2 29 28 PM
RouterData
Screenshot 2025-10-21 at 2 29 12 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

@Saptak88 Saptak88 requested review from a team as code owners October 8, 2025 05:18
@semanticdiff-com
Copy link

semanticdiff-com bot commented Oct 8, 2025

@Saptak88 Saptak88 self-assigned this Oct 8, 2025
@Saptak88 Saptak88 linked an issue Oct 8, 2025 that may be closed by this pull request
2 tasks
hrithikesh026
hrithikesh026 previously approved these changes Oct 8, 2025
hrithikesh026
hrithikesh026 previously approved these changes Oct 21, 2025
hrithikesh026
hrithikesh026 previously approved these changes Oct 24, 2025
@codecov
Copy link

codecov bot commented Oct 24, 2025

Codecov Report

❌ Patch coverage is 0% with 205 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@10587a0). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...src/core/unified_connector_service/transformers.rs 0.00% 107 Missing ⚠️
...tes/router/src/core/payments/flows/capture_flow.rs 0.00% 68 Missing ⚠️
...vices/src/grpc_client/unified_connector_service.rs 0.00% 22 Missing ⚠️
...rates/router/src/core/unified_connector_service.rs 0.00% 8 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9735   +/-   ##
=======================================
  Coverage        ?    3.93%           
=======================================
  Files           ?     1223           
  Lines           ?   299847           
  Branches        ?        0           
=======================================
  Hits            ?    11795           
  Misses          ?   288052           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

chaitak-gorai
chaitak-gorai previously approved these changes Oct 24, 2025
@Saptak88 Saptak88 dismissed stale reviews from chaitak-gorai and hrithikesh026 via c43e46b October 27, 2025 08:08
chaitak-gorai
chaitak-gorai previously approved these changes Oct 27, 2025
hrithikesh026
hrithikesh026 previously approved these changes Oct 27, 2025
@likhinbopanna likhinbopanna added this pull request to the merge queue Oct 27, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Oct 27, 2025
@Saptak88 Saptak88 dismissed stale reviews from hrithikesh026 and chaitak-gorai via ae0b27e October 27, 2025 13:55
@likhinbopanna likhinbopanna added this pull request to the merge queue Oct 27, 2025
Merged via the queue into main with commit b354d63 Oct 27, 2025
25 of 27 checks passed
@likhinbopanna likhinbopanna deleted the hs_ucs_capture branch October 27, 2025 15:50
aadityaguptaa pushed a commit that referenced this pull request Nov 10, 2025
…tion (#9735)

Co-authored-by: Chaitak Gorai <77141674+chaitak-gorai@users.noreply.github.com>
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.

[FEATURE] Add UCS integration for Capture flow

5 participants