vortex-sdk 0.2.0__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 (123) hide show
  1. vortex/__init__.py +265 -0
  2. vortex/api/__init__.py +24 -0
  3. vortex/api/billing_api.py +34608 -0
  4. vortex/api/catalog_api.py +708 -0
  5. vortex/api/checkout_api.py +372 -0
  6. vortex/api/credit_notes_api.py +1688 -0
  7. vortex/api/customer_balance_api.py +1747 -0
  8. vortex/api/customers_api.py +387 -0
  9. vortex/api/discounts_api.py +2623 -0
  10. vortex/api/entitlements_api.py +1646 -0
  11. vortex/api/hosted_api.py +2855 -0
  12. vortex/api/invoices_api.py +2402 -0
  13. vortex/api/payables_api.py +1380 -0
  14. vortex/api/payment_methods_api.py +2069 -0
  15. vortex/api/payment_requests_api.py +1877 -0
  16. vortex/api/payments_api.py +694 -0
  17. vortex/api/payments_readiness_api.py +2311 -0
  18. vortex/api/public_api.py +6931 -0
  19. vortex/api/quotes_api.py +6817 -0
  20. vortex/api/receipts_api.py +1111 -0
  21. vortex/api/subscriptions_api.py +1059 -0
  22. vortex/api/tax_api.py +1397 -0
  23. vortex/api/webhooks_api.py +4931 -0
  24. vortex/api_client.py +804 -0
  25. vortex/api_response.py +21 -0
  26. vortex/configuration.py +658 -0
  27. vortex/exceptions.py +218 -0
  28. vortex/models/__init__.py +104 -0
  29. vortex/models/api_error.py +103 -0
  30. vortex/models/api_error_error.py +114 -0
  31. vortex/models/api_write_envelope.py +101 -0
  32. vortex/models/apply_coupon_request.py +97 -0
  33. vortex/models/billing_order_form_sign_request.py +103 -0
  34. vortex/models/billing_order_form_signature_request_request.py +86 -0
  35. vortex/models/billing_order_form_void_request.py +86 -0
  36. vortex/models/billing_order_forms_expire_due_request.py +90 -0
  37. vortex/models/billing_order_update_request.py +99 -0
  38. vortex/models/billing_orders_execute_due_request.py +90 -0
  39. vortex/models/billing_quote_create_request.py +119 -0
  40. vortex/models/billing_quote_line_input.py +93 -0
  41. vortex/models/billing_quote_version_approve_request.py +87 -0
  42. vortex/models/billing_quote_version_create_request.py +103 -0
  43. vortex/models/billing_quote_version_update_request.py +102 -0
  44. vortex/models/billing_quote_version_void_request.py +96 -0
  45. vortex/models/checkout_session_line_item_request.py +91 -0
  46. vortex/models/coupon_targets.py +89 -0
  47. vortex/models/create_checkout_session_request.py +140 -0
  48. vortex/models/create_coupon_request.py +132 -0
  49. vortex/models/create_deposit_balance_payable_request.py +172 -0
  50. vortex/models/create_installment_payable_request.py +170 -0
  51. vortex/models/create_payable_request.py +158 -0
  52. vortex/models/create_recurring_payable_request.py +181 -0
  53. vortex/models/create_recurring_payable_request_cadence.py +96 -0
  54. vortex/models/credit_note_create_line.py +105 -0
  55. vortex/models/credit_note_create_request.py +112 -0
  56. vortex/models/credit_note_reason.py +39 -0
  57. vortex/models/credit_note_refund_reconcile_request.py +86 -0
  58. vortex/models/credit_note_refund_request.py +94 -0
  59. vortex/models/customer_balance_targets.py +102 -0
  60. vortex/models/customer_default_payment_method_request.py +88 -0
  61. vortex/models/customer_payment_method_archive_request.py +88 -0
  62. vortex/models/customer_payment_method_attach_request.py +94 -0
  63. vortex/models/customer_payment_method_setup_request.py +100 -0
  64. vortex/models/customer_upsert_request.py +96 -0
  65. vortex/models/expire_customer_balance_request.py +98 -0
  66. vortex/models/grant_customer_balance_from_payment_request.py +103 -0
  67. vortex/models/grant_customer_balance_request.py +106 -0
  68. vortex/models/grant_entitlement_request.py +106 -0
  69. vortex/models/invoice_collect_request.py +86 -0
  70. vortex/models/invoice_create_request.py +92 -0
  71. vortex/models/invoice_finalize_request.py +86 -0
  72. vortex/models/invoice_mark_uncollectible_request.py +90 -0
  73. vortex/models/invoice_tax.py +142 -0
  74. vortex/models/invoice_void_request.py +88 -0
  75. vortex/models/merchant_account_create_request.py +183 -0
  76. vortex/models/merchant_address.py +96 -0
  77. vortex/models/merchant_associated_identity.py +114 -0
  78. vortex/models/merchant_onboarding_link_request.py +95 -0
  79. vortex/models/merchant_profile_date.py +90 -0
  80. vortex/models/merchant_settlement_bank_account.py +94 -0
  81. vortex/models/merchant_tax_profile_request.py +125 -0
  82. vortex/models/merchant_tax_profile_request_registrations_inner.py +88 -0
  83. vortex/models/merchant_underwriting_data.py +127 -0
  84. vortex/models/merchant_underwriting_data_card_volume_distribution.py +90 -0
  85. vortex/models/merchant_underwriting_data_volume_distribution_by_business_type.py +90 -0
  86. vortex/models/open_api_invoice_tax_response.py +92 -0
  87. vortex/models/open_api_invoice_tax_response_all_of_data.py +92 -0
  88. vortex/models/payment_request_collect_request.py +86 -0
  89. vortex/models/payment_request_create_request.py +100 -0
  90. vortex/models/payment_request_link_create_request.py +89 -0
  91. vortex/models/price_create_request.py +122 -0
  92. vortex/models/product_create_request.py +92 -0
  93. vortex/models/reverse_customer_balance_request.py +98 -0
  94. vortex/models/revoke_entitlement_request.py +106 -0
  95. vortex/models/subscription_change_request.py +111 -0
  96. vortex/models/subscription_create_request.py +122 -0
  97. vortex/models/subscription_item_change_preview_request.py +100 -0
  98. vortex/models/subscription_item_change_request_item.py +91 -0
  99. vortex/models/tax_address.py +96 -0
  100. vortex/models/tax_behavior.py +36 -0
  101. vortex/models/tax_behavior_policy.py +100 -0
  102. vortex/models/tax_behavior_policy_request.py +89 -0
  103. vortex/models/tax_failure.py +104 -0
  104. vortex/models/tax_finalize_request.py +98 -0
  105. vortex/models/tax_jurisdiction_evidence.py +94 -0
  106. vortex/models/tax_line_evidence.py +103 -0
  107. vortex/models/tax_quote_request.py +98 -0
  108. vortex/models/terminate_applied_coupon_request.py +87 -0
  109. vortex/models/terminate_coupon_request.py +87 -0
  110. vortex/models/webhook_deliveries_dispatch_request.py +91 -0
  111. vortex/models/webhook_deliveries_redrive_request.py +107 -0
  112. vortex/models/webhook_delivery_replay_request.py +88 -0
  113. vortex/models/webhook_endpoint_create_request.py +91 -0
  114. vortex/models/webhook_endpoint_secret_rotate_request.py +87 -0
  115. vortex/models/webhook_endpoint_test_request.py +88 -0
  116. vortex/models/webhook_endpoint_update_request.py +103 -0
  117. vortex/models/webhook_event_resend_request.py +86 -0
  118. vortex/rest.py +263 -0
  119. vortex_sdk-0.2.0.dist-info/METADATA +34 -0
  120. vortex_sdk-0.2.0.dist-info/RECORD +123 -0
  121. vortex_sdk-0.2.0.dist-info/WHEEL +5 -0
  122. vortex_sdk-0.2.0.dist-info/licenses/LICENSE +21 -0
  123. vortex_sdk-0.2.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,88 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Vortex Payments API
