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(pm_auth): Added pm_auth_config to merchant_connector_account (#2183)
Sarthak Soniabfdea20b06a
diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rsindex 94d7c5b4a8..a1b13c5ff3 100644--- a/crates/api_models/src/admin.rs+++ b/crates/api_models/src/admin.rs@@ -633,6 +633,8 @@ pub struct MerchantConnectorCreate {pub connector_webhook_details: Option<MerchantConnectorWebhookDetails>,/// Identifier for the business profile, if not provided default will be chosen from merchant accountpub profile_id: Option<String>,++ pub pm_auth_config: Option<serde_json::Value>,}#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]@@ -736,6 +738,8 @@ pub struct MerchantConnectorResponse {pub profile_id: Option<String>,/// identifier for the verified domains of a particular connector accountpub applepay_verified_domains: Option<Vec<String>>,++ pub pm_auth_config: Option<serde_json::Value>,}/// Create a new Merchant Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialized services like Fraud / Accounting etc."@@ -805,6 +809,8 @@ pub struct MerchantConnectorUpdate {}}))]pub connector_webhook_details: Option<MerchantConnectorWebhookDetails>,++ pub pm_auth_config: Option<serde_json::Value>,}///Details of FrmConfigs are mentioned here... it should be passed in payment connector create api call, and stored in merchant_connector_tablediff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rsindex 779a4f05dd..c693ea57fc 100644--- a/crates/common_enums/src/enums.rs+++ b/crates/common_enums/src/enums.rs@@ -208,6 +208,8 @@ pub enum ConnectorType {NonBankingFinance,/// Acquirers, Gateways etcPayoutProcessor,+ /// PaymentMethods Auth Services+ PaymentMethodAuth,}#[allow(clippy::upper_case_acronyms)]diff --git a/crates/diesel_models/src/merchant_connector_account.rs b/crates/diesel_models/src/merchant_connector_account.rsindex cd5b66f523..ce2684c937 100644--- a/crates/diesel_models/src/merchant_connector_account.rs+++ b/crates/diesel_models/src/merchant_connector_account.rs@@ -41,6 +41,7 @@ pub struct MerchantConnectorAccount {pub profile_id: Option<String>,#[diesel(deserialize_as = super::OptionalDieselArray<String>)]pub applepay_verified_domains: Option<Vec<String>>,+ pub pm_auth_config: Option<serde_json::Value>,}#[derive(Clone, Debug, Insertable, router_derive::DebugAsDisplay)]@@ -68,6 +69,7 @@ pub struct MerchantConnectorAccountNew {pub profile_id: Option<String>,#[diesel(deserialize_as = super::OptionalDieselArray<String>)]pub applepay_verified_domains: Option<Vec<String>>,+ pub pm_auth_config: Option<serde_json::Value>,}#[derive(Clone, Debug, AsChangeset, router_derive::DebugAsDisplay)]@@ -89,6 +91,7 @@ pub struct MerchantConnectorAccountUpdateInternal {pub frm_config: Option<Vec<Secret<serde_json::Value>>>,#[diesel(deserialize_as = super::OptionalDieselArray<String>)]pub applepay_verified_domains: Option<Vec<String>>,+ pub pm_auth_config: Option<serde_json::Value>,}impl MerchantConnectorAccountUpdateInternal {@@ -110,6 +113,7 @@ impl MerchantConnectorAccountUpdateInternal {payment_methods_enabled: self.payment_methods_enabled,frm_config: self.frm_config,modified_at: self.modified_at.unwrap_or(source.modified_at),+ pm_auth_config: self.pm_auth_config,..source}diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rsindex 8d84475ddd..3a6e2cd2a9 100644--- a/crates/diesel_models/src/schema.rs+++ b/crates/diesel_models/src/schema.rs@@ -476,6 +476,7 @@ diesel::table! {#[max_length = 64]profile_id -> Nullable<Varchar>,applepay_verified_domains -> Nullable<Array<Nullable<Text>>>,+ pm_auth_config -> Nullable<Jsonb>,}}diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rsindex a6847968c2..fab416c431 100644--- a/crates/router/src/core/admin.rs+++ b/crates/router/src/core/admin.rs@@ -682,6 +682,7 @@ pub async fn create_payment_connector(},profile_id: Some(profile_id.clone()),applepay_verified_domains: None,+ pm_auth_config: req.pm_auth_config.clone(),};let mca = state@@ -847,6 +848,7 @@ pub async fn update_payment_connector(None => None,},applepay_verified_domains: None,+ pm_auth_config: req.pm_auth_config,};let updated_mca = dbdiff --git a/crates/router/src/core/verification/utils.rs b/crates/router/src/core/verification/utils.rsindex 36bf4b7d71..056cc8c2e5 100644--- a/crates/router/src/core/verification/utils.rs+++ b/crates/router/src/core/verification/utils.rs@@ -58,6 +58,7 @@ pub async fn check_existence_and_add_domain_to_db(frm_configs: None,connector_webhook_details: None,applepay_verified_domains: Some(already_verified_domains.clone()),+ pm_auth_config: None,};state.storediff --git a/crates/router/src/db/merchant_connector_account.rs b/crates/router/src/db/merchant_connector_account.rsindex e6377ea265..491e5b7881 100644--- a/crates/router/src/db/merchant_connector_account.rs+++ b/crates/router/src/db/merchant_connector_account.rs@@ -650,6 +650,7 @@ impl MerchantConnectorAccountInterface for MockDb {connector_webhook_details: t.connector_webhook_details,profile_id: t.profile_id,applepay_verified_domains: t.applepay_verified_domains,+ pm_auth_config: t.pm_auth_config,};accounts.push(account.clone());account@@ -845,6 +846,7 @@ mod merchant_connector_account_cache_tests {connector_webhook_details: None,profile_id: Some(profile_id.to_string()),applepay_verified_domains: None,+ pm_auth_config: None,};db.insert_merchant_connector_account(mca.clone(), &merchant_key)diff --git a/crates/router/src/types/domain/merchant_connector_account.rs b/crates/router/src/types/domain/merchant_connector_account.rsindex 7c23890345..a8dce1e6f0 100644--- a/crates/router/src/types/domain/merchant_connector_account.rs+++ b/crates/router/src/types/domain/merchant_connector_account.rs@@ -34,6 +34,7 @@ pub struct MerchantConnectorAccount {pub connector_webhook_details: Option<pii::SecretSerdeValue>,pub profile_id: Option<String>,pub applepay_verified_domains: Option<Vec<String>>,+ pub pm_auth_config: Option<serde_json::Value>,}#[derive(Debug)]@@ -51,6 +52,7 @@ pub enum MerchantConnectorAccountUpdate {frm_configs: Option<Vec<Secret<serde_json::Value>>>,connector_webhook_details: Option<pii::SecretSerdeValue>,applepay_verified_domains: Option<Vec<String>>,+ pm_auth_config: Option<serde_json::Value>,},}@@ -85,6 +87,7 @@ impl behaviour::Conversion for MerchantConnectorAccount {connector_webhook_details: self.connector_webhook_details,profile_id: self.profile_id,applepay_verified_domains: self.applepay_verified_domains,+ pm_auth_config: self.pm_auth_config,},)}@@ -123,6 +126,7 @@ impl behaviour::Conversion for MerchantConnectorAccount {connector_webhook_details: other.connector_webhook_details,profile_id: other.profile_id,applepay_verified_domains: other.applepay_verified_domains,+ pm_auth_config: other.pm_auth_config,})}@@ -149,6 +153,7 @@ impl behaviour::Conversion for MerchantConnectorAccount {connector_webhook_details: self.connector_webhook_details,profile_id: self.profile_id,applepay_verified_domains: self.applepay_verified_domains,+ pm_auth_config: self.pm_auth_config,})}}@@ -169,6 +174,7 @@ impl From<MerchantConnectorAccountUpdate> for MerchantConnectorAccountUpdateIntefrm_configs,connector_webhook_details,applepay_verified_domains,+ pm_auth_config,} => Self {merchant_id,connector_type,@@ -184,6 +190,7 @@ impl From<MerchantConnectorAccountUpdate> for MerchantConnectorAccountUpdateIntemodified_at: Some(common_utils::date_time::now()),connector_webhook_details,applepay_verified_domains,+ pm_auth_config,},}}diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rsindex 5bdb63814e..f114bf38b6 100644--- a/crates/router/src/types/transformers.rs+++ b/crates/router/src/types/transformers.rs@@ -668,6 +668,7 @@ impl TryFrom<domain::MerchantConnectorAccount> for api_models::admin::MerchantCo.transpose()?,profile_id: item.profile_id,applepay_verified_domains: item.applepay_verified_domains,+ pm_auth_config: item.pm_auth_config,})}}diff --git a/migrations/2023-09-18-104900_add_pm_auth_config_mca/down.sql b/migrations/2023-09-18-104900_add_pm_auth_config_mca/down.sqlnew file mode 100644index 0000000000..d4fc2b581e--- /dev/null+++ b/migrations/2023-09-18-104900_add_pm_auth_config_mca/down.sql@@ -0,0 +1,2 @@+-- This file should undo anything in `up.sql`+ALTER TABLE merchant_connector_account DROP COLUMN IF EXISTS pm_auth_config;\ No newline at end of filediff --git a/migrations/2023-09-18-104900_add_pm_auth_config_mca/up.sql b/migrations/2023-09-18-104900_add_pm_auth_config_mca/up.sqlnew file mode 100644index 0000000000..15cdafdbac--- /dev/null+++ b/migrations/2023-09-18-104900_add_pm_auth_config_mca/up.sql@@ -0,0 +1,3 @@+-- Your SQL goes here+ALTER TABLE merchant_connector_account ADD COLUMN IF NOT EXISTS pm_auth_config JSONB DEFAULT NULL;+ALTER TYPE "ConnectorType" ADD VALUE 'payment_method_auth';\ No newline at end of filediff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.jsonindex 2bce9585fd..1d943117c8 100644--- a/openapi/openapi_spec.json+++ b/openapi/openapi_spec.json@@ -3922,7 +3922,8 @@"networks","banking_entities","non_banking_finance",- "payout_processor"+ "payout_processor",+ "payment_method_auth"]},"CountryAlpha2": {@@ -6522,6 +6523,9 @@"type": "string","description": "Identifier for the business profile, if not provided default will be chosen from merchant account","nullable": true+ },+ "pm_auth_config": {+ "nullable": true}}},@@ -6746,6 +6750,9 @@},"description": "identifier for the verified domains of a particular connector account","nullable": true+ },+ "pm_auth_config": {+ "nullable": true}}},@@ -6843,6 +6850,9 @@}],"nullable": true+ },+ "pm_auth_config": {+ "nullable": true}}},