diff --git a/.typos.toml b/.typos.toml index d2ffb8a5b105..109e411884a8 100644 --- a/.typos.toml +++ b/.typos.toml @@ -41,7 +41,7 @@ ws2ipdef = "ws2ipdef" # WinSock Extension ws2tcpip = "ws2tcpip" # WinSock Extension ZAR = "ZAR" # South African Rand currency code JOD = "JOD" # Jordan currency code - +Payed = "Payed" # Paid status for digital virgo [default.extend-words] aci = "aci" # Name of a connector diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json index 0385aa55a20d..74a2bb8d2a7d 100644 --- a/api-reference-v2/openapi_spec.json +++ b/api-reference-v2/openapi_spec.json @@ -5826,6 +5826,7 @@ "cybersource", "datatrans", "deutschebank", + "digitalvirgo", "dlocal", "ebanx", "fiserv", @@ -8076,6 +8077,24 @@ "enum": [ "browser_ip" ] + }, + { + "type": "string", + "enum": [ + "user_msisdn" + ] + }, + { + "type": "string", + "enum": [ + "user_client_identifier" + ] + }, + { + "type": "string", + "enum": [ + "order_details_product_name" + ] } ], "description": "Possible field type of required fields in payment_method_data" @@ -10528,6 +10547,71 @@ "MobilePayRedirection": { "type": "object" }, + "MobilePaymentConsent": { + "type": "string", + "enum": [ + "consent_required", + "consent_not_required", + "consent_optional" + ] + }, + "MobilePaymentData": { + "oneOf": [ + { + "type": "object", + "required": [ + "direct_carrier_billing" + ], + "properties": { + "direct_carrier_billing": { + "type": "object", + "required": [ + "msisdn" + ], + "properties": { + "msisdn": { + "type": "string", + "description": "The phone number of the user", + "example": "1234567890" + }, + "client_uid": { + "type": "string", + "description": "Unique user id", + "example": "02iacdYXGI9CnyJdoN8c7", + "nullable": true + } + } + } + } + } + ] + }, + "MobilePaymentNextStepData": { + "type": "object", + "required": [ + "consent_data_required" + ], + "properties": { + "consent_data_required": { + "$ref": "#/components/schemas/MobilePaymentConsent" + } + } + }, + "MobilePaymentResponse": { + "allOf": [ + { + "allOf": [ + { + "$ref": "#/components/schemas/MobilePaymentData" + } + ], + "nullable": true + }, + { + "type": "object" + } + ] + }, "MomoRedirection": { "type": "object" }, @@ -10828,6 +10912,25 @@ ] } } + }, + { + "type": "object", + "description": "Contains consent to collect otp for mobile payment", + "required": [ + "consent_data_required", + "type" + ], + "properties": { + "consent_data_required": { + "$ref": "#/components/schemas/MobilePaymentConsent" + }, + "type": { + "type": "string", + "enum": [ + "collect_otp" + ] + } + } } ], "discriminator": { @@ -10842,7 +10945,8 @@ "invoke_sdk_client", "trigger_api", "display_bank_transfer_information", - "display_wait_screen" + "display_wait_screen", + "collect_otp" ] }, "NoThirdPartySdkSessionResponse": { @@ -11844,7 +11948,8 @@ "one_click", "link_wallet", "invoke_payment_app", - "display_wait_screen" + "display_wait_screen", + "collect_otp" ] }, "PaymentLinkConfig": { @@ -12136,7 +12241,8 @@ "upi", "voucher", "gift_card", - "open_banking" + "open_banking", + "mobile_payment" ] }, "PaymentMethodCollectLinkRequest": { @@ -12543,6 +12649,18 @@ "$ref": "#/components/schemas/OpenBankingData" } } + }, + { + "type": "object", + "title": "MobilePayment", + "required": [ + "mobile_payment" + ], + "properties": { + "mobile_payment": { + "$ref": "#/components/schemas/MobilePaymentData" + } + } } ] }, @@ -12749,6 +12867,17 @@ "$ref": "#/components/schemas/OpenBankingResponse" } } + }, + { + "type": "object", + "required": [ + "mobile_payment" + ], + "properties": { + "mobile_payment": { + "$ref": "#/components/schemas/MobilePaymentResponse" + } + } } ] }, @@ -13118,7 +13247,8 @@ "pay_easy", "local_bank_transfer", "mifinity", - "open_banking_pis" + "open_banking_pis", + "direct_carrier_billing" ] }, "PaymentMethodUpdate": { @@ -17921,6 +18051,7 @@ "cybersource", "datatrans", "deutschebank", + "digitalvirgo", "dlocal", "ebanx", "fiserv", diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json index 733ba96237c4..2e4133c473e4 100644 --- a/api-reference/openapi_spec.json +++ b/api-reference/openapi_spec.json @@ -8651,6 +8651,7 @@ "cybersource", "datatrans", "deutschebank", + "digitalvirgo", "dlocal", "ebanx", "fiserv", @@ -10829,6 +10830,24 @@ "enum": [ "browser_ip" ] + }, + { + "type": "string", + "enum": [ + "user_msisdn" + ] + }, + { + "type": "string", + "enum": [ + "user_client_identifier" + ] + }, + { + "type": "string", + "enum": [ + "order_details_product_name" + ] } ], "description": "Possible field type of required fields in payment_method_data" @@ -13661,6 +13680,71 @@ "MobilePayRedirection": { "type": "object" }, + "MobilePaymentConsent": { + "type": "string", + "enum": [ + "consent_required", + "consent_not_required", + "consent_optional" + ] + }, + "MobilePaymentData": { + "oneOf": [ + { + "type": "object", + "required": [ + "direct_carrier_billing" + ], + "properties": { + "direct_carrier_billing": { + "type": "object", + "required": [ + "msisdn" + ], + "properties": { + "msisdn": { + "type": "string", + "description": "The phone number of the user", + "example": "1234567890" + }, + "client_uid": { + "type": "string", + "description": "Unique user id", + "example": "02iacdYXGI9CnyJdoN8c7", + "nullable": true + } + } + } + } + } + ] + }, + "MobilePaymentNextStepData": { + "type": "object", + "required": [ + "consent_data_required" + ], + "properties": { + "consent_data_required": { + "$ref": "#/components/schemas/MobilePaymentConsent" + } + } + }, + "MobilePaymentResponse": { + "allOf": [ + { + "allOf": [ + { + "$ref": "#/components/schemas/MobilePaymentData" + } + ], + "nullable": true + }, + { + "type": "object" + } + ] + }, "MomoRedirection": { "type": "object" }, @@ -13961,6 +14045,25 @@ ] } } + }, + { + "type": "object", + "description": "Contains consent to collect otp for mobile payment", + "required": [ + "consent_data_required", + "type" + ], + "properties": { + "consent_data_required": { + "$ref": "#/components/schemas/MobilePaymentConsent" + }, + "type": { + "type": "string", + "enum": [ + "collect_otp" + ] + } + } } ], "discriminator": { @@ -13975,7 +14078,8 @@ "invoke_sdk_client", "trigger_api", "display_bank_transfer_information", - "display_wait_screen" + "display_wait_screen", + "collect_otp" ] }, "NoThirdPartySdkSessionResponse": { @@ -14970,7 +15074,8 @@ "one_click", "link_wallet", "invoke_payment_app", - "display_wait_screen" + "display_wait_screen", + "collect_otp" ] }, "PaymentLinkConfig": { @@ -15262,7 +15367,8 @@ "upi", "voucher", "gift_card", - "open_banking" + "open_banking", + "mobile_payment" ] }, "PaymentMethodCollectLinkRequest": { @@ -15669,6 +15775,18 @@ "$ref": "#/components/schemas/OpenBankingData" } } + }, + { + "type": "object", + "title": "MobilePayment", + "required": [ + "mobile_payment" + ], + "properties": { + "mobile_payment": { + "$ref": "#/components/schemas/MobilePaymentData" + } + } } ] }, @@ -15875,6 +15993,17 @@ "$ref": "#/components/schemas/OpenBankingResponse" } } + }, + { + "type": "object", + "required": [ + "mobile_payment" + ], + "properties": { + "mobile_payment": { + "$ref": "#/components/schemas/MobilePaymentResponse" + } + } } ] }, @@ -16244,7 +16373,8 @@ "pay_easy", "local_bank_transfer", "mifinity", - "open_banking_pis" + "open_banking_pis", + "direct_carrier_billing" ] }, "PaymentMethodUpdate": { @@ -22485,6 +22615,7 @@ "cybersource", "datatrans", "deutschebank", + "digitalvirgo", "dlocal", "ebanx", "fiserv", diff --git a/crates/api_models/src/connector_enums.rs b/crates/api_models/src/connector_enums.rs index b705d88df595..77081f49957b 100644 --- a/crates/api_models/src/connector_enums.rs +++ b/crates/api_models/src/connector_enums.rs @@ -71,7 +71,7 @@ pub enum Connector { Cybersource, Datatrans, Deutschebank, - // Digitalvirgo, template code for future usage + Digitalvirgo, Dlocal, Ebanx, Fiserv, @@ -212,6 +212,7 @@ impl Connector { | Self::Coinbase | Self::Cryptopay | Self::Deutschebank + | Self::Digitalvirgo | Self::Dlocal | Self::Ebanx | Self::Fiserv diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs index e2b2b7fde46f..817b047f38c4 100644 --- a/crates/api_models/src/enums.rs +++ b/crates/api_models/src/enums.rs @@ -226,6 +226,9 @@ pub enum FieldType { UserIban, BrowserLanguage, BrowserIp, + UserMsisdn, + UserClientIdentifier, + OrderDetailsProductName, } impl FieldType { @@ -316,6 +319,9 @@ impl PartialEq for FieldType { (Self::UserCpf, Self::UserCpf) => true, (Self::UserCnpj, Self::UserCnpj) => true, (Self::LanguagePreference { .. }, Self::LanguagePreference { .. }) => true, + (Self::UserMsisdn, Self::UserMsisdn) => true, + (Self::UserClientIdentifier, Self::UserClientIdentifier) => true, + (Self::OrderDetailsProductName, Self::OrderDetailsProductName) => true, _unused => false, } } diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs index 567d601c45c1..29c1b81df2fb 100644 --- a/crates/api_models/src/payments.rs +++ b/crates/api_models/src/payments.rs @@ -1990,6 +1990,7 @@ mod payment_method_data_serde { | PaymentMethodData::BankRedirect(_) | PaymentMethodData::BankTransfer(_) | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::CardToken(_) | PaymentMethodData::Crypto(_) | PaymentMethodData::GiftCard(_) @@ -2061,6 +2062,8 @@ pub enum PaymentMethodData { CardToken(CardToken), #[schema(title = "OpenBanking")] OpenBanking(OpenBankingData), + #[schema(title = "MobilePayment")] + MobilePayment(MobilePaymentData), } pub trait GetAddressFromPaymentMethodData { @@ -2085,7 +2088,8 @@ impl GetAddressFromPaymentMethodData for PaymentMethodData { | Self::GiftCard(_) | Self::CardToken(_) | Self::OpenBanking(_) - | Self::MandatePayment => None, + | Self::MandatePayment + | Self::MobilePayment(_) => None, } } } @@ -2123,6 +2127,7 @@ impl PaymentMethodData { Self::Voucher(_) => Some(api_enums::PaymentMethod::Voucher), Self::GiftCard(_) => Some(api_enums::PaymentMethod::GiftCard), Self::OpenBanking(_) => Some(api_enums::PaymentMethod::OpenBanking), + Self::MobilePayment(_) => Some(api_enums::PaymentMethod::MobilePayment), Self::CardToken(_) | Self::MandatePayment => None, } } @@ -2143,6 +2148,14 @@ impl GetPaymentMethodType for CardRedirectData { } } +impl GetPaymentMethodType for MobilePaymentData { + fn get_payment_method_type(&self) -> api_enums::PaymentMethodType { + match self { + Self::DirectCarrierBilling { .. } => api_enums::PaymentMethodType::DirectCarrierBilling, + } + } +} + impl GetPaymentMethodType for WalletData { fn get_payment_method_type(&self) -> api_enums::PaymentMethodType { match self { @@ -2432,6 +2445,10 @@ pub enum AdditionalPaymentData { #[serde(flatten)] details: Option, }, + MobilePayment { + #[serde(flatten)] + details: Option, + }, } #[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)] @@ -3232,6 +3249,20 @@ pub enum OpenBankingData { #[serde(rename = "open_banking_pis")] OpenBankingPIS {}, } + +#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)] +#[serde(rename_all = "snake_case")] +pub enum MobilePaymentData { + DirectCarrierBilling { + /// The phone number of the user + #[schema(value_type = String, example = "1234567890")] + msisdn: String, + /// Unique user id + #[schema(value_type = Option, example = "02iacdYXGI9CnyJdoN8c7")] + client_uid: Option, + }, +} + #[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)] #[serde(rename_all = "snake_case")] pub struct GooglePayWalletData { @@ -3502,6 +3533,7 @@ where | PaymentMethodDataResponse::GiftCard(_) | PaymentMethodDataResponse::PayLater(_) | PaymentMethodDataResponse::RealTimePayment(_) + | PaymentMethodDataResponse::MobilePayment(_) | PaymentMethodDataResponse::Upi(_) | PaymentMethodDataResponse::Wallet(_) | PaymentMethodDataResponse::BankTransfer(_) @@ -3538,6 +3570,7 @@ pub enum PaymentMethodDataResponse { CardRedirect(Box), CardToken(Box), OpenBanking(Box), + MobilePayment(Box), } #[derive(Eq, PartialEq, Clone, Debug, serde::Serialize, serde::Deserialize, ToSchema)] @@ -3597,6 +3630,12 @@ pub struct OpenBankingResponse { details: Option, } +#[derive(Eq, PartialEq, Clone, Debug, serde::Serialize, serde::Deserialize, ToSchema)] +pub struct MobilePaymentResponse { + #[serde(flatten)] + details: Option, +} + #[derive(Eq, PartialEq, Clone, Debug, serde::Serialize, serde::Deserialize, ToSchema)] pub struct RealTimePaymentDataResponse { #[serde(flatten)] @@ -3874,6 +3913,7 @@ pub enum NextActionType { TriggerApi, DisplayBankTransferInformation, DisplayWaitScreen, + CollectOtp, } #[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, ToSchema)] @@ -3930,6 +3970,10 @@ pub enum NextActionData { InvokeSdkClient { next_action_data: SdkNextActionData, }, + /// Contains consent to collect otp for mobile payment + CollectOtp { + consent_data_required: MobilePaymentConsent, + }, } #[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, ToSchema)] @@ -4025,6 +4069,20 @@ pub struct VoucherNextStepData { pub instructions_url: Option, } +#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)] +pub struct MobilePaymentNextStepData { + /// is consent details required to be shown by sdk + pub consent_data_required: MobilePaymentConsent, +} + +#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)] +#[serde(rename_all = "snake_case")] +pub enum MobilePaymentConsent { + ConsentRequired, + ConsentNotRequired, + ConsentOptional, +} + #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] pub struct QrCodeNextStepsInstruction { pub image_data_url: Url, @@ -5134,6 +5192,9 @@ impl From for PaymentMethodDataResponse { AdditionalPaymentData::OpenBanking { details } => { Self::OpenBanking(Box::new(OpenBankingResponse { details })) } + AdditionalPaymentData::MobilePayment { details } => { + Self::MobilePayment(Box::new(MobilePaymentResponse { details })) + } } } } diff --git a/crates/common_enums/src/connector_enums.rs b/crates/common_enums/src/connector_enums.rs index fe4b2c522904..9beaed759600 100644 --- a/crates/common_enums/src/connector_enums.rs +++ b/crates/common_enums/src/connector_enums.rs @@ -68,7 +68,7 @@ pub enum RoutableConnectors { Cybersource, Datatrans, Deutschebank, - // Digitalvirgo, template code for future usage + Digitalvirgo, Dlocal, Ebanx, Fiserv, diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs index 6ddc47e499f0..23dbab778256 100644 --- a/crates/common_enums/src/enums.rs +++ b/crates/common_enums/src/enums.rs @@ -1469,6 +1469,8 @@ pub enum PaymentExperience { InvokePaymentApp, /// Contains the data for displaying wait screen DisplayWaitScreen, + /// Represents that otp needs to be collect and contains if consent is required + CollectOtp, } #[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, strum::Display)] @@ -1597,6 +1599,7 @@ pub enum PaymentMethodType { Mifinity, #[serde(rename = "open_banking_pis")] OpenBankingPIS, + DirectCarrierBilling, } impl masking::SerializableSecret for PaymentMethodType {} @@ -1637,6 +1640,7 @@ pub enum PaymentMethod { Voucher, GiftCard, OpenBanking, + MobilePayment, } /// The type of the payment that differentiates between normal and various types of mandate payments. Use 'setup_mandate' in case of zero auth flow. diff --git a/crates/common_enums/src/transformers.rs b/crates/common_enums/src/transformers.rs index 77ff9e8e7142..f5f7ba3decd8 100644 --- a/crates/common_enums/src/transformers.rs +++ b/crates/common_enums/src/transformers.rs @@ -1887,6 +1887,7 @@ impl From for PaymentMethod { PaymentMethodType::Seicomart => Self::Voucher, PaymentMethodType::PayEasy => Self::Voucher, PaymentMethodType::OpenBankingPIS => Self::OpenBanking, + PaymentMethodType::DirectCarrierBilling => Self::MobilePayment, } } } diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs index 923edd386de7..3634fe730ca2 100644 --- a/crates/connector_configs/src/connector.rs +++ b/crates/connector_configs/src/connector.rs @@ -342,6 +342,7 @@ impl ConnectorConfig { Connector::Bambora => Ok(connector_data.bambora), Connector::Datatrans => Ok(connector_data.datatrans), Connector::Deutschebank => Ok(connector_data.deutschebank), + Connector::Digitalvirgo => Ok(connector_data.digitalvirgo), Connector::Dlocal => Ok(connector_data.dlocal), Connector::Ebanx => Ok(connector_data.ebanx_payout), Connector::Fiserv => Ok(connector_data.fiserv), diff --git a/crates/connector_configs/src/response_modifier.rs b/crates/connector_configs/src/response_modifier.rs index b6b2e8555e39..8a763b592186 100644 --- a/crates/connector_configs/src/response_modifier.rs +++ b/crates/connector_configs/src/response_modifier.rs @@ -20,6 +20,7 @@ impl ConnectorApiIntegrationPayload { let mut gift_card_details: Vec = Vec::new(); let mut card_redirect_details: Vec = Vec::new(); let mut open_banking_details: Vec = Vec::new(); + let mut mobile_payment_details: Vec = Vec::new(); if let Some(payment_methods_enabled) = response.payment_methods_enabled.clone() { for methods in payment_methods_enabled { @@ -221,6 +222,18 @@ impl ConnectorApiIntegrationPayload { } } } + api_models::enums::PaymentMethod::MobilePayment => { + if let Some(payment_method_types) = methods.payment_method_types { + for method_type in payment_method_types { + mobile_payment_details.push(Provider { + payment_method_type: method_type.payment_method_type, + accepted_currencies: method_type.accepted_currencies.clone(), + accepted_countries: method_type.accepted_countries.clone(), + payment_experience: method_type.payment_experience, + }) + } + } + } } } } diff --git a/crates/connector_configs/src/transformer.rs b/crates/connector_configs/src/transformer.rs index 88997691eb61..160e938ead3c 100644 --- a/crates/connector_configs/src/transformer.rs +++ b/crates/connector_configs/src/transformer.rs @@ -62,6 +62,9 @@ impl DashboardRequestPayload { | (_, PaymentMethodType::Paze) => { Some(api_models::enums::PaymentExperience::InvokeSdkClient) } + (_, PaymentMethodType::DirectCarrierBilling) => { + Some(api_models::enums::PaymentExperience::CollectOtp) + } _ => Some(api_models::enums::PaymentExperience::RedirectToUrl), }, } @@ -142,7 +145,8 @@ impl DashboardRequestPayload { | PaymentMethod::Voucher | PaymentMethod::GiftCard | PaymentMethod::OpenBanking - | PaymentMethod::CardRedirect => { + | PaymentMethod::CardRedirect + | PaymentMethod::MobilePayment => { if let Some(provider) = payload.provider { let val = Self::transform_payment_method( request.connector, diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml index 886b2dd7ee7c..5d41efc1a50f 100644 --- a/crates/connector_configs/toml/development.toml +++ b/crates/connector_configs/toml/development.toml @@ -1394,6 +1394,13 @@ api_key="Client ID" key1="Merchant ID" api_secret="Client Key" +[digitalvirgo] +[[digitalvirgo.mobile_payment]] + payment_method_type = "direct_carrier_billing" +[digitalvirgo.connector_auth.BodyKey] +api_key="Password" +key1="Username" + [dlocal] [[dlocal.credit]] payment_method_type = "Mastercard" diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml index d767417a043c..5462c121c371 100644 --- a/crates/connector_configs/toml/sandbox.toml +++ b/crates/connector_configs/toml/sandbox.toml @@ -1364,6 +1364,13 @@ api_key="Client ID" key1="Merchant ID" api_secret="Client Key" +[digitalvirgo] +[[digitalvirgo.mobile_payment]] + payment_method_type = "direct_carrier_billing" +[digitalvirgo.connector_auth.BodyKey] +api_key="Password" +key1="Username" + [dlocal] [[dlocal.credit]] payment_method_type = "Mastercard" diff --git a/crates/euclid/src/dssa/graph.rs b/crates/euclid/src/dssa/graph.rs index 13e115153829..30d71090f365 100644 --- a/crates/euclid/src/dssa/graph.rs +++ b/crates/euclid/src/dssa/graph.rs @@ -70,6 +70,7 @@ impl cgraph::NodeViz for dir::DirValue { Self::CardRedirectType(crt) => crt.to_string(), Self::RealTimePaymentType(rtpt) => rtpt.to_string(), Self::OpenBankingType(ob) => ob.to_string(), + Self::MobilePaymentType(mpt) => mpt.to_string(), } } } diff --git a/crates/euclid/src/frontend/ast/lowering.rs b/crates/euclid/src/frontend/ast/lowering.rs index 8a8ba695e9fa..24fc1e80428b 100644 --- a/crates/euclid/src/frontend/ast/lowering.rs +++ b/crates/euclid/src/frontend/ast/lowering.rs @@ -274,6 +274,8 @@ fn lower_comparison_inner( dir::DirKeyKind::CardRedirectType => lower_enum!(CardRedirectType, value), + dir::DirKeyKind::MobilePaymentType => lower_enum!(MobilePaymentType, value), + dir::DirKeyKind::RealTimePaymentType => lower_enum!(RealTimePaymentType, value), dir::DirKeyKind::CardBin => { diff --git a/crates/euclid/src/frontend/dir.rs b/crates/euclid/src/frontend/dir.rs index 9a7134e708a7..1bfe1fa16b7c 100644 --- a/crates/euclid/src/frontend/dir.rs +++ b/crates/euclid/src/frontend/dir.rs @@ -278,6 +278,13 @@ pub enum DirKeyKind { props(Category = "Payment Method Types") )] OpenBankingType, + #[serde(rename = "mobile_payment")] + #[strum( + serialize = "mobile_payment", + detailed_message = "Supported types of mobile payment method", + props(Category = "Payment Method Types") + )] + MobilePaymentType, } pub trait EuclidDirFilter: Sized @@ -327,6 +334,7 @@ impl DirKeyKind { Self::CardRedirectType => types::DataType::EnumVariant, Self::RealTimePaymentType => types::DataType::EnumVariant, Self::OpenBankingType => types::DataType::EnumVariant, + Self::MobilePaymentType => types::DataType::EnumVariant, } } pub fn get_value_set(&self) -> Option> { @@ -459,6 +467,11 @@ impl DirKeyKind { .map(DirValue::OpenBankingType) .collect(), ), + Self::MobilePaymentType => Some( + enums::MobilePaymentType::iter() + .map(DirValue::MobilePaymentType) + .collect(), + ), } } } @@ -528,6 +541,8 @@ pub enum DirValue { RealTimePaymentType(enums::RealTimePaymentType), #[serde(rename = "open_banking")] OpenBankingType(enums::OpenBankingType), + #[serde(rename = "mobile_payment")] + MobilePaymentType(enums::MobilePaymentType), } impl DirValue { @@ -563,6 +578,7 @@ impl DirValue { Self::GiftCardType(_) => (DirKeyKind::GiftCardType, None), Self::RealTimePaymentType(_) => (DirKeyKind::RealTimePaymentType, None), Self::OpenBankingType(_) => (DirKeyKind::OpenBankingType, None), + Self::MobilePaymentType(_) => (DirKeyKind::MobilePaymentType, None), }; DirKey::new(kind, data) @@ -599,6 +615,7 @@ impl DirValue { Self::CardRedirectType(_) => None, Self::RealTimePaymentType(_) => None, Self::OpenBankingType(_) => None, + Self::MobilePaymentType(_) => None, } } diff --git a/crates/euclid/src/frontend/dir/enums.rs b/crates/euclid/src/frontend/dir/enums.rs index 136cdf4d9817..6c96070159be 100644 --- a/crates/euclid/src/frontend/dir/enums.rs +++ b/crates/euclid/src/frontend/dir/enums.rs @@ -255,6 +255,25 @@ pub enum CardRedirectType { CardRedirect, } +#[derive( + Clone, + Debug, + Hash, + PartialEq, + Eq, + strum::Display, + strum::VariantNames, + strum::EnumIter, + strum::EnumString, + serde::Serialize, + serde::Deserialize, +)] +#[serde(rename_all = "snake_case")] +#[strum(serialize_all = "snake_case")] +pub enum MobilePaymentType { + DirectCarrierBilling, +} + #[derive( Clone, Debug, @@ -372,3 +391,4 @@ collect_variants!(GiftCardType); collect_variants!(BankTransferType); collect_variants!(CardRedirectType); collect_variants!(OpenBankingType); +collect_variants!(MobilePaymentType); diff --git a/crates/euclid/src/frontend/dir/lowering.rs b/crates/euclid/src/frontend/dir/lowering.rs index da589ec3748e..07ff2c4364ec 100644 --- a/crates/euclid/src/frontend/dir/lowering.rs +++ b/crates/euclid/src/frontend/dir/lowering.rs @@ -144,6 +144,14 @@ impl From for global_enums::PaymentMethodType { } } +impl From for global_enums::PaymentMethodType { + fn from(value: enums::MobilePaymentType) -> Self { + match value { + enums::MobilePaymentType::DirectCarrierBilling => Self::DirectCarrierBilling, + } + } +} + impl From for global_enums::PaymentMethodType { fn from(value: enums::BankRedirectType) -> Self { match value { @@ -248,6 +256,7 @@ fn lower_value(dir_value: dir::DirValue) -> Result EuclidValue::BusinessLabel(bl), dir::DirValue::SetupFutureUsage(sfu) => EuclidValue::SetupFutureUsage(sfu), dir::DirValue::OpenBankingType(ob) => EuclidValue::PaymentMethodType(ob.into()), + dir::DirValue::MobilePaymentType(mp) => EuclidValue::PaymentMethodType(mp.into()), }) } diff --git a/crates/euclid/src/frontend/dir/transformers.rs b/crates/euclid/src/frontend/dir/transformers.rs index de0b619b1203..914a94449183 100644 --- a/crates/euclid/src/frontend/dir/transformers.rs +++ b/crates/euclid/src/frontend/dir/transformers.rs @@ -39,6 +39,7 @@ impl IntoDirValue for (global_enums::PaymentMethodType, global_enums::PaymentMet | global_enums::PaymentMethod::Upi | global_enums::PaymentMethod::Voucher | global_enums::PaymentMethod::OpenBanking + | global_enums::PaymentMethod::MobilePayment | global_enums::PaymentMethod::GiftCard => Err(AnalysisErrorType::NotSupported), }, global_enums::PaymentMethodType::Bacs => match self.1 { @@ -55,6 +56,7 @@ impl IntoDirValue for (global_enums::PaymentMethodType, global_enums::PaymentMet | global_enums::PaymentMethod::Upi | global_enums::PaymentMethod::Voucher | global_enums::PaymentMethod::OpenBanking + | global_enums::PaymentMethod::MobilePayment | global_enums::PaymentMethod::GiftCard => Err(AnalysisErrorType::NotSupported), }, global_enums::PaymentMethodType::Becs => Ok(dirval!(BankDebitType = Becs)), @@ -72,6 +74,7 @@ impl IntoDirValue for (global_enums::PaymentMethodType, global_enums::PaymentMet | global_enums::PaymentMethod::Upi | global_enums::PaymentMethod::Voucher | global_enums::PaymentMethod::OpenBanking + | global_enums::PaymentMethod::MobilePayment | global_enums::PaymentMethod::GiftCard => Err(AnalysisErrorType::NotSupported), }, global_enums::PaymentMethodType::AliPay => Ok(dirval!(WalletType = AliPay)), @@ -189,6 +192,9 @@ impl IntoDirValue for (global_enums::PaymentMethodType, global_enums::PaymentMet Ok(dirval!(OpenBankingType = OpenBankingPIS)) } global_enums::PaymentMethodType::Paze => Ok(dirval!(WalletType = Paze)), + global_enums::PaymentMethodType::DirectCarrierBilling => { + Ok(dirval!(MobilePaymentType = DirectCarrierBilling)) + } } } } diff --git a/crates/euclid_wasm/src/lib.rs b/crates/euclid_wasm/src/lib.rs index 4f2e9aa3156a..9f610f9e6a33 100644 --- a/crates/euclid_wasm/src/lib.rs +++ b/crates/euclid_wasm/src/lib.rs @@ -262,6 +262,7 @@ pub fn get_variant_values(key: &str) -> Result { dir::DirKeyKind::BankDebitType => dir_enums::BankDebitType::VARIANTS, dir::DirKeyKind::RealTimePaymentType => dir_enums::RealTimePaymentType::VARIANTS, dir::DirKeyKind::OpenBankingType => dir_enums::OpenBankingType::VARIANTS, + dir::DirKeyKind::MobilePaymentType => dir_enums::MobilePaymentType::VARIANTS, dir::DirKeyKind::PaymentAmount | dir::DirKeyKind::Connector diff --git a/crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs b/crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs index 5345c550cd18..bb3bc3990772 100644 --- a/crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs @@ -212,6 +212,7 @@ impl TryFrom<&AirwallexRouterData<&types::PaymentsAuthorizeRouterData>> | PaymentMethodData::MandatePayment | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Upi(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) diff --git a/crates/hyperswitch_connectors/src/connectors/bambora/transformers.rs b/crates/hyperswitch_connectors/src/connectors/bambora/transformers.rs index 567f519d7944..f0ea149b0d6c 100644 --- a/crates/hyperswitch_connectors/src/connectors/bambora/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/bambora/transformers.rs @@ -221,6 +221,7 @@ impl TryFrom> for Bambora | PaymentMethodData::RealTimePayment(_) | PaymentMethodData::Upi(_) | PaymentMethodData::Voucher(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::GiftCard(_) | PaymentMethodData::OpenBanking(_) | PaymentMethodData::CardToken(_) diff --git a/crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs b/crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs index 798f28d1f0a4..05b9abae0515 100644 --- a/crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs @@ -113,6 +113,7 @@ impl TryFrom<&types::TokenizationRouterData> for BillwerkTokenRequest { | PaymentMethodData::MandatePayment | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Upi(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) diff --git a/crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs index 1228edcaaea9..cf65b9e5dfea 100644 --- a/crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs @@ -82,6 +82,7 @@ impl TryFrom<&CryptopayRouterData<&types::PaymentsAuthorizeRouterData>> | PaymentMethodData::Reward {} | PaymentMethodData::RealTimePayment(_) | PaymentMethodData::Upi(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) | PaymentMethodData::OpenBanking(_) diff --git a/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs b/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs index 5c59d73356f0..af6486f008e8 100644 --- a/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs +++ b/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs @@ -1,52 +1,62 @@ pub mod transformers; +use base64::Engine; +use common_enums::enums; use common_utils::{ + consts, errors::CustomResult, ext_traits::BytesExt, request::{Method, Request, RequestBuilder, RequestContent}, - types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector}, + types::{AmountConvertor, FloatMajorUnit, FloatMajorUnitForConnector}, }; use error_stack::{report, ResultExt}; use hyperswitch_domain_models::{ router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData}, router_flow_types::{ access_token_auth::AccessTokenAuth, - payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void}, + payments::{ + Authorize, Capture, CompleteAuthorize, PSync, PaymentMethodToken, Session, + SetupMandate, Void, + }, refunds::{Execute, RSync}, }, router_request_types::{ - AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData, - PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, - RefundsData, SetupMandateRequestData, + AccessTokenRequestData, CompleteAuthorizeData, PaymentMethodTokenizationData, + PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, + PaymentsSyncData, RefundsData, SetupMandateRequestData, }, router_response_types::{PaymentsResponseData, RefundsResponseData}, types::{ - PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData, - RefundSyncRouterData, RefundsRouterData, + PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, + PaymentsCompleteAuthorizeRouterData, PaymentsSyncRouterData, RefundSyncRouterData, + RefundsRouterData, }, }; use hyperswitch_interfaces::{ - api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation}, + api::{ + self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorRedirectResponse, + ConnectorValidation, + }, configs::Connectors, errors, events::connector_api_logs::ConnectorEvent, types::{self, Response}, webhooks, }; -use masking::{ExposeInterface, Mask}; +use masking::{Mask, PeekInterface}; use transformers as digitalvirgo; use crate::{constants::headers, types::ResponseRouterData, utils}; #[derive(Clone)] pub struct Digitalvirgo { - amount_converter: &'static (dyn AmountConvertor + Sync), + amount_converter: &'static (dyn AmountConvertor + Sync), } impl Digitalvirgo { pub fn new() -> &'static Self { &Self { - amount_converter: &StringMinorUnitForConnector, + amount_converter: &FloatMajorUnitForConnector, } } } @@ -63,6 +73,7 @@ impl api::Refund for Digitalvirgo {} impl api::RefundExecute for Digitalvirgo {} impl api::RefundSync for Digitalvirgo {} impl api::PaymentToken for Digitalvirgo {} +impl api::PaymentsCompleteAuthorize for Digitalvirgo {} impl ConnectorIntegration for Digitalvirgo @@ -111,9 +122,14 @@ impl ConnectorCommon for Digitalvirgo { ) -> CustomResult)>, errors::ConnectorError> { let auth = digitalvirgo::DigitalvirgoAuthType::try_from(auth_type) .change_context(errors::ConnectorError::FailedToObtainAuthType)?; + let encoded_api_key = consts::BASE64_ENGINE.encode(format!( + "{}:{}", + auth.username.peek(), + auth.password.peek() + )); Ok(vec![( headers::AUTHORIZATION.to_string(), - auth.api_key.expose().into_masked(), + format!("Basic {encoded_api_key}").into_masked(), )]) } @@ -130,18 +146,68 @@ impl ConnectorCommon for Digitalvirgo { event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); + let error_code = response.cause.or(response.operation_error); + Ok(ErrorResponse { status_code: res.status_code, - code: response.code, - message: response.message, - reason: response.reason, + code: error_code + .clone() + .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()), + message: error_code + .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()), + reason: response.description, attempt_status: None, connector_transaction_id: None, }) } } -impl ConnectorValidation for Digitalvirgo {} +impl ConnectorValidation for Digitalvirgo { + fn validate_capture_method( + &self, + capture_method: Option, + _pmt: Option, + ) -> CustomResult<(), errors::ConnectorError> { + let capture_method = capture_method.unwrap_or_default(); + match capture_method { + enums::CaptureMethod::Automatic => Ok(()), + enums::CaptureMethod::Manual + | enums::CaptureMethod::ManualMultiple + | enums::CaptureMethod::Scheduled => Err(utils::construct_not_supported_error_report( + capture_method, + self.id(), + )), + } + } + + fn validate_psync_reference_id( + &self, + _data: &PaymentsSyncData, + _is_three_ds: bool, + _status: enums::AttemptStatus, + _connector_meta_data: Option, + ) -> CustomResult<(), errors::ConnectorError> { + // in case we dont have transaction id, we can make psync using attempt id + Ok(()) + } +} + +impl ConnectorRedirectResponse for Digitalvirgo { + fn get_flow_type( + &self, + _query_params: &str, + _json_payload: Option, + action: enums::PaymentAction, + ) -> CustomResult { + match action { + enums::PaymentAction::PSync + | enums::PaymentAction::CompleteAuthorize + | enums::PaymentAction::PaymentAuthenticateCompleteAuthorize => { + Ok(enums::CallConnectorAction::Trigger) + } + } + } +} impl ConnectorIntegration for Digitalvirgo {} @@ -168,9 +234,9 @@ impl ConnectorIntegration CustomResult { - Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) + Ok(format!("{}/payment", self.base_url(connectors))) } fn get_request_body( @@ -184,7 +250,17 @@ impl ConnectorIntegration for Dig fn get_url( &self, - _req: &PaymentsSyncRouterData, - _connectors: &Connectors, + req: &PaymentsSyncRouterData, + connectors: &Connectors, ) -> CustomResult { - Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) + Ok(format!( + "{}{}{}", + self.base_url(connectors), + "/payment/state?partnerTransactionId=", + req.connector_request_reference_id + )) } fn build_request( @@ -282,10 +363,14 @@ impl ConnectorIntegration for Dig event_builder: Option<&mut ConnectorEvent>, res: Response, ) -> CustomResult { - let response: digitalvirgo::DigitalvirgoPaymentsResponse = res + let response_details: Vec = res .response .parse_struct("digitalvirgo PaymentsSyncResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; + let response = response_details + .first() + .cloned() + .ok_or(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); RouterData::try_from(ResponseRouterData { @@ -304,49 +389,54 @@ impl ConnectorIntegration for Dig } } -impl ConnectorIntegration for Digitalvirgo { +impl ConnectorIntegration + for Digitalvirgo +{ fn get_headers( &self, - req: &PaymentsCaptureRouterData, + req: &PaymentsCompleteAuthorizeRouterData, connectors: &Connectors, ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } - fn get_content_type(&self) -> &'static str { self.common_get_content_type() } - fn get_url( &self, - _req: &PaymentsCaptureRouterData, - _connectors: &Connectors, + _req: &PaymentsCompleteAuthorizeRouterData, + connectors: &Connectors, ) -> CustomResult { - Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) + Ok(format!( + "{}{}", + self.base_url(connectors), + "/payment/confirmation" + )) } - fn get_request_body( &self, - _req: &PaymentsCaptureRouterData, + req: &PaymentsCompleteAuthorizeRouterData, _connectors: &Connectors, ) -> CustomResult { - Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into()) + let connector_req = digitalvirgo::DigitalvirgoConfirmRequest::try_from(req)?; + Ok(RequestContent::Json(Box::new(connector_req))) } - fn build_request( &self, - req: &PaymentsCaptureRouterData, + req: &PaymentsCompleteAuthorizeRouterData, connectors: &Connectors, ) -> CustomResult, errors::ConnectorError> { Ok(Some( RequestBuilder::new() .method(Method::Post) - .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?) + .url(&types::PaymentsCompleteAuthorizeType::get_url( + self, req, connectors, + )?) .attach_default_headers() - .headers(types::PaymentsCaptureType::get_headers( + .headers(types::PaymentsCompleteAuthorizeType::get_headers( self, req, connectors, )?) - .set_body(types::PaymentsCaptureType::get_request_body( + .set_body(types::PaymentsCompleteAuthorizeType::get_request_body( self, req, connectors, )?) .build(), @@ -355,13 +445,13 @@ impl ConnectorIntegration fo fn handle_response( &self, - data: &PaymentsCaptureRouterData, + data: &PaymentsCompleteAuthorizeRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response: digitalvirgo::DigitalvirgoPaymentsResponse = res .response - .parse_struct("Digitalvirgo PaymentsCaptureResponse") + .parse_struct("DigitalvirgoPaymentsResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); @@ -381,158 +471,47 @@ impl ConnectorIntegration fo } } -impl ConnectorIntegration for Digitalvirgo {} - -impl ConnectorIntegration for Digitalvirgo { - fn get_headers( - &self, - req: &RefundsRouterData, - connectors: &Connectors, - ) -> CustomResult)>, errors::ConnectorError> { - self.build_headers(req, connectors) - } - - fn get_content_type(&self) -> &'static str { - self.common_get_content_type() - } - - fn get_url( +impl ConnectorIntegration for Digitalvirgo { + fn build_request( &self, - _req: &RefundsRouterData, + _req: &PaymentsCaptureRouterData, _connectors: &Connectors, - ) -> CustomResult { - Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) + ) -> CustomResult, errors::ConnectorError> { + Err(errors::ConnectorError::FlowNotSupported { + flow: "capture".to_string(), + connector: "digitalvirgo".to_string(), + } + .into()) } +} - fn get_request_body( - &self, - req: &RefundsRouterData, - _connectors: &Connectors, - ) -> CustomResult { - let refund_amount = utils::convert_amount( - self.amount_converter, - req.request.minor_refund_amount, - req.request.currency, - )?; - - let connector_router_data = - digitalvirgo::DigitalvirgoRouterData::from((refund_amount, req)); - let connector_req = - digitalvirgo::DigitalvirgoRefundRequest::try_from(&connector_router_data)?; - Ok(RequestContent::Json(Box::new(connector_req))) - } +impl ConnectorIntegration for Digitalvirgo {} +impl ConnectorIntegration for Digitalvirgo { fn build_request( &self, - req: &RefundsRouterData, - connectors: &Connectors, + _req: &RefundsRouterData, + _connectors: &Connectors, ) -> CustomResult, errors::ConnectorError> { - let request = RequestBuilder::new() - .method(Method::Post) - .url(&types::RefundExecuteType::get_url(self, req, connectors)?) - .attach_default_headers() - .headers(types::RefundExecuteType::get_headers( - self, req, connectors, - )?) - .set_body(types::RefundExecuteType::get_request_body( - self, req, connectors, - )?) - .build(); - Ok(Some(request)) - } - - fn handle_response( - &self, - data: &RefundsRouterData, - event_builder: Option<&mut ConnectorEvent>, - res: Response, - ) -> CustomResult, errors::ConnectorError> { - let response: digitalvirgo::RefundResponse = res - .response - .parse_struct("digitalvirgo RefundResponse") - .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; - event_builder.map(|i| i.set_response_body(&response)); - router_env::logger::info!(connector_response=?response); - RouterData::try_from(ResponseRouterData { - response, - data: data.clone(), - http_code: res.status_code, - }) - } - - fn get_error_response( - &self, - res: Response, - event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { - self.build_error_response(res, event_builder) + Err(errors::ConnectorError::FlowNotSupported { + flow: "refund".to_string(), + connector: "digitalvirgo".to_string(), + } + .into()) } } impl ConnectorIntegration for Digitalvirgo { - fn get_headers( - &self, - req: &RefundSyncRouterData, - connectors: &Connectors, - ) -> CustomResult)>, errors::ConnectorError> { - self.build_headers(req, connectors) - } - - fn get_content_type(&self) -> &'static str { - self.common_get_content_type() - } - - fn get_url( + fn build_request( &self, _req: &RefundSyncRouterData, _connectors: &Connectors, - ) -> CustomResult { - Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) - } - - fn build_request( - &self, - req: &RefundSyncRouterData, - connectors: &Connectors, ) -> CustomResult, errors::ConnectorError> { - Ok(Some( - RequestBuilder::new() - .method(Method::Get) - .url(&types::RefundSyncType::get_url(self, req, connectors)?) - .attach_default_headers() - .headers(types::RefundSyncType::get_headers(self, req, connectors)?) - .set_body(types::RefundSyncType::get_request_body( - self, req, connectors, - )?) - .build(), - )) - } - - fn handle_response( - &self, - data: &RefundSyncRouterData, - event_builder: Option<&mut ConnectorEvent>, - res: Response, - ) -> CustomResult { - let response: digitalvirgo::RefundResponse = res - .response - .parse_struct("digitalvirgo RefundSyncResponse") - .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; - event_builder.map(|i| i.set_response_body(&response)); - router_env::logger::info!(connector_response=?response); - RouterData::try_from(ResponseRouterData { - response, - data: data.clone(), - http_code: res.status_code, - }) - } - - fn get_error_response( - &self, - res: Response, - event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { - self.build_error_response(res, event_builder) + Err(errors::ConnectorError::FlowNotSupported { + flow: "refund_sync".to_string(), + connector: "digitalvirgo".to_string(), + } + .into()) } } diff --git a/crates/hyperswitch_connectors/src/connectors/digitalvirgo/transformers.rs b/crates/hyperswitch_connectors/src/connectors/digitalvirgo/transformers.rs index 856736842f90..a9408e4e1c52 100644 --- a/crates/hyperswitch_connectors/src/connectors/digitalvirgo/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/digitalvirgo/transformers.rs @@ -1,49 +1,49 @@ use common_enums::enums; -use common_utils::types::StringMinorUnit; +use common_utils::types::FloatMajorUnit; +use error_stack::ResultExt; use hyperswitch_domain_models::{ - payment_method_data::PaymentMethodData, + payment_method_data::{MobilePaymentData, PaymentMethodData}, router_data::{ConnectorAuthType, RouterData}, router_flow_types::refunds::{Execute, RSync}, router_request_types::ResponseId, router_response_types::{PaymentsResponseData, RefundsResponseData}, - types::{PaymentsAuthorizeRouterData, RefundsRouterData}, + types::{PaymentsAuthorizeRouterData, PaymentsCompleteAuthorizeRouterData, RefundsRouterData}, }; use hyperswitch_interfaces::errors; -use masking::Secret; +use masking::{ExposeInterface, Secret}; use serde::{Deserialize, Serialize}; use crate::{ types::{RefundsResponseRouterData, ResponseRouterData}, - utils::PaymentsAuthorizeRequestData, + utils::{PaymentsAuthorizeRequestData, PaymentsCompleteAuthorizeRequestData}, }; pub struct DigitalvirgoRouterData { - pub amount: StringMinorUnit, + pub amount: FloatMajorUnit, + pub surcharge_amount: Option, pub router_data: T, } -impl From<(StringMinorUnit, T)> for DigitalvirgoRouterData { - fn from((amount, item): (StringMinorUnit, T)) -> Self { +impl From<(FloatMajorUnit, Option, T)> for DigitalvirgoRouterData { + fn from((amount, surcharge_amount, item): (FloatMajorUnit, Option, T)) -> Self { Self { amount, + surcharge_amount, router_data: item, } } } #[derive(Default, Debug, Serialize, PartialEq)] +#[serde(rename_all = "camelCase")] pub struct DigitalvirgoPaymentsRequest { - amount: StringMinorUnit, - card: DigitalvirgoCard, -} - -#[derive(Default, Debug, Serialize, Eq, PartialEq)] -pub struct DigitalvirgoCard { - number: cards::CardNumber, - expiry_month: Secret, - expiry_year: Secret, - cvc: Secret, - complete: bool, + amount: FloatMajorUnit, + amount_surcharge: Option, + client_uid: Option, + msisdn: String, + product_name: String, + description: Option, + partner_transaction_id: String, } impl TryFrom<&DigitalvirgoRouterData<&PaymentsAuthorizeRouterData>> @@ -54,63 +54,80 @@ impl TryFrom<&DigitalvirgoRouterData<&PaymentsAuthorizeRouterData>> item: &DigitalvirgoRouterData<&PaymentsAuthorizeRouterData>, ) -> Result { match item.router_data.request.payment_method_data.clone() { - PaymentMethodData::Card(req_card) => { - let card = DigitalvirgoCard { - number: req_card.card_number, - expiry_month: req_card.card_exp_month, - expiry_year: req_card.card_exp_year, - cvc: req_card.card_cvc, - complete: item.router_data.request.is_auto_capture()?, - }; - Ok(Self { - amount: item.amount.clone(), - card, - }) - } + PaymentMethodData::MobilePayment(mobile_payment_data) => match mobile_payment_data { + MobilePaymentData::DirectCarrierBilling { msisdn, client_uid } => { + let order_details = item.router_data.request.get_order_details()?; + let product_name = order_details + .first() + .map(|order| order.product_name.to_owned()) + .ok_or(errors::ConnectorError::MissingRequiredField { + field_name: "product_name", + })?; + + Ok(Self { + amount: item.amount.to_owned(), + amount_surcharge: item.surcharge_amount.to_owned(), + client_uid, + msisdn, + product_name, + description: item.router_data.description.to_owned(), + partner_transaction_id: item + .router_data + .connector_request_reference_id + .to_owned(), + }) + } + }, _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()), } } } pub struct DigitalvirgoAuthType { - pub(super) api_key: Secret, + pub(super) username: Secret, + pub(super) password: Secret, } impl TryFrom<&ConnectorAuthType> for DigitalvirgoAuthType { type Error = error_stack::Report; fn try_from(auth_type: &ConnectorAuthType) -> Result { match auth_type { - ConnectorAuthType::HeaderKey { api_key } => Ok(Self { - api_key: api_key.to_owned(), + ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self { + username: key1.to_owned(), + password: api_key.to_owned(), }), _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()), } } } -#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)] -#[serde(rename_all = "lowercase")] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "SCREAMING_SNAKE_CASE")] pub enum DigitalvirgoPaymentStatus { - Succeeded, - Failed, - #[default] - Processing, + Ok, + ConfirmPayment, } impl From for common_enums::AttemptStatus { fn from(item: DigitalvirgoPaymentStatus) -> Self { match item { - DigitalvirgoPaymentStatus::Succeeded => Self::Charged, - DigitalvirgoPaymentStatus::Failed => Self::Failure, - DigitalvirgoPaymentStatus::Processing => Self::Authorizing, + DigitalvirgoPaymentStatus::Ok => Self::Charged, + DigitalvirgoPaymentStatus::ConfirmPayment => Self::AuthenticationPending, } } } -#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DigitalvirgoPaymentsResponse { - status: DigitalvirgoPaymentStatus, - id: String, + state: DigitalvirgoPaymentStatus, + transaction_id: String, + consent: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct DigitalvirgoConsentStatus { + required: Option, } impl TryFrom> @@ -120,10 +137,86 @@ impl TryFrom, ) -> Result { + // show if consent is required in next action + let connector_metadata = item + .response + .consent + .and_then(|consent_status| { + consent_status.required.map(|consent_required| { + if consent_required { + serde_json::json!({ + "consent_data_required": "consent_required", + }) + } else { + serde_json::json!({ + "consent_data_required": "consent_not_required", + }) + } + }) + }) + .or(Some(serde_json::json!({ + "consent_data_required": "consent_not_required", + }))); Ok(Self { - status: common_enums::AttemptStatus::from(item.response.status), + status: common_enums::AttemptStatus::from(item.response.state), response: Ok(PaymentsResponseData::TransactionResponse { - resource_id: ResponseId::ConnectorTransactionId(item.response.id), + resource_id: ResponseId::ConnectorTransactionId(item.response.transaction_id), + redirection_data: Box::new(None), + mandate_reference: Box::new(None), + connector_metadata, + network_txn_id: None, + connector_response_reference_id: None, + incremental_authorization_allowed: None, + charge_id: None, + }), + ..item.data + }) + } +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "SCREAMING_SNAKE_CASE")] +pub enum DigitalvirgoPaymentSyncStatus { + Accepted, + Payed, + Pending, + Cancelled, + Rejected, + Locked, +} + +impl From for common_enums::AttemptStatus { + fn from(item: DigitalvirgoPaymentSyncStatus) -> Self { + match item { + DigitalvirgoPaymentSyncStatus::Accepted => Self::AuthenticationPending, + DigitalvirgoPaymentSyncStatus::Payed => Self::Charged, + DigitalvirgoPaymentSyncStatus::Pending | DigitalvirgoPaymentSyncStatus::Locked => { + Self::Pending + } + DigitalvirgoPaymentSyncStatus::Cancelled => Self::Voided, + DigitalvirgoPaymentSyncStatus::Rejected => Self::Failure, + } + } +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct DigitalvirgoPaymentSyncResponse { + payment_status: DigitalvirgoPaymentSyncStatus, + transaction_id: String, +} + +impl TryFrom> + for RouterData +{ + type Error = error_stack::Report; + fn try_from( + item: ResponseRouterData, + ) -> Result { + Ok(Self { + status: common_enums::AttemptStatus::from(item.response.payment_status), + response: Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId(item.response.transaction_id), redirection_data: Box::new(None), mandate_reference: Box::new(None), connector_metadata: None, @@ -137,9 +230,43 @@ impl TryFrom, +} + +#[derive(Default, Debug, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct DigitalvirgoRedirectResponseData { + otp: Secret, +} + +impl TryFrom<&PaymentsCompleteAuthorizeRouterData> for DigitalvirgoConfirmRequest { + type Error = error_stack::Report; + fn try_from(item: &PaymentsCompleteAuthorizeRouterData) -> Result { + let payload_data = item.request.get_redirect_response_payload()?.expose(); + + let otp_data: DigitalvirgoRedirectResponseData = serde_json::from_value(payload_data) + .change_context(errors::ConnectorError::MissingConnectorRedirectionPayload { + field_name: "otp for transaction", + })?; + + Ok(Self { + transaction_id: item + .request + .connector_transaction_id + .clone() + .ok_or(errors::ConnectorError::MissingConnectorTransactionID)?, + token: otp_data.otp, + }) + } +} + #[derive(Default, Debug, Serialize)] pub struct DigitalvirgoRefundRequest { - pub amount: StringMinorUnit, + pub amount: FloatMajorUnit, } impl TryFrom<&DigitalvirgoRouterData<&RefundsRouterData>> for DigitalvirgoRefundRequest { @@ -166,7 +293,6 @@ impl From for enums::RefundStatus { RefundStatus::Succeeded => Self::Success, RefundStatus::Failed => Self::Failure, RefundStatus::Processing => Self::Pending, - //TODO: Review mapping } } } @@ -209,8 +335,7 @@ impl TryFrom> for RefundsRouter #[derive(Default, Debug, Serialize, Deserialize, PartialEq)] pub struct DigitalvirgoErrorResponse { - pub status_code: u16, - pub code: String, - pub message: String, - pub reason: Option, + pub cause: Option, + pub operation_error: Option, + pub description: Option, } diff --git a/crates/hyperswitch_connectors/src/connectors/dlocal/transformers.rs b/crates/hyperswitch_connectors/src/connectors/dlocal/transformers.rs index f2a6e1b6a6f8..d5a7f981a1b1 100644 --- a/crates/hyperswitch_connectors/src/connectors/dlocal/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/dlocal/transformers.rs @@ -166,6 +166,7 @@ impl TryFrom<&DlocalRouterData<&types::PaymentsAuthorizeRouterData>> for DlocalP | PaymentMethodData::MandatePayment | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Upi(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) diff --git a/crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs b/crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs index 6f4f303ae8ec..07562c3efbf9 100644 --- a/crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs @@ -195,6 +195,7 @@ impl TryFrom<&FiservRouterData<&types::PaymentsAuthorizeRouterData>> for FiservP | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) | PaymentMethodData::Upi(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) | PaymentMethodData::OpenBanking(_) diff --git a/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs b/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs index 813ab8beccd3..f3c3685b5c19 100644 --- a/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs @@ -515,6 +515,7 @@ impl TryFrom<&FiuuRouterData<&PaymentsAuthorizeRouterData>> for FiuuPaymentReque | PaymentMethodData::BankTransfer(_) | PaymentMethodData::Crypto(_) | PaymentMethodData::MandatePayment + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Reward | PaymentMethodData::Upi(_) | PaymentMethodData::Voucher(_) diff --git a/crates/hyperswitch_connectors/src/connectors/forte/transformers.rs b/crates/hyperswitch_connectors/src/connectors/forte/transformers.rs index 6e67409238d8..2583f47058bf 100644 --- a/crates/hyperswitch_connectors/src/connectors/forte/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/forte/transformers.rs @@ -140,6 +140,7 @@ impl TryFrom<&ForteRouterData<&types::PaymentsAuthorizeRouterData>> for FortePay | PaymentMethodData::MandatePayment {} | PaymentMethodData::Reward {} | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Upi(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) diff --git a/crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs index 66525d49c633..5d30146293cb 100644 --- a/crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs @@ -96,6 +96,7 @@ impl TryFrom<&GlobepayRouterData<&types::PaymentsAuthorizeRouterData>> for Globe | PaymentMethodData::MandatePayment | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Upi(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) diff --git a/crates/hyperswitch_connectors/src/connectors/helcim/transformers.rs b/crates/hyperswitch_connectors/src/connectors/helcim/transformers.rs index 427fef3836ce..4a8ddf68df9a 100644 --- a/crates/hyperswitch_connectors/src/connectors/helcim/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/helcim/transformers.rs @@ -178,6 +178,7 @@ impl TryFrom<&SetupMandateRouterData> for HelcimVerifyRequest { | PaymentMethodData::RealTimePayment(_) | PaymentMethodData::Upi(_) | PaymentMethodData::Voucher(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::GiftCard(_) | PaymentMethodData::OpenBanking(_) | PaymentMethodData::CardToken(_) @@ -274,6 +275,7 @@ impl TryFrom<&HelcimRouterData<&PaymentsAuthorizeRouterData>> for HelcimPayments | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) | PaymentMethodData::Upi(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) | PaymentMethodData::OpenBanking(_) diff --git a/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs index 3048a203d1b1..180db6268646 100644 --- a/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs @@ -615,6 +615,7 @@ impl TryFrom<&MultisafepayRouterData<&types::PaymentsAuthorizeRouterData>> | PaymentMethodData::Crypto(_) | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Upi(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) @@ -795,6 +796,7 @@ impl TryFrom<&MultisafepayRouterData<&types::PaymentsAuthorizeRouterData>> | PaymentMethodData::Crypto(_) | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Upi(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) diff --git a/crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs index 4149f740e76d..6297b97ee98a 100644 --- a/crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs @@ -618,6 +618,7 @@ fn get_payment_details_and_product( | PaymentMethodData::MandatePayment | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Upi(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) diff --git a/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs index d593864dbfce..b1e9c3015e8b 100644 --- a/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs @@ -408,6 +408,7 @@ impl TryFrom<&NexixpayRouterData<&PaymentsAuthorizeRouterData>> for NexixpayPaym | PaymentMethodData::MandatePayment | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Upi(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) @@ -826,6 +827,7 @@ impl TryFrom<&NexixpayRouterData<&PaymentsCompleteAuthorizeRouterData>> | PaymentMethodData::MandatePayment | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Upi(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) diff --git a/crates/hyperswitch_connectors/src/connectors/payeezy/transformers.rs b/crates/hyperswitch_connectors/src/connectors/payeezy/transformers.rs index 707e34a158c5..cda9c6b19526 100644 --- a/crates/hyperswitch_connectors/src/connectors/payeezy/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/payeezy/transformers.rs @@ -146,6 +146,7 @@ impl TryFrom<&PayeezyRouterData<&PaymentsAuthorizeRouterData>> for PayeezyPaymen | PaymentMethod::BankDebit | PaymentMethod::Reward | PaymentMethod::RealTimePayment + | PaymentMethod::MobilePayment | PaymentMethod::Upi | PaymentMethod::Voucher | PaymentMethod::OpenBanking @@ -262,6 +263,7 @@ fn get_payment_method_data( | PaymentMethodData::MandatePayment | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Upi(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) diff --git a/crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs b/crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs index 93ba34259788..74c8d1edb381 100644 --- a/crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs @@ -121,6 +121,7 @@ impl TryFrom<&PaymentsAuthorizeRouterData> for PowertranzPaymentsRequest { | PaymentMethodData::MandatePayment | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Upi(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) diff --git a/crates/hyperswitch_connectors/src/connectors/razorpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/razorpay/transformers.rs index 674f652a9336..3b2164dfc978 100644 --- a/crates/hyperswitch_connectors/src/connectors/razorpay/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/razorpay/transformers.rs @@ -405,6 +405,7 @@ impl | PaymentMethodData::MandatePayment | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) | PaymentMethodData::OpenBanking(_) diff --git a/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs b/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs index 4fb48938c429..540bcaebaaeb 100644 --- a/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs @@ -266,6 +266,7 @@ where | PaymentMethodData::MandatePayment | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Upi(_) | PaymentMethodData::OpenBanking(_) | PaymentMethodData::CardToken(_) @@ -479,6 +480,7 @@ impl TryFrom<&Shift4RouterData<&RouterData for SquareTokenRequest { | PaymentMethodData::MandatePayment | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Upi(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::OpenBanking(_) @@ -293,6 +294,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for SquarePaymentsRequest { | PaymentMethodData::MandatePayment | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Upi(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::OpenBanking(_) diff --git a/crates/hyperswitch_connectors/src/connectors/stax/transformers.rs b/crates/hyperswitch_connectors/src/connectors/stax/transformers.rs index a8e9a7ad8297..a675e3040e39 100644 --- a/crates/hyperswitch_connectors/src/connectors/stax/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/stax/transformers.rs @@ -118,6 +118,7 @@ impl TryFrom<&StaxRouterData<&types::PaymentsAuthorizeRouterData>> for StaxPayme | PaymentMethodData::MandatePayment | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) | PaymentMethodData::CardRedirect(_) @@ -272,6 +273,7 @@ impl TryFrom<&types::TokenizationRouterData> for StaxTokenRequest { | PaymentMethodData::MandatePayment | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) | PaymentMethodData::CardRedirect(_) diff --git a/crates/hyperswitch_connectors/src/connectors/tsys/transformers.rs b/crates/hyperswitch_connectors/src/connectors/tsys/transformers.rs index c867adaa23ea..cd9fe63e4a79 100644 --- a/crates/hyperswitch_connectors/src/connectors/tsys/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/tsys/transformers.rs @@ -102,6 +102,7 @@ impl TryFrom<&TsysRouterData<&types::PaymentsAuthorizeRouterData>> for TsysPayme | PaymentMethodData::MandatePayment | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Upi(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) diff --git a/crates/hyperswitch_connectors/src/connectors/volt/transformers.rs b/crates/hyperswitch_connectors/src/connectors/volt/transformers.rs index b13d029185f5..b8e1e99054a9 100644 --- a/crates/hyperswitch_connectors/src/connectors/volt/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/volt/transformers.rs @@ -143,6 +143,7 @@ impl TryFrom<&VoltRouterData<&types::PaymentsAuthorizeRouterData>> for VoltPayme | PaymentMethodData::MandatePayment | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Upi(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) diff --git a/crates/hyperswitch_connectors/src/connectors/worldline/transformers.rs b/crates/hyperswitch_connectors/src/connectors/worldline/transformers.rs index 05986631c679..89ee8d1b29b6 100644 --- a/crates/hyperswitch_connectors/src/connectors/worldline/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/worldline/transformers.rs @@ -240,6 +240,7 @@ impl | PaymentMethodData::MandatePayment | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Upi(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) diff --git a/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs index b69e4bcd97b6..fba589a48955 100644 --- a/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs @@ -177,6 +177,7 @@ fn fetch_payment_instrument( | PaymentMethodData::Crypto(_) | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Upi(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::CardRedirect(_) diff --git a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs index 166e71304835..7a30a434a5d7 100644 --- a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs @@ -700,6 +700,7 @@ impl TryFrom<&ZenRouterData<&types::PaymentsAuthorizeRouterData>> for ZenPayment | PaymentMethodData::MandatePayment | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Upi(_) | PaymentMethodData::OpenBanking(_) | PaymentMethodData::CardToken(_) diff --git a/crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs b/crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs index 8db75fe61aab..810193251137 100644 --- a/crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs @@ -178,6 +178,7 @@ impl TryFrom<&ZslRouterData<&types::PaymentsAuthorizeRouterData>> for ZslPayment | PaymentMethodData::MandatePayment | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Upi(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs index 81c079d5d523..6ee8926f8df8 100644 --- a/crates/hyperswitch_connectors/src/default_implementations.rs +++ b/crates/hyperswitch_connectors/src/default_implementations.rs @@ -323,7 +323,6 @@ default_imp_for_complete_authorize!( connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, - connectors::Digitalvirgo, connectors::Dlocal, connectors::Elavon, connectors::Fiserv, @@ -491,7 +490,6 @@ default_imp_for_connector_redirect_response!( connectors::Coinbase, connectors::Cryptopay, connectors::Deutschebank, - connectors::Digitalvirgo, connectors::Dlocal, connectors::Elavon, connectors::Fiserv, diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs index 81c9aa6084db..14596c0f2a21 100644 --- a/crates/hyperswitch_connectors/src/utils.rs +++ b/crates/hyperswitch_connectors/src/utils.rs @@ -1985,6 +1985,7 @@ pub enum PaymentMethodDataType { OpenBanking, NetworkToken, NetworkTransactionIdAndCardDetails, + DirectCarrierBilling, } impl From for PaymentMethodDataType { @@ -2171,6 +2172,9 @@ impl From for PaymentMethodDataType { PaymentMethodData::OpenBanking(data) => match data { hyperswitch_domain_models::payment_method_data::OpenBankingData::OpenBankingPIS { } => Self::OpenBanking }, + PaymentMethodData::MobilePayment(mobile_payment_data) => match mobile_payment_data { + hyperswitch_domain_models::payment_method_data::MobilePaymentData::DirectCarrierBilling { .. } => Self::DirectCarrierBilling, + }, } } } diff --git a/crates/hyperswitch_domain_models/src/payment_method_data.rs b/crates/hyperswitch_domain_models/src/payment_method_data.rs index e5f5fad99011..9e4d6cfbec5a 100644 --- a/crates/hyperswitch_domain_models/src/payment_method_data.rs +++ b/crates/hyperswitch_domain_models/src/payment_method_data.rs @@ -36,6 +36,7 @@ pub enum PaymentMethodData { CardToken(CardToken), OpenBanking(OpenBankingData), NetworkToken(NetworkTokenData), + MobilePayment(MobilePaymentData), } #[derive(Debug, Clone, PartialEq, Eq)] @@ -63,6 +64,7 @@ impl PaymentMethodData { Self::Voucher(_) => Some(common_enums::PaymentMethod::Voucher), Self::GiftCard(_) => Some(common_enums::PaymentMethod::GiftCard), Self::OpenBanking(_) => Some(common_enums::PaymentMethod::OpenBanking), + Self::MobilePayment(_) => Some(common_enums::PaymentMethod::MobilePayment), Self::CardToken(_) | Self::MandatePayment => None, } } @@ -598,6 +600,17 @@ pub struct NetworkTokenData { pub nick_name: Option>, } +#[derive(Eq, PartialEq, Clone, Debug, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +pub enum MobilePaymentData { + DirectCarrierBilling { + /// The phone number of the user + msisdn: String, + /// Unique user identifier + client_uid: Option, + }, +} + impl From for PaymentMethodData { fn from(api_model_payment_method_data: api_models::payments::PaymentMethodData) -> Self { match api_model_payment_method_data { @@ -645,6 +658,9 @@ impl From for PaymentMethodData { api_models::payments::PaymentMethodData::OpenBanking(ob_data) => { Self::OpenBanking(From::from(ob_data)) } + api_models::payments::PaymentMethodData::MobilePayment(mobile_payment_data) => { + Self::MobilePayment(From::from(mobile_payment_data)) + } } } } @@ -1397,6 +1413,27 @@ impl From for api_models::payments::OpenBankingData { } } +impl From for MobilePaymentData { + fn from(value: api_models::payments::MobilePaymentData) -> Self { + match value { + api_models::payments::MobilePaymentData::DirectCarrierBilling { + msisdn, + client_uid, + } => Self::DirectCarrierBilling { msisdn, client_uid }, + } + } +} + +impl From for api_models::payments::MobilePaymentData { + fn from(value: MobilePaymentData) -> Self { + match value { + MobilePaymentData::DirectCarrierBilling { msisdn, client_uid } => { + Self::DirectCarrierBilling { msisdn, client_uid } + } + } + } +} + #[derive(Debug, serde::Serialize, serde::Deserialize)] #[serde(rename_all = "camelCase")] pub struct TokenizedCardValue1 { @@ -1647,6 +1684,14 @@ impl GetPaymentMethodType for OpenBankingData { } } +impl GetPaymentMethodType for MobilePaymentData { + fn get_payment_method_type(&self) -> api_enums::PaymentMethodType { + match self { + Self::DirectCarrierBilling { .. } => api_enums::PaymentMethodType::DirectCarrierBilling, + } + } +} + impl From for ExtendedCardInfo { fn from(value: Card) -> Self { Self { diff --git a/crates/kgraph_utils/src/mca.rs b/crates/kgraph_utils/src/mca.rs index e897292d6ff1..e35c46723086 100644 --- a/crates/kgraph_utils/src/mca.rs +++ b/crates/kgraph_utils/src/mca.rs @@ -147,6 +147,9 @@ fn get_dir_value_payment_method( Ok(dirval!(OpenBankingType = OpenBankingPIS)) } api_enums::PaymentMethodType::Paze => Ok(dirval!(WalletType = Paze)), + api_enums::PaymentMethodType::DirectCarrierBilling => { + Ok(dirval!(MobilePaymentType = DirectCarrierBilling)) + } } } @@ -421,6 +424,7 @@ fn global_vec_pmt( global_vector.append(collect_global_variants!(BankTransferType)); global_vector.append(collect_global_variants!(CardRedirectType)); global_vector.append(collect_global_variants!(OpenBankingType)); + global_vector.append(collect_global_variants!(MobilePaymentType)); global_vector.push(dir::DirValue::PaymentMethod( dir::enums::PaymentMethod::Card, )); diff --git a/crates/kgraph_utils/src/transformers.rs b/crates/kgraph_utils/src/transformers.rs index 3aaeb0586d63..89b8c5a34ad0 100644 --- a/crates/kgraph_utils/src/transformers.rs +++ b/crates/kgraph_utils/src/transformers.rs @@ -104,6 +104,7 @@ impl IntoDirValue for api_enums::PaymentMethod { Self::GiftCard => Ok(dirval!(PaymentMethod = GiftCard)), Self::CardRedirect => Ok(dirval!(PaymentMethod = CardRedirect)), Self::OpenBanking => Ok(dirval!(PaymentMethod = OpenBanking)), + Self::MobilePayment => Ok(dirval!(PaymentMethod = MobilePayment)), } } } @@ -158,6 +159,7 @@ impl IntoDirValue for (api_enums::PaymentMethodType, api_enums::PaymentMethod) { | api_enums::PaymentMethod::Reward | api_enums::PaymentMethod::RealTimePayment | api_enums::PaymentMethod::Upi + | api_enums::PaymentMethod::MobilePayment | api_enums::PaymentMethod::Voucher | api_enums::PaymentMethod::OpenBanking | api_enums::PaymentMethod::GiftCard => Err(KgraphError::ContextConstructionError( @@ -176,6 +178,7 @@ impl IntoDirValue for (api_enums::PaymentMethodType, api_enums::PaymentMethod) { | api_enums::PaymentMethod::Reward | api_enums::PaymentMethod::RealTimePayment | api_enums::PaymentMethod::Upi + | api_enums::PaymentMethod::MobilePayment | api_enums::PaymentMethod::Voucher | api_enums::PaymentMethod::OpenBanking | api_enums::PaymentMethod::GiftCard => Err(KgraphError::ContextConstructionError( @@ -195,6 +198,7 @@ impl IntoDirValue for (api_enums::PaymentMethodType, api_enums::PaymentMethod) { | api_enums::PaymentMethod::Reward | api_enums::PaymentMethod::RealTimePayment | api_enums::PaymentMethod::Upi + | api_enums::PaymentMethod::MobilePayment | api_enums::PaymentMethod::Voucher | api_enums::PaymentMethod::OpenBanking | api_enums::PaymentMethod::GiftCard => Err(KgraphError::ContextConstructionError( @@ -308,6 +312,9 @@ impl IntoDirValue for (api_enums::PaymentMethodType, api_enums::PaymentMethod) { Ok(dirval!(OpenBankingType = OpenBankingPIS)) } api_enums::PaymentMethodType::Paze => Ok(dirval!(WalletType = Paze)), + api_enums::PaymentMethodType::DirectCarrierBilling => { + Ok(dirval!(MobilePaymentType = DirectCarrierBilling)) + } } } } diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs index c4a57830ae94..dc9274b71ee2 100644 --- a/crates/openapi/src/openapi.rs +++ b/crates/openapi/src/openapi.rs @@ -440,6 +440,8 @@ Never share your secret api keys. Keep them guarded and secure. api_models::payments::MultibancoBillingDetails, api_models::payments::DokuBillingDetails, api_models::payments::BankTransferInstructions, + api_models::payments::MobilePaymentNextStepData, + api_models::payments::MobilePaymentConsent, api_models::payments::ReceiverDetails, api_models::payments::AchTransfer, api_models::payments::MultibancoTransferInstructions, @@ -502,6 +504,8 @@ Never share your secret api keys. Keep them guarded and secure. api_models::payments::CustomerDetails, api_models::payments::GiftCardData, api_models::payments::GiftCardDetails, + api_models::payments::MobilePaymentData, + api_models::payments::MobilePaymentResponse, api_models::payments::Address, api_models::payouts::CardPayout, api_models::payouts::Wallet, diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs index 7c09813ca6b6..7417466bfd25 100644 --- a/crates/openapi/src/openapi_v2.rs +++ b/crates/openapi/src/openapi_v2.rs @@ -386,6 +386,8 @@ Never share your secret api keys. Keep them guarded and secure. api_models::payments::MultibancoBillingDetails, api_models::payments::DokuBillingDetails, api_models::payments::BankTransferInstructions, + api_models::payments::MobilePaymentNextStepData, + api_models::payments::MobilePaymentConsent, api_models::payments::ReceiverDetails, api_models::payments::AchTransfer, api_models::payments::MultibancoTransferInstructions, @@ -445,6 +447,8 @@ Never share your secret api keys. Keep them guarded and secure. api_models::payments::CustomerDetails, api_models::payments::GiftCardData, api_models::payments::GiftCardDetails, + api_models::payments::MobilePaymentData, + api_models::payments::MobilePaymentResponse, api_models::payments::Address, api_models::payouts::CardPayout, api_models::payouts::Wallet, diff --git a/crates/router/src/compatibility/stripe/payment_intents/types.rs b/crates/router/src/compatibility/stripe/payment_intents/types.rs index f0e4b1169c81..55516eeb3bcf 100644 --- a/crates/router/src/compatibility/stripe/payment_intents/types.rs +++ b/crates/router/src/compatibility/stripe/payment_intents/types.rs @@ -837,6 +837,9 @@ pub enum StripeNextAction { InvokeSdkClient { next_action_data: payments::SdkNextActionData, }, + CollectOtp { + consent_data_required: payments::MobilePaymentConsent, + }, } pub(crate) fn into_stripe_next_action( @@ -892,6 +895,11 @@ pub(crate) fn into_stripe_next_action( payments::NextActionData::InvokeSdkClient { next_action_data } => { StripeNextAction::InvokeSdkClient { next_action_data } } + payments::NextActionData::CollectOtp { + consent_data_required, + } => StripeNextAction::CollectOtp { + consent_data_required, + }, }) } diff --git a/crates/router/src/compatibility/stripe/setup_intents/types.rs b/crates/router/src/compatibility/stripe/setup_intents/types.rs index 58a4d95b28f7..03cf9742f704 100644 --- a/crates/router/src/compatibility/stripe/setup_intents/types.rs +++ b/crates/router/src/compatibility/stripe/setup_intents/types.rs @@ -391,6 +391,9 @@ pub enum StripeNextAction { InvokeSdkClient { next_action_data: payments::SdkNextActionData, }, + CollectOtp { + consent_data_required: payments::MobilePaymentConsent, + }, } pub(crate) fn into_stripe_next_action( @@ -446,6 +449,11 @@ pub(crate) fn into_stripe_next_action( payments::NextActionData::InvokeSdkClient { next_action_data } => { StripeNextAction::InvokeSdkClient { next_action_data } } + payments::NextActionData::CollectOtp { + consent_data_required, + } => StripeNextAction::CollectOtp { + consent_data_required, + }, }) } diff --git a/crates/router/src/configs/defaults/payment_connector_required_fields.rs b/crates/router/src/configs/defaults/payment_connector_required_fields.rs index c6a377294597..452e388c4074 100644 --- a/crates/router/src/configs/defaults/payment_connector_required_fields.rs +++ b/crates/router/src/configs/defaults/payment_connector_required_fields.rs @@ -12903,6 +12903,56 @@ impl Default for settings::RequiredFields { }, ) ])) + ), + ( + enums::PaymentMethod::MobilePayment, + PaymentMethodType(HashMap::from([ + ( + enums::PaymentMethodType::DirectCarrierBilling, + ConnectorFields { + fields: HashMap::from([ + ( + enums::Connector::Digitalvirgo, + RequiredFieldFinal { + mandate: HashMap::new(), + non_mandate: HashMap::new(), + common: HashMap::from( + [ + ( + "payment_method_data.mobile_payment.direct_carrier_billing.msisdn".to_string(), + RequiredFieldInfo { + required_field: "payment_method_data.mobile_payment.direct_carrier_billing.msisdn".to_string(), + display_name: "mobile_number".to_string(), + field_type: enums::FieldType::UserMsisdn, + value: None, + } + ), + ( + "payment_method_data.mobile_payment.direct_carrier_billing.client_uid".to_string(), + RequiredFieldInfo { + required_field: "payment_method_data.mobile_payment.direct_carrier_billing.client_uid".to_string(), + display_name: "client_identifier".to_string(), + field_type: enums::FieldType::UserClientIdentifier, + value: None, + } + ), + ( + "order_details.0.product_name".to_string(), + RequiredFieldInfo { + required_field: "order_details.0.product_name".to_string(), + display_name: "product_name".to_string(), + field_type: enums::FieldType::OrderDetailsProductName, + value: None, + } + ), + ] + ), + } + ), + ]) + } + ) + ])) ) ])) } diff --git a/crates/router/src/connector/aci/transformers.rs b/crates/router/src/connector/aci/transformers.rs index 77598f7be381..3e25799c02e6 100644 --- a/crates/router/src/connector/aci/transformers.rs +++ b/crates/router/src/connector/aci/transformers.rs @@ -434,6 +434,7 @@ impl TryFrom<&AciRouterData<&types::PaymentsAuthorizeRouterData>> for AciPayment | domain::PaymentMethodData::BankTransfer(_) | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::GiftCard(_) | domain::PaymentMethodData::CardRedirect(_) | domain::PaymentMethodData::Upi(_) diff --git a/crates/router/src/connector/adyen.rs b/crates/router/src/connector/adyen.rs index a82f46039446..7b491674e92a 100644 --- a/crates/router/src/connector/adyen.rs +++ b/crates/router/src/connector/adyen.rs @@ -209,6 +209,7 @@ impl ConnectorValidation for Adyen { } }, PaymentMethodType::CardRedirect + | PaymentMethodType::DirectCarrierBilling | PaymentMethodType::Fps | PaymentMethodType::DuitNow | PaymentMethodType::Interac diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs index 1c00d52a2871..ec97b6ebad54 100644 --- a/crates/router/src/connector/adyen/transformers.rs +++ b/crates/router/src/connector/adyen/transformers.rs @@ -1597,6 +1597,7 @@ impl<'a> TryFrom<&AdyenRouterData<&types::PaymentsAuthorizeRouterData>> | domain::PaymentMethodData::MandatePayment | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) @@ -2658,6 +2659,7 @@ impl<'a> | domain::PaymentMethodData::MandatePayment | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) diff --git a/crates/router/src/connector/authorizedotnet/transformers.rs b/crates/router/src/connector/authorizedotnet/transformers.rs index c9427683d883..42effdb4b4ac 100644 --- a/crates/router/src/connector/authorizedotnet/transformers.rs +++ b/crates/router/src/connector/authorizedotnet/transformers.rs @@ -339,6 +339,7 @@ impl TryFrom<&types::SetupMandateRouterData> for CreateCustomerProfileRequest { | domain::PaymentMethodData::MandatePayment | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) @@ -526,6 +527,7 @@ impl TryFrom<&AuthorizedotnetRouterData<&types::PaymentsAuthorizeRouterData>> | domain::PaymentMethodData::MandatePayment | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) @@ -587,6 +589,7 @@ impl | domain::PaymentMethodData::MandatePayment | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) diff --git a/crates/router/src/connector/bankofamerica/transformers.rs b/crates/router/src/connector/bankofamerica/transformers.rs index c6490cd61398..1530cbd82f83 100644 --- a/crates/router/src/connector/bankofamerica/transformers.rs +++ b/crates/router/src/connector/bankofamerica/transformers.rs @@ -319,6 +319,7 @@ impl TryFrom<&types::SetupMandateRouterData> for BankOfAmericaPaymentsRequest { | domain::PaymentMethodData::MandatePayment | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) @@ -399,6 +400,7 @@ impl | common_enums::PaymentMethod::BankDebit | common_enums::PaymentMethod::Reward | common_enums::PaymentMethod::RealTimePayment + | common_enums::PaymentMethod::MobilePayment | common_enums::PaymentMethod::Upi | common_enums::PaymentMethod::Voucher | common_enums::PaymentMethod::OpenBanking @@ -1094,6 +1096,7 @@ impl TryFrom<&BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>> | domain::PaymentMethodData::Crypto(_) | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) @@ -1587,6 +1590,7 @@ impl | common_enums::PaymentMethod::BankDebit | common_enums::PaymentMethod::Reward | common_enums::PaymentMethod::RealTimePayment + | common_enums::PaymentMethod::MobilePayment | common_enums::PaymentMethod::Upi | common_enums::PaymentMethod::Voucher | common_enums::PaymentMethod::OpenBanking @@ -1804,6 +1808,7 @@ impl | common_enums::PaymentMethod::BankDebit | common_enums::PaymentMethod::Reward | common_enums::PaymentMethod::RealTimePayment + | common_enums::PaymentMethod::MobilePayment | common_enums::PaymentMethod::Upi | common_enums::PaymentMethod::Voucher | common_enums::PaymentMethod::OpenBanking diff --git a/crates/router/src/connector/bluesnap/transformers.rs b/crates/router/src/connector/bluesnap/transformers.rs index 6db0ddac49bb..022512ea1c19 100644 --- a/crates/router/src/connector/bluesnap/transformers.rs +++ b/crates/router/src/connector/bluesnap/transformers.rs @@ -223,6 +223,7 @@ impl TryFrom<&BluesnapRouterData<&types::PaymentsAuthorizeRouterData>> | domain::PaymentMethodData::MandatePayment | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::CardRedirect(_) | domain::PaymentMethodData::Voucher(_) @@ -391,6 +392,7 @@ impl TryFrom<&BluesnapRouterData<&types::PaymentsAuthorizeRouterData>> for Blues | domain::PaymentMethodData::MandatePayment | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::CardRedirect(_) | domain::PaymentMethodData::Voucher(_) diff --git a/crates/router/src/connector/boku/transformers.rs b/crates/router/src/connector/boku/transformers.rs index 777b795a438d..4a947284d79d 100644 --- a/crates/router/src/connector/boku/transformers.rs +++ b/crates/router/src/connector/boku/transformers.rs @@ -107,6 +107,7 @@ impl TryFrom<&BokuRouterData<&types::PaymentsAuthorizeRouterData>> for BokuPayme | domain::PaymentMethodData::MandatePayment | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) diff --git a/crates/router/src/connector/braintree/transformers.rs b/crates/router/src/connector/braintree/transformers.rs index f606e671a8d9..bcef8124c65c 100644 --- a/crates/router/src/connector/braintree/transformers.rs +++ b/crates/router/src/connector/braintree/transformers.rs @@ -305,6 +305,7 @@ impl TryFrom<&BraintreeRouterData<&types::PaymentsAuthorizeRouterData>> | domain::PaymentMethodData::Crypto(_) | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) @@ -341,6 +342,7 @@ impl TryFrom<&BraintreeRouterData<&types::PaymentsCompleteAuthorizeRouterData>> | api_models::enums::PaymentMethod::BankDebit | api_models::enums::PaymentMethod::Reward | api_models::enums::PaymentMethod::RealTimePayment + | api_models::enums::PaymentMethod::MobilePayment | api_models::enums::PaymentMethod::Upi | api_models::enums::PaymentMethod::OpenBanking | api_models::enums::PaymentMethod::Voucher @@ -1105,6 +1107,7 @@ impl TryFrom<&types::TokenizationRouterData> for BraintreeTokenRequest { | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) @@ -1717,6 +1720,7 @@ fn get_braintree_redirect_form( | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) diff --git a/crates/router/src/connector/checkout/transformers.rs b/crates/router/src/connector/checkout/transformers.rs index 686a9d57ac3b..1f6b737367d0 100644 --- a/crates/router/src/connector/checkout/transformers.rs +++ b/crates/router/src/connector/checkout/transformers.rs @@ -129,6 +129,7 @@ impl TryFrom<&types::TokenizationRouterData> for TokenRequest { | domain::PaymentMethodData::MandatePayment | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::CardRedirect(_) @@ -375,6 +376,7 @@ impl TryFrom<&CheckoutRouterData<&types::PaymentsAuthorizeRouterData>> for Payme | domain::PaymentMethodData::MandatePayment | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::CardRedirect(_) diff --git a/crates/router/src/connector/cybersource/transformers.rs b/crates/router/src/connector/cybersource/transformers.rs index b99d0cb3283a..c9ebba4a10d8 100644 --- a/crates/router/src/connector/cybersource/transformers.rs +++ b/crates/router/src/connector/cybersource/transformers.rs @@ -245,6 +245,7 @@ impl TryFrom<&types::SetupMandateRouterData> for CybersourceZeroMandateRequest { | domain::PaymentMethodData::MandatePayment | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) @@ -1970,6 +1971,7 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsAuthorizeRouterData>> | domain::PaymentMethodData::Crypto(_) | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) @@ -2081,6 +2083,7 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsAuthorizeRouterData>> | domain::PaymentMethodData::MandatePayment | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) @@ -2808,6 +2811,7 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsPreProcessingRouterData>> | domain::PaymentMethodData::MandatePayment | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) @@ -2923,6 +2927,7 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsCompleteAuthorizeRouterData> | domain::PaymentMethodData::MandatePayment | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) diff --git a/crates/router/src/connector/datatrans/transformers.rs b/crates/router/src/connector/datatrans/transformers.rs index e9dcfd87071e..7d52e64b4b7c 100644 --- a/crates/router/src/connector/datatrans/transformers.rs +++ b/crates/router/src/connector/datatrans/transformers.rs @@ -183,6 +183,7 @@ impl TryFrom<&DatatransRouterData<&types::PaymentsAuthorizeRouterData>> | domain::PaymentMethodData::MandatePayment | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::CardRedirect(_) | domain::PaymentMethodData::Voucher(_) diff --git a/crates/router/src/connector/gocardless/transformers.rs b/crates/router/src/connector/gocardless/transformers.rs index 6a8fe01eede5..c5c34574433d 100644 --- a/crates/router/src/connector/gocardless/transformers.rs +++ b/crates/router/src/connector/gocardless/transformers.rs @@ -243,6 +243,7 @@ impl TryFrom<&types::TokenizationRouterData> for CustomerBankAccount { | domain::PaymentMethodData::MandatePayment | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) @@ -416,6 +417,7 @@ impl TryFrom<&types::SetupMandateRouterData> for GocardlessMandateRequest { | domain::PaymentMethodData::MandatePayment | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) diff --git a/crates/router/src/connector/iatapay/transformers.rs b/crates/router/src/connector/iatapay/transformers.rs index ec94b322fe71..fa5528eace3a 100644 --- a/crates/router/src/connector/iatapay/transformers.rs +++ b/crates/router/src/connector/iatapay/transformers.rs @@ -203,6 +203,7 @@ impl | domain::PaymentMethodData::Crypto(_) | domain::PaymentMethodData::MandatePayment | domain::PaymentMethodData::Reward + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) | domain::PaymentMethodData::CardToken(_) diff --git a/crates/router/src/connector/itaubank/transformers.rs b/crates/router/src/connector/itaubank/transformers.rs index 15dfb1ce2401..127f8526afe4 100644 --- a/crates/router/src/connector/itaubank/transformers.rs +++ b/crates/router/src/connector/itaubank/transformers.rs @@ -115,6 +115,7 @@ impl TryFrom<&ItaubankRouterData<&types::PaymentsAuthorizeRouterData>> for Itaub | domain::PaymentMethodData::MandatePayment | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) diff --git a/crates/router/src/connector/klarna.rs b/crates/router/src/connector/klarna.rs index 07bc6bd014c9..6aa9b62ed6ad 100644 --- a/crates/router/src/connector/klarna.rs +++ b/crates/router/src/connector/klarna.rs @@ -548,7 +548,8 @@ impl | common_enums::PaymentExperience::InvokeSdkClient | common_enums::PaymentExperience::LinkWallet | common_enums::PaymentExperience::OneClick - | common_enums::PaymentExperience::RedirectToUrl, + | common_enums::PaymentExperience::RedirectToUrl + | common_enums::PaymentExperience::CollectOtp, common_enums::PaymentMethodType::Ach | common_enums::PaymentMethodType::Affirm | common_enums::PaymentMethodType::AfterpayClearpay @@ -577,6 +578,7 @@ impl | common_enums::PaymentMethodType::Dana | common_enums::PaymentMethodType::DanamonVa | common_enums::PaymentMethodType::Debit + | common_enums::PaymentMethodType::DirectCarrierBilling | common_enums::PaymentMethodType::Efecty | common_enums::PaymentMethodType::Eps | common_enums::PaymentMethodType::Evoucher @@ -661,6 +663,7 @@ impl | domain::PaymentMethodData::MandatePayment | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::OpenBanking(_) diff --git a/crates/router/src/connector/mifinity/transformers.rs b/crates/router/src/connector/mifinity/transformers.rs index 6ff52bb7eb1b..1e2c420c767b 100644 --- a/crates/router/src/connector/mifinity/transformers.rs +++ b/crates/router/src/connector/mifinity/transformers.rs @@ -192,6 +192,7 @@ impl TryFrom<&MifinityRouterData<&types::PaymentsAuthorizeRouterData>> for Mifin | domain::PaymentMethodData::MandatePayment | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) diff --git a/crates/router/src/connector/nmi/transformers.rs b/crates/router/src/connector/nmi/transformers.rs index 0ec9cc948883..4c33f0200172 100644 --- a/crates/router/src/connector/nmi/transformers.rs +++ b/crates/router/src/connector/nmi/transformers.rs @@ -582,6 +582,7 @@ impl | domain::PaymentMethodData::MandatePayment | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) diff --git a/crates/router/src/connector/noon/transformers.rs b/crates/router/src/connector/noon/transformers.rs index 4556121db239..3e75130f575d 100644 --- a/crates/router/src/connector/noon/transformers.rs +++ b/crates/router/src/connector/noon/transformers.rs @@ -350,6 +350,7 @@ impl TryFrom<&NoonRouterData<&types::PaymentsAuthorizeRouterData>> for NoonPayme | domain::PaymentMethodData::MandatePayment {} | domain::PaymentMethodData::Reward {} | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) diff --git a/crates/router/src/connector/nuvei/transformers.rs b/crates/router/src/connector/nuvei/transformers.rs index 209d1a7476f6..121ec1d7b7ce 100644 --- a/crates/router/src/connector/nuvei/transformers.rs +++ b/crates/router/src/connector/nuvei/transformers.rs @@ -993,6 +993,7 @@ where | domain::PaymentMethodData::Crypto(_) | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::CardRedirect(_) @@ -1200,6 +1201,7 @@ impl TryFrom<(&types::PaymentsCompleteAuthorizeRouterData, Secret)> | Some(domain::PaymentMethodData::CardRedirect(..)) | Some(domain::PaymentMethodData::Reward) | Some(domain::PaymentMethodData::RealTimePayment(..)) + | Some(domain::PaymentMethodData::MobilePayment(..)) | Some(domain::PaymentMethodData::Upi(..)) | Some(domain::PaymentMethodData::OpenBanking(_)) | Some(domain::PaymentMethodData::CardToken(..)) diff --git a/crates/router/src/connector/opayo/transformers.rs b/crates/router/src/connector/opayo/transformers.rs index 44445a3d7d94..f55aa4325b06 100644 --- a/crates/router/src/connector/opayo/transformers.rs +++ b/crates/router/src/connector/opayo/transformers.rs @@ -71,6 +71,7 @@ impl TryFrom<&OpayoRouterData<&types::PaymentsAuthorizeRouterData>> for OpayoPay | domain::PaymentMethodData::MandatePayment | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) diff --git a/crates/router/src/connector/payme/transformers.rs b/crates/router/src/connector/payme/transformers.rs index 2f8b78e281ad..7b6b67c8408e 100644 --- a/crates/router/src/connector/payme/transformers.rs +++ b/crates/router/src/connector/payme/transformers.rs @@ -430,6 +430,7 @@ impl TryFrom<&PaymentMethodData> for SalePaymentMethod { | PaymentMethodData::MandatePayment | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::GiftCard(_) | PaymentMethodData::CardRedirect(_) | PaymentMethodData::Upi(_) @@ -678,6 +679,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PayRequest { | PaymentMethodData::MandatePayment | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Upi(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) @@ -745,6 +747,7 @@ impl TryFrom<&types::PaymentsCompleteAuthorizeRouterData> for Pay3dsRequest { | Some(PaymentMethodData::MandatePayment) | Some(PaymentMethodData::Reward) | Some(PaymentMethodData::RealTimePayment(_)) + | Some(PaymentMethodData::MobilePayment(_)) | Some(PaymentMethodData::Upi(_)) | Some(PaymentMethodData::Voucher(_)) | Some(PaymentMethodData::GiftCard(_)) @@ -787,6 +790,7 @@ impl TryFrom<&types::TokenizationRouterData> for CaptureBuyerRequest { | PaymentMethodData::MandatePayment | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Upi(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) diff --git a/crates/router/src/connector/paypal/transformers.rs b/crates/router/src/connector/paypal/transformers.rs index 3e01c614e8ef..ed8369607df7 100644 --- a/crates/router/src/connector/paypal/transformers.rs +++ b/crates/router/src/connector/paypal/transformers.rs @@ -1010,6 +1010,7 @@ impl TryFrom<&PaypalRouterData<&types::PaymentsAuthorizeRouterData>> for PaypalP | enums::PaymentMethodType::Dana | enums::PaymentMethodType::DanamonVa | enums::PaymentMethodType::Debit + | enums::PaymentMethodType::DirectCarrierBilling | enums::PaymentMethodType::DuitNow | enums::PaymentMethodType::Efecty | enums::PaymentMethodType::Eps @@ -1089,6 +1090,7 @@ impl TryFrom<&PaypalRouterData<&types::PaymentsAuthorizeRouterData>> for PaypalP } domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Crypto(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::OpenBanking(_) diff --git a/crates/router/src/connector/placetopay/transformers.rs b/crates/router/src/connector/placetopay/transformers.rs index 2d1ce4771cad..d809b9e770d8 100644 --- a/crates/router/src/connector/placetopay/transformers.rs +++ b/crates/router/src/connector/placetopay/transformers.rs @@ -138,6 +138,7 @@ impl TryFrom<&PlacetopayRouterData<&types::PaymentsAuthorizeRouterData>> | domain::PaymentMethodData::MandatePayment | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs index af82bda3e6af..32fa8da0320e 100644 --- a/crates/router/src/connector/stripe/transformers.rs +++ b/crates/router/src/connector/stripe/transformers.rs @@ -697,6 +697,7 @@ impl TryFrom for StripePaymentMethodType { | enums::PaymentMethodType::Alma | enums::PaymentMethodType::ClassicReward | enums::PaymentMethodType::Dana + | enums::PaymentMethodType::DirectCarrierBilling | enums::PaymentMethodType::Efecty | enums::PaymentMethodType::Evoucher | enums::PaymentMethodType::GoPay @@ -1344,6 +1345,7 @@ fn create_stripe_payment_method( domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::MandatePayment | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) @@ -1757,6 +1759,7 @@ impl TryFrom<(&types::PaymentsAuthorizeRouterData, MinorUnit)> for PaymentIntent | domain::payments::PaymentMethodData::MandatePayment | domain::payments::PaymentMethodData::Reward | domain::payments::PaymentMethodData::RealTimePayment(_) + | domain::payments::PaymentMethodData::MobilePayment(_) | domain::payments::PaymentMethodData::Upi(_) | domain::payments::PaymentMethodData::Voucher(_) | domain::payments::PaymentMethodData::GiftCard(_) @@ -3374,6 +3377,7 @@ impl | Some(domain::PaymentMethodData::Crypto(..)) | Some(domain::PaymentMethodData::Reward) | Some(domain::PaymentMethodData::RealTimePayment(..)) + | Some(domain::PaymentMethodData::MobilePayment(..)) | Some(domain::PaymentMethodData::MandatePayment) | Some(domain::PaymentMethodData::Upi(..)) | Some(domain::PaymentMethodData::GiftCard(..)) @@ -3831,6 +3835,7 @@ impl | domain::PaymentMethodData::Crypto(_) | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::GiftCard(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::CardRedirect(_) diff --git a/crates/router/src/connector/trustpay/transformers.rs b/crates/router/src/connector/trustpay/transformers.rs index 3b109a7f02e3..8312b3e26593 100644 --- a/crates/router/src/connector/trustpay/transformers.rs +++ b/crates/router/src/connector/trustpay/transformers.rs @@ -430,6 +430,7 @@ impl TryFrom<&TrustpayRouterData<&types::PaymentsAuthorizeRouterData>> for Trust | domain::PaymentMethodData::MandatePayment | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs index a9a5a01eef63..687edd5aa238 100644 --- a/crates/router/src/connector/utils.rs +++ b/crates/router/src/connector/utils.rs @@ -2823,6 +2823,7 @@ pub enum PaymentMethodDataType { VietQr, OpenBanking, NetworkToken, + DirectCarrierBilling, } impl From for PaymentMethodDataType { @@ -3009,6 +3010,9 @@ impl From for PaymentMethodDataType { domain::payments::PaymentMethodData::OpenBanking(data) => match data { hyperswitch_domain_models::payment_method_data::OpenBankingData::OpenBankingPIS { } => Self::OpenBanking }, + domain::payments::PaymentMethodData::MobilePayment(mobile_payment_data) => match mobile_payment_data { + hyperswitch_domain_models::payment_method_data::MobilePaymentData::DirectCarrierBilling { .. } => Self::DirectCarrierBilling, + }, } } } diff --git a/crates/router/src/connector/wellsfargo/transformers.rs b/crates/router/src/connector/wellsfargo/transformers.rs index 1ca6c7bd9683..3a2e35190e60 100644 --- a/crates/router/src/connector/wellsfargo/transformers.rs +++ b/crates/router/src/connector/wellsfargo/transformers.rs @@ -203,6 +203,7 @@ impl TryFrom<&types::SetupMandateRouterData> for WellsfargoZeroMandateRequest { | domain::PaymentMethodData::MandatePayment | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) @@ -1285,6 +1286,7 @@ impl TryFrom<&WellsfargoRouterData<&types::PaymentsAuthorizeRouterData>> | domain::PaymentMethodData::Crypto(_) | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) + | domain::PaymentMethodData::MobilePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs index ba27e8b00db4..49b16aaa3f46 100644 --- a/crates/router/src/core/admin.rs +++ b/crates/router/src/core/admin.rs @@ -1335,11 +1335,10 @@ impl<'a> ConnectorAuthTypeAndMetadataValidation<'a> { deutschebank::transformers::DeutschebankAuthType::try_from(self.auth_type)?; Ok(()) } - // Template code for future usage - // api_enums::Connector::Digitalvirgo => { - // digitalvirgo::transformers::DigitalvirgoAuthType::try_from(self.auth_type)?; - // Ok(()) - // } + api_enums::Connector::Digitalvirgo => { + digitalvirgo::transformers::DigitalvirgoAuthType::try_from(self.auth_type)?; + Ok(()) + } api_enums::Connector::Dlocal => { dlocal::transformers::DlocalAuthType::try_from(self.auth_type)?; Ok(()) diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs index a765c1feaa96..932a4a26ee09 100644 --- a/crates/router/src/core/payment_methods.rs +++ b/crates/router/src/core/payment_methods.rs @@ -126,6 +126,7 @@ pub async fn retrieve_payment_method_core( pm @ Some(domain::PaymentMethodData::CardRedirect(_)) => Ok((pm.to_owned(), None)), pm @ Some(domain::PaymentMethodData::GiftCard(_)) => Ok((pm.to_owned(), None)), pm @ Some(domain::PaymentMethodData::OpenBanking(_)) => Ok((pm.to_owned(), None)), + pm @ Some(domain::PaymentMethodData::MobilePayment(_)) => Ok((pm.to_owned(), None)), pm_opt @ Some(pm @ domain::PaymentMethodData::BankTransfer(_)) => { let payment_token = payment_helpers::store_payment_method_data_in_vault( state, diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs index 23cb25a52d5c..2d480d71fe7f 100644 --- a/crates/router/src/core/payments.rs +++ b/crates/router/src/core/payments.rs @@ -1765,6 +1765,7 @@ impl PaymentRedirectFlow for PaymentRedirectCompleteAuthorize { api_models::payments::NextActionData::WaitScreenInformation{..} => None, api_models::payments::NextActionData::ThreeDsInvoke{..} => None, api_models::payments::NextActionData::InvokeSdkClient{..} => None, + api_models::payments::NextActionData::CollectOtp{ .. } => None, }) .ok_or(errors::ApiErrorResponse::InternalServerError) diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs index acaccccbb17b..478211ec14cc 100644 --- a/crates/router/src/core/payments/helpers.rs +++ b/crates/router/src/core/payments/helpers.rs @@ -2821,6 +2821,10 @@ pub fn validate_payment_method_type_against_payment_method( payment_method_type, api_enums::PaymentMethodType::OpenBankingPIS ), + api_enums::PaymentMethod::MobilePayment => matches!( + payment_method_type, + api_enums::PaymentMethodType::DirectCarrierBilling + ), } } @@ -4696,6 +4700,11 @@ pub async fn get_additional_payment_data( }))) } } + domain::PaymentMethodData::MobilePayment(mobile_payment) => Ok(Some( + api_models::payments::AdditionalPaymentData::MobilePayment { + details: Some(mobile_payment.to_owned().into()), + }, + )), domain::PaymentMethodData::NetworkToken(_) => Ok(None), } } @@ -5390,6 +5399,11 @@ pub fn get_key_params_for_surcharge_details( ob_data.get_payment_method_type(), None, )), + domain::PaymentMethodData::MobilePayment(mobile_payment) => Some(( + common_enums::PaymentMethod::MobilePayment, + mobile_payment.get_payment_method_type(), + None, + )), domain::PaymentMethodData::CardToken(_) | domain::PaymentMethodData::NetworkToken(_) | domain::PaymentMethodData::CardDetailsForNetworkTransactionId(_) => None, diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs index 42c3c819fef6..8fb36764c970 100644 --- a/crates/router/src/core/payments/operations/payment_response.rs +++ b/crates/router/src/core/payments/operations/payment_response.rs @@ -1277,6 +1277,7 @@ async fn payment_response_update_tracker( | hyperswitch_domain_models::payment_method_data::PaymentMethodData::RealTimePayment( _, ) + | hyperswitch_domain_models::payment_method_data::PaymentMethodData::MobilePayment(_) | hyperswitch_domain_models::payment_method_data::PaymentMethodData::Upi(_) | hyperswitch_domain_models::payment_method_data::PaymentMethodData::Voucher(_) | hyperswitch_domain_models::payment_method_data::PaymentMethodData::GiftCard(_) diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs index ef0c3bd0d5fa..8f2280355f9f 100644 --- a/crates/router/src/core/payments/transformers.rs +++ b/crates/router/src/core/payments/transformers.rs @@ -1560,6 +1560,8 @@ where let next_action_voucher = voucher_next_steps_check(payment_attempt.clone())?; + let next_action_mobile_payment = mobile_payment_next_steps_check(&payment_attempt)?; + let next_action_containing_qr_code_url = qr_code_next_steps_check(payment_attempt.clone())?; let papal_sdk_next_action = paypal_sdk_next_steps_check(payment_attempt.clone())?; @@ -1590,6 +1592,11 @@ where voucher_details: voucher_data, } })) + .or(next_action_mobile_payment.map(|mobile_payment_data| { + api_models::payments::NextActionData::CollectOtp { + consent_data_required: mobile_payment_data.consent_data_required, + } + })) .or(next_action_containing_qr_code_url.map(|qr_code_data| { api_models::payments::NextActionData::foreign_from(qr_code_data) })) @@ -2204,6 +2211,31 @@ pub fn voucher_next_steps_check( Ok(voucher_next_step) } +#[cfg(feature = "v1")] +pub fn mobile_payment_next_steps_check( + payment_attempt: &storage::PaymentAttempt, +) -> RouterResult> { + let mobile_payment_next_step = if let Some(diesel_models::enums::PaymentMethod::MobilePayment) = + payment_attempt.payment_method + { + let mobile_paymebnt_next_steps: Option = + payment_attempt + .connector_metadata + .clone() + .map(|metadata| { + metadata + .parse_value("MobilePaymentNextStepData") + .change_context(errors::ApiErrorResponse::InternalServerError) + .attach_printable("Failed to parse the Value to NextRequirements struct") + }) + .transpose()?; + mobile_paymebnt_next_steps + } else { + None + }; + Ok(mobile_payment_next_step) +} + pub fn change_order_details_to_new_type( order_amount: MinorUnit, order_details: api_models::payments::OrderDetails, diff --git a/crates/router/src/core/payout_link.rs b/crates/router/src/core/payout_link.rs index b175c8b7c03e..31e65e8e0a79 100644 --- a/crates/router/src/core/payout_link.rs +++ b/crates/router/src/core/payout_link.rs @@ -418,6 +418,7 @@ pub async fn filter_payout_methods( | common_enums::PaymentMethod::BankDebit | common_enums::PaymentMethod::Reward | common_enums::PaymentMethod::RealTimePayment + | common_enums::PaymentMethod::MobilePayment | common_enums::PaymentMethod::Upi | common_enums::PaymentMethod::Voucher | common_enums::PaymentMethod::OpenBanking diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs index 985a6644524f..b432c57c5d1d 100644 --- a/crates/router/src/types/api.rs +++ b/crates/router/src/types/api.rs @@ -375,10 +375,9 @@ impl ConnectorData { enums::Connector::Deutschebank => { Ok(ConnectorEnum::Old(Box::new(connector::Deutschebank::new()))) } - // tempplate code for future usage - // enums::Connector::Digitalvirgo => { - // Ok(ConnectorEnum::Old(Box::new(connector::Digitalvirgo::new()))) - // } + enums::Connector::Digitalvirgo => { + Ok(ConnectorEnum::Old(Box::new(connector::Digitalvirgo::new()))) + } enums::Connector::Dlocal => Ok(ConnectorEnum::Old(Box::new(&connector::Dlocal))), #[cfg(feature = "dummy_connector")] enums::Connector::DummyConnector1 => Ok(ConnectorEnum::Old(Box::new( diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs index f4d8c4f06b90..c97084a22977 100644 --- a/crates/router/src/types/transformers.rs +++ b/crates/router/src/types/transformers.rs @@ -231,6 +231,7 @@ impl ForeignTryFrom for common_enums::RoutableConnectors { api_enums::Connector::Cybersource => Self::Cybersource, api_enums::Connector::Datatrans => Self::Datatrans, api_enums::Connector::Deutschebank => Self::Deutschebank, + api_enums::Connector::Digitalvirgo => Self::Digitalvirgo, api_enums::Connector::Dlocal => Self::Dlocal, api_enums::Connector::Ebanx => Self::Ebanx, // api_enums::Connector::Elavon => Self::Elavon, @@ -537,6 +538,7 @@ impl ForeignFrom for api_enums::PaymentMethod { | api_enums::PaymentMethodType::DuitNow | api_enums::PaymentMethodType::PromptPay | api_enums::PaymentMethodType::VietQr => Self::RealTimePayment, + api_enums::PaymentMethodType::DirectCarrierBilling => Self::MobilePayment, } } } @@ -563,6 +565,7 @@ impl ForeignTryFrom for api_enums::PaymentMethod { payments::PaymentMethodData::GiftCard(..) => Ok(Self::GiftCard), payments::PaymentMethodData::CardRedirect(..) => Ok(Self::CardRedirect), payments::PaymentMethodData::OpenBanking(..) => Ok(Self::OpenBanking), + payments::PaymentMethodData::MobilePayment(..) => Ok(Self::MobilePayment), payments::PaymentMethodData::MandatePayment => { Err(errors::ApiErrorResponse::InvalidRequestData { message: ("Mandate payments cannot have payment_method_data field".to_string()),