feat(core): payment links - add support for custom background image and layout in details section (#6725)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Kashif
2024-12-12 20:50:33 +05:30
committed by GitHub
parent 1564ad72b8
commit d11d87408d
19 changed files with 775 additions and 87 deletions

View File

@ -2667,6 +2667,8 @@ pub struct BusinessPaymentLinkConfig {
/// A list of allowed domains (glob patterns) where this link can be embedded / opened from
#[schema(value_type = Option<HashSet<String>>)]
pub allowed_domains: Option<HashSet<String>>,
/// Toggle for HyperSwitch branding visibility
pub branding_visibility: Option<bool>,
}
impl BusinessPaymentLinkConfig {
@ -2725,6 +2727,11 @@ pub struct PaymentLinkConfigRequest {
pub show_card_form_by_default: Option<bool>,
/// Dynamic details related to merchant to be rendered in payment link
pub transaction_details: Option<Vec<PaymentLinkTransactionDetails>>,
/// Configurations for the background image for details section
pub background_image: Option<PaymentLinkBackgroundImageConfig>,
/// Custom layout for details section
#[schema(value_type = Option<PaymentLinkDetailsLayout>, example = "layout1")]
pub details_layout: Option<api_enums::PaymentLinkDetailsLayout>,
}
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, PartialEq, ToSchema)]
@ -2752,6 +2759,19 @@ pub struct TransactionDetailsUiConfiguration {
pub is_value_bold: Option<bool>,
}
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, PartialEq, ToSchema)]
pub struct PaymentLinkBackgroundImageConfig {
/// URL of the image
#[schema(value_type = String, example = "https://hyperswitch.io/favicon.ico")]
pub url: common_utils::types::Url,
/// Position of the image in the UI
#[schema(value_type = Option<ElementPosition>, example = "top-left")]
pub position: Option<api_enums::ElementPosition>,
/// Size of the image in the UI
#[schema(value_type = Option<ElementSize>, example = "contain")]
pub size: Option<api_enums::ElementSize>,
}
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, PartialEq, ToSchema)]
pub struct PaymentLinkConfig {
/// custom theme for the payment link
@ -2774,6 +2794,13 @@ pub struct PaymentLinkConfig {
pub allowed_domains: Option<HashSet<String>>,
/// Dynamic details related to merchant to be rendered in payment link
pub transaction_details: Option<Vec<PaymentLinkTransactionDetails>>,
/// Configurations for the background image for details section
pub background_image: Option<PaymentLinkBackgroundImageConfig>,
/// Custom layout for details section
#[schema(value_type = Option<PaymentLinkDetailsLayout>, example = "layout1")]
pub details_layout: Option<api_enums::PaymentLinkDetailsLayout>,
/// Toggle for HyperSwitch branding visibility
pub branding_visibility: Option<bool>,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq)]

View File

@ -6856,6 +6856,9 @@ pub struct PaymentLinkDetails {
pub show_card_form_by_default: bool,
pub locale: Option<String>,
pub transaction_details: Option<Vec<admin::PaymentLinkTransactionDetails>>,
pub background_image: Option<admin::PaymentLinkBackgroundImageConfig>,
pub details_layout: Option<api_enums::PaymentLinkDetailsLayout>,
pub branding_visibility: Option<bool>,
}
#[derive(Debug, serde::Serialize, Clone)]