1#![allow(dead_code)]
2use crate::spec;
3
4#[derive(Debug, Clone)]
8pub struct ParamSet {
9 institution: Option<String>,
10 terminal_pwd: Option<String>,
11 sip_user: Option<String>,
12 sip_pass: Option<String>,
13 location: Option<String>,
14 patron_id: Option<String>,
15 patron_pwd: Option<String>,
16 item_id: Option<String>,
17 start_item: Option<usize>,
18 end_item: Option<usize>,
19
20 pay_amount: Option<String>,
22
23 pay_type: Option<spec::PayType>,
24
25 fee_type: Option<spec::FeeType>,
26
27 fee_id: Option<String>,
29
30 transaction_id: Option<String>,
32
33 summary: Option<usize>,
37}
38
39impl Default for ParamSet {
40 fn default() -> Self {
41 Self::new()
42 }
43}
44
45impl ParamSet {
46 pub fn new() -> Self {
47 ParamSet {
48 institution: None,
49 terminal_pwd: None,
50 sip_user: None,
51 sip_pass: None,
52 location: None,
53 patron_id: None,
54 patron_pwd: None,
55 item_id: None,
56 start_item: None,
57 end_item: None,
58 summary: None,
59 pay_amount: None,
60 transaction_id: None,
61 fee_id: None,
62 pay_type: None,
63 fee_type: None,
64 }
65 }
66
67 pub fn institution(&self) -> Option<&str> {
68 self.institution.as_deref()
69 }
70 pub fn terminal_pwd(&self) -> Option<&str> {
71 self.terminal_pwd.as_deref()
72 }
73 pub fn sip_user(&self) -> Option<&str> {
74 self.sip_user.as_deref()
75 }
76 pub fn sip_pass(&self) -> Option<&str> {
77 self.sip_pass.as_deref()
78 }
79 pub fn location(&self) -> Option<&str> {
80 self.location.as_deref()
81 }
82 pub fn patron_id(&self) -> Option<&str> {
83 self.patron_id.as_deref()
84 }
85 pub fn patron_pwd(&self) -> Option<&str> {
86 self.patron_pwd.as_deref()
87 }
88 pub fn item_id(&self) -> Option<&str> {
89 self.item_id.as_deref()
90 }
91 pub fn start_item(&self) -> Option<usize> {
92 self.start_item
93 }
94 pub fn end_item(&self) -> Option<usize> {
95 self.end_item
96 }
97 pub fn summary(&self) -> Option<usize> {
98 self.summary
99 }
100 pub fn pay_amount(&self) -> Option<&str> {
101 self.pay_amount.as_deref()
102 }
103 pub fn transaction_id(&self) -> Option<&str> {
104 self.transaction_id.as_deref()
105 }
106 pub fn fee_id(&self) -> Option<&str> {
107 self.fee_id.as_deref()
108 }
109 pub fn pay_type(&self) -> Option<spec::PayType> {
110 self.pay_type
111 }
112 pub fn fee_type(&self) -> Option<spec::FeeType> {
113 self.fee_type
114 }
115
116 pub fn set_institution(&mut self, value: &str) -> &mut Self {
119 self.institution = Some(value.to_string());
120 self
121 }
122 pub fn set_terminal_pwd(&mut self, value: &str) -> &mut Self {
123 self.terminal_pwd = Some(value.to_string());
124 self
125 }
126 pub fn set_sip_user(&mut self, value: &str) -> &mut Self {
127 self.sip_user = Some(value.to_string());
128 self
129 }
130 pub fn set_sip_pass(&mut self, value: &str) -> &mut Self {
131 self.sip_pass = Some(value.to_string());
132 self
133 }
134 pub fn set_location(&mut self, value: &str) -> &mut Self {
135 self.location = Some(value.to_string());
136 self
137 }
138 pub fn set_patron_id(&mut self, value: &str) -> &mut Self {
139 self.patron_id = Some(value.to_string());
140 self
141 }
142 pub fn set_patron_pwd(&mut self, value: &str) -> &mut Self {
143 self.patron_pwd = Some(value.to_string());
144 self
145 }
146 pub fn set_item_id(&mut self, value: &str) -> &mut Self {
147 self.item_id = Some(value.to_string());
148 self
149 }
150 pub fn set_start_item(&mut self, value: usize) -> &mut Self {
151 self.start_item = Some(value);
152 self
153 }
154 pub fn set_end_item(&mut self, value: usize) -> &mut Self {
155 self.end_item = Some(value);
156 self
157 }
158 pub fn set_summary(&mut self, value: usize) -> &mut Self {
159 self.summary = Some(value);
160 self
161 }
162 pub fn set_pay_amount(&mut self, amount: &str) -> &mut Self {
163 self.pay_amount = Some(amount.to_string());
164 self
165 }
166 pub fn set_transaction_id(&mut self, id: &str) -> &mut Self {
167 self.transaction_id = Some(id.to_string());
168 self
169 }
170 pub fn set_fee_id(&mut self, id: &str) -> &mut Self {
171 self.fee_id = Some(id.to_string());
172 self
173 }
174 pub fn set_pay_type(&mut self, pt: spec::PayType) -> &mut Self {
175 self.pay_type = Some(pt);
176 self
177 }
178 pub fn set_fee_type(&mut self, pt: spec::FeeType) -> &mut Self {
179 self.fee_type = Some(pt);
180 self
181 }
182}