Skip to content

feat(routing): Add routing evaluation rule endpoint and related flow#8656

Merged
likhinbopanna merged 5 commits intomainfrom
add-de-route
Jul 18, 2025
Merged

feat(routing): Add routing evaluation rule endpoint and related flow#8656
likhinbopanna merged 5 commits intomainfrom
add-de-route

Conversation

@GauravRawat369
Copy link
Contributor

@GauravRawat369 GauravRawat369 commented Jul 15, 2025

Type of Change

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

Description

This PR adds the routing rule evaluation endpoint to Hyperswitch, which calls the decision engine
Added evaluate_routing_rule function, which calls send_decision_engine_request with ApiKeyAuth auth

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

curl --location 'http://localhost:8080/routing/rule/evaluate' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_Zgz3AVVEqf4l1IZtWu******tLXfe0CcbUmdQ3Ol91gfvt0aytHG5C2FXmCxc' \
--data '{
  "created_by":"merchant_1752591820",
  "parameters": {
    "payment_method": { "type": "enum_variant", "value": "upi"},
    "amount": { "type": "number","value": 100}
  },
  "fallback_output": [
    {
      "gateway_name": "cybersource",
      "gateway_id": "mca_51nE*****0cuknbQRaWz"
    }
  ]
}'

Response

{
    "status": "default_selection",
    "output": {
        "type": "priority",
        "connectors": [
            {
                "gateway_name": "stripe",
                "gateway_id": "mca_111"
            },
            {
                "gateway_name": "adyen",
                "gateway_id": "mca_112"
            },
            {
                "gateway_name": "checkout",
                "gateway_id": "mca_113"
            }
        ]
    },
    "evaluated_output": [
        {
            "gateway_name": "stripe",
            "gateway_id": "mca_111"
        }
    ],
    "eligible_connectors": []
}

Logs at Decision-engine

image

Logs at Hyperswitch

image

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

@GauravRawat369 GauravRawat369 requested review from a team as code owners July 15, 2025 12:45
@semanticdiff-com
Copy link

semanticdiff-com bot commented Jul 15, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/routes/lock_utils.rs  36% smaller
  crates/router/src/routes/app.rs  24% smaller
  crates/router/src/routes/routing.rs  10% smaller
  crates/router/src/core/payments/routing/utils.rs  0% smaller
  crates/router_env/src/logger/types.rs  0% smaller

@likhinbopanna likhinbopanna added this pull request to the merge queue Jul 18, 2025
Merged via the queue into main with commit 126018e Jul 18, 2025
24 of 28 checks passed
@likhinbopanna likhinbopanna deleted the add-de-route branch July 18, 2025 08:48
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)
  ...
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.

Add support to call decision engine PL Routing from hyperswitch after API key authentication

4 participants