mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 09:07:09 +08:00
feat(merchant_account): add is_recon_enabled field in merchant_account (#1713)
This commit is contained in:
@ -227,6 +227,9 @@ pub struct MerchantAccountResponse {
|
|||||||
|
|
||||||
/// The organization id merchant is associated with
|
/// The organization id merchant is associated with
|
||||||
pub organization_id: Option<String>,
|
pub organization_id: Option<String>,
|
||||||
|
|
||||||
|
/// A boolean value to indicate if the merchant has recon service is enabled or not, by default value is false
|
||||||
|
pub is_recon_enabled: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
|
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
|
||||||
|
|||||||
@ -36,6 +36,7 @@ pub struct MerchantAccount {
|
|||||||
pub modified_at: time::PrimitiveDateTime,
|
pub modified_at: time::PrimitiveDateTime,
|
||||||
pub frm_routing_algorithm: Option<serde_json::Value>,
|
pub frm_routing_algorithm: Option<serde_json::Value>,
|
||||||
pub organization_id: Option<String>,
|
pub organization_id: Option<String>,
|
||||||
|
pub is_recon_enabled: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Insertable, router_derive::DebugAsDisplay)]
|
#[derive(Clone, Debug, Insertable, router_derive::DebugAsDisplay)]
|
||||||
@ -61,6 +62,7 @@ pub struct MerchantAccountNew {
|
|||||||
pub modified_at: time::PrimitiveDateTime,
|
pub modified_at: time::PrimitiveDateTime,
|
||||||
pub frm_routing_algorithm: Option<serde_json::Value>,
|
pub frm_routing_algorithm: Option<serde_json::Value>,
|
||||||
pub organization_id: Option<String>,
|
pub organization_id: Option<String>,
|
||||||
|
pub is_recon_enabled: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, AsChangeset, router_derive::DebugAsDisplay)]
|
#[derive(Clone, Debug, Default, AsChangeset, router_derive::DebugAsDisplay)]
|
||||||
@ -85,4 +87,5 @@ pub struct MerchantAccountUpdateInternal {
|
|||||||
pub intent_fulfillment_time: Option<i64>,
|
pub intent_fulfillment_time: Option<i64>,
|
||||||
pub frm_routing_algorithm: Option<serde_json::Value>,
|
pub frm_routing_algorithm: Option<serde_json::Value>,
|
||||||
pub organization_id: Option<String>,
|
pub organization_id: Option<String>,
|
||||||
|
pub is_recon_enabled: bool,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -330,6 +330,7 @@ diesel::table! {
|
|||||||
frm_routing_algorithm -> Nullable<Jsonb>,
|
frm_routing_algorithm -> Nullable<Jsonb>,
|
||||||
#[max_length = 32]
|
#[max_length = 32]
|
||||||
organization_id -> Nullable<Varchar>,
|
organization_id -> Nullable<Varchar>,
|
||||||
|
is_recon_enabled -> Bool,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -41,11 +41,15 @@ impl Default for super::settings::Secrets {
|
|||||||
jwt_secret: "secret".into(),
|
jwt_secret: "secret".into(),
|
||||||
#[cfg(not(feature = "kms"))]
|
#[cfg(not(feature = "kms"))]
|
||||||
admin_api_key: "test_admin".into(),
|
admin_api_key: "test_admin".into(),
|
||||||
|
#[cfg(not(feature = "kms"))]
|
||||||
|
recon_admin_api_key: "recon_test_admin".into(),
|
||||||
master_enc_key: "".into(),
|
master_enc_key: "".into(),
|
||||||
#[cfg(feature = "kms")]
|
#[cfg(feature = "kms")]
|
||||||
kms_encrypted_jwt_secret: "".into(),
|
kms_encrypted_jwt_secret: "".into(),
|
||||||
#[cfg(feature = "kms")]
|
#[cfg(feature = "kms")]
|
||||||
kms_encrypted_admin_api_key: "".into(),
|
kms_encrypted_admin_api_key: "".into(),
|
||||||
|
#[cfg(feature = "kms")]
|
||||||
|
kms_encrypted_recon_admin_api_key: "".into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -317,11 +317,15 @@ pub struct Secrets {
|
|||||||
pub jwt_secret: String,
|
pub jwt_secret: String,
|
||||||
#[cfg(not(feature = "kms"))]
|
#[cfg(not(feature = "kms"))]
|
||||||
pub admin_api_key: String,
|
pub admin_api_key: String,
|
||||||
|
#[cfg(not(feature = "kms"))]
|
||||||
|
pub recon_admin_api_key: String,
|
||||||
pub master_enc_key: String,
|
pub master_enc_key: String,
|
||||||
#[cfg(feature = "kms")]
|
#[cfg(feature = "kms")]
|
||||||
pub kms_encrypted_jwt_secret: String,
|
pub kms_encrypted_jwt_secret: String,
|
||||||
#[cfg(feature = "kms")]
|
#[cfg(feature = "kms")]
|
||||||
pub kms_encrypted_admin_api_key: String,
|
pub kms_encrypted_admin_api_key: String,
|
||||||
|
#[cfg(feature = "kms")]
|
||||||
|
pub kms_encrypted_recon_admin_api_key: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Clone)]
|
#[derive(Debug, Deserialize, Clone)]
|
||||||
|
|||||||
@ -173,6 +173,7 @@ pub async fn create_merchant_account(
|
|||||||
intent_fulfillment_time: req.intent_fulfillment_time.map(i64::from),
|
intent_fulfillment_time: req.intent_fulfillment_time.map(i64::from),
|
||||||
id: None,
|
id: None,
|
||||||
organization_id: req.organization_id,
|
organization_id: req.organization_id,
|
||||||
|
is_recon_enabled: false,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
.await
|
.await
|
||||||
|
|||||||
@ -35,6 +35,7 @@ impl TryFrom<domain::MerchantAccount> for MerchantAccountResponse {
|
|||||||
frm_routing_algorithm: item.frm_routing_algorithm,
|
frm_routing_algorithm: item.frm_routing_algorithm,
|
||||||
intent_fulfillment_time: item.intent_fulfillment_time,
|
intent_fulfillment_time: item.intent_fulfillment_time,
|
||||||
organization_id: item.organization_id,
|
organization_id: item.organization_id,
|
||||||
|
is_recon_enabled: item.is_recon_enabled,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,6 +37,7 @@ pub struct MerchantAccount {
|
|||||||
pub modified_at: time::PrimitiveDateTime,
|
pub modified_at: time::PrimitiveDateTime,
|
||||||
pub intent_fulfillment_time: Option<i64>,
|
pub intent_fulfillment_time: Option<i64>,
|
||||||
pub organization_id: Option<String>,
|
pub organization_id: Option<String>,
|
||||||
|
pub is_recon_enabled: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::large_enum_variant)]
|
#[allow(clippy::large_enum_variant)]
|
||||||
@ -63,6 +64,9 @@ pub enum MerchantAccountUpdate {
|
|||||||
StorageSchemeUpdate {
|
StorageSchemeUpdate {
|
||||||
storage_scheme: enums::MerchantStorageScheme,
|
storage_scheme: enums::MerchantStorageScheme,
|
||||||
},
|
},
|
||||||
|
ReconUpdate {
|
||||||
|
is_recon_enabled: bool,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<MerchantAccountUpdate> for MerchantAccountUpdateInternal {
|
impl From<MerchantAccountUpdate> for MerchantAccountUpdateInternal {
|
||||||
@ -110,6 +114,10 @@ impl From<MerchantAccountUpdate> for MerchantAccountUpdateInternal {
|
|||||||
modified_at: Some(date_time::now()),
|
modified_at: Some(date_time::now()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
|
MerchantAccountUpdate::ReconUpdate { is_recon_enabled } => Self {
|
||||||
|
is_recon_enabled,
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -144,6 +152,7 @@ impl super::behaviour::Conversion for MerchantAccount {
|
|||||||
intent_fulfillment_time: self.intent_fulfillment_time,
|
intent_fulfillment_time: self.intent_fulfillment_time,
|
||||||
frm_routing_algorithm: self.frm_routing_algorithm,
|
frm_routing_algorithm: self.frm_routing_algorithm,
|
||||||
organization_id: self.organization_id,
|
organization_id: self.organization_id,
|
||||||
|
is_recon_enabled: self.is_recon_enabled,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,6 +193,7 @@ impl super::behaviour::Conversion for MerchantAccount {
|
|||||||
modified_at: item.modified_at,
|
modified_at: item.modified_at,
|
||||||
intent_fulfillment_time: item.intent_fulfillment_time,
|
intent_fulfillment_time: item.intent_fulfillment_time,
|
||||||
organization_id: item.organization_id,
|
organization_id: item.organization_id,
|
||||||
|
is_recon_enabled: item.is_recon_enabled,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
.await
|
.await
|
||||||
@ -215,6 +225,7 @@ impl super::behaviour::Conversion for MerchantAccount {
|
|||||||
intent_fulfillment_time: self.intent_fulfillment_time,
|
intent_fulfillment_time: self.intent_fulfillment_time,
|
||||||
frm_routing_algorithm: self.frm_routing_algorithm,
|
frm_routing_algorithm: self.frm_routing_algorithm,
|
||||||
organization_id: self.organization_id,
|
organization_id: self.organization_id,
|
||||||
|
is_recon_enabled: self.is_recon_enabled,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,2 @@
|
|||||||
|
-- This file should undo anything in `up.sql`
|
||||||
|
ALTER TABLE merchant_account DROP COLUMN is_recon_enabled;
|
||||||
@ -0,0 +1,2 @@
|
|||||||
|
-- Your SQL goes here
|
||||||
|
ALTER TABLE merchant_account ADD COLUMN "is_recon_enabled" BOOLEAN NOT NULL DEFAULT FALSE;
|
||||||
@ -5014,7 +5014,8 @@
|
|||||||
"merchant_id",
|
"merchant_id",
|
||||||
"enable_payment_response_hash",
|
"enable_payment_response_hash",
|
||||||
"redirect_to_merchant_with_http_post",
|
"redirect_to_merchant_with_http_post",
|
||||||
"primary_business_details"
|
"primary_business_details",
|
||||||
|
"is_recon_enabled"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"merchant_id": {
|
"merchant_id": {
|
||||||
@ -5135,6 +5136,10 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The organization id merchant is associated with",
|
"description": "The organization id merchant is associated with",
|
||||||
"nullable": true
|
"nullable": true
|
||||||
|
},
|
||||||
|
"is_recon_enabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "A boolean value to indicate if the merchant has recon service is enabled or not, by default value is false"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user