stripe_shared/
payment_intent_next_action_konbini_stores.rs1#[derive(Clone, Debug)]
2#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
3#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
4pub struct PaymentIntentNextActionKonbiniStores {
5 pub familymart: Option<stripe_shared::PaymentIntentNextActionKonbiniFamilymart>,
7 pub lawson: Option<stripe_shared::PaymentIntentNextActionKonbiniLawson>,
9 pub ministop: Option<stripe_shared::PaymentIntentNextActionKonbiniMinistop>,
11 pub seicomart: Option<stripe_shared::PaymentIntentNextActionKonbiniSeicomart>,
13}
14#[doc(hidden)]
15pub struct PaymentIntentNextActionKonbiniStoresBuilder {
16 familymart: Option<Option<stripe_shared::PaymentIntentNextActionKonbiniFamilymart>>,
17 lawson: Option<Option<stripe_shared::PaymentIntentNextActionKonbiniLawson>>,
18 ministop: Option<Option<stripe_shared::PaymentIntentNextActionKonbiniMinistop>>,
19 seicomart: Option<Option<stripe_shared::PaymentIntentNextActionKonbiniSeicomart>>,
20}
21
22#[allow(
23 unused_variables,
24 irrefutable_let_patterns,
25 clippy::let_unit_value,
26 clippy::match_single_binding,
27 clippy::single_match
28)]
29const _: () = {
30 use miniserde::de::{Map, Visitor};
31 use miniserde::json::Value;
32 use miniserde::{Deserialize, Result, make_place};
33 use stripe_types::miniserde_helpers::FromValueOpt;
34 use stripe_types::{MapBuilder, ObjectDeser};
35
36 make_place!(Place);
37
38 impl Deserialize for PaymentIntentNextActionKonbiniStores {
39 fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
40 Place::new(out)
41 }
42 }
43
44 struct Builder<'a> {
45 out: &'a mut Option<PaymentIntentNextActionKonbiniStores>,
46 builder: PaymentIntentNextActionKonbiniStoresBuilder,
47 }
48
49 impl Visitor for Place<PaymentIntentNextActionKonbiniStores> {
50 fn map(&mut self) -> Result<Box<dyn Map + '_>> {
51 Ok(Box::new(Builder {
52 out: &mut self.out,
53 builder: PaymentIntentNextActionKonbiniStoresBuilder::deser_default(),
54 }))
55 }
56 }
57
58 impl MapBuilder for PaymentIntentNextActionKonbiniStoresBuilder {
59 type Out = PaymentIntentNextActionKonbiniStores;
60 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
61 Ok(match k {
62 "familymart" => Deserialize::begin(&mut self.familymart),
63 "lawson" => Deserialize::begin(&mut self.lawson),
64 "ministop" => Deserialize::begin(&mut self.ministop),
65 "seicomart" => Deserialize::begin(&mut self.seicomart),
66 _ => <dyn Visitor>::ignore(),
67 })
68 }
69
70 fn deser_default() -> Self {
71 Self {
72 familymart: Deserialize::default(),
73 lawson: Deserialize::default(),
74 ministop: Deserialize::default(),
75 seicomart: Deserialize::default(),
76 }
77 }
78
79 fn take_out(&mut self) -> Option<Self::Out> {
80 let (Some(familymart), Some(lawson), Some(ministop), Some(seicomart)) = (
81 self.familymart.take(),
82 self.lawson.take(),
83 self.ministop.take(),
84 self.seicomart.take(),
85 ) else {
86 return None;
87 };
88 Some(Self::Out { familymart, lawson, ministop, seicomart })
89 }
90 }
91
92 impl Map for Builder<'_> {
93 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
94 self.builder.key(k)
95 }
96
97 fn finish(&mut self) -> Result<()> {
98 *self.out = self.builder.take_out();
99 Ok(())
100 }
101 }
102
103 impl ObjectDeser for PaymentIntentNextActionKonbiniStores {
104 type Builder = PaymentIntentNextActionKonbiniStoresBuilder;
105 }
106
107 impl FromValueOpt for PaymentIntentNextActionKonbiniStores {
108 fn from_value(v: Value) -> Option<Self> {
109 let Value::Object(obj) = v else {
110 return None;
111 };
112 let mut b = PaymentIntentNextActionKonbiniStoresBuilder::deser_default();
113 for (k, v) in obj {
114 match k.as_str() {
115 "familymart" => b.familymart = FromValueOpt::from_value(v),
116 "lawson" => b.lawson = FromValueOpt::from_value(v),
117 "ministop" => b.ministop = FromValueOpt::from_value(v),
118 "seicomart" => b.seicomart = FromValueOpt::from_value(v),
119 _ => {}
120 }
121 }
122 b.take_out()
123 }
124 }
125};