|
| 1 | +use std::collections::HashMap; |
| 2 | + |
1 | 3 | use cards::CardNumber;
|
2 | 4 | use common_utils::{
|
3 | 5 | consts::default_payouts_list_limit,
|
4 | 6 | crypto, id_type, link_utils,
|
5 | 7 | pii::{self, Email},
|
6 | 8 | };
|
7 | 9 | use masking::Secret;
|
| 10 | +use router_derive::FlatStruct; |
8 | 11 | use serde::{Deserialize, Serialize};
|
9 | 12 | use time::PrimitiveDateTime;
|
10 | 13 | use utoipa::ToSchema;
|
11 | 14 |
|
12 |
| -use crate::{enums as api_enums, payments}; |
| 15 | +use crate::{enums as api_enums, payment_methods::RequiredFieldInfo, payments}; |
13 | 16 |
|
14 | 17 | #[derive(Debug, Deserialize, Serialize, Clone, ToSchema)]
|
15 | 18 | pub enum PayoutRequest {
|
@@ -204,6 +207,10 @@ pub struct PayoutCreatePayoutLinkConfig {
|
204 | 207 | #[schema(value_type = Option<Vec<EnabledPaymentMethod>>, example = r#"[{"payment_method": "bank_transfer", "payment_method_types": ["ach", "bacs"]}]"#)]
|
205 | 208 | pub enabled_payment_methods: Option<Vec<link_utils::EnabledPaymentMethod>>,
|
206 | 209 |
|
| 210 | + /// Form layout of the payout link |
| 211 | + #[schema(value_type = Option<UIWidgetFormLayout>, max_length = 255, example = "tabs")] |
| 212 | + pub form_layout: Option<api_enums::UIWidgetFormLayout>, |
| 213 | + |
207 | 214 | /// `test_mode` allows for opening payout links without any restrictions. This removes
|
208 | 215 | /// - domain name validations
|
209 | 216 | /// - check for making sure link is accessed within an iframe
|
@@ -411,7 +418,7 @@ pub struct PayoutCreateResponse {
|
411 | 418 | pub payout_type: Option<api_enums::PayoutType>,
|
412 | 419 |
|
413 | 420 | /// The billing address for the payout
|
414 |
| - #[schema(value_type = Option<Object>, example = json!(r#"{ |
| 421 | + #[schema(value_type = Option<Address>, example = json!(r#"{ |
415 | 422 | "address": {
|
416 | 423 | "line1": "1467",
|
417 | 424 | "line2": "Harrison Street",
|
@@ -778,12 +785,31 @@ pub struct PayoutLinkDetails {
|
778 | 785 | #[serde(flatten)]
|
779 | 786 | pub ui_config: link_utils::GenericLinkUiConfigFormData,
|
780 | 787 | pub enabled_payment_methods: Vec<link_utils::EnabledPaymentMethod>,
|
| 788 | + pub enabled_payment_methods_with_required_fields: Vec<PayoutEnabledPaymentMethodsInfo>, |
781 | 789 | pub amount: common_utils::types::StringMajorUnit,
|
782 | 790 | pub currency: common_enums::Currency,
|
783 | 791 | pub locale: String,
|
| 792 | + pub form_layout: Option<common_enums::UIWidgetFormLayout>, |
784 | 793 | pub test_mode: bool,
|
785 | 794 | }
|
786 | 795 |
|
| 796 | +#[derive(Clone, Debug, serde::Serialize)] |
| 797 | +pub struct PayoutEnabledPaymentMethodsInfo { |
| 798 | + pub payment_method: common_enums::PaymentMethod, |
| 799 | + pub payment_method_types_info: Vec<PaymentMethodTypeInfo>, |
| 800 | +} |
| 801 | + |
| 802 | +#[derive(Clone, Debug, serde::Serialize)] |
| 803 | +pub struct PaymentMethodTypeInfo { |
| 804 | + pub payment_method_type: common_enums::PaymentMethodType, |
| 805 | + pub required_fields: Option<HashMap<String, RequiredFieldInfo>>, |
| 806 | +} |
| 807 | + |
| 808 | +#[derive(Clone, Debug, serde::Serialize, FlatStruct)] |
| 809 | +pub struct RequiredFieldsOverrideRequest { |
| 810 | + pub billing: Option<payments::Address>, |
| 811 | +} |
| 812 | + |
787 | 813 | #[derive(Clone, Debug, serde::Serialize)]
|
788 | 814 | pub struct PayoutLinkStatusDetails {
|
789 | 815 | pub payout_link_id: String,
|
|
0 commit comments