use std::{collections::HashMap, fmt::Debug}; use common_utils::{id_type, types::MinorUnit}; pub use euclid::{ dssa::types::EuclidAnalysable, frontend::{ ast, dir::{DirKeyKind, EuclidDirFilter}, }, }; use serde::{Deserialize, Serialize}; use crate::enums::{Currency, PaymentMethod}; #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct OpenRouterDecideGatewayRequest { pub payment_info: PaymentInfo, pub merchant_id: id_type::ProfileId, pub eligible_gateway_list: Option>, pub ranking_algorithm: Option, pub elimination_enabled: Option, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] pub enum RankingAlgorithm { SrBasedRouting, PlBasedRouting, } #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct PaymentInfo { pub payment_id: id_type::PaymentId, pub amount: MinorUnit, pub currency: Currency, // customerId: Option, // preferredGateway: Option, pub payment_type: String, // metadata: Option, // internalMetadata: Option, // isEmi: Option, // emiBank: Option, // emiTenure: Option, pub payment_method_type: String, pub payment_method: PaymentMethod, // paymentSource: Option, // authType: Option, // cardIssuerBankName: Option, // cardIsin: Option, // cardType: Option, // cardSwitchProvider: Option>, } #[derive(Debug, Serialize, Deserialize, PartialEq)] pub struct DecidedGateway { pub gateway_priority_map: Option>, } #[derive(Debug, Serialize, Deserialize)] pub struct ErrorResponse { pub status: String, pub error_code: String, pub error_message: String, pub priority_logic_tag: Option, pub filter_wise_gateways: Option, pub error_info: UnifiedError, pub is_dynamic_mga_enabled: bool, } #[derive(Debug, Serialize, Deserialize)] pub struct UnifiedError { pub code: String, pub user_message: String, pub developer_message: String, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] #[serde(rename_all = "camelCase")] pub struct UpdateScorePayload { pub merchant_id: id_type::ProfileId, pub gateway: String, pub status: TxnStatus, pub payment_id: id_type::PaymentId, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] pub enum TxnStatus { Started, AuthenticationFailed, JuspayDeclined, PendingVbv, VBVSuccessful, Authorized, AuthorizationFailed, Charged, Authorizing, CODInitiated, Voided, VoidInitiated, Nop, CaptureInitiated, CaptureFailed, VoidFailed, AutoRefunded, PartialCharged, ToBeCharged, Pending, Failure, Declined, }