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
refactor(core): introduce new field `cardFundingSource` to `GooglePayPaymentMethodData` (#9571)
Pa1NarKdaad946eb57d
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.jsonindex 8b38587077..9e18f37167 100644--- a/api-reference/v1/openapi_spec_v1.json+++ b/api-reference/v1/openapi_spec_v1.json@@ -16163,6 +16163,15 @@}}},+ "GooglePayCardFundingSource": {+ "type": "string",+ "enum": [+ "CREDIT",+ "DEBIT",+ "PREPAID",+ "UNKNOWN"+ ]+ },"GooglePayPaymentMethodInfo": {"type": "object","required": [@@ -16185,6 +16194,14 @@}],"nullable": true+ },+ "card_funding_source": {+ "allOf": [+ {+ "$ref": "#/components/schemas/GooglePayCardFundingSource"+ }+ ],+ "nullable": true}}},diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.jsonindex b38b5139be..3667161425 100644--- a/api-reference/v2/openapi_spec_v2.json+++ b/api-reference/v2/openapi_spec_v2.json@@ -12366,6 +12366,15 @@}}},+ "GooglePayCardFundingSource": {+ "type": "string",+ "enum": [+ "CREDIT",+ "DEBIT",+ "PREPAID",+ "UNKNOWN"+ ]+ },"GooglePayPaymentMethodInfo": {"type": "object","required": [@@ -12388,6 +12397,14 @@}],"nullable": true+ },+ "card_funding_source": {+ "allOf": [+ {+ "$ref": "#/components/schemas/GooglePayCardFundingSource"+ }+ ],+ "nullable": true}}},diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rsindex 5f38ee86f9..f0fa9ab13a 100644--- a/crates/api_models/src/payments.rs+++ b/crates/api_models/src/payments.rs@@ -9,7 +9,7 @@ pub mod trait_impls;use cards::CardNumber;#[cfg(feature = "v2")]use common_enums::enums::PaymentConnectorTransmission;-use common_enums::ProductType;+use common_enums::{GooglePayCardFundingSource, ProductType};#[cfg(feature = "v1")]use common_types::primitive_wrappers::{ExtendedAuthorizationAppliedBool, RequestExtendedAuthorizationBool,@@ -4289,6 +4289,8 @@ pub struct GooglePayPaymentMethodInfo {pub card_details: String,//assurance_details of the cardpub assurance_details: Option<GooglePayAssuranceDetails>,+ /// Card funding source for the selected payment method+ pub card_funding_source: Option<GooglePayCardFundingSource>,}#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rsindex 529bb649cc..e6e71abff7 100644--- a/crates/common_enums/src/enums.rs+++ b/crates/common_enums/src/enums.rs@@ -9560,3 +9560,13 @@ pub enum ExternalVaultEnabled {#[default]Skip,}++#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]+#[serde(rename_all = "UPPERCASE")]+pub enum GooglePayCardFundingSource {+ Credit,+ Debit,+ Prepaid,+ #[serde(other)]+ Unknown,+}diff --git a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rsindex ccbacedfeb..8fe123f5e3 100644--- a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs@@ -1,4 +1,4 @@-use common_enums::{enums, CaptureMethod, FutureUsage, PaymentChannel};+use common_enums::{enums, CaptureMethod, FutureUsage, GooglePayCardFundingSource, PaymentChannel};use common_types::{payments::{ApplePayPaymentData, ApplePayPredecryptData, GPayPredecryptData, GpayTokenizationData,@@ -1081,6 +1081,7 @@ struct GooglePayInfoCamelCase {card_network: Secret<String>,card_details: Secret<String>,assurance_details: Option<GooglePayAssuranceDetailsCamelCase>,+ card_funding_source: Option<GooglePayCardFundingSource>,}#[derive(Debug, Serialize)]#[serde(rename_all = "camelCase")]@@ -1209,6 +1210,7 @@ where.card_holder_authenticated,account_verified: details.account_verified,}),+ card_funding_source: gpay_data.info.card_funding_source.clone(),},tokenization_data: GooglePayTokenizationDataCamelCase {token_type: token_type.into(),diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rsindex fd3e68f801..b1ad3ac295 100644--- a/crates/hyperswitch_connectors/src/utils.rs+++ b/crates/hyperswitch_connectors/src/utils.rs@@ -51,7 +51,10 @@ use hyperswitch_domain_models::{address::{Address, AddressDetails, PhoneDetails},mandates,network_tokenization::NetworkTokenNumber,- payment_method_data::{self, Card, CardDetailsForNetworkTransactionId, PaymentMethodData},+ payment_method_data::{+ self, Card, CardDetailsForNetworkTransactionId, GooglePayPaymentMethodInfo,+ PaymentMethodData,+ },router_data::{ErrorResponse, L2L3Data, PaymentMethodToken, RecurringMandatePaymentData,RouterData as ConnectorRouterData,@@ -238,13 +241,6 @@ pub struct GooglePayWalletData {pub tokenization_data: common_types::payments::GpayTokenizationData,}-#[derive(Clone, Debug, serde::Serialize)]-#[serde(rename_all = "camelCase")]-pub struct GooglePayPaymentMethodInfo {- pub card_network: String,- pub card_details: String,-}-#[derive(Debug, Serialize)]pub struct CardMandateInfo {pub card_exp_month: Secret<String>,@@ -277,6 +273,8 @@ impl TryFrom<payment_method_data::GooglePayWalletData> for GooglePayWalletData {info: GooglePayPaymentMethodInfo {card_network: data.info.card_network,card_details: data.info.card_details,+ assurance_details: data.info.assurance_details,+ card_funding_source: data.info.card_funding_source,},tokenization_data,})diff --git a/crates/hyperswitch_domain_models/src/payment_method_data.rs b/crates/hyperswitch_domain_models/src/payment_method_data.rsindex 6bc9062eea..7046bb18c2 100644--- a/crates/hyperswitch_domain_models/src/payment_method_data.rs+++ b/crates/hyperswitch_domain_models/src/payment_method_data.rs@@ -6,7 +6,7 @@ use api_models::{payment_methods::{self},payments::{additional_info as payment_additional_types, ExtendedCardInfo},};-use common_enums::enums as api_enums;+use common_enums::{enums as api_enums, GooglePayCardFundingSource};use common_utils::{ext_traits::{OptionExt, StringExt},id_type,@@ -468,8 +468,10 @@ pub struct GooglePayPaymentMethodInfo {pub card_network: String,/// The details of the cardpub card_details: String,- //assurance_details of the card+ /// assurance_details of the cardpub assurance_details: Option<GooglePayAssuranceDetails>,+ /// Card funding source for the selected payment method+ pub card_funding_source: Option<GooglePayCardFundingSource>,}#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]@@ -1265,6 +1267,7 @@ impl From<api_models::payments::GooglePayWalletData> for GooglePayWalletData {account_verified: info.account_verified,}}),+ card_funding_source: value.info.card_funding_source,},tokenization_data: value.tokenization_data,}diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rsindex e52daa7fed..2759bfc6e1 100644--- a/crates/openapi/src/openapi.rs+++ b/crates/openapi/src/openapi.rs@@ -382,6 +382,7 @@ Never share your secret api keys. Keep them guarded and secure.api_models::enums::OrganizationType,api_models::enums::PaymentLinkShowSdkTerms,api_models::enums::ExternalVaultEnabled,+ api_models::enums::GooglePayCardFundingSource,api_models::enums::VaultSdk,api_models::admin::ExternalVaultConnectorDetails,api_models::admin::MerchantConnectorCreate,diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rsindex 6ea50cb85f..f4c1944931 100644--- a/crates/openapi/src/openapi_v2.rs+++ b/crates/openapi/src/openapi_v2.rs@@ -334,6 +334,7 @@ Never share your secret api keys. Keep them guarded and secure.api_models::enums::PaymentLinkSdkLabelType,api_models::enums::PaymentLinkShowSdkTerms,api_models::enums::OrganizationType,+ api_models::enums::GooglePayCardFundingSource,api_models::admin::MerchantConnectorCreate,api_models::admin::AdditionalMerchantData,api_models::admin::CardTestingGuardConfig,diff --git a/crates/router/tests/connectors/payu.rs b/crates/router/tests/connectors/payu.rsindex 585a5a10f1..17278bf5e1 100644--- a/crates/router/tests/connectors/payu.rs+++ b/crates/router/tests/connectors/payu.rs@@ -1,3 +1,4 @@+use common_enums::GooglePayCardFundingSource;use masking::PeekInterface;use router::types::{self, domain, storage::enums, AccessToken, ConnectorAuthType};@@ -97,6 +98,7 @@ async fn should_authorize_gpay_payment() {card_network: "VISA".to_string(),card_details: "1234".to_string(),assurance_details: None,+ card_funding_source: Some(GooglePayCardFundingSource::Unknown),},tokenization_data: common_types::payments::GpayTokenizationData::Encrypted(common_types::payments::GpayEcryptedTokenizationData {diff --git a/crates/router/tests/connectors/worldpay.rs b/crates/router/tests/connectors/worldpay.rsindex 2c792337b1..022d0862cb 100644--- a/crates/router/tests/connectors/worldpay.rs+++ b/crates/router/tests/connectors/worldpay.rs@@ -1,3 +1,4 @@+use common_enums::GooglePayCardFundingSource;use futures::future::OptionFuture;use router::types::{self, domain, storage::enums};use serde_json::json;@@ -70,6 +71,7 @@ async fn should_authorize_gpay_payment() {card_network: "VISA".to_string(),card_details: "1234".to_string(),assurance_details: None,+ card_funding_source: Some(GooglePayCardFundingSource::Unknown),},tokenization_data: common_types::payments::GpayTokenizationData::Encrypted(common_types::payments::GpayEcryptedTokenizationData {