From d0a041c361668d0eff6c9b0dde67351b6ed43d19 Mon Sep 17 00:00:00 2001 From: Sakil Mostak <73734619+Sakilmostak@users.noreply.github.com> Date: Thu, 14 Nov 2024 01:19:59 +0530 Subject: [PATCH] feat(core): add Mobile Payment (Direct Carrier Billing) as a payment method (#6196) Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> --- .typos.toml | 2 +- api-reference-v2/openapi_spec.json | 139 +++++++- api-reference/openapi_spec.json | 139 +++++++- crates/api_models/src/connector_enums.rs | 3 +- crates/api_models/src/enums.rs | 6 + crates/api_models/src/payments.rs | 63 +++- crates/common_enums/src/connector_enums.rs | 2 +- crates/common_enums/src/enums.rs | 4 + crates/common_enums/src/transformers.rs | 1 + crates/connector_configs/src/connector.rs | 1 + .../src/response_modifier.rs | 13 + crates/connector_configs/src/transformer.rs | 6 +- .../connector_configs/toml/development.toml | 7 + crates/connector_configs/toml/sandbox.toml | 7 + crates/euclid/src/dssa/graph.rs | 1 + crates/euclid/src/frontend/ast/lowering.rs | 2 + crates/euclid/src/frontend/dir.rs | 17 + crates/euclid/src/frontend/dir/enums.rs | 20 ++ crates/euclid/src/frontend/dir/lowering.rs | 9 + .../euclid/src/frontend/dir/transformers.rs | 6 + crates/euclid_wasm/src/lib.rs | 1 + .../src/connectors/airwallex/transformers.rs | 1 + .../src/connectors/bambora/transformers.rs | 1 + .../src/connectors/billwerk/transformers.rs | 1 + .../src/connectors/cryptopay/transformers.rs | 1 + .../src/connectors/digitalvirgo.rs | 333 ++++++++---------- .../connectors/digitalvirgo/transformers.rs | 235 +++++++++--- .../src/connectors/dlocal/transformers.rs | 1 + .../src/connectors/fiserv/transformers.rs | 1 + .../src/connectors/fiuu/transformers.rs | 1 + .../src/connectors/forte/transformers.rs | 1 + .../src/connectors/globepay/transformers.rs | 1 + .../src/connectors/helcim/transformers.rs | 2 + .../connectors/multisafepay/transformers.rs | 2 + .../src/connectors/nexinets/transformers.rs | 1 + .../src/connectors/nexixpay/transformers.rs | 2 + .../src/connectors/payeezy/transformers.rs | 2 + .../src/connectors/powertranz/transformers.rs | 1 + .../src/connectors/razorpay/transformers.rs | 1 + .../src/connectors/shift4/transformers.rs | 2 + .../src/connectors/square/transformers.rs | 2 + .../src/connectors/stax/transformers.rs | 2 + .../src/connectors/tsys/transformers.rs | 1 + .../src/connectors/volt/transformers.rs | 1 + .../src/connectors/worldline/transformers.rs | 1 + .../src/connectors/worldpay/transformers.rs | 1 + .../src/connectors/zen/transformers.rs | 1 + .../src/connectors/zsl/transformers.rs | 1 + .../src/default_implementations.rs | 2 - crates/hyperswitch_connectors/src/utils.rs | 4 + .../src/payment_method_data.rs | 45 +++ crates/kgraph_utils/src/mca.rs | 4 + crates/kgraph_utils/src/transformers.rs | 7 + crates/openapi/src/openapi.rs | 4 + crates/openapi/src/openapi_v2.rs | 4 + .../stripe/payment_intents/types.rs | 8 + .../stripe/setup_intents/types.rs | 8 + .../payment_connector_required_fields.rs | 50 +++ .../router/src/connector/aci/transformers.rs | 1 + crates/router/src/connector/adyen.rs | 1 + .../src/connector/adyen/transformers.rs | 2 + .../connector/authorizedotnet/transformers.rs | 3 + .../connector/bankofamerica/transformers.rs | 5 + .../src/connector/bluesnap/transformers.rs | 2 + .../router/src/connector/boku/transformers.rs | 1 + .../src/connector/braintree/transformers.rs | 4 + .../src/connector/checkout/transformers.rs | 2 + .../src/connector/cybersource/transformers.rs | 5 + .../src/connector/datatrans/transformers.rs | 1 + .../src/connector/gocardless/transformers.rs | 2 + .../src/connector/iatapay/transformers.rs | 1 + .../src/connector/itaubank/transformers.rs | 1 + crates/router/src/connector/klarna.rs | 5 +- .../src/connector/mifinity/transformers.rs | 1 + .../router/src/connector/nmi/transformers.rs | 1 + .../router/src/connector/noon/transformers.rs | 1 + .../src/connector/nuvei/transformers.rs | 2 + .../src/connector/opayo/transformers.rs | 1 + .../src/connector/payme/transformers.rs | 4 + .../src/connector/paypal/transformers.rs | 2 + .../src/connector/placetopay/transformers.rs | 1 + .../src/connector/stripe/transformers.rs | 5 + .../src/connector/trustpay/transformers.rs | 1 + crates/router/src/connector/utils.rs | 4 + .../src/connector/wellsfargo/transformers.rs | 2 + crates/router/src/core/admin.rs | 9 +- crates/router/src/core/payment_methods.rs | 1 + crates/router/src/core/payments.rs | 1 + crates/router/src/core/payments/helpers.rs | 14 + .../payments/operations/payment_response.rs | 1 + .../router/src/core/payments/transformers.rs | 32 ++ crates/router/src/core/payout_link.rs | 1 + crates/router/src/types/api.rs | 7 +- crates/router/src/types/transformers.rs | 3 + 94 files changed, 1058 insertions(+), 257 deletions(-) diff --git a/.typos.toml b/.typos.toml index d2ffb8a5b10..109e411884a 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 0385aa55a20..74a2bb8d2a7 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 733ba96237c..2e4133c473e 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 b705d88df59..77081f49957 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 e2b2b7fde46..817b047f38c 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 567d601c45c..29c1b81df2f 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 fe4b2c52290..9beaed75960 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 6ddc47e499f..23dbab77825 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 77ff9e8e714..f5f7ba3decd 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 923edd386de..3634fe730ca 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 b6b2e8555e3..8a763b59218 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 88997691eb6..160e938ead3 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 886b2dd7ee7..5d41efc1a50 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 d767417a043..5462c121c37 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 13e11515382..30d71090f36 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 8a8ba695e9f..24fc1e80428 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 9a7134e708a..1bfe1fa16b7 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 136cdf4d981..6c96070159b 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 da589ec3748..07ff2c4364e 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 de0b619b120..914a9444918 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 4f2e9aa3156..9f610f9e6a3 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 5345c550cd1..bb3bc399077 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 567f519d794..f0ea149b0d6 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 798f28d1f0a..05b9abae051 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 1228edcaaea..cf65b9e5dfe 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 5c59d73356f..af6486f008e 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 856736842f9..a9408e4e1c5 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 f2a6e1b6a6f..d5a7f981a1b 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 6f4f303ae8e..07562c3efbf 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 813ab8beccd..f3c3685b5c1 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 6e67409238d..2583f47058b 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 66525d49c63..5d30146293c 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 427fef3836c..4a8ddf68df9 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 3048a203d1b..180db626864 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 4149f740e76..6297b97ee98 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 d593864dbfc..b1e9c3015e8 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 707e34a158c..cda9c6b1952 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 93ba3425978..74c8d1edb38 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 674f652a933..3b2164dfc97 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 4fb48938c42..540bcaebaae 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 a8e9a7ad829..a675e3040e3 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 c867adaa23e..cd9fe63e4a7 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 b13d029185f..b8e1e99054a 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 05986631c67..89ee8d1b29b 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 b69e4bcd97b..fba589a4895 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 166e7130483..7a30a434a5d 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 8db75fe61aa..81019325113 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 81c079d5d52..6ee8926f8df 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 81c9aa6084d..14596c0f2a2 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 e5f5fad9901..9e4d6cfbec5 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 e897292d6ff..e35c4672308 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 3aaeb0586d6..89b8c5a34ad 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 c4a57830ae9..dc9274b71ee 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 7c09813ca6b..7417466bfd2 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 f0e4b1169c8..55516eeb3bc 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 58a4d95b28f..03cf9742f70 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 c6a37729459..452e388c407 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 77598f7be38..3e25799c02e 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 a82f4603944..7b491674e92 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 1c00d52a287..ec97b6ebad5 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 c9427683d88..42effdb4b4a 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 c6490cd6139..1530cbd82f8 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 6db0ddac49b..022512ea1c1 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 777b795a438..4a947284d79 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 f606e671a8d..bcef8124c65 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 686a9d57ac3..1f6b737367d 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 b99d0cb3283..c9ebba4a10d 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 e9dcfd87071..7d52e64b4b7 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 6a8fe01eede..c5c34574433 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 ec94b322fe7..fa5528eace3 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 15dfb1ce240..127f8526afe 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 07bc6bd014c..6aa9b62ed6a 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 6ff52bb7eb1..1e2c420c767 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 0ec9cc94888..4c33f020017 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 4556121db23..3e75130f575 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 209d1a7476f..121ec1d7b7c 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 44445a3d7d9..f55aa4325b0 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 2f8b78e281a..7b6b67c8408 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 3e01c614e8e..ed8369607df 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 2d1ce4771ca..d809b9e770d 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 af82bda3e6a..32fa8da0320 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 3b109a7f02e..8312b3e2659 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 a9a5a01eef6..687edd5aa23 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 1ca6c7bd968..3a2e35190e6 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 ba27e8b00db..49b16aaa3f4 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 a765c1feaa9..932a4a26ee0 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 23cb25a52d5..2d480d71fe7 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 acaccccbb17..478211ec14c 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 42c3c819fef..8fb36764c97 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 ef0c3bd0d5f..8f2280355f9 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 b175c8b7c03..31e65e8e0a7 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 985a6644524..b432c57c5d1 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 f4d8c4f06b9..c97084a2297 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()),