feat(router): Better UI payment link and order details product image and merchant config support (#2583)

Co-authored-by: Sahkal Poddar <sahkal.poddar@juspay.in>
Co-authored-by: Kashif <46213975+kashif-m@users.noreply.github.com>
Co-authored-by: Kashif <mohammed.kashif@juspay.in>
Co-authored-by: Bernard Eugine <114725419+bernard-eugine@users.noreply.github.com>
Co-authored-by: Kashif <kashif@protonmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Sahkal Poddar
2023-10-17 14:40:45 +05:30
committed by GitHub
parent 3807601ee1
commit fdd9580012
19 changed files with 469 additions and 205 deletions

View File

@ -95,6 +95,8 @@ pub struct MerchantAccountCreate {
/// The id of the organization to which the merchant belongs to
pub organization_id: Option<String>,
pub payment_link_config: Option<PaymentLinkConfig>,
}
#[derive(Clone, Debug, Deserialize, Serialize, ToSchema)]
@ -184,6 +186,8 @@ pub struct MerchantAccountUpdate {
/// To unset this field, pass an empty string
#[schema(max_length = 64)]
pub default_profile: Option<String>,
pub payment_link_config: Option<serde_json::Value>,
}
#[derive(Clone, Debug, ToSchema, Serialize)]
@ -277,6 +281,8 @@ pub struct MerchantAccountResponse {
/// A enum value to indicate the status of recon service. By default it is not_requested.
#[schema(value_type = ReconStatus, example = "not_requested")]
pub recon_status: enums::ReconStatus,
pub payment_link_config: Option<serde_json::Value>,
}
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
@ -497,6 +503,22 @@ pub struct PrimaryBusinessDetails {
pub business: String,
}
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize, PartialEq)]
#[serde(deny_unknown_fields)]
pub struct PaymentLinkConfig {
pub merchant_logo: Option<String>,
pub color_scheme: Option<PaymentLinkColorSchema>,
}
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize, PartialEq)]
#[serde(deny_unknown_fields)]
pub struct PaymentLinkColorSchema {
pub primary_color: Option<String>,
pub primary_accent_color: Option<String>,
pub secondary_color: Option<String>,
}
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
#[serde(deny_unknown_fields)]
pub struct WebhookDetails {

View File

@ -226,6 +226,7 @@ pub struct PaymentsRequest {
"product_name": "gillete creme",
"quantity": 15,
"amount" : 900
"product_img_link" : "https://dummy-img-link.com"
}]"#)]
pub order_details: Option<Vec<OrderDetailsWithAmount>>,
@ -2418,6 +2419,8 @@ pub struct OrderDetailsWithAmount {
pub quantity: u16,
/// the amount per quantity of product
pub amount: i64,
/// The image URL of the product
pub product_img_link: Option<String>,
}
#[derive(Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
@ -2428,6 +2431,8 @@ pub struct OrderDetails {
/// The quantity of the product to be purchased
#[schema(example = 1)]
pub quantity: u16,
/// The image URL of the product
pub product_img_link: Option<String>,
}
#[derive(Default, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
@ -3120,3 +3125,19 @@ pub struct PaymentLinkInitiateRequest {
pub merchant_id: String,
pub payment_id: String,
}
#[derive(Debug, serde::Serialize)]
pub struct PaymentLinkDetails {
pub amount: i64,
pub currency: api_enums::Currency,
pub pub_key: String,
pub client_secret: String,
pub payment_id: String,
#[serde(with = "common_utils::custom_serde::iso8601")]
pub expiry: PrimitiveDateTime,
pub merchant_logo: String,
pub return_url: String,
pub merchant_name: crypto::OptionalEncryptableName,
pub order_details: Vec<pii::SecretSerdeValue>,
pub max_items_visible_after_collapse: i8,
}