Skip to content

Conversation

@AmitsinghTanwar007
Copy link
Contributor

@AmitsinghTanwar007 AmitsinghTanwar007 commented Nov 28, 2025

Type of Change

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

Description

There were two rollout keys in HS<>UCS tunnel which were creating confusion so I merged them So that the Transaction can be controlled using one rollout key.

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?

This is curl for creating the config

curl --location 'http://localhost:8080/configs/' \
--header 'Content-Type: application/json' \
--header 'api-key: test_admin' \
--header 'x-tenant-id: public' \
--header 'Cookie: _xsrf=2|9ebbce7b|591025242b16b60dbcc5c18fb3c7a819|1764069467' \
--data '
{
    "key": "ucs_rollout_config_merchant_1764236098_authorizedotnet_card_Authorize",
    "value": "{\"rollout_percent\": 1.0, \"http_url\": \"http://localhost:8081\", \"https_url\":\"http://localhost:8081\", \"execution_mode\": \"shadow\"}"
}
'

Authorize Flow

Authorize Request
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: ' \
--header 'Cookie: _xsrf=' \
--data-raw '{
    "amount": 6540,
    "currency": "USD",
    "amount_to_capture": 6540,
    "confirm": true,
    "profile_id": "pro_Usujx8sGKZ1OjWLUeGLS",
    "capture_method": "automatic",
    "authentication_type": "no_three_ds",
    "setup_future_usage": "off_session",
    "customer": {
        "id": "customer123w9ryuwuryweiuyrewiuhi", //need to updated for create_connector_customer flow
        "name": "John Doe",
        "email": "[email protected]",//need to updated for create_connector_customer flow
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "customer_id": "customer123w9ryuwuryweiuyrewiuhi",//need to updated for create_connector_customer flow
    "phone_country_code": "+1",
    "routing": {
        "type": "single",
        "data": "authorizedotnet"
    },
    "description": "Its my first payment request",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_holder_name": "Joseph Doe",
            "card_number": "5123456789012346",
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_cvc": "100",
            "card_network": "Visa"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "[email protected]"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "[email protected]"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 6540,
            "account_name": "transaction_processing"
        }
    ],
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "browser_info": {
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;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"
    },
    "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"
        }
    },
    "connector_metadata": {
        "noon": {
            "order_category": "pay"
        }
    },
    "payment_link": false,
    "payment_type": "normal",
    "request_incremental_authorization": false,
    "merchant_order_reference_id": "testing_the_integ03454",
    "all_keys_required": true,
    "session_expiry": 900
}'
Authorize Response
{
    "payment_id": "pay_nGxyofcByR45vSXqtxcw",
    "merchant_id": "merchant_1761124451",
    "status": "succeeded",
    "amount": 6540,
    "net_amount": 6540,
    "connector": "authorizedotnet",
    "client_secret": "pay_nGxyofcByR45vSXqtxcw_secret_uDqnVxhyI4Mvubh6tkak",
    "currency": "USD",
    "customer_id": "customer123w9ryuwuryweiuyrewiuhi",
    "description": "Its my first payment request",
    "capture_method": "automatic",
    "payment_method": "card",
    "connector_transaction_id": "120073086322",
    "network_transaction_id": "WC001WNXVWT1BHW7ICMFA44",
    "merchant_order_reference_id": "testing_the_integ03454",
    "connector_mandate_id": "933135702-932436342",
    "feature_metadata": {
        "gateway_system": "direct"
    },
    "connector_metadata": {
        "noon": {
            "order_category": "pay"
        }
    },
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 6540
        }
    ],
    "ephemeral_key": {
        "customer_id": "customer123w9ryuwuryweiuyrewiuhi",
        "created_at": 1761306340,
        "expires": 1761309940,
        "secret": "epk_5329d1ef7bfc4c21a17d689167caa98a"
    },
    "whole_connector_response": "{\"transactionResponse\":{\"responseCode\":\"1\",\"authCode\":\"19RFGL\",\"avsResultCode\":\"Y\",\"cvvResultCode\":\"P\",\"transId\":\"120073086322\",\"messages\":[{\"code\":\"1\",\"description\":\"This transaction has been approved.\"}]}}"
}

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

@AmitsinghTanwar007 AmitsinghTanwar007 requested review from a team as code owners November 28, 2025 11:46
@semanticdiff-com
Copy link

semanticdiff-com bot commented Nov 28, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/core/unified_connector_service.rs  27% smaller
  crates/router/src/core/payments/helpers.rs  5% smaller
  crates/common_enums/src/enums.rs  0% smaller

@codecov
Copy link

codecov bot commented Nov 28, 2025

Codecov Report

❌ Patch coverage is 17.39130% with 76 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@2be1452). Learn more about missing BASE report.

Files with missing lines Patch % Lines
crates/router/src/core/payments/helpers.rs 18.00% 41 Missing ⚠️
...rates/router/src/core/unified_connector_service.rs 16.66% 35 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10473   +/-   ##
=======================================
  Coverage        ?    6.45%           
=======================================
  Files           ?     1251           
  Lines           ?   312681           
  Branches        ?        0           
=======================================
  Hits            ?    20196           
  Misses          ?   292485           
  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.

@AmitsinghTanwar007 AmitsinghTanwar007 self-assigned this Dec 2, 2025
@AmitsinghTanwar007 AmitsinghTanwar007 linked an issue Dec 2, 2025 that may be closed by this pull request
2 tasks
should_execute: false,
proxy_override: None,
execution_mode: ExecutionMode::NotApplicable,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be based on evaluation and then returning it ?

}

// Helper function to execute rollout logic or return default
fn execute_rollout_decision(
Copy link
Contributor

Choose a reason for hiding this comment

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

can be converted into a From for RolloutExecutionResult;

the
is_valid_percent: bool,
is_valid_execution_mode: bool,

validations can be moved inside the from impl

"Using DirectConnector - not in ucs_only_list and rollout not enabled"
"Using DirectConnector - not in ucs_only_list"
);
Ok(ConnectorIntegrationType::DirectConnector)
Copy link
Contributor

Choose a reason for hiding this comment

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

Naming can be better as connectors that are in both hs and ucs are also grouped in DirectConnector.

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] Merge the two config keys for UCS in HS<>UCS tunnel

4 participants