Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 70 additions & 56 deletions api-reference-v2/openapi_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -12587,6 +12587,14 @@
"type": "string",
"description": "The url for Qr code given by the connector"
},
"display_text": {
"type": "string",
"nullable": true
},
"border_color": {
"type": "string",
"nullable": true
},
"type": {
"type": "string",
"enum": [
Expand Down Expand Up @@ -13983,6 +13991,28 @@
"type": "string",
"description": "Custom background colour for the payment link",
"nullable": true
},
"sdk_ui_rules": {
"type": "object",
"description": "SDK configuration rules",
"additionalProperties": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"nullable": true
},
"payment_link_ui_rules": {
"type": "object",
"description": "Payment link configuration rules",
"additionalProperties": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"nullable": true
}
}
},
Expand Down Expand Up @@ -14098,6 +14128,28 @@
"type": "string",
"description": "Custom background colour for the payment link",
"nullable": true
},
"sdk_ui_rules": {
"type": "object",
"description": "SDK configuration rules",
"additionalProperties": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"nullable": true
},
"payment_link_ui_rules": {
"type": "object",
"description": "Payment link configuration rules",
"additionalProperties": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"nullable": true
}
}
},
Expand Down Expand Up @@ -15301,13 +15353,29 @@
"description": "The return url to which the user should be redirected to",
"nullable": true
},
"associated_payment": {
"next_action": {
"allOf": [
{
"$ref": "#/components/schemas/PaymentsResponse"
"$ref": "#/components/schemas/NextActionData"
}
],
"nullable": true
},
"authentication_details": {
"allOf": [
{
"$ref": "#/components/schemas/AuthenticationDetails"
}
],
"nullable": true
},
"associated_payment_methods": {
"type": "array",
"items": {
"$ref": "#/components/schemas/id_type.GlobalPaymentMethodId"
},
"description": "The payment method that was created using this payment method session",
"nullable": true
}
}
},
Expand Down Expand Up @@ -15542,60 +15610,6 @@
},
"additionalProperties": false
},
"PaymentMethodsSessionResponse": {
"type": "object",
"required": [
"id",
"customer_id",
"expires_at",
"client_secret"
],
"properties": {
"id": {
"type": "string",
"example": "12345_pms_01926c58bc6e77c09e809964e72af8c8"
},
"customer_id": {
"type": "string",
"description": "The customer id for which the payment methods session is to be created",
"example": "12345_cus_01926c58bc6e77c09e809964e72af8c8"
},
"billing": {
"allOf": [
{
"$ref": "#/components/schemas/Address"
}
],
"nullable": true
},
"psp_tokenization": {
"allOf": [
{
"$ref": "#/components/schemas/PspTokenization"
}
],
"nullable": true
},
"network_tokenization": {
"allOf": [
{
"$ref": "#/components/schemas/NetworkTokenization"
}
],
"nullable": true
},
"expires_at": {
"type": "string",
"format": "date-time",
"description": "The iso timestamp when the session will expire\nTrying to retrieve the session or any operations on the session after this time will result in an error",
"example": "2023-01-18T11:04:09.922Z"
},
"client_secret": {
"type": "string",
"description": "Client Secret"
}
}
},
"PaymentMethodsSessionUpdateRequest": {
"type": "object",
"properties": {
Expand Down
44 changes: 44 additions & 0 deletions api-reference/openapi_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -16543,6 +16543,28 @@
"type": "string",
"description": "Custom background colour for the payment link",
"nullable": true
},
"sdk_ui_rules": {
"type": "object",
"description": "SDK configuration rules",
"additionalProperties": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"nullable": true
},
"payment_link_ui_rules": {
"type": "object",
"description": "Payment link configuration rules",
"additionalProperties": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"nullable": true
}
}
},
Expand Down Expand Up @@ -16658,6 +16680,28 @@
"type": "string",
"description": "Custom background colour for the payment link",
"nullable": true
},
"sdk_ui_rules": {
"type": "object",
"description": "SDK configuration rules",
"additionalProperties": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"nullable": true
},
"payment_link_ui_rules": {
"type": "object",
"description": "Payment link configuration rules",
"additionalProperties": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"nullable": true
}
}
},
Expand Down
8 changes: 8 additions & 0 deletions crates/api_models/src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2810,6 +2810,10 @@ pub struct PaymentLinkConfigRequest {
pub payment_button_text_colour: Option<String>,
/// Custom background colour for the payment link
pub background_colour: Option<String>,
/// SDK configuration rules
pub sdk_ui_rules: Option<HashMap<String, HashMap<String, String>>>,
/// Payment link configuration rules
pub payment_link_ui_rules: Option<HashMap<String, HashMap<String, String>>>,
}

#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, PartialEq, ToSchema)]
Expand Down Expand Up @@ -2891,6 +2895,10 @@ pub struct PaymentLinkConfig {
pub payment_button_text_colour: Option<String>,
/// Custom background colour for the payment link
pub background_colour: Option<String>,
/// SDK configuration rules
pub sdk_ui_rules: Option<HashMap<String, HashMap<String, String>>>,
/// Payment link configuration rules
pub payment_link_ui_rules: Option<HashMap<String, HashMap<String, String>>>,
}

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq)]
Expand Down
4 changes: 4 additions & 0 deletions crates/api_models/src/payments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7831,6 +7831,8 @@ pub struct PaymentLinkDetails {
pub payment_button_colour: Option<String>,
pub payment_button_text_colour: Option<String>,
pub background_colour: Option<String>,
pub sdk_ui_rules: Option<HashMap<String, HashMap<String, String>>>,
pub payment_link_ui_rules: Option<HashMap<String, HashMap<String, String>>>,
}