5
+
6
+ Public Vortex Payments API for customers, subscriptions, invoices, payment requests, checkout, receipts, webhooks, tax.
7
+
8
+ The version of the OpenAPI document: 2026-08
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, StrictBool, StrictStr
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 WebhookEndpointTestRequest(BaseModel):
27
+ """
28
+ WebhookEndpointTestRequest
29
+ """ # noqa: E501
30
+ event_type: StrictStr = Field(alias="eventType")
31
+ dispatch: Optional[StrictBool] = None
32
+ __properties: ClassVar[List[str]] = ["eventType", "dispatch"]
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 WebhookEndpointTestRequest 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
+ return _dict
74
+
75
+ @classmethod
76
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
77
+ """Create an instance of WebhookEndpointTestRequest from a dict"""
78
+ if obj is None:
79
+ return None
80
+
81
+ if not isinstance(obj, dict):
82
+ return cls.model_validate(obj)
83
+
84
+ _obj = cls.model_validate({
85
+ "eventType": obj.get("eventType"),
86
+ "dispatch": obj.get("dispatch")
87
+ })
88
+ return _obj
@@ -0,0 +1,103 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Vortex Payments API
5
+
6
+ Public Vortex Payments API for customers, subscriptions, invoices, payment requests, checkout, receipts, webhooks, tax.
7
+
8
+ The version of the OpenAPI document: 2026-08
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, StrictStr, field_validator
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 WebhookEndpointUpdateRequest(BaseModel):
28
+ """
29
+ WebhookEndpointUpdateRequest
30
+ """ # noqa: E501
31
+ url: Optional[StrictStr] = None
32
+ description: Optional[StrictStr] = None
33
+ event_types: Optional[Annotated[List[StrictStr], Field(min_length=1)]] = Field(default=None, alias="eventTypes")
34
+ status: Optional[StrictStr] = None
35
+ __properties: ClassVar[List[str]] = ["url", "description", "eventTypes", "status"]
36
+
37
+ @field_validator('status')
38
+ def status_validate_enum(cls, value):
39
+ """Validates the enum"""
40
+ if value is None:
41
+ return value
42
+
43
+ if value not in set(['active', 'disabled']):
44
+ raise ValueError("must be one of enum values ('active', 'disabled')")
45
+ return value
46
+
47
+ model_config = ConfigDict(
48
+ validate_by_name=True,
49
+ validate_by_alias=True,
50
+ validate_assignment=True,
51
+ protected_namespaces=(),
52
+ )
53
+
54
+
55
+ def to_str(self) -> str:
56
+ """Returns the string representation of the model using alias"""
57
+ return pprint.pformat(self.model_dump(by_alias=True))
58
+
59
+ def to_json(self) -> str:
60
+ """Returns the JSON representation of the model using alias"""
61
+ return json.dumps(to_jsonable_python(self.to_dict()))
62
+
63
+ @classmethod
64
+ def from_json(cls, json_str: str) -> Optional[Self]:
65
+ """Create an instance of WebhookEndpointUpdateRequest from a JSON string"""
66
+ return cls.from_dict(json.loads(json_str))
67
+
68
+ def to_dict(self) -> Dict[str, Any]:
69
+ """Return the dictionary representation of the model using alias.
70
+
71
+ This has the following differences from calling pydantic's
72
+ `self.model_dump(by_alias=True)`:
73
+
74
+ * `None` is only added to the output dict for nullable fields that
75
+ were set at model initialization. Other fields with value `None`
76
+ are ignored.
77
+ """
78
+ excluded_fields: Set[str] = set([
79
+ ])
80
+
81
+ _dict = self.model_dump(
82
+ by_alias=True,
83
+ exclude=excluded_fields,
84
+ exclude_none=True,
85
+ )
86
+ return _dict
87
+
88
+ @classmethod
89
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
90
+ """Create an instance of WebhookEndpointUpdateRequest from a dict"""
91
+ if obj is None:
92
+ return None
93
+
94
+ if not isinstance(obj, dict):
95
+ return cls.model_validate(obj)
96
+
97
+ _obj = cls.model_validate({
98
+ "url": obj.get("url"),
99
+ "description": obj.get("description"),
100
+ "eventTypes": obj.get("eventTypes"),
101
+ "status": obj.get("status")
102
+ })
103
+ return _obj
@@ -0,0 +1,86 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Vortex Payments API
5
+
6
+ Public Vortex Payments API for customers, subscriptions, invoices, payment requests, checkout, receipts, webhooks, tax.
7
+
8
+ The version of the OpenAPI document: 2026-08
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, StrictStr
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 WebhookEventResendRequest(BaseModel):
27
+ """
28
+ WebhookEventResendRequest
29
+ """ # noqa: E501
30
+ endpoint_id: Optional[StrictStr] = Field(default=None, alias="endpointId")
31
+ __properties: ClassVar[List[str]] = ["endpointId"]
32
+
33
+ model_config = ConfigDict(
34
+ validate_by_name=True,
35
+ validate_by_alias=True,
36
+ validate_assignment=True,
37
+ protected_namespaces=(),
38
+ )
39
+
40
+
41
+ def to_str(self) -> str:
42
+ """Returns the string representation of the model using alias"""
43
+ return pprint.pformat(self.model_dump(by_alias=True))
44
+
45
+ def to_json(self) -> str:
46
+ """Returns the JSON representation of the model using alias"""
47
+ return json.dumps(to_jsonable_python(self.to_dict()))
48
+
49
+ @classmethod
50
+ def from_json(cls, json_str: str) -> Optional[Self]:
51
+ """Create an instance of WebhookEventResendRequest from a JSON string"""
52
+ return cls.from_dict(json.loads(json_str))
53
+
54
+ def to_dict(self) -> Dict[str, Any]:
55
+ """Return the dictionary representation of the model using alias.
56
+
57
+ This has the following differences from calling pydantic's
58
+ `self.model_dump(by_alias=True)`:
59
+
60
+ * `None` is only added to the output dict for nullable fields that
61
+ were set at model initialization. Other fields with value `None`
62
+ are ignored.
63
+ """
64
+ excluded_fields: Set[str] = set([
65
+ ])
66
+
67
+ _dict = self.model_dump(
68
+ by_alias=True,
69
+ exclude=excluded_fields,
70
+ exclude_none=True,
71
+ )
72
+ return _dict
73
+
74
+ @classmethod
75
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
76
+ """Create an instance of WebhookEventResendRequest from a dict"""
77
+ if obj is None:
78
+ return None
79
+
80
+ if not isinstance(obj, dict):
81
+ return cls.model_validate(obj)
82
+
83
+ _obj = cls.model_validate({
84
+ "endpointId": obj.get("endpointId")
85
+ })
86
+ return _obj
vortex/rest.py ADDED
@@ -0,0 +1,263 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Vortex Payments API
5
+
6
+ Public Vortex Payments API for customers, subscriptions, invoices, payment requests, checkout, receipts, webhooks, tax.
7
+
8
+ The version of the OpenAPI document: 2026-08
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ import io
16
+ import json
17
+ import re
18
+ import ssl
19
+
20
+ import urllib3
21
+
22
+ from vortex.exceptions import ApiException, ApiValueError
23
+
24
+ SUPPORTED_SOCKS_PROXIES = {"socks5", "socks5h", "socks4", "socks4a"}
25
+ RESTResponseType = urllib3.HTTPResponse
26
+
27
+
28
+ def is_socks_proxy_url(url):
29
+ if url is None:
30
+ return False
31
+ split_section = url.split("://")
32
+ if len(split_section) < 2:
33
+ return False
34
+ else:
35
+ return split_section[0].lower() in SUPPORTED_SOCKS_PROXIES
36
+
37
+
38
+ class RESTResponse(io.IOBase):
39
+
40
+ def __init__(self, resp) -> None:
41
+ self.response = resp
42
+ self.status = resp.status
43
+ self.reason = resp.reason
44
+ self.data = None
45
+
46
+ def read(self):
47
+ if self.data is None:
48
+ self.data = self.response.data
49
+ return self.data
50
+
51
+ @property
52
+ def headers(self):
53
+ """Returns a dictionary of response headers."""
54
+ return self.response.headers
55
+
56
+ def getheaders(self):
57
+ """Returns a dictionary of the response headers; use ``headers`` instead."""
58
+ return self.response.headers
59
+
60
+ def getheader(self, name, default=None):
61
+ """Returns a given response header; use ``headers.get()`` instead."""
62
+ return self.response.headers.get(name, default)
63
+
64
+
65
+ class RESTClientObject:
66
+
67
+ def __init__(self, configuration) -> None:
68
+ # urllib3.PoolManager will pass all kw parameters to connectionpool
69
+ # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501
70
+ # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501
71
+ # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501
72
+
73
+ # cert_reqs
74
+ if configuration.verify_ssl:
75
+ cert_reqs = ssl.CERT_REQUIRED
76
+ else:
77
+ cert_reqs = ssl.CERT_NONE
78
+
79
+ pool_args = {
80
+ "cert_reqs": cert_reqs,
81
+ "ca_certs": configuration.ssl_ca_cert,
82
+ "cert_file": configuration.cert_file,
83
+ "key_file": configuration.key_file,
84
+ "ca_cert_data": configuration.ca_cert_data,
85
+ }
86
+ if configuration.assert_hostname is not None:
87
+ pool_args['assert_hostname'] = (
88
+ configuration.assert_hostname
89
+ )
90
+
91
+ if configuration.retries is not None:
92
+ pool_args['retries'] = configuration.retries
93
+
94
+ if configuration.tls_server_name:
95
+ pool_args['server_hostname'] = configuration.tls_server_name
96
+
97
+
98
+ if configuration.socket_options is not None:
99
+ pool_args['socket_options'] = configuration.socket_options
100
+
101
+ if configuration.connection_pool_maxsize is not None:
102
+ pool_args['maxsize'] = configuration.connection_pool_maxsize
103
+
104
+ # https pool manager
105
+ self.pool_manager: urllib3.PoolManager
106
+
107
+ if configuration.proxy:
108
+ if is_socks_proxy_url(configuration.proxy):
109
+ from urllib3.contrib.socks import SOCKSProxyManager
110
+ pool_args["proxy_url"] = configuration.proxy
111
+ pool_args["headers"] = configuration.proxy_headers
112
+ self.pool_manager = SOCKSProxyManager(**pool_args)
113
+ else:
114
+ pool_args["proxy_url"] = configuration.proxy
115
+ pool_args["proxy_headers"] = configuration.proxy_headers
116
+ self.pool_manager = urllib3.ProxyManager(**pool_args)
117
+ else:
118
+ self.pool_manager = urllib3.PoolManager(**pool_args)
119
+
120
+ def request(
121
+ self,
122
+ method,
123
+ url,
124
+ headers=None,
125
+ body=None,
126
+ post_params=None,
127
+ _request_timeout=None
128
+ ):
129
+ """Perform requests.
130
+
131
+ :param method: http request method
132
+ :param url: http request url
133
+ :param headers: http request headers
134
+ :param body: request json body, for `application/json`
135
+ :param post_params: request post parameters,
136
+ `application/x-www-form-urlencoded`
137
+ and `multipart/form-data`
138
+ :param _request_timeout: timeout setting for this request. If one
139
+ number provided, it will be total request
140
+ timeout. It can also be a pair (tuple) of
141
+ (connection, read) timeouts.
142
+ """
143
+ method = method.upper()
144
+ assert method in [
145
+ 'GET',
146
+ 'HEAD',
147
+ 'DELETE',
148
+ 'POST',
149
+ 'PUT',
150
+ 'PATCH',
151
+ 'OPTIONS'
152
+ ]
153
+
154
+ if post_params and body:
155
+ raise ApiValueError(
156
+ "body parameter cannot be used with post_params parameter."
157
+ )
158
+
159
+ post_params = post_params or {}
160
+ headers = headers or {}
161
+
162
+ timeout = None
163
+ if _request_timeout:
164
+ if isinstance(_request_timeout, (int, float)):
165
+ timeout = urllib3.Timeout(total=_request_timeout)
166
+ elif (
167
+ isinstance(_request_timeout, tuple)
168
+ and len(_request_timeout) == 2
169
+ ):
170
+ timeout = urllib3.Timeout(
171
+ connect=_request_timeout[0],
172
+ read=_request_timeout[1]
173
+ )
174
+
175
+ try:
176
+ # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
177
+ if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
178
+
179
+ # no content type provided or payload is json
180
+ content_type = headers.get('Content-Type')
181
+ if (
182
+ not content_type
183
+ or re.search('json', content_type, re.IGNORECASE)
184
+ ):
185
+ request_body = None
186
+ if body is not None:
187
+ request_body = json.dumps(body)
188
+ r = self.pool_manager.request(
189
+ method,
190
+ url,
191
+ body=request_body,
192
+ timeout=timeout,
193
+ headers=headers,
194
+ preload_content=False
195
+ )
196
+ elif content_type == 'application/x-www-form-urlencoded':
197
+ r = self.pool_manager.request(
198
+ method,
199
+ url,
200
+ fields=post_params,
201
+ encode_multipart=False,
202
+ timeout=timeout,
203
+ headers=headers,
204
+ preload_content=False
205
+ )
206
+ elif content_type == 'multipart/form-data':
207
+ # must del headers['Content-Type'], or the correct
208
+ # Content-Type which generated by urllib3 will be
209
+ # overwritten.
210
+ del headers['Content-Type']
211
+ # Ensures that dict objects are serialized
212
+ post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a,b) for a, b in post_params]
213
+ r = self.pool_manager.request(
214
+ method,
215
+ url,
216
+ fields=post_params,
217
+ encode_multipart=True,
218
+ timeout=timeout,
219
+ headers=headers,
220
+ preload_content=False
221
+ )
222
+ # Pass a `string` parameter directly in the body to support
223
+ # other content types than JSON when `body` argument is
224
+ # provided in serialized form.
225
+ elif isinstance(body, str) or isinstance(body, bytes):
226
+ r = self.pool_manager.request(
227
+ method,
228
+ url,
229
+ body=body,
230
+ timeout=timeout,
231
+ headers=headers,
232
+ preload_content=False
233
+ )
234
+ elif headers['Content-Type'].startswith('text/') and isinstance(body, bool):
235
+ request_body = "true" if body else "false"
236
+ r = self.pool_manager.request(
237
+ method,
238
+ url,
239
+ body=request_body,
240
+ preload_content=False,
241
+ timeout=timeout,
242
+ headers=headers)
243
+ else:
244
+ # Cannot generate the request from given parameters
245
+ msg = """Cannot prepare a request message for provided
246
+ arguments. Please check that your arguments match
247
+ declared content type."""
248
+ raise ApiException(status=0, reason=msg)
249
+ # For `GET`, `HEAD`
250
+ else:
251
+ r = self.pool_manager.request(
252
+ method,
253
+ url,
254
+ fields={},
255
+ timeout=timeout,
256
+ headers=headers,
257
+ preload_content=False
258
+ )
259
+ except urllib3.exceptions.SSLError as e:
260
+ msg = "\n".join([type(e).__name__, str(e)])
261
+ raise ApiException(status=0, reason=msg)
262
+
263
+ return RESTResponse(r)
@@ -0,0 +1,34 @@
1
+ Metadata-Version: 2.4
2
+ Name: vortex-sdk
3
+ Version: 0.2.0
4
+ Summary: Generated Python SDK for the Vortex Payments public API.
5
+ License: MIT
6
+ Requires-Python: >=3.9
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Requires-Dist: urllib3<3.0.0,>=2.1.0
10
+ Requires-Dist: python-dateutil>=2.8.2
11
+ Requires-Dist: pydantic>=2
12
+ Requires-Dist: typing-extensions>=4.7.1
13
+ Dynamic: license-file
14
+
15
+ # vortex-sdk
16
+
17
+ Generated Python SDK for the Vortex Payments public API.
18
+
19
+ This package is generated from `docs/openapi/vortex-public.openapi.json` by `pnpm run sdk:generate`.
20
+ It is MIT-licensed and published to PyPI.
21
+
22
+ ```bash
23
+ pip install vortex-sdk
24
+ ```
25
+
26
+ ```py
27
+ import vortex
28
+
29
+ # Point at the sandbox host for test data; vb_test_ keys are sandbox-only.
30
+ configuration = vortex.Configuration(
31
+ host = "https://api.sandbox.vortex.nyc"
32
+ )
33
+ configuration.access_token = "<VORTEX_API_KEY>"
34
+ ```