feat(core): [Payment Link] add dynamic merchant fields (#5512)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Sakil Mostak
2024-08-08 19:50:07 +05:30
committed by GitHub
parent 0cbbc92a43
commit 03f0ea1582
11 changed files with 160 additions and 41 deletions

View File

@ -30,6 +30,7 @@ routing_v2 = []
[dependencies]
actix-web = { version = "4.5.1", optional = true }
error-stack = "0.4.1"
indexmap = "2.3.0"
mime = "0.3.17"
reqwest = { version = "0.11.27", optional = true }
serde = { version = "1.0.197", features = ["derive"] }

View File

@ -12,6 +12,7 @@ use common_utils::{
not(feature = "merchant_account_v2")
))]
use common_utils::{crypto::OptionalEncryptableName, ext_traits::ValueExt};
use indexmap::IndexMap;
#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
use masking::ExposeInterface;
use masking::Secret;
@ -2235,6 +2236,9 @@ pub struct PaymentLinkConfigRequest {
/// Enable saved payment method option for payment link
#[schema(default = false, example = true)]
pub enabled_saved_payment_method: Option<bool>,
/// Dynamic details related to merchant to be rendered in payment link
#[schema(value_type = Option<Object>, example = r#"{ "value1": "some-value", "value2": "some-value" }"#)]
pub transaction_details: Option<IndexMap<String, String>>,
}
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, PartialEq, ToSchema)]
@ -2253,6 +2257,8 @@ pub struct PaymentLinkConfig {
pub enabled_saved_payment_method: bool,
/// A list of allowed domains (glob patterns) where this link can be embedded / opened from
pub allowed_domains: Option<HashSet<String>>,
/// Dynamic details related to merchant to be rendered in payment link
pub transaction_details: Option<String>,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq)]

View File

@ -5385,8 +5385,8 @@ pub struct PaymentLinkInitiateRequest {
#[derive(Debug, serde::Serialize)]
#[serde(untagged)]
pub enum PaymentLinkData {
PaymentLinkDetails(PaymentLinkDetails),
PaymentLinkStatusDetails(PaymentLinkStatusDetails),
PaymentLinkDetails(Box<PaymentLinkDetails>),
PaymentLinkStatusDetails(Box<PaymentLinkStatusDetails>),
}
#[derive(Debug, serde::Serialize, Clone)]
@ -5408,6 +5408,7 @@ pub struct PaymentLinkDetails {
pub sdk_layout: String,
pub display_sdk_only: bool,
pub locale: Option<String>,
pub transaction_details: Option<String>,
}
#[derive(Debug, serde::Serialize, Clone)]
@ -5433,6 +5434,7 @@ pub struct PaymentLinkStatusDetails {
pub theme: String,
pub return_url: String,
pub locale: Option<String>,
pub transaction_details: Option<String>,
}
#[derive(Clone, Debug, serde::Deserialize, ToSchema, serde::Serialize)]