Skip to content

Conversation

spritianeja03
Copy link
Contributor

@spritianeja03 spritianeja03 commented Jul 15, 2025

Type of Change

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

Description

This PR adds API key auth to the decision engine endpoints for the decide gateway call and the update gateway score call.

Additional Changes

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

Motivation and Context

Closes #8613

How did you test it?

decide-gateway
curl --location 'http://localhost:8080/routing/evaluate' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_UnrorzUwWmt9GUkRTalEmIjrWu3JwKNh8TkSZmMJ2Fsm***** \
--data '{           
        "merchantId": "pro_VTQjooFPAyPOBC0aj9Jk",
        "eligibleGatewayList": ["GatewayA", "GatewayB", "GatewayC"],
        "rankingAlgorithm": "SR_BASED_ROUTING",
        "eliminationEnabled": true,
        "paymentInfo": {
            "paymentId": "PAY12359",
            "amount": 100,
            "currency": "USD",
            "customerId": "CUST12345",
            "udfs": null,
            "preferredGateway": null,
            "paymentType": "ORDER_PAYMENT",
            "metadata": null,
            "internalMetadata": null,
            "isEmi": false,
            "emiBank": null,
            "emiTenure": null,
            "paymentMethodType": "credit",
            "paymentMethod": "card",
            "paymentSource": null,
            "authType": null,
            "cardIssuerBankName": null,
            "cardIsin": null,
            "cardType": null,
            "cardSwitchProvider": null
        }
}'
response
{
    "decided_gateway": "GatewayA",
    "gateway_priority_map": {
        "GatewayA": 1.0,
        "GatewayB": 1.0,
        "GatewayC": 1.0
    },
    "filter_wise_gateways": null,
    "priority_logic_tag": null,
    "routing_approach": "SR_SELECTION_V3_ROUTING",
    "gateway_before_evaluation": "GatewayC",
    "priority_logic_output": {
        "isEnforcement": false,
        "gws": [
            "GatewayA",
            "GatewayB",
            "GatewayC"
        ],
        "priorityLogicTag": null,
        "gatewayReferenceIds": {},
        "primaryLogic": null,
        "fallbackLogic": null
    },
    "reset_approach": "NO_RESET",
    "routing_dimension": "ORDER_PAYMENT, CREDIT, card",
    "routing_dimension_level": "PM_LEVEL",
    "is_scheduled_outage": false,
    "is_dynamic_mga_enabled": false,
    "gateway_mga_id_map": null
}

update-gateway-score
curl --location 'http://localhost:8080/routing/feedback' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_UnrorzUwWmt9GUkRTalEmIjrWu3JwKNh8TkSZmMJ2Fs******' \
--data '{
  "merchantId" : "pro_VTQjooFPAyPOBC0aj9Jk",
  "gateway": "GatewayC",
  "gatewayReferenceId": null,
  "status": "FAILURE",
  "paymentId": "PAY12359",
  "enforceDynamicRoutingFailure" : null
}'
response
{
    "message": "Success"
}

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

@spritianeja03 spritianeja03 requested review from a team as code owners July 15, 2025 08:27
Copy link

semanticdiff-com bot commented Jul 15, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/routes/lock_utils.rs  61% smaller
  crates/router/src/core/routing.rs  6% smaller
  crates/api_models/src/events/routing.rs  0% smaller
  crates/api_models/src/open_router.rs  0% smaller
  crates/router/src/core/payments/routing/utils.rs  0% smaller
  crates/router/src/routes/app.rs  0% smaller
  crates/router/src/routes/routing.rs  0% smaller
  crates/router_env/src/logger/types.rs  0% smaller

@spritianeja03 spritianeja03 self-assigned this Jul 15, 2025
@spritianeja03 spritianeja03 added A-routing Area: Routing M-api-contract-changes Metadata: This PR involves API contract changes labels Jul 15, 2025
@spritianeja03 spritianeja03 added this to the July 2025 Release milestone Jul 15, 2025
@hyperswitch-bot hyperswitch-bot bot removed the M-api-contract-changes Metadata: This PR involves API contract changes label Jul 15, 2025
@spritianeja03 spritianeja03 changed the title feat(router): Add API key auth for decision engine endpoints feat(routing): Add API key auth for decision engine endpoints Jul 15, 2025
jagan-jaya
jagan-jaya previously approved these changes Jul 16, 2025
tsdk02
tsdk02 previously approved these changes Jul 16, 2025
jagan-jaya
jagan-jaya previously approved these changes Jul 16, 2025
@spritianeja03 spritianeja03 dismissed stale reviews from jagan-jaya and tsdk02 via 0c8f0ed July 16, 2025 11:54
@likhinbopanna likhinbopanna added this pull request to the merge queue Jul 18, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 18, 2025
@likhinbopanna likhinbopanna added this pull request to the merge queue Jul 21, 2025
Merged via the queue into main with commit f4da057 Jul 21, 2025
19 of 29 checks passed
@likhinbopanna likhinbopanna deleted the auth-wrapper-for-decision-engine-endpoints branch July 21, 2025 13:38
pixincreate added a commit that referenced this pull request Jul 22, 2025
…ordea-sepa

