mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 18:17:13 +08:00 
			
		
		
		
	refactor(router): include payment method type in connector choice for session flow (#1036)
This commit is contained in:
		| @ -1032,8 +1032,13 @@ where | ||||
|  | ||||
|     let connector = if should_call_connector(operation, payment_data) { | ||||
|         Some(match connector_choice { | ||||
|             api::ConnectorChoice::SessionMultiple(connectors) => { | ||||
|                 api::ConnectorCallType::Multiple(connectors) | ||||
|             api::ConnectorChoice::SessionMultiple(session_connectors) => { | ||||
|                 api::ConnectorCallType::Multiple( | ||||
|                     session_connectors | ||||
|                         .into_iter() | ||||
|                         .map(|c| c.connector) | ||||
|                         .collect(), | ||||
|                 ) | ||||
|             } | ||||
|  | ||||
|             api::ConnectorChoice::StraightThrough(straight_through) => connector_selection( | ||||
|  | ||||
| @ -350,7 +350,10 @@ where | ||||
|                             connector_and_payment_method_type.0.as_str(), | ||||
|                             api::GetToken::from(connector_and_payment_method_type.1), | ||||
|                         )?; | ||||
|                         connectors_data.push(connector_details); | ||||
|                         connectors_data.push(api::SessionConnectorData { | ||||
|                             payment_method_type, | ||||
|                             connector: connector_details, | ||||
|                         }); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| @ -364,7 +367,10 @@ where | ||||
|                     connector_and_payment_method_type.0.as_str(), | ||||
|                     api::GetToken::from(connector_and_payment_method_type.1), | ||||
|                 )?; | ||||
|                 connectors_data.push(connector_details); | ||||
|                 connectors_data.push(api::SessionConnectorData { | ||||
|                     payment_method_type: connector_and_payment_method_type.1, | ||||
|                     connector: connector_details, | ||||
|                 }); | ||||
|             } | ||||
|             connectors_data | ||||
|         }; | ||||
|  | ||||
| @ -150,8 +150,14 @@ pub struct ConnectorData { | ||||
|     pub get_token: GetToken, | ||||
| } | ||||
|  | ||||
| #[derive(Clone)] | ||||
| pub struct SessionConnectorData { | ||||
|     pub payment_method_type: api_enums::PaymentMethodType, | ||||
|     pub connector: ConnectorData, | ||||
| } | ||||
|  | ||||
| pub enum ConnectorChoice { | ||||
|     SessionMultiple(Vec<ConnectorData>), | ||||
|     SessionMultiple(Vec<SessionConnectorData>), | ||||
|     StraightThrough(serde_json::Value), | ||||
|     Decide, | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 ItsMeShashank
					ItsMeShashank