refactor: use hashmap deserializer for generic_link options (#5157)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Kashif
2024-07-02 15:16:20 +05:30
committed by GitHub
parent 3bbdfb5a1c
commit a343f69dc4
23 changed files with 310 additions and 90 deletions

View File

@ -41,6 +41,7 @@ strum = { version = "0.26.2", features = ["derive"] }
thiserror = "1.0.58"
time = { version = "0.3.35", features = ["serde", "serde-well-known", "std"] }
tokio = { version = "1.37.0", features = ["macros", "rt-multi-thread"], optional = true }
url = { version = "2.5.0", features = ["serde"] }
utoipa = { version = "4.2.0", features = ["preserve_order", "preserve_path_order"] }
uuid = { version = "1.8.0", features = ["v7"] }

View File

@ -1,6 +1,6 @@
//! Common
use std::primitive::i64;
use std::{collections::HashSet, primitive::i64};
use common_enums::enums;
use diesel::{
@ -148,7 +148,7 @@ pub struct PayoutLinkData {
/// Identifier for the payouts resource
pub payout_id: String,
/// Link to render the payout link
pub link: Secret<String>,
pub link: url::Url,
/// Client secret generated for authenticating frontend APIs
pub client_secret: Secret<String>,
/// Expiry in seconds from the time it was created
@ -167,11 +167,11 @@ pub struct PayoutLinkData {
crate::impl_to_sql_from_sql_json!(PayoutLinkData);
/// Object for GenericLinkUiConfig
#[derive(Clone, Debug, Default, serde::Deserialize, Serialize, ToSchema)]
#[derive(Clone, Debug, serde::Deserialize, Serialize, ToSchema)]
pub struct GenericLinkUiConfig {
/// Merchant's display logo
#[schema(value_type = Option<String>, max_length = 255, example = "https://hyperswitch.io/favicon.ico")]
pub logo: Option<String>,
pub logo: Option<url::Url>,
/// Custom merchant name for the link
#[schema(value_type = Option<String>, max_length = 255, example = "Hyperswitch")]
@ -182,12 +182,12 @@ pub struct GenericLinkUiConfig {
pub theme: Option<String>,
}
/// Object for GenericLinkUIConfigFormData
#[derive(Clone, Debug, Default, serde::Deserialize, Serialize, ToSchema)]
pub struct GenericLinkUIConfigFormData {
/// Object for GenericLinkUiConfigFormData
#[derive(Clone, Debug, serde::Deserialize, Serialize, ToSchema)]
pub struct GenericLinkUiConfigFormData {
/// Merchant's display logo
#[schema(value_type = String, max_length = 255, example = "https://hyperswitch.io/favicon.ico")]
pub logo: String,
pub logo: url::Url,
/// Custom merchant name for the link
#[schema(value_type = String, max_length = 255, example = "Hyperswitch")]
@ -206,6 +206,6 @@ pub struct EnabledPaymentMethod {
pub payment_method: enums::PaymentMethod,
/// An array of associated payment method types
#[schema(value_type = Vec<PaymentMethodType>)]
pub payment_method_types: Vec<enums::PaymentMethodType>,
#[schema(value_type = HashSet<PaymentMethodType>)]
pub payment_method_types: HashSet<enums::PaymentMethodType>,
}