diff --git a/config/config.example.toml b/config/config.example.toml index e2cdf7fd3f2..5b414d7eea1 100644 --- a/config/config.example.toml +++ b/config/config.example.toml @@ -690,6 +690,11 @@ google_pay = { currency = "ARS, AUD, CAD, CLP, COP, EUR, HKD, INR, KWD, MYR, MXN samsung_pay = { currency = "USD,GBP,EUR,SEK" } paze = { currency = "USD,SEK" } +[pm_filters.barclaycard] +credit = { currency = "USD,GBP,EUR,PLN,SEK" } +debit = { currency = "USD,GBP,EUR,PLN,SEK" } +google_pay = { currency = "ARS, AUD, CAD, CLP, COP, EUR, HKD, INR, KWD, MYR, MXN, NZD, PEN, QAR, SAR, SGD, ZAR, UAH, AED, GBP, USD, PLN, SEK" } + [pm_filters.globepay] ali_pay = { country = "GB",currency = "GBP" } we_chat_pay = { country = "GB",currency = "GBP" } diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml index 9e64b7928e4..6660a1cbbea 100644 --- a/config/deployments/integration_test.toml +++ b/config/deployments/integration_test.toml @@ -496,6 +496,11 @@ google_pay = { currency = "ARS, AUD, CAD, CLP, COP, EUR, HKD, INR, KWD, MYR, MXN samsung_pay = { currency = "USD,GBP,EUR,SEK" } paze = { currency = "USD,SEK" } +[pm_filters.barclaycard] +credit = { currency = "USD,GBP,EUR,PLN,SEK" } +debit = { currency = "USD,GBP,EUR,PLN,SEK" } +google_pay = { currency = "ARS, AUD, CAD, CLP, COP, EUR, HKD, INR, KWD, MYR, MXN, NZD, PEN, QAR, SAR, SGD, ZAR, UAH, AED, GBP, USD, PLN, SEK" } + [pm_filters.itaubank] pix = { country = "BR", currency = "BRL" } diff --git a/config/deployments/production.toml b/config/deployments/production.toml index fe7041d5539..78f6e2c0671 100644 --- a/config/deployments/production.toml +++ b/config/deployments/production.toml @@ -430,6 +430,11 @@ google_pay = { currency = "ARS, AUD, CAD, CLP, COP, EUR, HKD, INR, KWD, MYR, MXN samsung_pay = { currency = "USD,GBP,EUR,SEK" } paze = { currency = "USD,SEK" } +[pm_filters.barclaycard] +credit = { currency = "USD,GBP,EUR,PLN,SEK" } +debit = { currency = "USD,GBP,EUR,PLN,SEK" } +google_pay = { currency = "ARS, AUD, CAD, CLP, COP, EUR, HKD, INR, KWD, MYR, MXN, NZD, PEN, QAR, SAR, SGD, ZAR, UAH, AED, GBP, USD, PLN, SEK" } + [pm_filters.itaubank] pix = { country = "BR", currency = "BRL" } diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml index e9f5b09c752..f5155be4e2f 100644 --- a/config/deployments/sandbox.toml +++ b/config/deployments/sandbox.toml @@ -439,6 +439,11 @@ google_pay = { currency = "ARS, AUD, CAD, CLP, COP, EUR, HKD, INR, KWD, MYR, MXN samsung_pay = { currency = "USD,GBP,EUR,SEK" } paze = { currency = "USD,SEK" } +[pm_filters.barclaycard] +credit = { currency = "USD,GBP,EUR,PLN,SEK" } +debit = { currency = "USD,GBP,EUR,PLN,SEK" } +google_pay = { currency = "ARS, AUD, CAD, CLP, COP, EUR, HKD, INR, KWD, MYR, MXN, NZD, PEN, QAR, SAR, SGD, ZAR, UAH, AED, GBP, USD, PLN, SEK" } + [pm_filters.nexixpay] credit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU,AU,BR,US", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" } debit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU,AU,BR,US", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" } diff --git a/config/development.toml b/config/development.toml index c06d9798cd3..257e857c2f7 100644 --- a/config/development.toml +++ b/config/development.toml @@ -598,6 +598,11 @@ google_pay = { currency = "ARS, AUD, CAD, CLP, COP, EUR, HKD, INR, KWD, MYR, MXN samsung_pay = { currency = "USD,GBP,EUR,SEK" } paze = { currency = "USD,SEK" } +[pm_filters.barclaycard] +credit = { currency = "USD,GBP,EUR,PLN,SEK" } +debit = { currency = "USD,GBP,EUR,PLN,SEK" } +google_pay = { currency = "ARS, AUD, CAD, CLP, COP, EUR, HKD, INR, KWD, MYR, MXN, NZD, PEN, QAR, SAR, SGD, ZAR, UAH, AED, GBP, USD, PLN, SEK" } + [pm_filters.globepay] ali_pay = { country = "GB",currency = "GBP,CNY" } diff --git a/config/docker_compose.toml b/config/docker_compose.toml index 8893834e23e..d8b310d241e 100644 --- a/config/docker_compose.toml +++ b/config/docker_compose.toml @@ -633,6 +633,11 @@ google_pay = { currency = "ARS, AUD, CAD, CLP, COP, EUR, HKD, INR, KWD, MYR, MXN samsung_pay = { currency = "USD,GBP,EUR,SEK" } paze = { currency = "USD,SEK" } +[pm_filters.barclaycard] +credit = { currency = "USD,GBP,EUR,PLN,SEK" } +debit = { currency = "USD,GBP,EUR,PLN,SEK" } +google_pay = { currency = "ARS, AUD, CAD, CLP, COP, EUR, HKD, INR, KWD, MYR, MXN, NZD, PEN, QAR, SAR, SGD, ZAR, UAH, AED, GBP, USD, PLN, SEK" } + [pm_filters.globepay] ali_pay = { country = "GB",currency = "GBP,CNY" } we_chat_pay = { country = "GB",currency = "GBP,CNY" } diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml index 2b5130aaea5..db8a914a031 100644 --- a/crates/connector_configs/toml/development.toml +++ b/crates/connector_configs/toml/development.toml @@ -1026,11 +1026,83 @@ options=["visa","masterCard","amex","discover"] payment_method_type = "CartesBancaires" [[barclaycard.debit]] payment_method_type = "UnionPay" +[[barclaycard.wallet]] + payment_method_type = "google_pay" [barclaycard.connector_auth.SignatureKey] api_key="Key" key1="Merchant ID" api_secret="Shared Secret" +[[barclaycard.metadata.google_pay]] +name = "merchant_name" +label = "Google Pay Merchant Name" +placeholder = "Enter Google Pay Merchant Name" +required = true +type = "Text" +[[barclaycard.metadata.google_pay]] +name = "merchant_id" +label = "Google Pay Merchant Id" +placeholder = "Enter Google Pay Merchant Id" +required = true +type = "Text" +[[barclaycard.metadata.google_pay]] +name = "gateway_merchant_id" +label = "Google Pay Merchant Key" +placeholder = "Enter Google Pay Merchant Key" +required = true +type = "Text" +[[barclaycard.metadata.google_pay]] +name = "allowed_auth_methods" +label = "Allowed Auth Methods" +placeholder = "Enter Allowed Auth Methods" +required = true +type = "MultiSelect" +options = ["PAN_ONLY", "CRYPTOGRAM_3DS"] + +[[barclaycard.connector_wallets_details.google_pay]] +name = "merchant_name" +label = "Google Pay Merchant Name" +placeholder = "Enter Google Pay Merchant Name" +required = true +type = "Text" +[[barclaycard.connector_wallets_details.google_pay]] +name = "merchant_id" +label = "Google Pay Merchant Id" +placeholder = "Enter Google Pay Merchant Id" +required = true +type = "Text" +[[barclaycard.connector_wallets_details.google_pay]] +name = "gateway_merchant_id" +label = "Google Pay Merchant Key" +placeholder = "Enter Google Pay Merchant Key" +required = true +type = "Text" +[[barclaycard.connector_wallets_details.google_pay]] +name = "public_key" +label = "Google Pay Public Key" +placeholder = "Enter Google Pay Public Key" +required = true +type = "Text" +[[barclaycard.connector_wallets_details.google_pay]] +name = "private_key" +label = "Google Pay Private Key" +placeholder = "Enter Google Pay Private Key" +required = true +type = "Text" +[[barclaycard.connector_wallets_details.google_pay]] +name = "recipient_id" +label = "Recipient Id" +placeholder = "Enter Recipient Id" +required = true +type = "Text" +[[barclaycard.connector_wallets_details.google_pay]] +name = "allowed_auth_methods" +label = "Allowed Auth Methods" +placeholder = "Enter Allowed Auth Methods" +required = true +type = "MultiSelect" +options = ["PAN_ONLY", "CRYPTOGRAM_3DS"] + [bitpay] [[bitpay.crypto]] payment_method_type = "crypto_currency" diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml index 2f5281162f7..1186e7a34f1 100644 --- a/crates/connector_configs/toml/production.toml +++ b/crates/connector_configs/toml/production.toml @@ -1028,11 +1028,83 @@ payment_method_type = "DinersClub" payment_method_type = "CartesBancaires" [[barclaycard.debit]] payment_method_type = "UnionPay" +[[barclaycard.wallet]] + payment_method_type = "google_pay" [barclaycard.connector_auth.SignatureKey] api_key = "Key" key1 = "Merchant ID" api_secret = "Shared Secret" +[[barclaycard.metadata.google_pay]] +name = "merchant_name" +label = "Google Pay Merchant Name" +placeholder = "Enter Google Pay Merchant Name" +required = true +type = "Text" +[[barclaycard.metadata.google_pay]] +name = "merchant_id" +label = "Google Pay Merchant Id" +placeholder = "Enter Google Pay Merchant Id" +required = true +type = "Text" +[[barclaycard.metadata.google_pay]] +name = "gateway_merchant_id" +label = "Google Pay Merchant Key" +placeholder = "Enter Google Pay Merchant Key" +required = true +type = "Text" +[[barclaycard.metadata.google_pay]] +name = "allowed_auth_methods" +label = "Allowed Auth Methods" +placeholder = "Enter Allowed Auth Methods" +required = true +type = "MultiSelect" +options = ["PAN_ONLY", "CRYPTOGRAM_3DS"] + +[[barclaycard.connector_wallets_details.google_pay]] +name = "merchant_name" +label = "Google Pay Merchant Name" +placeholder = "Enter Google Pay Merchant Name" +required = true +type = "Text" +[[barclaycard.connector_wallets_details.google_pay]] +name = "merchant_id" +label = "Google Pay Merchant Id" +placeholder = "Enter Google Pay Merchant Id" +required = true +type = "Text" +[[barclaycard.connector_wallets_details.google_pay]] +name = "gateway_merchant_id" +label = "Google Pay Merchant Key" +placeholder = "Enter Google Pay Merchant Key" +required = true +type = "Text" +[[barclaycard.connector_wallets_details.google_pay]] +name = "public_key" +label = "Google Pay Public Key" +placeholder = "Enter Google Pay Public Key" +required = true +type = "Text" +[[barclaycard.connector_wallets_details.google_pay]] +name = "private_key" +label = "Google Pay Private Key" +placeholder = "Enter Google Pay Private Key" +required = true +type = "Text" +[[barclaycard.connector_wallets_details.google_pay]] +name = "recipient_id" +label = "Recipient Id" +placeholder = "Enter Recipient Id" +required = true +type = "Text" +[[barclaycard.connector_wallets_details.google_pay]] +name = "allowed_auth_methods" +label = "Allowed Auth Methods" +placeholder = "Enter Allowed Auth Methods" +required = true +type = "MultiSelect" +options = ["PAN_ONLY", "CRYPTOGRAM_3DS"] + [cashtocode] [[cashtocode.reward]] payment_method_type = "classic" diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml index cc3c8afc666..52238493ebc 100644 --- a/crates/connector_configs/toml/sandbox.toml +++ b/crates/connector_configs/toml/sandbox.toml @@ -1026,11 +1026,83 @@ payment_method_type = "DinersClub" payment_method_type = "CartesBancaires" [[barclaycard.debit]] payment_method_type = "UnionPay" +[[barclaycard.wallet]] + payment_method_type = "google_pay" [barclaycard.connector_auth.SignatureKey] api_key = "Key" key1 = "Merchant ID" api_secret = "Shared Secret" +[[barclaycard.metadata.google_pay]] +name = "merchant_name" +label = "Google Pay Merchant Name" +placeholder = "Enter Google Pay Merchant Name" +required = true +type = "Text" +[[barclaycard.metadata.google_pay]] +name = "merchant_id" +label = "Google Pay Merchant Id" +placeholder = "Enter Google Pay Merchant Id" +required = true +type = "Text" +[[barclaycard.metadata.google_pay]] +name = "gateway_merchant_id" +label = "Google Pay Merchant Key" +placeholder = "Enter Google Pay Merchant Key" +required = true +type = "Text" +[[barclaycard.metadata.google_pay]] +name = "allowed_auth_methods" +label = "Allowed Auth Methods" +placeholder = "Enter Allowed Auth Methods" +required = true +type = "MultiSelect" +options = ["PAN_ONLY", "CRYPTOGRAM_3DS"] + +[[barclaycard.connector_wallets_details.google_pay]] +name = "merchant_name" +label = "Google Pay Merchant Name" +placeholder = "Enter Google Pay Merchant Name" +required = true +type = "Text" +[[barclaycard.connector_wallets_details.google_pay]] +name = "merchant_id" +label = "Google Pay Merchant Id" +placeholder = "Enter Google Pay Merchant Id" +required = true +type = "Text" +[[barclaycard.connector_wallets_details.google_pay]] +name = "gateway_merchant_id" +label = "Google Pay Merchant Key" +placeholder = "Enter Google Pay Merchant Key" +required = true +type = "Text" +[[barclaycard.connector_wallets_details.google_pay]] +name = "public_key" +label = "Google Pay Public Key" +placeholder = "Enter Google Pay Public Key" +required = true +type = "Text" +[[barclaycard.connector_wallets_details.google_pay]] +name = "private_key" +label = "Google Pay Private Key" +placeholder = "Enter Google Pay Private Key" +required = true +type = "Text" +[[barclaycard.connector_wallets_details.google_pay]] +name = "recipient_id" +label = "Recipient Id" +placeholder = "Enter Recipient Id" +required = true +type = "Text" +[[barclaycard.connector_wallets_details.google_pay]] +name = "allowed_auth_methods" +label = "Allowed Auth Methods" +placeholder = "Enter Allowed Auth Methods" +required = true +type = "MultiSelect" +options = ["PAN_ONLY", "CRYPTOGRAM_3DS"] + [bitpay] [[bitpay.crypto]] payment_method_type = "crypto_currency" diff --git a/crates/hyperswitch_connectors/src/connectors/barclaycard.rs b/crates/hyperswitch_connectors/src/connectors/barclaycard.rs index 950b985fa68..8448855ac1e 100644 --- a/crates/hyperswitch_connectors/src/connectors/barclaycard.rs +++ b/crates/hyperswitch_connectors/src/connectors/barclaycard.rs @@ -1003,19 +1003,30 @@ static BARCLAYCARD_SUPPORTED_PAYMENT_METHODS: LazyLock PaymentMethodDetails { mandates: enums::FeatureStatus::NotSupported, refunds: enums::FeatureStatus::Supported, - supported_capture_methods, + supported_capture_methods: supported_capture_methods.clone(), specific_features: Some( api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({ api_models::feature_matrix::CardSpecificFeatures { three_ds: common_enums::FeatureStatus::NotSupported, no_three_ds: common_enums::FeatureStatus::Supported, - supported_card_networks: supported_card_network, + supported_card_networks: supported_card_network.clone(), } }), ), }, ); + barclaycard_supported_payment_methods.add( + enums::PaymentMethod::Wallet, + enums::PaymentMethodType::GooglePay, + PaymentMethodDetails { + mandates: enums::FeatureStatus::NotSupported, + refunds: enums::FeatureStatus::Supported, + supported_capture_methods, + specific_features: None, + }, + ); + barclaycard_supported_payment_methods }); diff --git a/crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs b/crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs index d66782b093c..f519d96e884 100644 --- a/crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs @@ -1,7 +1,8 @@ +use base64::Engine; use common_enums::enums; -use common_utils::pii; +use common_utils::{consts, pii}; use hyperswitch_domain_models::{ - payment_method_data::PaymentMethodData, + payment_method_data::{GooglePayWalletData, PaymentMethodData, WalletData}, router_data::{ AdditionalPaymentMethodConnectorResponse, ConnectorAuthType, ConnectorResponseData, ErrorResponse, RouterData, @@ -99,6 +100,7 @@ pub struct BarclaycardPaymentsRequest { pub struct ProcessingInformation { commerce_indicator: String, capture: Option, + payment_solution: Option, } #[derive(Debug, Serialize)] @@ -125,10 +127,17 @@ pub struct CardPaymentInformation { card: Card, } +#[derive(Debug, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct GooglePayPaymentInformation { + fluid_data: FluidData, +} + #[derive(Debug, Serialize)] #[serde(untagged)] pub enum PaymentInformation { Cards(Box), + GooglePay(Box), } #[derive(Debug, Serialize)] @@ -142,6 +151,12 @@ pub struct Card { card_type: Option, } +#[derive(Debug, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct FluidData { + value: Secret, +} + #[derive(Debug, Serialize)] #[serde(rename_all = "camelCase")] pub struct OrderInformationWithBill { @@ -159,55 +174,48 @@ pub struct Amount { #[derive(Debug, Serialize)] #[serde(rename_all = "camelCase")] pub struct BillTo { - first_name: Option>, - last_name: Option>, - address1: Option>, - locality: Option, - #[serde(skip_serializing_if = "Option::is_none")] - administrative_area: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - postal_code: Option>, - country: Option, + first_name: Secret, + last_name: Secret, + address1: Secret, + locality: String, + administrative_area: Secret, + postal_code: Secret, + country: enums::CountryAlpha2, email: pii::Email, } +fn truncate_string(state: &Secret, max_len: usize) -> Secret { + let exposed = state.clone().expose(); + let truncated = exposed.get(..max_len).unwrap_or(&exposed); + Secret::new(truncated.to_string()) +} + fn build_bill_to( - address_details: Option<&hyperswitch_domain_models::address::Address>, + address_details: &hyperswitch_domain_models::address::AddressDetails, email: pii::Email, ) -> Result> { - let default_address = BillTo { - first_name: None, - last_name: None, - address1: None, - locality: None, - administrative_area: None, - postal_code: None, - country: None, - email: email.clone(), - }; - - Ok(address_details - .and_then(|addr| { - addr.address.as_ref().map(|addr| { - let administrative_area = addr.to_state_code_as_optional().unwrap_or_else(|_| { - addr.state - .clone() - .map(|state| Secret::new(format!("{:.20}", state.expose()))) - }); - - BillTo { - first_name: addr.first_name.clone(), - last_name: addr.last_name.clone(), - address1: addr.line1.clone(), - locality: addr.city.clone(), - administrative_area, - postal_code: addr.zip.clone(), - country: addr.country, - email, - } - }) + let administrative_area = address_details + .to_state_code_as_optional() + .unwrap_or_else(|_| { + address_details + .get_state() + .ok() + .map(|state| truncate_string(state, 20)) }) - .unwrap_or(default_address)) + .ok_or_else(|| errors::ConnectorError::MissingRequiredField { + field_name: "billing_address.state", + })?; + + Ok(BillTo { + first_name: address_details.get_first_name()?.clone(), + last_name: address_details.get_last_name()?.clone(), + address1: address_details.get_line1()?.clone(), + locality: address_details.get_city()?.clone(), + administrative_area, + postal_code: address_details.get_zip()?.clone(), + country: address_details.get_country()?.to_owned(), + email, + }) } fn get_barclaycard_card_type(card_network: common_enums::CardNetwork) -> Option<&'static str> { @@ -231,6 +239,20 @@ fn get_barclaycard_card_type(card_network: common_enums::CardNetwork) -> Option< } } +#[derive(Debug, Serialize)] +pub enum PaymentSolution { + GooglePay, +} + +impl From for String { + fn from(solution: PaymentSolution) -> Self { + let payment_solution = match solution { + PaymentSolution::GooglePay => "012", + }; + payment_solution.to_string() + } +} + impl From<( &BarclaycardRouterData<&PaymentsAuthorizeRouterData>, @@ -256,14 +278,16 @@ impl impl TryFrom<( &BarclaycardRouterData<&PaymentsAuthorizeRouterData>, + Option, Option, )> for ProcessingInformation { type Error = error_stack::Report; fn try_from( - (item, network): ( + (item, solution, network): ( &BarclaycardRouterData<&PaymentsAuthorizeRouterData>, + Option, Option, ), ) -> Result { @@ -274,6 +298,7 @@ impl item.router_data.request.capture_method, Some(enums::CaptureMethod::Automatic) | None )), + payment_solution: solution.map(String::from), commerce_indicator, }) } @@ -432,10 +457,48 @@ impl }; let email = item.router_data.request.get_email()?; - let bill_to = build_bill_to(item.router_data.get_optional_billing(), email)?; + let bill_to = build_bill_to(item.router_data.get_billing_address()?, email)?; let order_information = OrderInformationWithBill::from((item, Some(bill_to))); let payment_information = PaymentInformation::try_from(&ccard)?; - let processing_information = ProcessingInformation::try_from((item, None))?; + let processing_information = ProcessingInformation::try_from((item, None, None))?; + let client_reference_information = ClientReferenceInformation::from(item); + let merchant_defined_information = item + .router_data + .request + .metadata + .clone() + .map(convert_metadata_to_merchant_defined_info); + + Ok(Self { + processing_information, + payment_information, + order_information, + client_reference_information, + merchant_defined_information, + consumer_authentication_information: None, + }) + } +} + +impl + TryFrom<( + &BarclaycardRouterData<&PaymentsAuthorizeRouterData>, + GooglePayWalletData, + )> for BarclaycardPaymentsRequest +{ + type Error = error_stack::Report; + fn try_from( + (item, google_pay_data): ( + &BarclaycardRouterData<&PaymentsAuthorizeRouterData>, + GooglePayWalletData, + ), + ) -> Result { + let email = item.router_data.request.get_email()?; + let bill_to = build_bill_to(item.router_data.get_billing_address()?, email)?; + let order_information = OrderInformationWithBill::from((item, Some(bill_to))); + let payment_information = PaymentInformation::from(&google_pay_data); + let processing_information = + ProcessingInformation::try_from((item, Some(PaymentSolution::GooglePay), None))?; let client_reference_information = ClientReferenceInformation::from(item); let merchant_defined_information = item .router_data @@ -462,8 +525,45 @@ impl TryFrom<&BarclaycardRouterData<&PaymentsAuthorizeRouterData>> for Barclayca ) -> Result { match item.router_data.request.payment_method_data.clone() { PaymentMethodData::Card(ccard) => Self::try_from((item, ccard)), - PaymentMethodData::Wallet(_) - | PaymentMethodData::MandatePayment + PaymentMethodData::Wallet(wallet_data) => match wallet_data { + WalletData::GooglePay(google_pay_data) => Self::try_from((item, google_pay_data)), + WalletData::AliPayQr(_) + | WalletData::AliPayRedirect(_) + | WalletData::AliPayHkRedirect(_) + | WalletData::AmazonPayRedirect(_) + | WalletData::ApplePay(_) + | WalletData::MomoRedirect(_) + | WalletData::KakaoPayRedirect(_) + | WalletData::GoPayRedirect(_) + | WalletData::GcashRedirect(_) + | WalletData::ApplePayRedirect(_) + | WalletData::ApplePayThirdPartySdk(_) + | WalletData::DanaRedirect {} + | WalletData::GooglePayRedirect(_) + | WalletData::GooglePayThirdPartySdk(_) + | WalletData::MbWayRedirect(_) + | WalletData::MobilePayRedirect(_) + | WalletData::PaypalRedirect(_) + | WalletData::PaypalSdk(_) + | WalletData::Paze(_) + | WalletData::RevolutPay(_) + | WalletData::SamsungPay(_) + | WalletData::TwintRedirect {} + | WalletData::VippsRedirect {} + | WalletData::TouchNGoRedirect(_) + | WalletData::WeChatPayRedirect(_) + | WalletData::WeChatPayQr(_) + | WalletData::CashappQr(_) + | WalletData::SwishQr(_) + | WalletData::Paysera(_) + | WalletData::Skrill(_) + | WalletData::BluecodeRedirect {} + | WalletData::Mifinity(_) => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Barclaycard"), + ) + .into()), + }, + PaymentMethodData::MandatePayment | PaymentMethodData::CardRedirect(_) | PaymentMethodData::PayLater(_) | PaymentMethodData::BankRedirect(_) @@ -1575,6 +1675,18 @@ impl TryFrom<&hyperswitch_domain_models::payment_method_data::Card> for PaymentI } } +impl From<&GooglePayWalletData> for PaymentInformation { + fn from(google_pay_data: &GooglePayWalletData) -> Self { + Self::GooglePay(Box::new(GooglePayPaymentInformation { + fluid_data: FluidData { + value: Secret::from( + consts::BASE64_ENGINE.encode(google_pay_data.tokenization_data.token.clone()), + ), + }, + })) + } +} + fn get_commerce_indicator(network: Option) -> String { match network { Some(card_network) => match card_network.to_lowercase().as_str() { diff --git a/crates/payment_methods/src/configs/payment_connector_required_fields.rs b/crates/payment_methods/src/configs/payment_connector_required_fields.rs index 875813f4e10..1d7f081c6d8 100644 --- a/crates/payment_methods/src/configs/payment_connector_required_fields.rs +++ b/crates/payment_methods/src/configs/payment_connector_required_fields.rs @@ -1242,6 +1242,14 @@ fn get_cards_required_fields() -> HashMap { [card_basic(), email(), full_name(), billing_address()].concat(), ), ), + ( + Connector::Barclaycard, + fields( + vec![], + vec![], + [card_basic(), full_name(), billing_address()].concat(), + ), + ), (Connector::Billwerk, fields(vec![], vec![], card_basic())), ( Connector::Bluesnap, @@ -2408,6 +2416,10 @@ fn get_wallet_required_fields() -> HashMap