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
fix(frm): add new column frm_config instead of alterning the existing… (#1925)
Jagan8d916feb3fe9
diff --git a/crates/diesel_models/src/merchant_connector_account.rs b/crates/diesel_models/src/merchant_connector_account.rsindex 9982fb7593..91ecb87ea8 100644--- a/crates/diesel_models/src/merchant_connector_account.rs+++ b/crates/diesel_models/src/merchant_connector_account.rs@@ -32,11 +32,12 @@ pub struct MerchantConnectorAccount {pub business_country: storage_enums::CountryAlpha2,pub business_label: String,pub business_sub_label: Option<String>,- #[diesel(deserialize_as = super::OptionalDieselArray<pii::SecretSerdeValue>)]- pub frm_configs: Option<Vec<Secret<serde_json::Value>>>,+ pub frm_configs: Option<Secret<serde_json::Value>>,pub created_at: time::PrimitiveDateTime,pub modified_at: time::PrimitiveDateTime,pub connector_webhook_details: Option<pii::SecretSerdeValue>,+ #[diesel(deserialize_as = super::OptionalDieselArray<pii::SecretSerdeValue>)]+ pub frm_config: Option<Vec<Secret<serde_json::Value>>>,}#[derive(Clone, Debug, Insertable, router_derive::DebugAsDisplay)]@@ -55,11 +56,12 @@ pub struct MerchantConnectorAccountNew {pub business_country: storage_enums::CountryAlpha2,pub business_label: String,pub business_sub_label: Option<String>,- #[diesel(deserialize_as = super::OptionalDieselArray<pii::SecretSerdeValue>)]- pub frm_configs: Option<Vec<Secret<serde_json::Value>>>,+ pub frm_configs: Option<Secret<serde_json::Value>>,pub created_at: time::PrimitiveDateTime,pub modified_at: time::PrimitiveDateTime,pub connector_webhook_details: Option<pii::SecretSerdeValue>,+ #[diesel(deserialize_as = super::OptionalDieselArray<pii::SecretSerdeValue>)]+ pub frm_config: Option<Vec<Secret<serde_json::Value>>>,}#[derive(Clone, Debug, AsChangeset, router_derive::DebugAsDisplay)]@@ -73,11 +75,12 @@ pub struct MerchantConnectorAccountUpdateInternal {pub disabled: Option<bool>,pub merchant_connector_id: Option<String>,pub payment_methods_enabled: Option<Vec<serde_json::Value>>,+ pub frm_configs: Option<Secret<serde_json::Value>>,pub metadata: Option<pii::SecretSerdeValue>,- #[diesel(deserialize_as = super::OptionalDieselArray<pii::SecretSerdeValue>)]- pub frm_configs: Option<Vec<Secret<serde_json::Value>>>,pub modified_at: Option<time::PrimitiveDateTime>,pub connector_webhook_details: Option<pii::SecretSerdeValue>,+ #[diesel(deserialize_as = super::OptionalDieselArray<pii::SecretSerdeValue>)]+ pub frm_config: Option<Vec<Secret<serde_json::Value>>>,}impl MerchantConnectorAccountUpdateInternal {@@ -97,7 +100,7 @@ impl MerchantConnectorAccountUpdateInternal {.merchant_connector_id.unwrap_or(source.merchant_connector_id),payment_methods_enabled: self.payment_methods_enabled,- frm_configs: self.frm_configs,+ frm_config: self.frm_config,modified_at: self.modified_at.unwrap_or(source.modified_at),..sourcediff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rsindex 76c0436a79..5ba63997b7 100644--- a/crates/diesel_models/src/schema.rs+++ b/crates/diesel_models/src/schema.rs@@ -424,10 +424,11 @@ diesel::table! {business_label -> Varchar,#[max_length = 64]business_sub_label -> Nullable<Varchar>,- frm_configs -> Nullable<Array<Nullable<Jsonb>>>,+ frm_configs -> Nullable<Jsonb>,created_at -> Timestamp,modified_at -> Timestamp,connector_webhook_details -> Nullable<Jsonb>,+ frm_config -> Nullable<Array<Nullable<Jsonb>>>,}}diff --git a/crates/router/src/db/merchant_connector_account.rs b/crates/router/src/db/merchant_connector_account.rsindex 5808d3f3db..03e93b22a1 100644--- a/crates/router/src/db/merchant_connector_account.rs+++ b/crates/router/src/db/merchant_connector_account.rs@@ -551,7 +551,8 @@ impl MerchantConnectorAccountInterface for MockDb {merchant_connector_id: t.merchant_connector_id,payment_methods_enabled: t.payment_methods_enabled,metadata: t.metadata,- frm_configs: t.frm_configs,+ frm_configs: None,+ frm_config: t.frm_configs,connector_type: t.connector_type,connector_label: t.connector_label,business_country: t.business_country,diff --git a/crates/router/src/types/domain/merchant_connector_account.rs b/crates/router/src/types/domain/merchant_connector_account.rsindex 371ea5f6ae..95b1bd1de4 100644--- a/crates/router/src/types/domain/merchant_connector_account.rs+++ b/crates/router/src/types/domain/merchant_connector_account.rs@@ -71,7 +71,8 @@ impl behaviour::Conversion for MerchantConnectorAccount {payment_methods_enabled: self.payment_methods_enabled,connector_type: self.connector_type,metadata: self.metadata,- frm_configs: self.frm_configs,+ frm_configs: None,+ frm_config: self.frm_configs,business_country: self.business_country,business_label: self.business_label,connector_label: self.connector_label,@@ -107,7 +108,7 @@ impl behaviour::Conversion for MerchantConnectorAccount {connector_type: other.connector_type,metadata: other.metadata,- frm_configs: other.frm_configs,+ frm_configs: other.frm_config,business_country: other.business_country,business_label: other.business_label,connector_label: other.connector_label,@@ -130,7 +131,8 @@ impl behaviour::Conversion for MerchantConnectorAccount {payment_methods_enabled: self.payment_methods_enabled,connector_type: Some(self.connector_type),metadata: self.metadata,- frm_configs: self.frm_configs,+ frm_configs: None,+ frm_config: self.frm_configs,business_country: self.business_country,business_label: self.business_label,connector_label: self.connector_label,@@ -167,7 +169,8 @@ impl From<MerchantConnectorAccountUpdate> for MerchantConnectorAccountUpdateIntemerchant_connector_id,payment_methods_enabled,metadata,- frm_configs,+ frm_configs: None,+ frm_config: frm_configs,modified_at: Some(common_utils::date_time::now()),connector_webhook_details,},diff --git a/migrations/2023-08-11-073905_add_frm_config_in_mca/down.sql b/migrations/2023-08-11-073905_add_frm_config_in_mca/down.sqlnew file mode 100644index 0000000000..3ce14d5082--- /dev/null+++ b/migrations/2023-08-11-073905_add_frm_config_in_mca/down.sql@@ -0,0 +1,4 @@+ALTER TABLE "merchant_connector_account" DROP COLUMN frm_config;+ALTER TABLE merchant_connector_account+ALTER COLUMN frm_configs TYPE jsonb[]+USING ARRAY[frm_configs]::jsonb[];\ No newline at end of filediff --git a/migrations/2023-08-11-073905_add_frm_config_in_mca/up.sql b/migrations/2023-08-11-073905_add_frm_config_in_mca/up.sqlnew file mode 100644index 0000000000..131f321965--- /dev/null+++ b/migrations/2023-08-11-073905_add_frm_config_in_mca/up.sql@@ -0,0 +1,5 @@+ALTER TABLE "merchant_connector_account" ADD COLUMN frm_config jsonb[];+-- Do not run below migration in PROD as this only makes sandbox compatible to PROD version+ALTER TABLE merchant_connector_account+ALTER COLUMN frm_configs TYPE jsonb+USING frm_configs[1]::jsonb;\ No newline at end of file