maytes-api-client-py 0.1.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. maytes_api_client/__init__.py +150 -0
  2. maytes_api_client/api/__init__.py +5 -0
  3. maytes_api_client/api/default_api.py +2661 -0
  4. maytes_api_client/api_client.py +804 -0
  5. maytes_api_client/api_response.py +21 -0
  6. maytes_api_client/configuration.py +630 -0
  7. maytes_api_client/exceptions.py +218 -0
  8. maytes_api_client/managed_client.py +199 -0
  9. maytes_api_client/models/__init__.py +64 -0
  10. maytes_api_client/models/cancel_checkout409_response.py +101 -0
  11. maytes_api_client/models/cancel_checkout_request.py +88 -0
  12. maytes_api_client/models/cancel_checkout_response.py +92 -0
  13. maytes_api_client/models/capture_checkout409_response.py +101 -0
  14. maytes_api_client/models/capture_checkout422_response.py +101 -0
  15. maytes_api_client/models/capture_checkout_request.py +118 -0
  16. maytes_api_client/models/capture_checkout_response.py +92 -0
  17. maytes_api_client/models/checkout.py +159 -0
  18. maytes_api_client/models/checkout_cancelled.py +97 -0
  19. maytes_api_client/models/checkout_captured.py +109 -0
  20. maytes_api_client/models/checkout_created.py +95 -0
  21. maytes_api_client/models/checkout_discount.py +133 -0
  22. maytes_api_client/models/checkout_fee.py +150 -0
  23. maytes_api_client/models/create_checkout401_response.py +101 -0
  24. maytes_api_client/models/create_checkout409_response.py +101 -0
  25. maytes_api_client/models/create_checkout422_response.py +101 -0
  26. maytes_api_client/models/create_checkout_request.py +213 -0
  27. maytes_api_client/models/create_checkout_response.py +92 -0
  28. maytes_api_client/models/create_refund_request.py +91 -0
  29. maytes_api_client/models/customer_data.py +107 -0
  30. maytes_api_client/models/digital_goods_custom_data.py +93 -0
  31. maytes_api_client/models/digital_goods_line_item.py +150 -0
  32. maytes_api_client/models/donation_line_item.py +144 -0
  33. maytes_api_client/models/error_response_dto.py +94 -0
  34. maytes_api_client/models/fee.py +103 -0
  35. maytes_api_client/models/fee_breakdown_line.py +101 -0
  36. maytes_api_client/models/food_beverage_line_item.py +144 -0
  37. maytes_api_client/models/get_checkout404_response.py +101 -0
  38. maytes_api_client/models/get_checkout422_response.py +101 -0
  39. maytes_api_client/models/get_checkout_response.py +92 -0
  40. maytes_api_client/models/get_settlement_response.py +92 -0
  41. maytes_api_client/models/health_response.py +88 -0
  42. maytes_api_client/models/line_item.py +210 -0
  43. maytes_api_client/models/list_settlements_response.py +96 -0
  44. maytes_api_client/models/o_auth_token_request.py +102 -0
  45. maytes_api_client/models/o_auth_token_response.py +96 -0
  46. maytes_api_client/models/other_line_item.py +144 -0
  47. maytes_api_client/models/physical_goods_custom_data.py +90 -0
  48. maytes_api_client/models/physical_goods_line_item.py +150 -0
  49. maytes_api_client/models/refund_checkout402_response.py +101 -0
  50. maytes_api_client/models/refund_checkout409_response.py +101 -0
  51. maytes_api_client/models/service_custom_data.py +93 -0
  52. maytes_api_client/models/service_line_item.py +150 -0
  53. maytes_api_client/models/settlement.py +160 -0
  54. maytes_api_client/models/tax.py +111 -0
  55. maytes_api_client/models/ticket_custom_data.py +125 -0
  56. maytes_api_client/models/ticket_line_item.py +150 -0
  57. maytes_api_client/models/ticket_seating.py +94 -0
  58. maytes_api_client/py.typed +0 -0
  59. maytes_api_client/rest.py +263 -0
  60. maytes_api_client/webhook_verifier.py +197 -0
  61. maytes_api_client_py-0.1.1.dist-info/METADATA +70 -0
  62. maytes_api_client_py-0.1.1.dist-info/RECORD +65 -0
  63. maytes_api_client_py-0.1.1.dist-info/WHEEL +5 -0
  64. maytes_api_client_py-0.1.1.dist-info/licenses/LICENSE +21 -0
  65. maytes_api_client_py-0.1.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,101 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Maytes API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, StrictStr, field_validator
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+ from pydantic_core import to_jsonable_python
25
+
26
+ class CreateCheckout409Response(BaseModel):
27
+ """
28
+ CreateCheckout409Response
29
+ """ # noqa: E501
30
+ message: StrictStr
31
+ error: StrictStr
32
+ code: StrictStr
33
+ metadata: Optional[Dict[str, Any]] = None
34
+ __properties: ClassVar[List[str]] = ["message", "error", "code", "metadata"]
35
+
36
+ @field_validator('code')
37
+ def code_validate_enum(cls, value):
38
+ """Validates the enum"""
39
+ if value not in set(['order_already_authorized', 'merchant_not_accepting_checkouts']):
40
+ raise ValueError("must be one of enum values ('order_already_authorized', 'merchant_not_accepting_checkouts')")
41
+ return value
42
+
43
+ model_config = ConfigDict(
44
+ validate_by_name=True,
45
+ validate_by_alias=True,
46
+ validate_assignment=True,
47
+ protected_namespaces=(),
48
+ )
49
+
50
+
51
+ def to_str(self) -> str:
52
+ """Returns the string representation of the model using alias"""
53
+ return pprint.pformat(self.model_dump(by_alias=True))
54
+
55
+ def to_json(self) -> str:
56
+ """Returns the JSON representation of the model using alias"""
57
+ return json.dumps(to_jsonable_python(self.to_dict()))
58
+
59
+ @classmethod
60
+ def from_json(cls, json_str: str) -> Optional[Self]:
61
+ """Create an instance of CreateCheckout409Response from a JSON string"""
62
+ return cls.from_dict(json.loads(json_str))
63
+
64
+ def to_dict(self) -> Dict[str, Any]:
65
+ """Return the dictionary representation of the model using alias.
66
+
67
+ This has the following differences from calling pydantic's
68
+ `self.model_dump(by_alias=True)`:
69
+
70
+ * `None` is only added to the output dict for nullable fields that
71
+ were set at model initialization. Other fields with value `None`
72
+ are ignored.
73
+ """
74
+ excluded_fields: Set[str] = set([
75
+ ])
76
+
77
+ _dict = self.model_dump(
78
+ by_alias=True,
79
+ exclude=excluded_fields,
80
+ exclude_none=True,
81
+ )
82
+ return _dict
83
+
84
+ @classmethod
85
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
86
+ """Create an instance of CreateCheckout409Response from a dict"""
87
+ if obj is None:
88
+ return None
89
+
90
+ if not isinstance(obj, dict):
91
+ return cls.model_validate(obj)
92
+
93
+ _obj = cls.model_validate({
94
+ "message": obj.get("message"),
95
+ "error": obj.get("error"),
96
+ "code": obj.get("code"),
97
+ "metadata": obj.get("metadata")
98
+ })
99
+ return _obj
100
+
101
+
@@ -0,0 +1,101 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Maytes API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, StrictStr, field_validator
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+ from pydantic_core import to_jsonable_python
25
+
26
+ class CreateCheckout422Response(BaseModel):
27
+ """
28
+ CreateCheckout422Response
29
+ """ # noqa: E501
30
+ message: StrictStr
31
+ error: StrictStr
32
+ code: StrictStr
33
+ metadata: Optional[Dict[str, Any]] = None
34
+ __properties: ClassVar[List[str]] = ["message", "error", "code", "metadata"]
35
+
36
+ @field_validator('code')
37
+ def code_validate_enum(cls, value):
38
+ """Validates the enum"""
39
+ if value not in set(['invalid_amount', 'amount_below_minimum', 'invalid_amount_arithmetic', 'currency_not_supported', 'merchant_currency_mismatch', 'merchant_not_configured']):
40
+ raise ValueError("must be one of enum values ('invalid_amount', 'amount_below_minimum', 'invalid_amount_arithmetic', 'currency_not_supported', 'merchant_currency_mismatch', 'merchant_not_configured')")
41
+ return value
42
+
43
+ model_config = ConfigDict(
44
+ validate_by_name=True,
45
+ validate_by_alias=True,
46
+ validate_assignment=True,
47
+ protected_namespaces=(),
48
+ )
49
+
50
+
51
+ def to_str(self) -> str:
52
+ """Returns the string representation of the model using alias"""
53
+ return pprint.pformat(self.model_dump(by_alias=True))
54
+
55
+ def to_json(self) -> str:
56
+ """Returns the JSON representation of the model using alias"""
57
+ return json.dumps(to_jsonable_python(self.to_dict()))
58
+
59
+ @classmethod
60
+ def from_json(cls, json_str: str) -> Optional[Self]:
61
+ """Create an instance of CreateCheckout422Response from a JSON string"""
62
+ return cls.from_dict(json.loads(json_str))
63
+
64
+ def to_dict(self) -> Dict[str, Any]:
65
+ """Return the dictionary representation of the model using alias.
66
+
67
+ This has the following differences from calling pydantic's
68
+ `self.model_dump(by_alias=True)`:
69
+
70
+ * `None` is only added to the output dict for nullable fields that
71
+ were set at model initialization. Other fields with value `None`
72
+ are ignored.
73
+ """
74
+ excluded_fields: Set[str] = set([
75
+ ])
76
+
77
+ _dict = self.model_dump(
78
+ by_alias=True,
79
+ exclude=excluded_fields,
80
+ exclude_none=True,
81
+ )
82
+ return _dict
83
+
84
+ @classmethod
85
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
86
+ """Create an instance of CreateCheckout422Response from a dict"""
87
+ if obj is None:
88
+ return None
89
+
90
+ if not isinstance(obj, dict):
91
+ return cls.model_validate(obj)
92
+
93
+ _obj = cls.model_validate({
94
+ "message": obj.get("message"),
95
+ "error": obj.get("error"),
96
+ "code": obj.get("code"),
97
+ "metadata": obj.get("metadata")
98
+ })
99
+ return _obj
100
+
101
+
@@ -0,0 +1,213 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Maytes API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from datetime import datetime
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing_extensions import Annotated
24
+ from maytes_api_client.models.checkout_discount import CheckoutDiscount
25
+ from maytes_api_client.models.checkout_fee import CheckoutFee
26
+ from maytes_api_client.models.customer_data import CustomerData
27
+ from maytes_api_client.models.line_item import LineItem
28
+ from maytes_api_client.models.tax import Tax
29
+ from typing import Optional, Set
30
+ from typing_extensions import Self
31
+ from pydantic_core import to_jsonable_python
32
+
33
+ class CreateCheckoutRequest(BaseModel):
34
+ """
35
+ CreateCheckoutRequest
36
+ """ # noqa: E501
37
+ merchant_order_id: Optional[StrictStr] = None
38
+ merchant_expires_at: Optional[datetime] = None
39
+ total_amount: Annotated[int, Field(strict=True, gt=0)]
40
+ currency: Annotated[str, Field(strict=True)]
41
+ return_url: StrictStr
42
+ cancel_url: StrictStr
43
+ items: Annotated[List[LineItem], Field(min_length=1)]
44
+ fees: Optional[List[CheckoutFee]] = None
45
+ discounts: Optional[List[CheckoutDiscount]] = None
46
+ tax: Optional[Tax] = None
47
+ shipping_amount: Optional[Annotated[int, Field(strict=True, ge=0)]] = None
48
+ customer_data: Optional[CustomerData] = None
49
+ metadata: Optional[Dict[str, Any]] = None
50
+ allocation_model: Optional[StrictStr] = None
51
+ __properties: ClassVar[List[str]] = ["merchant_order_id", "merchant_expires_at", "total_amount", "currency", "return_url", "cancel_url", "items", "fees", "discounts", "tax", "shipping_amount", "customer_data", "metadata", "allocation_model"]
52
+
53
+ @field_validator('currency')
54
+ def currency_validate_regular_expression(cls, value):
55
+ """Validates the regular expression"""
56
+ if not isinstance(value, str):
57
+ value = str(value)
58
+
59
+ if not re.match(r"^[A-Z]{3}$", value):
60
+ raise ValueError(r"must validate the regular expression /^[A-Z]{3}$/")
61
+ return value
62
+
63
+ @field_validator('allocation_model')
64
+ def allocation_model_validate_enum(cls, value):
65
+ """Validates the enum"""
66
+ if value is None:
67
+ return value
68
+
69
+ if value not in set(['basic_amount', 'item_assignment']):
70
+ raise ValueError("must be one of enum values ('basic_amount', 'item_assignment')")
71
+ return value
72
+
73
+ model_config = ConfigDict(
74
+ validate_by_name=True,
75
+ validate_by_alias=True,
76
+ validate_assignment=True,
77
+ protected_namespaces=(),
78
+ )
79
+
80
+
81
+ def to_str(self) -> str:
82
+ """Returns the string representation of the model using alias"""
83
+ return pprint.pformat(self.model_dump(by_alias=True))
84
+
85
+ def to_json(self) -> str:
86
+ """Returns the JSON representation of the model using alias"""
87
+ return json.dumps(to_jsonable_python(self.to_dict()))
88
+
89
+ @classmethod
90
+ def from_json(cls, json_str: str) -> Optional[Self]:
91
+ """Create an instance of CreateCheckoutRequest from a JSON string"""
92
+ return cls.from_dict(json.loads(json_str))
93
+
94
+ def to_dict(self) -> Dict[str, Any]:
95
+ """Return the dictionary representation of the model using alias.
96
+
97
+ This has the following differences from calling pydantic's
98
+ `self.model_dump(by_alias=True)`:
99
+
100
+ * `None` is only added to the output dict for nullable fields that
101
+ were set at model initialization. Other fields with value `None`
102
+ are ignored.
103
+ """
104
+ excluded_fields: Set[str] = set([
105
+ ])
106
+
107
+ _dict = self.model_dump(
108
+ by_alias=True,
109
+ exclude=excluded_fields,
110
+ exclude_none=True,
111
+ )
112
+ # override the default output from pydantic by calling `to_dict()` of each item in items (list)
113
+ _items = []
114
+ if self.items:
115
+ for _item_items in self.items:
116
+ if _item_items:
117
+ _items.append(_item_items.to_dict())
118
+ _dict['items'] = _items
119
+ # override the default output from pydantic by calling `to_dict()` of each item in fees (list)
120
+ _items = []
121
+ if self.fees:
122
+ for _item_fees in self.fees:
123
+ if _item_fees:
124
+ _items.append(_item_fees.to_dict())
125
+ _dict['fees'] = _items
126
+ # override the default output from pydantic by calling `to_dict()` of each item in discounts (list)
127
+ _items = []
128
+ if self.discounts:
129
+ for _item_discounts in self.discounts:
130
+ if _item_discounts:
131
+ _items.append(_item_discounts.to_dict())
132
+ _dict['discounts'] = _items
133
+ # override the default output from pydantic by calling `to_dict()` of tax
134
+ if self.tax:
135
+ _dict['tax'] = self.tax.to_dict()
136
+ # override the default output from pydantic by calling `to_dict()` of customer_data
137
+ if self.customer_data:
138
+ _dict['customer_data'] = self.customer_data.to_dict()
139
+ # set to None if merchant_order_id (nullable) is None
140
+ # and model_fields_set contains the field
141
+ if self.merchant_order_id is None and "merchant_order_id" in self.model_fields_set:
142
+ _dict['merchant_order_id'] = None
143
+
144
+ # set to None if merchant_expires_at (nullable) is None
145
+ # and model_fields_set contains the field
146
+ if self.merchant_expires_at is None and "merchant_expires_at" in self.model_fields_set:
147
+ _dict['merchant_expires_at'] = None
148
+
149
+ # set to None if fees (nullable) is None
150
+ # and model_fields_set contains the field
151
+ if self.fees is None and "fees" in self.model_fields_set:
152
+ _dict['fees'] = None
153
+
154
+ # set to None if discounts (nullable) is None
155
+ # and model_fields_set contains the field
156
+ if self.discounts is None and "discounts" in self.model_fields_set:
157
+ _dict['discounts'] = None
158
+
159
+ # set to None if tax (nullable) is None
160
+ # and model_fields_set contains the field
161
+ if self.tax is None and "tax" in self.model_fields_set:
162
+ _dict['tax'] = None
163
+
164
+ # set to None if shipping_amount (nullable) is None
165
+ # and model_fields_set contains the field
166
+ if self.shipping_amount is None and "shipping_amount" in self.model_fields_set:
167
+ _dict['shipping_amount'] = None
168
+
169
+ # set to None if customer_data (nullable) is None
170
+ # and model_fields_set contains the field
171
+ if self.customer_data is None and "customer_data" in self.model_fields_set:
172
+ _dict['customer_data'] = None
173
+
174
+ # set to None if metadata (nullable) is None
175
+ # and model_fields_set contains the field
176
+ if self.metadata is None and "metadata" in self.model_fields_set:
177
+ _dict['metadata'] = None
178
+
179
+ # set to None if allocation_model (nullable) is None
180
+ # and model_fields_set contains the field
181
+ if self.allocation_model is None and "allocation_model" in self.model_fields_set:
182
+ _dict['allocation_model'] = None
183
+
184
+ return _dict
185
+
186
+ @classmethod
187
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
188
+ """Create an instance of CreateCheckoutRequest from a dict"""
189
+ if obj is None:
190
+ return None
191
+
192
+ if not isinstance(obj, dict):
193
+ return cls.model_validate(obj)
194
+
195
+ _obj = cls.model_validate({
196
+ "merchant_order_id": obj.get("merchant_order_id"),
197
+ "merchant_expires_at": obj.get("merchant_expires_at"),
198
+ "total_amount": obj.get("total_amount"),
199
+ "currency": obj.get("currency"),
200
+ "return_url": obj.get("return_url"),
201
+ "cancel_url": obj.get("cancel_url"),
202
+ "items": [LineItem.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None,
203
+ "fees": [CheckoutFee.from_dict(_item) for _item in obj["fees"]] if obj.get("fees") is not None else None,
204
+ "discounts": [CheckoutDiscount.from_dict(_item) for _item in obj["discounts"]] if obj.get("discounts") is not None else None,
205
+ "tax": Tax.from_dict(obj["tax"]) if obj.get("tax") is not None else None,
206
+ "shipping_amount": obj.get("shipping_amount"),
207
+ "customer_data": CustomerData.from_dict(obj["customer_data"]) if obj.get("customer_data") is not None else None,
208
+ "metadata": obj.get("metadata"),
209
+ "allocation_model": obj.get("allocation_model")
210
+ })
211
+ return _obj
212
+
213
+
@@ -0,0 +1,92 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Maytes API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict
21
+ from typing import Any, ClassVar, Dict, List
22
+ from maytes_api_client.models.checkout_created import CheckoutCreated
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+ from pydantic_core import to_jsonable_python
26
+
27
+ class CreateCheckoutResponse(BaseModel):
28
+ """
29
+ CreateCheckoutResponse
30
+ """ # noqa: E501
31
+ data: CheckoutCreated
32
+ __properties: ClassVar[List[str]] = ["data"]
33
+
34
+ model_config = ConfigDict(
35
+ validate_by_name=True,
36
+ validate_by_alias=True,
37
+ validate_assignment=True,
38
+ protected_namespaces=(),
39
+ )
40
+
41
+
42
+ def to_str(self) -> str:
43
+ """Returns the string representation of the model using alias"""
44
+ return pprint.pformat(self.model_dump(by_alias=True))
45
+
46
+ def to_json(self) -> str:
47
+ """Returns the JSON representation of the model using alias"""
48
+ return json.dumps(to_jsonable_python(self.to_dict()))
49
+
50
+ @classmethod
51
+ def from_json(cls, json_str: str) -> Optional[Self]:
52
+ """Create an instance of CreateCheckoutResponse from a JSON string"""
53
+ return cls.from_dict(json.loads(json_str))
54
+
55
+ def to_dict(self) -> Dict[str, Any]:
56
+ """Return the dictionary representation of the model using alias.
57
+
58
+ This has the following differences from calling pydantic's
59
+ `self.model_dump(by_alias=True)`:
60
+
61
+ * `None` is only added to the output dict for nullable fields that
62
+ were set at model initialization. Other fields with value `None`
63
+ are ignored.
64
+ """
65
+ excluded_fields: Set[str] = set([
66
+ ])
67
+
68
+ _dict = self.model_dump(
69
+ by_alias=True,
70
+ exclude=excluded_fields,
71
+ exclude_none=True,
72
+ )
73
+ # override the default output from pydantic by calling `to_dict()` of data
74
+ if self.data:
75
+ _dict['data'] = self.data.to_dict()
76
+ return _dict
77
+
78
+ @classmethod
79
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
80
+ """Create an instance of CreateCheckoutResponse from a dict"""
81
+ if obj is None:
82
+ return None
83
+
84
+ if not isinstance(obj, dict):
85
+ return cls.model_validate(obj)
86
+
87
+ _obj = cls.model_validate({
88
+ "data": CheckoutCreated.from_dict(obj["data"]) if obj.get("data") is not None else None
89
+ })
90
+ return _obj
91
+
92
+
@@ -0,0 +1,91 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Maytes API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing_extensions import Annotated
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+ from pydantic_core import to_jsonable_python
26
+
27
+ class CreateRefundRequest(BaseModel):
28
+ """
29
+ CreateRefundRequest
30
+ """ # noqa: E501
31
+ reason: Optional[Annotated[str, Field(strict=True, max_length=500)]] = Field(default=None, description="Free-text reason; forwarded to Stripe as refund metadata.")
32
+ merchant_refund_ref: Annotated[str, Field(min_length=1, strict=True, max_length=255)] = Field(description="Idempotency key scoped to the merchant. Repeating the same value returns the existing refund.")
33
+ __properties: ClassVar[List[str]] = ["reason", "merchant_refund_ref"]
34
+
35
+ model_config = ConfigDict(
36
+ validate_by_name=True,
37
+ validate_by_alias=True,
38
+ validate_assignment=True,
39
+ protected_namespaces=(),
40
+ )
41
+
42
+
43
+ def to_str(self) -> str:
44
+ """Returns the string representation of the model using alias"""
45
+ return pprint.pformat(self.model_dump(by_alias=True))
46
+
47
+ def to_json(self) -> str:
48
+ """Returns the JSON representation of the model using alias"""
49
+ return json.dumps(to_jsonable_python(self.to_dict()))
50
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
+ """Create an instance of CreateRefundRequest from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ """Return the dictionary representation of the model using alias.
58
+
59
+ This has the following differences from calling pydantic's
60
+ `self.model_dump(by_alias=True)`:
61
+
62
+ * `None` is only added to the output dict for nullable fields that
63
+ were set at model initialization. Other fields with value `None`
64
+ are ignored.
65
+ """
66
+ excluded_fields: Set[str] = set([
67
+ ])
68
+
69
+ _dict = self.model_dump(
70
+ by_alias=True,
71
+ exclude=excluded_fields,
72
+ exclude_none=True,
73
+ )
74
+ return _dict
75
+
76
+ @classmethod
77
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
78
+ """Create an instance of CreateRefundRequest from a dict"""
79
+ if obj is None:
80
+ return None
81
+
82
+ if not isinstance(obj, dict):
83
+ return cls.model_validate(obj)
84
+
85
+ _obj = cls.model_validate({
86
+ "reason": obj.get("reason"),
87
+ "merchant_refund_ref": obj.get("merchant_refund_ref")
88
+ })
89
+ return _obj
90
+
91
+