-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into frm_oss
- Loading branch information
Showing
31 changed files
with
1,473 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
use masking::Secret; | ||
use strum::EnumString; | ||
|
||
#[derive(Debug, serde::Deserialize, serde::Serialize)] | ||
pub enum SetMetaDataRequest { | ||
ProductionAgreement(ProductionAgreementRequest), | ||
SetupProcessor(SetupProcessor), | ||
ConfigureEndpoint, | ||
SetupComplete, | ||
FirstProcessorConnected(ProcessorConnected), | ||
SecondProcessorConnected(ProcessorConnected), | ||
ConfiguredRouting(ConfiguredRouting), | ||
TestPayment(TestPayment), | ||
IntegrationMethod(IntegrationMethod), | ||
IntegrationCompleted, | ||
SPRoutingConfigured(ConfiguredRouting), | ||
SPTestPayment, | ||
DownloadWoocom, | ||
ConfigureWoocom, | ||
SetupWoocomWebhook, | ||
IsMultipleConfiguration, | ||
} | ||
|
||
#[derive(Debug, serde::Deserialize, serde::Serialize)] | ||
pub struct ProductionAgreementRequest { | ||
pub version: String, | ||
#[serde(skip_deserializing)] | ||
pub ip_address: Option<Secret<String, common_utils::pii::IpAddress>>, | ||
} | ||
|
||
#[derive(Debug, serde::Deserialize, serde::Serialize)] | ||
pub struct SetupProcessor { | ||
pub connector_id: String, | ||
} | ||
|
||
#[derive(Debug, serde::Deserialize, serde::Serialize)] | ||
pub struct ProcessorConnected { | ||
pub processor_id: String, | ||
pub processor_name: String, | ||
} | ||
|
||
#[derive(Debug, serde::Deserialize, serde::Serialize)] | ||
pub struct ConfiguredRouting { | ||
pub routing_id: String, | ||
} | ||
|
||
#[derive(Debug, serde::Deserialize, serde::Serialize)] | ||
pub struct TestPayment { | ||
pub payment_id: String, | ||
} | ||
|
||
#[derive(Debug, serde::Deserialize, serde::Serialize)] | ||
pub struct IntegrationMethod { | ||
pub integration_type: String, | ||
} | ||
|
||
#[derive(Debug, serde::Deserialize, EnumString, serde::Serialize)] | ||
pub enum GetMetaDataRequest { | ||
ProductionAgreement, | ||
SetupProcessor, | ||
ConfigureEndpoint, | ||
SetupComplete, | ||
FirstProcessorConnected, | ||
SecondProcessorConnected, | ||
ConfiguredRouting, | ||
TestPayment, | ||
IntegrationMethod, | ||
IntegrationCompleted, | ||
StripeConnected, | ||
PaypalConnected, | ||
SPRoutingConfigured, | ||
SPTestPayment, | ||
DownloadWoocom, | ||
ConfigureWoocom, | ||
SetupWoocomWebhook, | ||
IsMultipleConfiguration, | ||
} | ||
|
||
#[derive(Debug, serde::Deserialize, serde::Serialize)] | ||
#[serde(transparent)] | ||
pub struct GetMultipleMetaDataPayload { | ||
pub results: Vec<GetMetaDataRequest>, | ||
} | ||
|
||
#[derive(Debug, serde::Deserialize, serde::Serialize)] | ||
pub struct GetMultipleMetaDataRequest { | ||
pub keys: String, | ||
} | ||
|
||
#[derive(Debug, serde::Serialize)] | ||
pub enum GetMetaDataResponse { | ||
ProductionAgreement(bool), | ||
SetupProcessor(Option<SetupProcessor>), | ||
ConfigureEndpoint(bool), | ||
SetupComplete(bool), | ||
FirstProcessorConnected(Option<ProcessorConnected>), | ||
SecondProcessorConnected(Option<ProcessorConnected>), | ||
ConfiguredRouting(Option<ConfiguredRouting>), | ||
TestPayment(Option<TestPayment>), | ||
IntegrationMethod(Option<IntegrationMethod>), | ||
IntegrationCompleted(bool), | ||
StripeConnected(Option<ProcessorConnected>), | ||
PaypalConnected(Option<ProcessorConnected>), | ||
SPRoutingConfigured(Option<ConfiguredRouting>), | ||
SPTestPayment(bool), | ||
DownloadWoocom(bool), | ||
ConfigureWoocom(bool), | ||
SetupWoocomWebhook(bool), | ||
IsMultipleConfiguration(bool), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
use diesel::{associations::HasTable, BoolExpressionMethods, ExpressionMethods}; | ||
use router_env::tracing::{self, instrument}; | ||
|
||
use crate::{ | ||
enums, | ||
query::generics, | ||
schema::dashboard_metadata::dsl, | ||
user::dashboard_metadata::{DashboardMetadata, DashboardMetadataNew}, | ||
PgPooledConn, StorageResult, | ||
}; | ||
|
||
impl DashboardMetadataNew { | ||
#[instrument(skip(conn))] | ||
pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<DashboardMetadata> { | ||
generics::generic_insert(conn, self).await | ||
} | ||
} | ||
|
||
impl DashboardMetadata { | ||
pub async fn find_user_scoped_dashboard_metadata( | ||
conn: &PgPooledConn, | ||
user_id: String, | ||
merchant_id: String, | ||
org_id: String, | ||
data_types: Vec<enums::DashboardMetadata>, | ||
) -> StorageResult<Vec<Self>> { | ||
let predicate = dsl::user_id | ||
.eq(user_id) | ||
.and(dsl::merchant_id.eq(merchant_id)) | ||
.and(dsl::org_id.eq(org_id)) | ||
.and(dsl::data_key.eq_any(data_types)); | ||
|
||
generics::generic_filter::<<Self as HasTable>::Table, _, _, _>( | ||
conn, | ||
predicate, | ||
None, | ||
None, | ||
Some(dsl::last_modified_at.asc()), | ||
) | ||
.await | ||
} | ||
|
||
pub async fn find_merchant_scoped_dashboard_metadata( | ||
conn: &PgPooledConn, | ||
merchant_id: String, | ||
org_id: String, | ||
data_types: Vec<enums::DashboardMetadata>, | ||
) -> StorageResult<Vec<Self>> { | ||
let predicate = dsl::user_id | ||
.is_null() | ||
.and(dsl::merchant_id.eq(merchant_id)) | ||
.and(dsl::org_id.eq(org_id)) | ||
.and(dsl::data_key.eq_any(data_types)); | ||
|
||
generics::generic_filter::<<Self as HasTable>::Table, _, _, _>( | ||
conn, | ||
predicate, | ||
None, | ||
None, | ||
Some(dsl::last_modified_at.asc()), | ||
) | ||
.await | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use diesel::{query_builder::AsChangeset, Identifiable, Insertable, Queryable}; | ||
use time::PrimitiveDateTime; | ||
|
||
use crate::{enums, schema::dashboard_metadata}; | ||
|
||
#[derive(Clone, Debug, Identifiable, Queryable)] | ||
#[diesel(table_name = dashboard_metadata)] | ||
pub struct DashboardMetadata { | ||
pub id: i32, | ||
pub user_id: Option<String>, | ||
pub merchant_id: String, | ||
pub org_id: String, | ||
pub data_key: enums::DashboardMetadata, | ||
pub data_value: serde_json::Value, | ||
pub created_by: String, | ||
pub created_at: PrimitiveDateTime, | ||
pub last_modified_by: String, | ||
pub last_modified_at: PrimitiveDateTime, | ||
} | ||
|
||
#[derive( | ||
router_derive::Setter, Clone, Debug, Insertable, router_derive::DebugAsDisplay, AsChangeset, | ||
)] | ||
#[diesel(table_name = dashboard_metadata)] | ||
pub struct DashboardMetadataNew { | ||
pub user_id: Option<String>, | ||
pub merchant_id: String, | ||
pub org_id: String, | ||
pub data_key: enums::DashboardMetadata, | ||
pub data_value: serde_json::Value, | ||
pub created_by: String, | ||
pub created_at: PrimitiveDateTime, | ||
pub last_modified_by: String, | ||
pub last_modified_at: PrimitiveDateTime, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.