Debian Codegraph @

stripe/terminal/_configuration.py

raw
1 # -*- coding: utf-8 -*-
2 # File generated from our OpenAPI spec
3 from stripe._createable_api_resource import CreateableAPIResource
4 from stripe._deletable_api_resource import DeletableAPIResource
5 from stripe._expandable_field import ExpandableField
6 from stripe._list_object import ListObject
7 from stripe._listable_api_resource import ListableAPIResource
8 from stripe._stripe_object import StripeObject
9 from stripe._updateable_api_resource import UpdateableAPIResource
10 from stripe._util import class_method_variant, sanitize_id
11 from typing import ClassVar, List, Optional, cast, overload
12 from typing_extensions import Literal, Unpack, TYPE_CHECKING
13
14 if TYPE_CHECKING:
15 from stripe._file import File
16 from stripe.params.terminal._configuration_create_params import (
17 ConfigurationCreateParams,
18 )
19 from stripe.params.terminal._configuration_delete_params import (
20 ConfigurationDeleteParams,
21 )
22 from stripe.params.terminal._configuration_list_params import (
23 ConfigurationListParams,
24 )
25 from stripe.params.terminal._configuration_modify_params import (
26 ConfigurationModifyParams,
27 )
28 from stripe.params.terminal._configuration_retrieve_params import (
29 ConfigurationRetrieveParams,
30 )
31
32
33 class Configuration(
34 CreateableAPIResource["Configuration"],
35 DeletableAPIResource["Configuration"],
36 ListableAPIResource["Configuration"],
37 UpdateableAPIResource["Configuration"],
38 ):
39 """
40 A Configurations object represents how features should be configured for terminal readers.
41 For information about how to use it, see the [Terminal configurations documentation](https://docs.stripe.com/terminal/fleet/configurations-overview).
42 """
43
44 OBJECT_NAME: ClassVar[Literal["terminal.configuration"]] = (
45 "terminal.configuration"
46 )
47
48 class BbposWisepad3(StripeObject):
49 splashscreen: Optional[ExpandableField["File"]]
50 """
51 A File ID representing an image to display on the reader
52 """
53
54 class BbposWiseposE(StripeObject):
55 splashscreen: Optional[ExpandableField["File"]]
56 """
57 A File ID representing an image to display on the reader
58 """
59
60 class Cellular(StripeObject):
61 enabled: bool
62 """
63 Whether a cellular-capable reader can connect to the internet over cellular.
64 """
65
66 class Offline(StripeObject):
67 enabled: Optional[bool]
68 """
69 Determines whether to allow transactions to be collected while reader is offline. Defaults to false.
70 """
71
72 class RebootWindow(StripeObject):
73 end_hour: int
74 """
75 Integer between 0 to 23 that represents the end hour of the reboot time window. The value must be different than the start_hour.
76 """
77 start_hour: int
78 """
79 Integer between 0 to 23 that represents the start hour of the reboot time window.
80 """
81
82 class StripeS700(StripeObject):
83 splashscreen: Optional[ExpandableField["File"]]
84 """
85 A File ID representing an image to display on the reader
86 """
87
88 class StripeS710(StripeObject):
89 splashscreen: Optional[ExpandableField["File"]]
90 """
91 A File ID representing an image to display on the reader
92 """
93
94 class Tipping(StripeObject):
95 class Aed(StripeObject):
96 fixed_amounts: Optional[List[int]]
97 """
98 Fixed amounts displayed when collecting a tip
99 """
100 percentages: Optional[List[int]]
101 """
102 Percentages displayed when collecting a tip
103 """
104 smart_tip_threshold: Optional[int]
105 """
106 Below this amount, fixed amounts will be displayed; above it, percentages will be displayed
107 """
108
109 class Aud(StripeObject):
110 fixed_amounts: Optional[List[int]]
111 """
112 Fixed amounts displayed when collecting a tip
113 """
114 percentages: Optional[List[int]]
115 """
116 Percentages displayed when collecting a tip
117 """
118 smart_tip_threshold: Optional[int]
119 """
120 Below this amount, fixed amounts will be displayed; above it, percentages will be displayed
121 """
122
123 class Cad(StripeObject):
124 fixed_amounts: Optional[List[int]]
125 """
126 Fixed amounts displayed when collecting a tip
127 """
128 percentages: Optional[List[int]]
129 """
130 Percentages displayed when collecting a tip
131 """
132 smart_tip_threshold: Optional[int]
133 """
134 Below this amount, fixed amounts will be displayed; above it, percentages will be displayed
135 """
136
137 class Chf(StripeObject):
138 fixed_amounts: Optional[List[int]]
139 """
140 Fixed amounts displayed when collecting a tip
141 """
142 percentages: Optional[List[int]]
143 """
144 Percentages displayed when collecting a tip
145 """
146 smart_tip_threshold: Optional[int]
147 """
148 Below this amount, fixed amounts will be displayed; above it, percentages will be displayed
149 """
150
151 class Czk(StripeObject):
152 fixed_amounts: Optional[List[int]]
153 """
154 Fixed amounts displayed when collecting a tip
155 """
156 percentages: Optional[List[int]]
157 """
158 Percentages displayed when collecting a tip
159 """
160 smart_tip_threshold: Optional[int]
161 """
162 Below this amount, fixed amounts will be displayed; above it, percentages will be displayed
163 """
164
165 class Dkk(StripeObject):
166 fixed_amounts: Optional[List[int]]
167 """
168 Fixed amounts displayed when collecting a tip
169 """
170 percentages: Optional[List[int]]
171 """
172 Percentages displayed when collecting a tip
173 """
174 smart_tip_threshold: Optional[int]
175 """
176 Below this amount, fixed amounts will be displayed; above it, percentages will be displayed
177 """
178
179 class Eur(StripeObject):
180 fixed_amounts: Optional[List[int]]
181 """
182 Fixed amounts displayed when collecting a tip
183 """
184 percentages: Optional[List[int]]
185 """
186 Percentages displayed when collecting a tip
187 """
188 smart_tip_threshold: Optional[int]
189 """
190 Below this amount, fixed amounts will be displayed; above it, percentages will be displayed
191 """
192
193 class Gbp(StripeObject):
194 fixed_amounts: Optional[List[int]]
195 """
196 Fixed amounts displayed when collecting a tip
197 """
198 percentages: Optional[List[int]]
199 """
200 Percentages displayed when collecting a tip
201 """
202 smart_tip_threshold: Optional[int]
203 """
204 Below this amount, fixed amounts will be displayed; above it, percentages will be displayed
205 """
206
207 class Gip(StripeObject):
208 fixed_amounts: Optional[List[int]]
209 """
210 Fixed amounts displayed when collecting a tip
211 """
212 percentages: Optional[List[int]]
213 """
214 Percentages displayed when collecting a tip
215 """
216 smart_tip_threshold: Optional[int]
217 """
218 Below this amount, fixed amounts will be displayed; above it, percentages will be displayed
219 """
220
221 class Hkd(StripeObject):
222 fixed_amounts: Optional[List[int]]
223 """
224 Fixed amounts displayed when collecting a tip
225 """
226 percentages: Optional[List[int]]
227 """
228 Percentages displayed when collecting a tip
229 """
230 smart_tip_threshold: Optional[int]
231 """
232 Below this amount, fixed amounts will be displayed; above it, percentages will be displayed
233 """
234
235 class Huf(StripeObject):
236 fixed_amounts: Optional[List[int]]
237 """
238 Fixed amounts displayed when collecting a tip
239 """
240 percentages: Optional[List[int]]
241 """
242 Percentages displayed when collecting a tip
243 """
244 smart_tip_threshold: Optional[int]
245 """
246 Below this amount, fixed amounts will be displayed; above it, percentages will be displayed
247 """
248
249 class Jpy(StripeObject):
250 fixed_amounts: Optional[List[int]]
251 """
252 Fixed amounts displayed when collecting a tip
253 """
254 percentages: Optional[List[int]]
255 """
256 Percentages displayed when collecting a tip
257 """
258 smart_tip_threshold: Optional[int]
259 """
260 Below this amount, fixed amounts will be displayed; above it, percentages will be displayed
261 """
262
263 class Mxn(StripeObject):
264 fixed_amounts: Optional[List[int]]
265 """
266 Fixed amounts displayed when collecting a tip
267 """
268 percentages: Optional[List[int]]
269 """
270 Percentages displayed when collecting a tip
271 """
272 smart_tip_threshold: Optional[int]
273 """
274 Below this amount, fixed amounts will be displayed; above it, percentages will be displayed
275 """
276
277 class Myr(StripeObject):
278 fixed_amounts: Optional[List[int]]
279 """
280 Fixed amounts displayed when collecting a tip
281 """
282 percentages: Optional[List[int]]
283 """
284 Percentages displayed when collecting a tip
285 """
286 smart_tip_threshold: Optional[int]
287 """
288 Below this amount, fixed amounts will be displayed; above it, percentages will be displayed
289 """
290
291 class Nok(StripeObject):
292 fixed_amounts: Optional[List[int]]
293 """
294 Fixed amounts displayed when collecting a tip
295 """
296 percentages: Optional[List[int]]
297 """
298 Percentages displayed when collecting a tip
299 """
300 smart_tip_threshold: Optional[int]
301 """
302 Below this amount, fixed amounts will be displayed; above it, percentages will be displayed
303 """
304
305 class Nzd(StripeObject):
306 fixed_amounts: Optional[List[int]]
307 """
308 Fixed amounts displayed when collecting a tip
309 """
310 percentages: Optional[List[int]]
311 """
312 Percentages displayed when collecting a tip
313 """
314 smart_tip_threshold: Optional[int]
315 """
316 Below this amount, fixed amounts will be displayed; above it, percentages will be displayed
317 """
318
319 class Pln(StripeObject):
320 fixed_amounts: Optional[List[int]]
321 """
322 Fixed amounts displayed when collecting a tip
323 """
324 percentages: Optional[List[int]]
325 """
326 Percentages displayed when collecting a tip
327 """
328 smart_tip_threshold: Optional[int]
329 """
330 Below this amount, fixed amounts will be displayed; above it, percentages will be displayed
331 """
332
333 class Ron(StripeObject):
334 fixed_amounts: Optional[List[int]]
335 """
336 Fixed amounts displayed when collecting a tip
337 """
338 percentages: Optional[List[int]]
339 """
340 Percentages displayed when collecting a tip
341 """
342 smart_tip_threshold: Optional[int]
343 """
344 Below this amount, fixed amounts will be displayed; above it, percentages will be displayed
345 """
346
347 class Sek(StripeObject):
348 fixed_amounts: Optional[List[int]]
349 """
350 Fixed amounts displayed when collecting a tip
351 """
352 percentages: Optional[List[int]]
353 """
354 Percentages displayed when collecting a tip
355 """
356 smart_tip_threshold: Optional[int]
357 """
358 Below this amount, fixed amounts will be displayed; above it, percentages will be displayed
359 """
360
361 class Sgd(StripeObject):
362 fixed_amounts: Optional[List[int]]
363 """
364 Fixed amounts displayed when collecting a tip
365 """
366 percentages: Optional[List[int]]
367 """
368 Percentages displayed when collecting a tip
369 """
370 smart_tip_threshold: Optional[int]
371 """
372 Below this amount, fixed amounts will be displayed; above it, percentages will be displayed
373 """
374
375 class Usd(StripeObject):
376 fixed_amounts: Optional[List[int]]
377 """
378 Fixed amounts displayed when collecting a tip
379 """
380 percentages: Optional[List[int]]
381 """
382 Percentages displayed when collecting a tip
383 """
384 smart_tip_threshold: Optional[int]
385 """
386 Below this amount, fixed amounts will be displayed; above it, percentages will be displayed
387 """
388
389 aed: Optional[Aed]
390 aud: Optional[Aud]
391 cad: Optional[Cad]
392 chf: Optional[Chf]
393 czk: Optional[Czk]
394 dkk: Optional[Dkk]
395 eur: Optional[Eur]
396 gbp: Optional[Gbp]
397 gip: Optional[Gip]
398 hkd: Optional[Hkd]
399 huf: Optional[Huf]
400 jpy: Optional[Jpy]
401 mxn: Optional[Mxn]
402 myr: Optional[Myr]
403 nok: Optional[Nok]
404 nzd: Optional[Nzd]
405 pln: Optional[Pln]
406 ron: Optional[Ron]
407 sek: Optional[Sek]
408 sgd: Optional[Sgd]
409 usd: Optional[Usd]
410 _inner_class_types = {
411 "aed": Aed,
412 "aud": Aud,
413 "cad": Cad,
414 "chf": Chf,
415 "czk": Czk,
416 "dkk": Dkk,
417 "eur": Eur,
418 "gbp": Gbp,
419 "gip": Gip,
420 "hkd": Hkd,
421 "huf": Huf,
422 "jpy": Jpy,
423 "mxn": Mxn,
424 "myr": Myr,
425 "nok": Nok,
426 "nzd": Nzd,
427 "pln": Pln,
428 "ron": Ron,
429 "sek": Sek,
430 "sgd": Sgd,
431 "usd": Usd,
432 }
433
434 class VerifoneP400(StripeObject):
435 splashscreen: Optional[ExpandableField["File"]]
436 """
437 A File ID representing an image to display on the reader
438 """
439
440 class Wifi(StripeObject):
441 class EnterpriseEapPeap(StripeObject):
442 ca_certificate_file: Optional[str]
443 """
444 A File ID representing a PEM file containing the server certificate
445 """
446 password: str
447 """
448 Password for connecting to the WiFi network
449 """
450 ssid: str
451 """
452 Name of the WiFi network
453 """
454 username: str
455 """
456 Username for connecting to the WiFi network
457 """
458
459 class EnterpriseEapTls(StripeObject):
460 ca_certificate_file: Optional[str]
461 """
462 A File ID representing a PEM file containing the server certificate
463 """
464 client_certificate_file: str
465 """
466 A File ID representing a PEM file containing the client certificate
467 """
468 private_key_file: str
469 """
470 A File ID representing a PEM file containing the client RSA private key
471 """
472 private_key_file_password: Optional[str]
473 """
474 Password for the private key file
475 """
476 ssid: str
477 """
478 Name of the WiFi network
479 """
480
481 class PersonalPsk(StripeObject):
482 password: str
483 """
484 Password for connecting to the WiFi network
485 """
486 ssid: str
487 """
488 Name of the WiFi network
489 """
490
491 enterprise_eap_peap: Optional[EnterpriseEapPeap]
492 enterprise_eap_tls: Optional[EnterpriseEapTls]
493 personal_psk: Optional[PersonalPsk]
494 type: Literal[
495 "enterprise_eap_peap", "enterprise_eap_tls", "personal_psk"
496 ]
497 """
498 Security type of the WiFi network. The hash with the corresponding name contains the credentials for this security type.
499 """
500 _inner_class_types = {
501 "enterprise_eap_peap": EnterpriseEapPeap,
502 "enterprise_eap_tls": EnterpriseEapTls,
503 "personal_psk": PersonalPsk,
504 }
505
506 bbpos_wisepad3: Optional[BbposWisepad3]
507 bbpos_wisepos_e: Optional[BbposWiseposE]
508 cellular: Optional[Cellular]
509 deleted: Optional[Literal[True]]
510 """
511 Always true for a deleted object
512 """
513 id: str
514 """
515 Unique identifier for the object.
516 """
517 is_account_default: Optional[bool]
518 """
519 Whether this Configuration is the default for your account
520 """
521 livemode: bool
522 """
523 Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
524 """
525 name: Optional[str]
526 """
527 String indicating the name of the Configuration object, set by the user
528 """
529 object: Literal["terminal.configuration"]
530 """
531 String representing the object's type. Objects of the same type share the same value.
532 """
533 offline: Optional[Offline]
534 reboot_window: Optional[RebootWindow]
535 stripe_s700: Optional[StripeS700]
536 stripe_s710: Optional[StripeS710]
537 tipping: Optional[Tipping]
538 verifone_p400: Optional[VerifoneP400]
539 wifi: Optional[Wifi]
540
541 @classmethod
542 def create(
543 cls, **params: Unpack["ConfigurationCreateParams"]
544 ) -> "Configuration":
545 """
546 Creates a new Configuration object.
547 """
548 return cast(
549 "Configuration",
550 cls._static_request(
551 "post",
552 cls.class_url(),
553 params=params,
554 ),
555 )
556
557 @classmethod
558 async def create_async(
559 cls, **params: Unpack["ConfigurationCreateParams"]
560 ) -> "Configuration":
561 """
562 Creates a new Configuration object.
563 """
564 return cast(
565 "Configuration",
566 await cls._static_request_async(
567 "post",
568 cls.class_url(),
569 params=params,
570 ),
571 )
572
573 @classmethod
574 def _cls_delete(
575 cls, sid: str, **params: Unpack["ConfigurationDeleteParams"]
576 ) -> "Configuration":
577 """
578 Deletes a Configuration object.
579 """
580 url = "%s/%s" % (cls.class_url(), sanitize_id(sid))
581 return cast(
582 "Configuration",
583 cls._static_request(
584 "delete",
585 url,
586 params=params,
587 ),
588 )
589
590 @overload
591 @staticmethod
592 def delete(
593 sid: str, **params: Unpack["ConfigurationDeleteParams"]
594 ) -> "Configuration":
595 """
596 Deletes a Configuration object.
597 """
598 ...
599
600 @overload
601 def delete(
602 self, **params: Unpack["ConfigurationDeleteParams"]
603 ) -> "Configuration":
604 """
605 Deletes a Configuration object.
606 """
607 ...
608
609 @class_method_variant("_cls_delete")
610 def delete( # pyright: ignore[reportGeneralTypeIssues]
611 self, **params: Unpack["ConfigurationDeleteParams"]
612 ) -> "Configuration":
613 """
614 Deletes a Configuration object.
615 """
616 return self._request_and_refresh(
617 "delete",
618 self.instance_url(),
619 params=params,
620 )
621
622 @classmethod
623 async def _cls_delete_async(
624 cls, sid: str, **params: Unpack["ConfigurationDeleteParams"]
625 ) -> "Configuration":
626 """
627 Deletes a Configuration object.
628 """
629 url = "%s/%s" % (cls.class_url(), sanitize_id(sid))
630 return cast(
631 "Configuration",
632 await cls._static_request_async(
633 "delete",
634 url,
635 params=params,
636 ),
637 )
638
639 @overload
640 @staticmethod
641 async def delete_async(
642 sid: str, **params: Unpack["ConfigurationDeleteParams"]
643 ) -> "Configuration":
644 """
645 Deletes a Configuration object.
646 """
647 ...
648
649 @overload
650 async def delete_async(
651 self, **params: Unpack["ConfigurationDeleteParams"]
652 ) -> "Configuration":
653 """
654 Deletes a Configuration object.
655 """
656 ...
657
658 @class_method_variant("_cls_delete_async")
659 async def delete_async( # pyright: ignore[reportGeneralTypeIssues]
660 self, **params: Unpack["ConfigurationDeleteParams"]
661 ) -> "Configuration":
662 """
663 Deletes a Configuration object.
664 """
665 return await self._request_and_refresh_async(
666 "delete",
667 self.instance_url(),
668 params=params,
669 )
670
671 @classmethod
672 def list(
673 cls, **params: Unpack["ConfigurationListParams"]
674 ) -> ListObject["Configuration"]:
675 """
676 Returns a list of Configuration objects.
677 """
678 result = cls._static_request(
679 "get",
680 cls.class_url(),
681 params=params,
682 )
683 if not isinstance(result, ListObject):
684 raise TypeError(
685 "Expected list object from API, got %s"
686 % (type(result).__name__)
687 )
688
689 return result
690
691 @classmethod
692 async def list_async(
693 cls, **params: Unpack["ConfigurationListParams"]
694 ) -> ListObject["Configuration"]:
695 """
696 Returns a list of Configuration objects.
697 """
698 result = await cls._static_request_async(
699 "get",
700 cls.class_url(),
701 params=params,
702 )
703 if not isinstance(result, ListObject):
704 raise TypeError(
705 "Expected list object from API, got %s"
706 % (type(result).__name__)
707 )
708
709 return result
710
711 @classmethod
712 def modify(
713 cls, id: str, **params: Unpack["ConfigurationModifyParams"]
714 ) -> "Configuration":
715 """
716 Updates a new Configuration object.
717 """
718 url = "%s/%s" % (cls.class_url(), sanitize_id(id))
719 return cast(
720 "Configuration",
721 cls._static_request(
722 "post",
723 url,
724 params=params,
725 ),
726 )
727
728 @classmethod
729 async def modify_async(
730 cls, id: str, **params: Unpack["ConfigurationModifyParams"]
731 ) -> "Configuration":
732 """
733 Updates a new Configuration object.
734 """
735 url = "%s/%s" % (cls.class_url(), sanitize_id(id))
736 return cast(
737 "Configuration",
738 await cls._static_request_async(
739 "post",
740 url,
741 params=params,
742 ),
743 )
744
745 @classmethod
746 def retrieve(
747 cls, id: str, **params: Unpack["ConfigurationRetrieveParams"]
748 ) -> "Configuration":
749 """
750 Retrieves a Configuration object.
751 """
752 instance = cls(id, **params)
753 instance.refresh()
754 return instance
755
756 @classmethod
757 async def retrieve_async(
758 cls, id: str, **params: Unpack["ConfigurationRetrieveParams"]
759 ) -> "Configuration":
760 """
761 Retrieves a Configuration object.
762 """
763 instance = cls(id, **params)
764 await instance.refresh_async()
765 return instance
766
767 _inner_class_types = {
768 "bbpos_wisepad3": BbposWisepad3,
769 "bbpos_wisepos_e": BbposWiseposE,
770 "cellular": Cellular,
771 "offline": Offline,
772 "reboot_window": RebootWindow,
773 "stripe_s700": StripeS700,
774 "stripe_s710": StripeS710,
775 "tipping": Tipping,
776 "verifone_p400": VerifoneP400,
777 "wifi": Wifi,
778 }