1#[derive(Clone, Debug)]
2#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
3#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
4pub struct IssuingNetworkTokenWalletProvider {
5 pub account_id: Option<String>,
7 pub account_trust_score: Option<i64>,
10 pub card_number_source: Option<IssuingNetworkTokenWalletProviderCardNumberSource>,
12 pub cardholder_address: Option<stripe_shared::IssuingNetworkTokenAddress>,
13 pub cardholder_name: Option<String>,
15 pub device_trust_score: Option<i64>,
17 pub hashed_account_email_address: Option<String>,
19 pub reason_codes: Option<Vec<IssuingNetworkTokenWalletProviderReasonCodes>>,
21 pub suggested_decision: Option<IssuingNetworkTokenWalletProviderSuggestedDecision>,
23 pub suggested_decision_version: Option<String>,
25}
26#[doc(hidden)]
27pub struct IssuingNetworkTokenWalletProviderBuilder {
28 account_id: Option<Option<String>>,
29 account_trust_score: Option<Option<i64>>,
30 card_number_source: Option<Option<IssuingNetworkTokenWalletProviderCardNumberSource>>,
31 cardholder_address: Option<Option<stripe_shared::IssuingNetworkTokenAddress>>,
32 cardholder_name: Option<Option<String>>,
33 device_trust_score: Option<Option<i64>>,
34 hashed_account_email_address: Option<Option<String>>,
35 reason_codes: Option<Option<Vec<IssuingNetworkTokenWalletProviderReasonCodes>>>,
36 suggested_decision: Option<Option<IssuingNetworkTokenWalletProviderSuggestedDecision>>,
37 suggested_decision_version: Option<Option<String>>,
38}
39
40#[allow(
41 unused_variables,
42 irrefutable_let_patterns,
43 clippy::let_unit_value,
44 clippy::match_single_binding,
45 clippy::single_match
46)]
47const _: () = {
48 use miniserde::de::{Map, Visitor};
49 use miniserde::json::Value;
50 use miniserde::{Deserialize, Result, make_place};
51 use stripe_types::miniserde_helpers::FromValueOpt;
52 use stripe_types::{MapBuilder, ObjectDeser};
53
54 make_place!(Place);
55
56 impl Deserialize for IssuingNetworkTokenWalletProvider {
57 fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
58 Place::new(out)
59 }
60 }
61
62 struct Builder<'a> {
63 out: &'a mut Option<IssuingNetworkTokenWalletProvider>,
64 builder: IssuingNetworkTokenWalletProviderBuilder,
65 }
66
67 impl Visitor for Place<IssuingNetworkTokenWalletProvider> {
68 fn map(&mut self) -> Result<Box<dyn Map + '_>> {
69 Ok(Box::new(Builder {
70 out: &mut self.out,
71 builder: IssuingNetworkTokenWalletProviderBuilder::deser_default(),
72 }))
73 }
74 }
75
76 impl MapBuilder for IssuingNetworkTokenWalletProviderBuilder {
77 type Out = IssuingNetworkTokenWalletProvider;
78 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
79 Ok(match k {
80 "account_id" => Deserialize::begin(&mut self.account_id),
81 "account_trust_score" => Deserialize::begin(&mut self.account_trust_score),
82 "card_number_source" => Deserialize::begin(&mut self.card_number_source),
83 "cardholder_address" => Deserialize::begin(&mut self.cardholder_address),
84 "cardholder_name" => Deserialize::begin(&mut self.cardholder_name),
85 "device_trust_score" => Deserialize::begin(&mut self.device_trust_score),
86 "hashed_account_email_address" => {
87 Deserialize::begin(&mut self.hashed_account_email_address)
88 }
89 "reason_codes" => Deserialize::begin(&mut self.reason_codes),
90 "suggested_decision" => Deserialize::begin(&mut self.suggested_decision),
91 "suggested_decision_version" => {
92 Deserialize::begin(&mut self.suggested_decision_version)
93 }
94 _ => <dyn Visitor>::ignore(),
95 })
96 }
97
98 fn deser_default() -> Self {
99 Self {
100 account_id: Deserialize::default(),
101 account_trust_score: Deserialize::default(),
102 card_number_source: Deserialize::default(),
103 cardholder_address: Deserialize::default(),
104 cardholder_name: Deserialize::default(),
105 device_trust_score: Deserialize::default(),
106 hashed_account_email_address: Deserialize::default(),
107 reason_codes: Deserialize::default(),
108 suggested_decision: Deserialize::default(),
109 suggested_decision_version: Deserialize::default(),
110 }
111 }
112
113 fn take_out(&mut self) -> Option<Self::Out> {
114 let (
115 Some(account_id),
116 Some(account_trust_score),
117 Some(card_number_source),
118 Some(cardholder_address),
119 Some(cardholder_name),
120 Some(device_trust_score),
121 Some(hashed_account_email_address),
122 Some(reason_codes),
123 Some(suggested_decision),
124 Some(suggested_decision_version),
125 ) = (
126 self.account_id.take(),
127 self.account_trust_score,
128 self.card_number_source.take(),
129 self.cardholder_address.take(),
130 self.cardholder_name.take(),
131 self.device_trust_score,
132 self.hashed_account_email_address.take(),
133 self.reason_codes.take(),
134 self.suggested_decision.take(),
135 self.suggested_decision_version.take(),
136 )
137 else {
138 return None;
139 };
140 Some(Self::Out {
141 account_id,
142 account_trust_score,
143 card_number_source,
144 cardholder_address,
145 cardholder_name,
146 device_trust_score,
147 hashed_account_email_address,
148 reason_codes,
149 suggested_decision,
150 suggested_decision_version,
151 })
152 }
153 }
154
155 impl Map for Builder<'_> {
156 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
157 self.builder.key(k)
158 }
159
160 fn finish(&mut self) -> Result<()> {
161 *self.out = self.builder.take_out();
162 Ok(())
163 }
164 }
165
166 impl ObjectDeser for IssuingNetworkTokenWalletProvider {
167 type Builder = IssuingNetworkTokenWalletProviderBuilder;
168 }
169
170 impl FromValueOpt for IssuingNetworkTokenWalletProvider {
171 fn from_value(v: Value) -> Option<Self> {
172 let Value::Object(obj) = v else {
173 return None;
174 };
175 let mut b = IssuingNetworkTokenWalletProviderBuilder::deser_default();
176 for (k, v) in obj {
177 match k.as_str() {
178 "account_id" => b.account_id = FromValueOpt::from_value(v),
179 "account_trust_score" => b.account_trust_score = FromValueOpt::from_value(v),
180 "card_number_source" => b.card_number_source = FromValueOpt::from_value(v),
181 "cardholder_address" => b.cardholder_address = FromValueOpt::from_value(v),
182 "cardholder_name" => b.cardholder_name = FromValueOpt::from_value(v),
183 "device_trust_score" => b.device_trust_score = FromValueOpt::from_value(v),
184 "hashed_account_email_address" => {
185 b.hashed_account_email_address = FromValueOpt::from_value(v)
186 }
187 "reason_codes" => b.reason_codes = FromValueOpt::from_value(v),
188 "suggested_decision" => b.suggested_decision = FromValueOpt::from_value(v),
189 "suggested_decision_version" => {
190 b.suggested_decision_version = FromValueOpt::from_value(v)
191 }
192 _ => {}
193 }
194 }
195 b.take_out()
196 }
197 }
198};
199#[derive(Clone, Eq, PartialEq)]
201#[non_exhaustive]
202pub enum IssuingNetworkTokenWalletProviderCardNumberSource {
203 App,
204 Manual,
205 OnFile,
206 Other,
207 Unknown(String),
209}
210impl IssuingNetworkTokenWalletProviderCardNumberSource {
211 pub fn as_str(&self) -> &str {
212 use IssuingNetworkTokenWalletProviderCardNumberSource::*;
213 match self {
214 App => "app",
215 Manual => "manual",
216 OnFile => "on_file",
217 Other => "other",
218 Unknown(v) => v,
219 }
220 }
221}
222
223impl std::str::FromStr for IssuingNetworkTokenWalletProviderCardNumberSource {
224 type Err = std::convert::Infallible;
225 fn from_str(s: &str) -> Result<Self, Self::Err> {
226 use IssuingNetworkTokenWalletProviderCardNumberSource::*;
227 match s {
228 "app" => Ok(App),
229 "manual" => Ok(Manual),
230 "on_file" => Ok(OnFile),
231 "other" => Ok(Other),
232 v => {
233 tracing::warn!(
234 "Unknown value '{}' for enum '{}'",
235 v,
236 "IssuingNetworkTokenWalletProviderCardNumberSource"
237 );
238 Ok(Unknown(v.to_owned()))
239 }
240 }
241 }
242}
243impl std::fmt::Display for IssuingNetworkTokenWalletProviderCardNumberSource {
244 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
245 f.write_str(self.as_str())
246 }
247}
248
249impl std::fmt::Debug for IssuingNetworkTokenWalletProviderCardNumberSource {
250 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
251 f.write_str(self.as_str())
252 }
253}
254#[cfg(feature = "serialize")]
255impl serde::Serialize for IssuingNetworkTokenWalletProviderCardNumberSource {
256 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
257 where
258 S: serde::Serializer,
259 {
260 serializer.serialize_str(self.as_str())
261 }
262}
263impl miniserde::Deserialize for IssuingNetworkTokenWalletProviderCardNumberSource {
264 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
265 crate::Place::new(out)
266 }
267}
268
269impl miniserde::de::Visitor for crate::Place<IssuingNetworkTokenWalletProviderCardNumberSource> {
270 fn string(&mut self, s: &str) -> miniserde::Result<()> {
271 use std::str::FromStr;
272 self.out = Some(
273 IssuingNetworkTokenWalletProviderCardNumberSource::from_str(s).expect("infallible"),
274 );
275 Ok(())
276 }
277}
278
279stripe_types::impl_from_val_with_from_str!(IssuingNetworkTokenWalletProviderCardNumberSource);
280#[cfg(feature = "deserialize")]
281impl<'de> serde::Deserialize<'de> for IssuingNetworkTokenWalletProviderCardNumberSource {
282 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
283 use std::str::FromStr;
284 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
285 Ok(Self::from_str(&s).expect("infallible"))
286 }
287}
288#[derive(Clone, Eq, PartialEq)]
290#[non_exhaustive]
291pub enum IssuingNetworkTokenWalletProviderReasonCodes {
292 AccountCardTooNew,
293 AccountRecentlyChanged,
294 AccountTooNew,
295 AccountTooNewSinceLaunch,
296 AdditionalDevice,
297 DataExpired,
298 DeferIdVDecision,
299 DeviceRecentlyLost,
300 GoodActivityHistory,
301 HasSuspendedTokens,
302 HighRisk,
303 InactiveAccount,
304 LongAccountTenure,
305 LowAccountScore,
306 LowDeviceScore,
307 LowPhoneNumberScore,
308 NetworkServiceError,
309 OutsideHomeTerritory,
310 ProvisioningCardholderMismatch,
311 ProvisioningDeviceAndCardholderMismatch,
312 ProvisioningDeviceMismatch,
313 SameDeviceNoPriorAuthentication,
314 SameDeviceSuccessfulPriorAuthentication,
315 SoftwareUpdate,
316 SuspiciousActivity,
317 TooManyDifferentCardholders,
318 TooManyRecentAttempts,
319 TooManyRecentTokens,
320 Unknown(String),
322}
323impl IssuingNetworkTokenWalletProviderReasonCodes {
324 pub fn as_str(&self) -> &str {
325 use IssuingNetworkTokenWalletProviderReasonCodes::*;
326 match self {
327 AccountCardTooNew => "account_card_too_new",
328 AccountRecentlyChanged => "account_recently_changed",
329 AccountTooNew => "account_too_new",
330 AccountTooNewSinceLaunch => "account_too_new_since_launch",
331 AdditionalDevice => "additional_device",
332 DataExpired => "data_expired",
333 DeferIdVDecision => "defer_id_v_decision",
334 DeviceRecentlyLost => "device_recently_lost",
335 GoodActivityHistory => "good_activity_history",
336 HasSuspendedTokens => "has_suspended_tokens",
337 HighRisk => "high_risk",
338 InactiveAccount => "inactive_account",
339 LongAccountTenure => "long_account_tenure",
340 LowAccountScore => "low_account_score",
341 LowDeviceScore => "low_device_score",
342 LowPhoneNumberScore => "low_phone_number_score",
343 NetworkServiceError => "network_service_error",
344 OutsideHomeTerritory => "outside_home_territory",
345 ProvisioningCardholderMismatch => "provisioning_cardholder_mismatch",
346 ProvisioningDeviceAndCardholderMismatch => {
347 "provisioning_device_and_cardholder_mismatch"
348 }
349 ProvisioningDeviceMismatch => "provisioning_device_mismatch",
350 SameDeviceNoPriorAuthentication => "same_device_no_prior_authentication",
351 SameDeviceSuccessfulPriorAuthentication => {
352 "same_device_successful_prior_authentication"
353 }
354 SoftwareUpdate => "software_update",
355 SuspiciousActivity => "suspicious_activity",
356 TooManyDifferentCardholders => "too_many_different_cardholders",
357 TooManyRecentAttempts => "too_many_recent_attempts",
358 TooManyRecentTokens => "too_many_recent_tokens",
359 Unknown(v) => v,
360 }
361 }
362}
363
364impl std::str::FromStr for IssuingNetworkTokenWalletProviderReasonCodes {
365 type Err = std::convert::Infallible;
366 fn from_str(s: &str) -> Result<Self, Self::Err> {
367 use IssuingNetworkTokenWalletProviderReasonCodes::*;
368 match s {
369 "account_card_too_new" => Ok(AccountCardTooNew),
370 "account_recently_changed" => Ok(AccountRecentlyChanged),
371 "account_too_new" => Ok(AccountTooNew),
372 "account_too_new_since_launch" => Ok(AccountTooNewSinceLaunch),
373 "additional_device" => Ok(AdditionalDevice),
374 "data_expired" => Ok(DataExpired),
375 "defer_id_v_decision" => Ok(DeferIdVDecision),
376 "device_recently_lost" => Ok(DeviceRecentlyLost),
377 "good_activity_history" => Ok(GoodActivityHistory),
378 "has_suspended_tokens" => Ok(HasSuspendedTokens),
379 "high_risk" => Ok(HighRisk),
380 "inactive_account" => Ok(InactiveAccount),
381 "long_account_tenure" => Ok(LongAccountTenure),
382 "low_account_score" => Ok(LowAccountScore),
383 "low_device_score" => Ok(LowDeviceScore),
384 "low_phone_number_score" => Ok(LowPhoneNumberScore),
385 "network_service_error" => Ok(NetworkServiceError),
386 "outside_home_territory" => Ok(OutsideHomeTerritory),
387 "provisioning_cardholder_mismatch" => Ok(ProvisioningCardholderMismatch),
388 "provisioning_device_and_cardholder_mismatch" => {
389 Ok(ProvisioningDeviceAndCardholderMismatch)
390 }
391 "provisioning_device_mismatch" => Ok(ProvisioningDeviceMismatch),
392 "same_device_no_prior_authentication" => Ok(SameDeviceNoPriorAuthentication),
393 "same_device_successful_prior_authentication" => {
394 Ok(SameDeviceSuccessfulPriorAuthentication)
395 }
396 "software_update" => Ok(SoftwareUpdate),
397 "suspicious_activity" => Ok(SuspiciousActivity),
398 "too_many_different_cardholders" => Ok(TooManyDifferentCardholders),
399 "too_many_recent_attempts" => Ok(TooManyRecentAttempts),
400 "too_many_recent_tokens" => Ok(TooManyRecentTokens),
401 v => {
402 tracing::warn!(
403 "Unknown value '{}' for enum '{}'",
404 v,
405 "IssuingNetworkTokenWalletProviderReasonCodes"
406 );
407 Ok(Unknown(v.to_owned()))
408 }
409 }
410 }
411}
412impl std::fmt::Display for IssuingNetworkTokenWalletProviderReasonCodes {
413 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
414 f.write_str(self.as_str())
415 }
416}
417
418impl std::fmt::Debug for IssuingNetworkTokenWalletProviderReasonCodes {
419 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
420 f.write_str(self.as_str())
421 }
422}
423#[cfg(feature = "serialize")]
424impl serde::Serialize for IssuingNetworkTokenWalletProviderReasonCodes {
425 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
426 where
427 S: serde::Serializer,
428 {
429 serializer.serialize_str(self.as_str())
430 }
431}
432impl miniserde::Deserialize for IssuingNetworkTokenWalletProviderReasonCodes {
433 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
434 crate::Place::new(out)
435 }
436}
437
438impl miniserde::de::Visitor for crate::Place<IssuingNetworkTokenWalletProviderReasonCodes> {
439 fn string(&mut self, s: &str) -> miniserde::Result<()> {
440 use std::str::FromStr;
441 self.out =
442 Some(IssuingNetworkTokenWalletProviderReasonCodes::from_str(s).expect("infallible"));
443 Ok(())
444 }
445}
446
447stripe_types::impl_from_val_with_from_str!(IssuingNetworkTokenWalletProviderReasonCodes);
448#[cfg(feature = "deserialize")]
449impl<'de> serde::Deserialize<'de> for IssuingNetworkTokenWalletProviderReasonCodes {
450 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
451 use std::str::FromStr;
452 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
453 Ok(Self::from_str(&s).expect("infallible"))
454 }
455}
456#[derive(Clone, Eq, PartialEq)]
458#[non_exhaustive]
459pub enum IssuingNetworkTokenWalletProviderSuggestedDecision {
460 Approve,
461 Decline,
462 RequireAuth,
463 Unknown(String),
465}
466impl IssuingNetworkTokenWalletProviderSuggestedDecision {
467 pub fn as_str(&self) -> &str {
468 use IssuingNetworkTokenWalletProviderSuggestedDecision::*;
469 match self {
470 Approve => "approve",
471 Decline => "decline",
472 RequireAuth => "require_auth",
473 Unknown(v) => v,
474 }
475 }
476}
477
478impl std::str::FromStr for IssuingNetworkTokenWalletProviderSuggestedDecision {
479 type Err = std::convert::Infallible;
480 fn from_str(s: &str) -> Result<Self, Self::Err> {
481 use IssuingNetworkTokenWalletProviderSuggestedDecision::*;
482 match s {
483 "approve" => Ok(Approve),
484 "decline" => Ok(Decline),
485 "require_auth" => Ok(RequireAuth),
486 v => {
487 tracing::warn!(
488 "Unknown value '{}' for enum '{}'",
489 v,
490 "IssuingNetworkTokenWalletProviderSuggestedDecision"
491 );
492 Ok(Unknown(v.to_owned()))
493 }
494 }
495 }
496}
497impl std::fmt::Display for IssuingNetworkTokenWalletProviderSuggestedDecision {
498 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
499 f.write_str(self.as_str())
500 }
501}
502
503impl std::fmt::Debug for IssuingNetworkTokenWalletProviderSuggestedDecision {
504 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
505 f.write_str(self.as_str())
506 }
507}
508#[cfg(feature = "serialize")]
509impl serde::Serialize for IssuingNetworkTokenWalletProviderSuggestedDecision {
510 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
511 where
512 S: serde::Serializer,
513 {
514 serializer.serialize_str(self.as_str())
515 }
516}
517impl miniserde::Deserialize for IssuingNetworkTokenWalletProviderSuggestedDecision {
518 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
519 crate::Place::new(out)
520 }
521}
522
523impl miniserde::de::Visitor for crate::Place<IssuingNetworkTokenWalletProviderSuggestedDecision> {
524 fn string(&mut self, s: &str) -> miniserde::Result<()> {
525 use std::str::FromStr;
526 self.out = Some(
527 IssuingNetworkTokenWalletProviderSuggestedDecision::from_str(s).expect("infallible"),
528 );
529 Ok(())
530 }
531}
532
533stripe_types::impl_from_val_with_from_str!(IssuingNetworkTokenWalletProviderSuggestedDecision);
534#[cfg(feature = "deserialize")]
535impl<'de> serde::Deserialize<'de> for IssuingNetworkTokenWalletProviderSuggestedDecision {
536 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
537 use std::str::FromStr;
538 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
539 Ok(Self::from_str(&s).expect("infallible"))
540 }
541}