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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
use crate::resources::enums::landing_page::LandingPage;
use crate::resources::enums::shipping_preference::ShippingPreference;
use crate::resources::enums::user_action::UserAction;
use crate::resources::payment_method::PaymentMethod;
use crate::resources::stored_payment_source::StoredPaymentSource;
use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;
#[skip_serializing_none]
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct OrderApplicationContext {
pub brand_name: Option<String>,
pub locale: Option<String>,
pub landing_page: Option<LandingPage>,
pub shipping_preference: Option<ShippingPreference>,
pub user_action: Option<UserAction>,
pub payment_method: Option<PaymentMethod>,
pub return_url: Option<String>,
pub cancel_url: Option<String>,
pub stored_payment_source: Option<StoredPaymentSource>,
}
impl OrderApplicationContext {
pub fn new() -> OrderApplicationContext {
OrderApplicationContext {
brand_name: None,
locale: None,
landing_page: None,
shipping_preference: None,
user_action: None,
payment_method: None,
return_url: None,
cancel_url: None,
stored_payment_source: None,
}
}
pub fn brand_name(mut self, brand_name: String) -> OrderApplicationContext {
self.brand_name = Some(brand_name);
self
}
pub fn locale(mut self, locale: String) -> OrderApplicationContext {
self.locale = Some(locale);
self
}
pub fn landing_page(mut self, landing_page: LandingPage) -> OrderApplicationContext {
self.landing_page = Some(landing_page);
self
}
pub fn shipping_preference(
mut self,
shipping_preference: ShippingPreference,
) -> OrderApplicationContext {
self.shipping_preference = Some(shipping_preference);
self
}
pub fn user_action(mut self, user_action: UserAction) -> OrderApplicationContext {
self.user_action = Some(user_action);
self
}
pub fn payment_method(mut self, payment_method: PaymentMethod) -> OrderApplicationContext {
self.payment_method = Some(payment_method);
self
}
pub fn return_url(mut self, return_url: String) -> OrderApplicationContext {
self.return_url = Some(return_url);
self
}
pub fn cancel_url(mut self, cancel_url: String) -> OrderApplicationContext {
self.cancel_url = Some(cancel_url);
self
}
pub fn stored_payment_source(
mut self,
stored_payment_source: StoredPaymentSource,
) -> OrderApplicationContext {
self.stored_payment_source = Some(stored_payment_source);
self
}
}