mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 17:19:15 +08:00
feat(merchant_account_v2): add merchant_account_v2 domain and diesel models (#5365)
Co-authored-by: hrithikesh026 <hrithikesh.vm@juspay.in> Co-authored-by: Prajjwal Kumar <prajjwal.kumar@juspay.in> Co-authored-by: Sanchith Hegde <sanchith.hegde@juspay.in> Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -1,7 +1,5 @@
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
#[cfg(feature = "v2")]
|
||||
use common_utils::new_type;
|
||||
use common_utils::{
|
||||
consts,
|
||||
crypto::Encryptable,
|
||||
@ -9,9 +7,12 @@ use common_utils::{
|
||||
ext_traits::Encode,
|
||||
id_type, link_utils, pii,
|
||||
};
|
||||
#[cfg(not(feature = "v2"))]
|
||||
#[cfg(all(
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "merchant_account_v2")
|
||||
))]
|
||||
use common_utils::{crypto::OptionalEncryptableName, ext_traits::ValueExt};
|
||||
#[cfg(feature = "v2")]
|
||||
#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
|
||||
use masking::ExposeInterface;
|
||||
use masking::Secret;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -19,7 +20,10 @@ use url;
|
||||
use utoipa::ToSchema;
|
||||
|
||||
use super::payments::AddressDetails;
|
||||
#[cfg(not(feature = "v2"))]
|
||||
#[cfg(all(
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "merchant_account_v2")
|
||||
))]
|
||||
use crate::routing;
|
||||
use crate::{enums as api_enums, payment_methods};
|
||||
|
||||
@ -28,7 +32,10 @@ pub struct MerchantAccountListRequest {
|
||||
pub organization_id: String,
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "v2"))]
|
||||
#[cfg(all(
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "merchant_account_v2")
|
||||
))]
|
||||
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct MerchantAccountCreate {
|
||||
@ -108,7 +115,10 @@ pub struct MerchantAccountCreate {
|
||||
pub pm_collect_link_config: Option<BusinessCollectLinkConfig>,
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "v2"))]
|
||||
#[cfg(all(
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "merchant_account_v2")
|
||||
))]
|
||||
impl MerchantAccountCreate {
|
||||
pub fn get_merchant_reference_id(&self) -> id_type::MerchantId {
|
||||
self.merchant_id.clone()
|
||||
@ -182,13 +192,13 @@ impl MerchantAccountCreate {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v2")]
|
||||
#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
|
||||
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct MerchantAccountCreate {
|
||||
/// Name of the Merchant Account, This will be used as a prefix to generate the id
|
||||
#[schema(value_type= String, max_length = 64, example = "NewAge Retailer")]
|
||||
pub merchant_name: Secret<new_type::MerchantName>,
|
||||
pub merchant_name: Secret<common_utils::new_type::MerchantName>,
|
||||
|
||||
/// Details about the merchant, contains phone and emails of primary and secondary contact person.
|
||||
pub merchant_details: Option<MerchantDetails>,
|
||||
@ -201,7 +211,7 @@ pub struct MerchantAccountCreate {
|
||||
pub organization_id: String,
|
||||
}
|
||||
|
||||
#[cfg(feature = "v2")]
|
||||
#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
|
||||
impl MerchantAccountCreate {
|
||||
pub fn get_merchant_reference_id(&self) -> id_type::MerchantId {
|
||||
id_type::MerchantId::from_merchant_name(self.merchant_name.clone().expose())
|
||||
@ -327,7 +337,10 @@ pub struct MerchantAccountUpdate {
|
||||
pub pm_collect_link_config: Option<BusinessCollectLinkConfig>,
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "v2"))]
|
||||
#[cfg(all(
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "merchant_account_v2")
|
||||
))]
|
||||
#[derive(Clone, Debug, ToSchema, Serialize)]
|
||||
pub struct MerchantAccountResponse {
|
||||
/// The identifier for the Merchant Account
|
||||
@ -419,7 +432,7 @@ pub struct MerchantAccountResponse {
|
||||
pub pm_collect_link_config: Option<BusinessCollectLinkConfig>,
|
||||
}
|
||||
|
||||
#[cfg(feature = "v2")]
|
||||
#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
|
||||
#[derive(Clone, Debug, ToSchema, Serialize)]
|
||||
pub struct MerchantAccountResponse {
|
||||
/// The identifier for the Merchant Account
|
||||
|
||||
Reference in New Issue
Block a user