#[derive(Debug, serde::Serialize, Clone)]
Expand All @@ -7846,6 +7848,8 @@ pub struct SecurePaymentLinkDetails {
pub payment_button_colour: Option<String>,
pub payment_button_text_colour: Option<String>,
pub background_colour: Option<String>,
pub sdk_ui_rules: Option<HashMap<String, HashMap<String, String>>>,
pub payment_link_ui_rules: Option<HashMap<String, HashMap<String, String>>>,
}

#[derive(Debug, serde::Serialize)]
Expand Down
2 changes: 2 additions & 0 deletions crates/diesel_models/src/business_profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,8 @@ pub struct PaymentLinkConfigRequest {
pub skip_status_screen: Option<bool>,
pub payment_button_text_colour: Option<String>,
pub background_colour: Option<String>,
pub sdk_ui_rules: Option<HashMap<String, HashMap<String, String>>>,
pub payment_link_ui_rules: Option<HashMap<String, HashMap<String, String>>>,
}

#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, PartialEq)]
Expand Down
6 changes: 6 additions & 0 deletions crates/diesel_models/src/payment_intent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@ pub struct PaymentLinkConfigRequestForPayments {
pub payment_button_text_colour: Option<String>,
/// Custom background colour for the payment link
pub background_colour: Option<String>,
/// SDK configuration rules
pub sdk_ui_rules:
Option<std::collections::HashMap<String, std::collections::HashMap<String, String>>>,
/// Payment link configuration rules
pub payment_link_ui_rules:
Option<std::collections::HashMap<String, std::collections::HashMap<String, String>>>,
}

common_utils::impl_to_sql_from_sql_json!(PaymentLinkConfigRequestForPayments);
Expand Down
6 changes: 6 additions & 0 deletions crates/hyperswitch_domain_models/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,8 @@ impl ApiModelToDieselModelConvertor<api_models::admin::PaymentLinkConfigRequest>
skip_status_screen: item.skip_status_screen,
background_colour: item.background_colour,
payment_button_text_colour: item.payment_button_text_colour,
sdk_ui_rules: item.sdk_ui_rules,
payment_link_ui_rules: item.payment_link_ui_rules,
}
}
fn convert_back(self) -> api_models::admin::PaymentLinkConfigRequest {
Expand All @@ -433,6 +435,8 @@ impl ApiModelToDieselModelConvertor<api_models::admin::PaymentLinkConfigRequest>
skip_status_screen,
background_colour,
payment_button_text_colour,
sdk_ui_rules,
payment_link_ui_rules,
} = self;
api_models::admin::PaymentLinkConfigRequest {
theme,
Expand All @@ -458,6 +462,8 @@ impl ApiModelToDieselModelConvertor<api_models::admin::PaymentLinkConfigRequest>
skip_status_screen,
background_colour,
payment_button_text_colour,
sdk_ui_rules,
payment_link_ui_rules,
}
}
}
Expand Down
16 changes: 15 additions & 1 deletion crates/router/src/core/payment_link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ pub async fn form_payment_link_data(
skip_status_screen: None,
background_colour: None,
payment_button_text_colour: None,
sdk_ui_rules: None,
payment_link_ui_rules: None,
}
};

Expand Down Expand Up @@ -286,6 +288,8 @@ pub async fn form_payment_link_data(
skip_status_screen: payment_link_config.skip_status_screen,
background_colour: payment_link_config.background_colour.clone(),
payment_button_text_colour: payment_link_config.payment_button_text_colour.clone(),
sdk_ui_rules: payment_link_config.sdk_ui_rules.clone(),
payment_link_ui_rules: payment_link_config.payment_link_ui_rules.clone(),
};

Ok((
Expand Down Expand Up @@ -342,6 +346,8 @@ pub async fn initiate_secure_payment_link_flow(
skip_status_screen: payment_link_config.skip_status_screen,
background_colour: payment_link_config.background_colour,
payment_button_text_colour: payment_link_config.payment_button_text_colour,
sdk_ui_rules: payment_link_config.sdk_ui_rules,
payment_link_ui_rules: payment_link_config.payment_link_ui_rules,
};
let js_script = format!(
"window.__PAYMENT_DETAILS = {}",
Expand Down Expand Up @@ -653,6 +659,8 @@ pub fn get_payment_link_config_based_on_priority(
skip_status_screen,
background_colour,
payment_button_text_colour,
sdk_ui_rules,
payment_link_ui_rules,
) = get_payment_link_config_value!(
payment_create_link_config,
business_theme_configs,
Expand All @@ -664,7 +672,9 @@ pub fn get_payment_link_config_based_on_priority(
(payment_button_colour),
(skip_status_screen),
(background_colour),
(payment_button_text_colour)
(payment_button_text_colour),
(sdk_ui_rules),
(payment_link_ui_rules),
);

let payment_link_config =
Expand All @@ -690,6 +700,8 @@ pub fn get_payment_link_config_based_on_priority(
payment_button_colour,
background_colour,
payment_button_text_colour,
sdk_ui_rules,
payment_link_ui_rules,
};

Ok((payment_link_config, domain_name))
Expand Down Expand Up @@ -798,6 +810,8 @@ pub async fn get_payment_link_status(
skip_status_screen: None,
background_colour: None,
payment_button_text_colour: None,
sdk_ui_rules: None,
payment_link_ui_rules: None,
}
};

Expand Down
Loading
Loading