1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
* public
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.87.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// CustomField : Definition of a custom field for checkout
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CustomField {
/// Type of field determining validation rules
#[serde(rename = "field_type")]
pub field_type: models::CustomFieldType,
/// Unique identifier for this field (used as key in responses)
#[serde(rename = "key")]
pub key: String,
/// Display label shown to customer
#[serde(rename = "label")]
pub label: String,
/// Options for dropdown type (required for dropdown, ignored for others)
#[serde(rename = "options", skip_serializing_if = "Option::is_none")]
pub options: Option<Vec<String>>,
/// Placeholder text for the input
#[serde(rename = "placeholder", skip_serializing_if = "Option::is_none")]
pub placeholder: Option<String>,
/// Whether this field is required
#[serde(rename = "required", skip_serializing_if = "Option::is_none")]
pub required: Option<bool>,
}
impl CustomField {
/// Definition of a custom field for checkout
pub fn new(field_type: models::CustomFieldType, key: String, label: String) -> CustomField {
CustomField {
field_type,
key,
label,
options: None,
placeholder: None,
required: None,
}
}
}