This session is being continued from a previous conversation that ran out of context. The conversation is summarized below:
I've analyzed the hyperswitch codebase and documented the changes needed to implement the API contract changes to accept saving_percentage in the decision engine response.
Implementation Summary
Required Structural Change
Modify DebitRoutingOutput in crates/api_models/src/open_router.rs:
Current:
pub struct DebitRoutingOutput {
pub co_badged_card_networks: Vec<common_enums::CardNetwork>,
pub issuer_country: common_enums::CountryAlpha2,
pub is_regulated: bool,
pub regulated_name: Option<common_enums::RegulatedName>,
pub card_type: common_enums::CardType,
}
Required:
pub struct DebitRoutingOutput {
pub co_badged_card_networks_info: Vec<CoBadgedCardNetworksInfo>,
pub issuer_country: common_enums::CountryAlpha2,
pub is_regulated: bool,
pub regulated_name: Option<common_enums::RegulatedName>,
pub card_type: common_enums::CardType,
}
pub struct CoBadgedCardNetworksInfo {
pub network: common_enums::CardNetwork,
pub saving_percentage: f64,
}
Files to Update
crates/api_models/src/open_router.rs - Main API contract file
crates/api_models/src/payment_methods.rs - Related data structures
crates/router/src/core/debit_routing.rs - Usage in routing logic
Expected API Response
This enables decision engine responses with saving percentages:
"co_badged_card_networks_info": [
{
"network": "ACCEL",
"saving_percentage": 0.14
},
{
"network": "STAR",
"saving_percentage": 0.04
},
{
"network": "VISA",
"saving_percentage": 0.0
}
]
This implements the API contract enhancement for saving percentage support in decision engine responses..
Please continue the conversation from where we left it off without asking the user any further questions. Continue with the last task that you were asked to work on.