mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 01:27:31 +08:00
feat(pm_auth): pm_auth service migration (#3047)
Co-authored-by: Sarthak Soni <76486416+Sarthak1799@users.noreply.github.com> Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: Sarthak Soni <sarthak.soni@juspay.in>
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
use std::str::FromStr;
|
||||
|
||||
pub use common_enums::*;
|
||||
use utoipa::ToSchema;
|
||||
|
||||
@ -500,3 +502,26 @@ pub enum LockerChoice {
|
||||
Basilisk,
|
||||
Tartarus,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Eq,
|
||||
PartialEq,
|
||||
serde::Serialize,
|
||||
serde::Deserialize,
|
||||
strum::Display,
|
||||
strum::EnumString,
|
||||
frunk::LabelledGeneric,
|
||||
ToSchema,
|
||||
)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
pub enum PmAuthConnectors {
|
||||
Plaid,
|
||||
}
|
||||
|
||||
pub fn convert_pm_auth_connector(connector_name: &str) -> Option<PmAuthConnectors> {
|
||||
PmAuthConnectors::from_str(connector_name).ok()
|
||||
}
|
||||
|
||||
@ -23,6 +23,7 @@ pub mod payment_methods;
|
||||
pub mod payments;
|
||||
#[cfg(feature = "payouts")]
|
||||
pub mod payouts;
|
||||
pub mod pm_auth;
|
||||
pub mod refunds;
|
||||
pub mod routing;
|
||||
pub mod surcharge_decision_configs;
|
||||
|
||||
57
crates/api_models/src/pm_auth.rs
Normal file
57
crates/api_models/src/pm_auth.rs
Normal file
@ -0,0 +1,57 @@
|
||||
use common_enums::{PaymentMethod, PaymentMethodType};
|
||||
use common_utils::{
|
||||
events::{ApiEventMetric, ApiEventsType},
|
||||
impl_misc_api_event_type,
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct LinkTokenCreateRequest {
|
||||
pub language: Option<String>, // optional language field to be passed
|
||||
pub client_secret: Option<String>, // client secret to be passed in req body
|
||||
pub payment_id: String, // payment_id to be passed in req body for redis pm_auth connector name fetch
|
||||
pub payment_method: PaymentMethod, // payment_method to be used for filtering pm_auth connector
|
||||
pub payment_method_type: PaymentMethodType, // payment_method_type to be used for filtering pm_auth connector
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize)]
|
||||
pub struct LinkTokenCreateResponse {
|
||||
pub link_token: String, // link_token received in response
|
||||
pub connector: String, // pm_auth connector name in response
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
|
||||
pub struct ExchangeTokenCreateRequest {
|
||||
pub public_token: String,
|
||||
pub client_secret: Option<String>,
|
||||
pub payment_id: String,
|
||||
pub payment_method: PaymentMethod,
|
||||
pub payment_method_type: PaymentMethodType,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize)]
|
||||
pub struct ExchangeTokenCreateResponse {
|
||||
pub access_token: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct PaymentMethodAuthConfig {
|
||||
pub enabled_payment_methods: Vec<PaymentMethodAuthConnectorChoice>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct PaymentMethodAuthConnectorChoice {
|
||||
pub payment_method: PaymentMethod,
|
||||
pub payment_method_type: PaymentMethodType,
|
||||
pub connector_name: String,
|
||||
pub mca_id: String,
|
||||
}
|
||||
|
||||
impl_misc_api_event_type!(
|
||||
LinkTokenCreateRequest,
|
||||
LinkTokenCreateResponse,
|
||||
ExchangeTokenCreateRequest,
|
||||
ExchangeTokenCreateResponse
|
||||
);
|
||||
Reference in New Issue
Block a user