mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
feat(user): add support for dashboard metadata (#3000)
Co-authored-by: Rachit Naithani <81706961+racnan@users.noreply.github.com> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Sakil Mostak <73734619+Sakilmostak@users.noreply.github.com> Co-authored-by: Prasunna Soppa <70575890+prasunna09@users.noreply.github.com> Co-authored-by: Arjun Karthik <m.arjunkarthik@gmail.com> Co-authored-by: Brian Silah <71752651+unpervertedkid@users.noreply.github.com>
This commit is contained in:
@ -1,6 +1,11 @@
|
||||
use common_utils::events::{ApiEventMetric, ApiEventsType};
|
||||
|
||||
use crate::user::{ChangePasswordRequest, ConnectAccountRequest, ConnectAccountResponse};
|
||||
use crate::user::{
|
||||
dashboard_metadata::{
|
||||
GetMetaDataRequest, GetMetaDataResponse, GetMultipleMetaDataPayload, SetMetaDataRequest,
|
||||
},
|
||||
ChangePasswordRequest, ConnectAccountRequest, ConnectAccountResponse,
|
||||
};
|
||||
|
||||
impl ApiEventMetric for ConnectAccountResponse {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
@ -13,4 +18,10 @@ impl ApiEventMetric for ConnectAccountResponse {
|
||||
|
||||
impl ApiEventMetric for ConnectAccountRequest {}
|
||||
|
||||
common_utils::impl_misc_api_event_type!(ChangePasswordRequest);
|
||||
common_utils::impl_misc_api_event_type!(
|
||||
ChangePasswordRequest,
|
||||
GetMultipleMetaDataPayload,
|
||||
GetMetaDataResponse,
|
||||
GetMetaDataRequest,
|
||||
SetMetaDataRequest
|
||||
);
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
use common_utils::pii;
|
||||
use masking::Secret;
|
||||
pub mod dashboard_metadata;
|
||||
|
||||
#[derive(serde::Deserialize, Debug, Clone, serde::Serialize)]
|
||||
pub struct ConnectAccountRequest {
|
||||
|
||||
110
crates/api_models/src/user/dashboard_metadata.rs
Normal file
110
crates/api_models/src/user/dashboard_metadata.rs
Normal file
@ -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),
|
||||
}
|
||||
Reference in New Issue
Block a user