Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
feat(connector): [tesouro] google pay (#9706)
Pa1NarK916444b0182c
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.tomlindex 480991d227..6fa379821d 100644--- a/crates/connector_configs/toml/development.toml+++ b/crates/connector_configs/toml/development.toml@@ -7312,7 +7312,9 @@ payment_method_type = "JCB"payment_method_type = "Maestro"[[tesouro.wallet]]payment_method_type = "apple_pay"-+[[tesouro.wallet]]+ payment_method_type = "google_pay"+[tesouro.connector_auth.SignatureKey]api_key = "Client ID"api_secret = "Client Secret"diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.tomlindex fc54ac0411..32f3c61d73 100644--- a/crates/connector_configs/toml/production.toml+++ b/crates/connector_configs/toml/production.toml@@ -6048,6 +6048,8 @@ payment_method_type = "JCB"payment_method_type = "Maestro"[[tesouro.wallet]]payment_method_type = "apple_pay"+[[tesouro.wallet]]+ payment_method_type = "google_pay"[tesouro.connector_auth.SignatureKey]api_key = "Client ID"diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.tomlindex 5b97befb34..9435e3eae8 100644--- a/crates/connector_configs/toml/sandbox.toml+++ b/crates/connector_configs/toml/sandbox.toml@@ -7291,7 +7291,9 @@ payment_method_type = "JCB"payment_method_type = "Maestro"[[tesouro.wallet]]payment_method_type = "apple_pay"-+[[tesouro.wallet]]+ payment_method_type = "google_pay"+[tesouro.connector_auth.SignatureKey]api_key = "Client ID"api_secret = "Client Secret"diff --git a/crates/hyperswitch_connectors/src/connectors/tesouro.rs b/crates/hyperswitch_connectors/src/connectors/tesouro.rsindex f8298e3cf7..2180fc0c42 100644--- a/crates/hyperswitch_connectors/src/connectors/tesouro.rs+++ b/crates/hyperswitch_connectors/src/connectors/tesouro.rs@@ -905,6 +905,17 @@ static TESOURO_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> = La},);+ tesouro_supported_payment_methods.add(+ enums::PaymentMethod::Wallet,+ enums::PaymentMethodType::GooglePay,+ PaymentMethodDetails {+ mandates: enums::FeatureStatus::NotSupported,+ refunds: enums::FeatureStatus::Supported,+ supported_capture_methods: supported_capture_methods.clone(),+ specific_features: None,+ },+ );+tesouro_supported_payment_methods});diff --git a/crates/hyperswitch_connectors/src/connectors/tesouro/transformers.rs b/crates/hyperswitch_connectors/src/connectors/tesouro/transformers.rsindex 83afb66904..f7bdc0fedc 100644--- a/crates/hyperswitch_connectors/src/connectors/tesouro/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/tesouro/transformers.rs@@ -1,9 +1,11 @@use common_enums::enums;-use common_types::payments::ApplePayPredecryptData;+use common_types::payments::{ApplePayPredecryptData, GPayPredecryptData};use common_utils::types::FloatMajorUnit;use error_stack::ResultExt;use hyperswitch_domain_models::{- payment_method_data::{ApplePayWalletData, Card, PaymentMethodData, WalletData},+ payment_method_data::{+ ApplePayWalletData, Card, GooglePayWalletData, PaymentMethodData, WalletData,+ },router_data::{AccessToken, ConnectorAuthType, ErrorResponse, PaymentMethodToken, RouterData},router_flow_types::refunds::{Execute, RSync},router_request_types::{@@ -464,6 +466,26 @@ fn get_apple_pay_data(}}+fn get_goole_pay_data(+ google_pay_wallet_data: &GooglePayWalletData,+ payment_method_token: Option<&PaymentMethodToken>,+) -> Result<GPayPredecryptData, error_stack::Report<errors::ConnectorError>> {+ if let Some(PaymentMethodToken::GooglePayDecrypt(decrypted_data)) = payment_method_token {+ return Ok(*decrypted_data.clone());+ }++ match &google_pay_wallet_data.tokenization_data {+ common_types::payments::GpayTokenizationData::Decrypted(decrypted_data) => {+ Ok(decrypted_data.clone())+ }+ common_types::payments::GpayTokenizationData::Encrypted(_) => {+ Err(errors::ConnectorError::MissingRequiredField {+ field_name: "decrypted google pay data",+ })?+ }+ }+}+impl TryFrom<(&ApplePayWalletData, Option<&PaymentMethodToken>)> for TesouroPaymentMethodDetails {type Error = error_stack::Report<errors::ConnectorError>;fn try_from(@@ -484,6 +506,34 @@ impl TryFrom<(&ApplePayWalletData, Option<&PaymentMethodToken>)> for TesouroPaym}}+impl TryFrom<(&GooglePayWalletData, Option<&PaymentMethodToken>)> for TesouroPaymentMethodDetails {+ type Error = error_stack::Report<errors::ConnectorError>;+ fn try_from(+ (wallet_data, payment_method_token): (&GooglePayWalletData, Option<&PaymentMethodToken>),+ ) -> Result<Self, Self::Error> {+ let google_pay_data = get_goole_pay_data(wallet_data, payment_method_token)?;++ let network_token_details = TesouroNetworkTokenPassThroughDetails {+ expiration_year: google_pay_data+ .get_four_digit_expiry_year()+ .change_context(errors::ConnectorError::InvalidWalletToken {+ wallet_name: "Google Pay".to_string(),+ })?,+ cryptogram: google_pay_data.cryptogram.ok_or(+ errors::ConnectorError::MissingRequiredField {+ field_name: "google pay data cryptogram",+ },+ )?,+ token_value: google_pay_data.application_primary_account_number,+ expiration_month: google_pay_data.card_exp_month,+ ecommerce_indicator: google_pay_data.eci_indicator,+ wallet_type: TesouroWalletType::GooglePay,+ };++ Ok(Self::NetworkTokenPassThroughDetails(network_token_details))+ }+}+pub struct TesouroCaptureData {automatic_capture: TesouroAutomaticCapture,authorization_intent: TesouroAuthorizationIntent,@@ -553,6 +603,13 @@ impl TryFrom<&TesouroRouterData<&PaymentsAuthorizeRouterData>> for TesouroAuthorpayment_method_token,))}+ WalletData::GooglePay(google_pay_wallet_data) => {+ let payment_method_token = item.router_data.payment_method_token.as_ref();+ TesouroPaymentMethodDetails::try_from((+ google_pay_wallet_data,+ payment_method_token,+ ))+ }WalletData::AliPayQr(_)| WalletData::AliPayRedirect(_)| WalletData::AliPayHkRedirect(_)@@ -569,7 +626,6 @@ impl TryFrom<&TesouroRouterData<&PaymentsAuthorizeRouterData>> for TesouroAuthor| WalletData::ApplePayThirdPartySdk(_)| WalletData::DanaRedirect {}| WalletData::GooglePayRedirect(_)- | WalletData::GooglePay(_)| WalletData::GooglePayThirdPartySdk(_)| WalletData::MbWayRedirect(_)| WalletData::MobilePayRedirect(_)