* 'main' of github.com:juspay/hyperswitch:
  refactor(connector): [Adyen] map ssn and session validity for Pix (#8702)
  feat(core): Implement UCS kill switch for emergency fallback (#8651)
  fix(openapi): Added Error Response Schema for Status Code 400 (#8684)
  feat(connector): Add template code for breadpay (#8655)
  chore(version): 2025.07.21.1
  refactor(payments): fetch payment method information in attempts list api v2 and add custom billing connector template (#8681)
  fix(router): Make v2 endpoints follow standard naming conventions (#8630)
  fix(connector): [Cybersource] Add type_selection_indicator as 1 for all cards  (#8663)
  feat(routing): Add API key auth for decision engine endpoints (#8640)
  feat(authentication): Added eligibility flow for modular authentication (#8431)
  feat(connector): [BLACKHAWKNETWORK] Add Template Code  (#8632)
  fix: remove straight through routing from routing approach (#8695)
  fix(connector): [Access Worldpay] correct enum deserialization for payment responses for (#8689)
  chore(version): 2025.07.21.0
pixincreate added a commit that referenced this pull request Jul 22, 2025
…ayload-recurring

* 'main' of github.com:juspay/hyperswitch: (48 commits)
  fix(connector): Add Trustpay in Authentication Providers Config (#8622)
  refactor(connector): [Adyen] map ssn and session validity for Pix (#8702)
  feat(core): Implement UCS kill switch for emergency fallback (#8651)
  fix(openapi): Added Error Response Schema for Status Code 400 (#8684)
  feat(connector): Add template code for breadpay (#8655)
  chore(version): 2025.07.21.1
  refactor(payments): fetch payment method information in attempts list api v2 and add custom billing connector template (#8681)
  fix(router): Make v2 endpoints follow standard naming conventions (#8630)
  fix(connector): [Cybersource] Add type_selection_indicator as 1 for all cards  (#8663)
  feat(routing): Add API key auth for decision engine endpoints (#8640)
  feat(authentication): Added eligibility flow for modular authentication (#8431)
  feat(connector): [BLACKHAWKNETWORK] Add Template Code  (#8632)
  fix: remove straight through routing from routing approach (#8695)
  fix(connector): [Access Worldpay] correct enum deserialization for payment responses for (#8689)
  chore(version): 2025.07.21.0
  feat(debit_routing): add debit routing support for apple pay (#8673)
  refactor(router): decrypt the wallet token before the debit routing call (#8598)
  chore: update org retrieve api response to include org type (#8660)
  feat(routing): Add routing evaluation rule endpoint and related flow (#8656)
  fix(connector): [AUTHORIZEDOTNET] Added Invoice Number Fix (#8685)
  ...
pixincreate added a commit that referenced this pull request Jul 22, 2025
…acilitapay-mca-metadata

* 'main' of github.com:juspay/hyperswitch:
  fix(connector): Add Trustpay in Authentication Providers Config (#8622)
  refactor(connector): [Adyen] map ssn and session validity for Pix (#8702)
  feat(core): Implement UCS kill switch for emergency fallback (#8651)
  fix(openapi): Added Error Response Schema for Status Code 400 (#8684)
  feat(connector): Add template code for breadpay (#8655)
  chore(version): 2025.07.21.1
  refactor(payments): fetch payment method information in attempts list api v2 and add custom billing connector template (#8681)
  fix(router): Make v2 endpoints follow standard naming conventions (#8630)
  fix(connector): [Cybersource] Add type_selection_indicator as 1 for all cards  (#8663)
  feat(routing): Add API key auth for decision engine endpoints (#8640)
  feat(authentication): Added eligibility flow for modular authentication (#8431)
  feat(connector): [BLACKHAWKNETWORK] Add Template Code  (#8632)
  fix: remove straight through routing from routing approach (#8695)
  fix(connector): [Access Worldpay] correct enum deserialization for payment responses for (#8689)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-routing Area: Routing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support to call decision engine Dynamic Routing from hyperswitch after API key authentication
5 participants