dana-python 0.1.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.
- dana/__init__.py +14 -0
- dana/api_client.py +818 -0
- dana/api_response.py +35 -0
- dana/base/__init__.py +14 -0
- dana/base/configuration.py +582 -0
- dana/base/model.py +43 -0
- dana/base/types.py +17 -0
- dana/exceptions.py +227 -0
- dana/payment_gateway/__init__.py +14 -0
- dana/payment_gateway/v1/__init__.py +45 -0
- dana/payment_gateway/v1/api/__init__.py +19 -0
- dana/payment_gateway/v1/api/payment_gateway_api.py +343 -0
- dana/payment_gateway/v1/enum.py +59 -0
- dana/payment_gateway/v1/models/__init__.py +38 -0
- dana/payment_gateway/v1/models/buyer.py +113 -0
- dana/payment_gateway/v1/models/consult_pay_request.py +119 -0
- dana/payment_gateway/v1/models/consult_pay_request_additional_info.py +119 -0
- dana/payment_gateway/v1/models/consult_pay_request_amount.py +109 -0
- dana/payment_gateway/v1/models/consult_pay_response.py +119 -0
- dana/payment_gateway/v1/models/env_info.py +152 -0
- dana/payment_gateway/v1/models/payment_info.py +136 -0
- dana/payment_gateway/v1/models/promo_info.py +115 -0
- dana/rest.py +269 -0
- dana/utils/models.py +48 -0
- dana/utils/script.py +53 -0
- dana/utils/snap_configuration.py +644 -0
- dana/utils/snap_header.py +111 -0
- dana_python-0.1.0.dist-info/METADATA +148 -0
- dana_python-0.1.0.dist-info/RECORD +32 -0
- dana_python-0.1.0.dist-info/WHEEL +5 -0
- dana_python-0.1.0.dist-info/licenses/LICENSE +187 -0
- dana_python-0.1.0.dist-info/top_level.txt +1 -0
dana/exceptions.py
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
# Copyright 2025 PT Espay Debit Indonesia Koe
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
# coding: utf-8
|
|
16
|
+
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
The version of the OpenAPI document: 1.0.0
|
|
20
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
21
|
+
|
|
22
|
+
Do not edit the class manually.
|
|
23
|
+
""" # noqa: E501
|
|
24
|
+
|
|
25
|
+
from typing import Any, Optional
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
|
|
28
|
+
class OpenApiException(Exception):
|
|
29
|
+
"""The base exception class for all OpenAPIExceptions"""
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class ApiTypeError(OpenApiException, TypeError):
|
|
33
|
+
def __init__(self, msg, path_to_item=None, valid_classes=None,
|
|
34
|
+
key_type=None) -> None:
|
|
35
|
+
""" Raises an exception for TypeErrors
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
msg (str): the exception message
|
|
39
|
+
|
|
40
|
+
Keyword Args:
|
|
41
|
+
path_to_item (list): a list of keys an indices to get to the
|
|
42
|
+
current_item
|
|
43
|
+
None if unset
|
|
44
|
+
valid_classes (tuple): the primitive classes that current item
|
|
45
|
+
should be an instance of
|
|
46
|
+
None if unset
|
|
47
|
+
key_type (bool): False if our value is a value in a dict
|
|
48
|
+
True if it is a key in a dict
|
|
49
|
+
False if our item is an item in a list
|
|
50
|
+
None if unset
|
|
51
|
+
"""
|
|
52
|
+
self.path_to_item = path_to_item
|
|
53
|
+
self.valid_classes = valid_classes
|
|
54
|
+
self.key_type = key_type
|
|
55
|
+
full_msg = msg
|
|
56
|
+
if path_to_item:
|
|
57
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
58
|
+
super(ApiTypeError, self).__init__(full_msg)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class ApiValueError(OpenApiException, ValueError):
|
|
62
|
+
def __init__(self, msg, path_to_item=None) -> None:
|
|
63
|
+
"""
|
|
64
|
+
Args:
|
|
65
|
+
msg (str): the exception message
|
|
66
|
+
|
|
67
|
+
Keyword Args:
|
|
68
|
+
path_to_item (list) the path to the exception in the
|
|
69
|
+
received_data dict. None if unset
|
|
70
|
+
"""
|
|
71
|
+
|
|
72
|
+
self.path_to_item = path_to_item
|
|
73
|
+
full_msg = msg
|
|
74
|
+
if path_to_item:
|
|
75
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
76
|
+
super(ApiValueError, self).__init__(full_msg)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class ApiAttributeError(OpenApiException, AttributeError):
|
|
80
|
+
def __init__(self, msg, path_to_item=None) -> None:
|
|
81
|
+
"""
|
|
82
|
+
Raised when an attribute reference or assignment fails.
|
|
83
|
+
|
|
84
|
+
Args:
|
|
85
|
+
msg (str): the exception message
|
|
86
|
+
|
|
87
|
+
Keyword Args:
|
|
88
|
+
path_to_item (None/list) the path to the exception in the
|
|
89
|
+
received_data dict
|
|
90
|
+
"""
|
|
91
|
+
self.path_to_item = path_to_item
|
|
92
|
+
full_msg = msg
|
|
93
|
+
if path_to_item:
|
|
94
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
95
|
+
super(ApiAttributeError, self).__init__(full_msg)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
class ApiKeyError(OpenApiException, KeyError):
|
|
99
|
+
def __init__(self, msg, path_to_item=None) -> None:
|
|
100
|
+
"""
|
|
101
|
+
Args:
|
|
102
|
+
msg (str): the exception message
|
|
103
|
+
|
|
104
|
+
Keyword Args:
|
|
105
|
+
path_to_item (None/list) the path to the exception in the
|
|
106
|
+
received_data dict
|
|
107
|
+
"""
|
|
108
|
+
self.path_to_item = path_to_item
|
|
109
|
+
full_msg = msg
|
|
110
|
+
if path_to_item:
|
|
111
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
112
|
+
super(ApiKeyError, self).__init__(full_msg)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
class ApiException(OpenApiException):
|
|
116
|
+
|
|
117
|
+
def __init__(
|
|
118
|
+
self,
|
|
119
|
+
status=None,
|
|
120
|
+
reason=None,
|
|
121
|
+
http_resp=None,
|
|
122
|
+
*,
|
|
123
|
+
body: Optional[str] = None,
|
|
124
|
+
data: Optional[Any] = None,
|
|
125
|
+
) -> None:
|
|
126
|
+
self.status = status
|
|
127
|
+
self.reason = reason
|
|
128
|
+
self.body = body
|
|
129
|
+
self.data = data
|
|
130
|
+
self.headers = None
|
|
131
|
+
|
|
132
|
+
if http_resp:
|
|
133
|
+
if self.status is None:
|
|
134
|
+
self.status = http_resp.status
|
|
135
|
+
if self.reason is None:
|
|
136
|
+
self.reason = http_resp.reason
|
|
137
|
+
if self.body is None:
|
|
138
|
+
try:
|
|
139
|
+
self.body = http_resp.data.decode('utf-8')
|
|
140
|
+
except Exception:
|
|
141
|
+
pass
|
|
142
|
+
self.headers = http_resp.getheaders()
|
|
143
|
+
|
|
144
|
+
@classmethod
|
|
145
|
+
def from_response(
|
|
146
|
+
cls,
|
|
147
|
+
*,
|
|
148
|
+
http_resp,
|
|
149
|
+
body: Optional[str],
|
|
150
|
+
data: Optional[Any],
|
|
151
|
+
) -> Self:
|
|
152
|
+
if http_resp.status == 400:
|
|
153
|
+
raise BadRequestException(http_resp=http_resp, body=body, data=data)
|
|
154
|
+
|
|
155
|
+
if http_resp.status == 401:
|
|
156
|
+
raise UnauthorizedException(http_resp=http_resp, body=body, data=data)
|
|
157
|
+
|
|
158
|
+
if http_resp.status == 403:
|
|
159
|
+
raise ForbiddenException(http_resp=http_resp, body=body, data=data)
|
|
160
|
+
|
|
161
|
+
if http_resp.status == 404:
|
|
162
|
+
raise NotFoundException(http_resp=http_resp, body=body, data=data)
|
|
163
|
+
|
|
164
|
+
# Added new conditions for 409 and 422
|
|
165
|
+
if http_resp.status == 409:
|
|
166
|
+
raise ConflictException(http_resp=http_resp, body=body, data=data)
|
|
167
|
+
|
|
168
|
+
if http_resp.status == 422:
|
|
169
|
+
raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data)
|
|
170
|
+
|
|
171
|
+
if 500 <= http_resp.status <= 599:
|
|
172
|
+
raise ServiceException(http_resp=http_resp, body=body, data=data)
|
|
173
|
+
raise ApiException(http_resp=http_resp, body=body, data=data)
|
|
174
|
+
|
|
175
|
+
def __str__(self):
|
|
176
|
+
"""Custom error messages for exception"""
|
|
177
|
+
error_message = "({0})\n"\
|
|
178
|
+
"Reason: {1}\n".format(self.status, self.reason)
|
|
179
|
+
if self.headers:
|
|
180
|
+
error_message += "HTTP response headers: {0}\n".format(
|
|
181
|
+
self.headers)
|
|
182
|
+
|
|
183
|
+
if self.data or self.body:
|
|
184
|
+
error_message += "HTTP response body: {0}\n".format(self.data or self.body)
|
|
185
|
+
|
|
186
|
+
return error_message
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
class BadRequestException(ApiException):
|
|
190
|
+
pass
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
class NotFoundException(ApiException):
|
|
194
|
+
pass
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
class UnauthorizedException(ApiException):
|
|
198
|
+
pass
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
class ForbiddenException(ApiException):
|
|
202
|
+
pass
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
class ServiceException(ApiException):
|
|
206
|
+
pass
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
class ConflictException(ApiException):
|
|
210
|
+
"""Exception for HTTP 409 Conflict."""
|
|
211
|
+
pass
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
class UnprocessableEntityException(ApiException):
|
|
215
|
+
"""Exception for HTTP 422 Unprocessable Entity."""
|
|
216
|
+
pass
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
def render_path(path_to_item):
|
|
220
|
+
"""Returns a string representation of a path"""
|
|
221
|
+
result = ""
|
|
222
|
+
for pth in path_to_item:
|
|
223
|
+
if isinstance(pth, int):
|
|
224
|
+
result += "[{0}]".format(pth)
|
|
225
|
+
else:
|
|
226
|
+
result += "['{0}']".format(pth)
|
|
227
|
+
return result
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Copyright 2025 PT Espay Debit Indonesia Koe
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Copyright 2025 PT Espay Debit Indonesia Koe
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
# coding: utf-8
|
|
16
|
+
|
|
17
|
+
# flake8: noqa
|
|
18
|
+
|
|
19
|
+
"""
|
|
20
|
+
Payment Gateway API
|
|
21
|
+
|
|
22
|
+
API for doing operations in DANA Payment Gateway (Gapura)
|
|
23
|
+
|
|
24
|
+
The version of the OpenAPI document: 1.0.0
|
|
25
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
26
|
+
|
|
27
|
+
Do not edit the class manually.
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
__version__ = "1.0.0"
|
|
32
|
+
|
|
33
|
+
# import apis into sdk package
|
|
34
|
+
from dana.payment_gateway.v1.api.payment_gateway_api import PaymentGatewayApi
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
# import models into sdk package
|
|
38
|
+
from dana.payment_gateway.v1.models.buyer import Buyer
|
|
39
|
+
from dana.payment_gateway.v1.models.consult_pay_request import ConsultPayRequest
|
|
40
|
+
from dana.payment_gateway.v1.models.consult_pay_request_additional_info import ConsultPayRequestAdditionalInfo
|
|
41
|
+
from dana.payment_gateway.v1.models.consult_pay_request_amount import ConsultPayRequestAmount
|
|
42
|
+
from dana.payment_gateway.v1.models.consult_pay_response import ConsultPayResponse
|
|
43
|
+
from dana.payment_gateway.v1.models.env_info import EnvInfo
|
|
44
|
+
from dana.payment_gateway.v1.models.payment_info import PaymentInfo
|
|
45
|
+
from dana.payment_gateway.v1.models.promo_info import PromoInfo
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Copyright 2025 PT Espay Debit Indonesia Koe
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
# flake8: noqa
|
|
16
|
+
|
|
17
|
+
# import apis into api package
|
|
18
|
+
from dana.payment_gateway.v1.api.payment_gateway_api import PaymentGatewayApi
|
|
19
|
+
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
# Copyright 2025 PT Espay Debit Indonesia Koe
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
# coding: utf-8
|
|
16
|
+
|
|
17
|
+
"""
|
|
18
|
+
Payment Gateway API
|
|
19
|
+
|
|
20
|
+
API for doing operations in DANA Payment Gateway (Gapura)
|
|
21
|
+
|
|
22
|
+
The version of the OpenAPI document: 1.0.0
|
|
23
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
24
|
+
|
|
25
|
+
Do not edit the class manually.
|
|
26
|
+
""" # noqa: E501
|
|
27
|
+
|
|
28
|
+
import warnings
|
|
29
|
+
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
|
|
30
|
+
from typing import Any, Dict, List, Optional, Tuple, Union, Type
|
|
31
|
+
from typing_extensions import Annotated
|
|
32
|
+
|
|
33
|
+
from dana.payment_gateway.v1.models.consult_pay_request import ConsultPayRequest
|
|
34
|
+
from dana.payment_gateway.v1.models.consult_pay_response import ConsultPayResponse
|
|
35
|
+
|
|
36
|
+
from dana.api_response import ApiResponse
|
|
37
|
+
from dana.rest import RESTResponseType
|
|
38
|
+
|
|
39
|
+
from dana.base.types import RequestSerialized
|
|
40
|
+
from dana.base.model import BaseSdkModel
|
|
41
|
+
from dana.utils.snap_header import SnapHeader
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class PaymentGatewayApi:
|
|
45
|
+
"""NOTE: This class is auto generated by OpenAPI Generator
|
|
46
|
+
Ref: https://openapi-generator.tech
|
|
47
|
+
|
|
48
|
+
Do not edit the class manually.
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
def __init__(self, api_client=None) -> None:
|
|
52
|
+
if api_client is None:
|
|
53
|
+
raise ValueError("Argument api_client can't be empty")
|
|
54
|
+
self.api_client = api_client
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@validate_call
|
|
58
|
+
def consult_pay(
|
|
59
|
+
self,
|
|
60
|
+
consult_pay_request: ConsultPayRequest,
|
|
61
|
+
_request_timeout: Union[
|
|
62
|
+
None,
|
|
63
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
64
|
+
Tuple[
|
|
65
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
66
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
67
|
+
]
|
|
68
|
+
] = None,
|
|
69
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
70
|
+
_content_type: Optional[StrictStr] = None,
|
|
71
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
72
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
73
|
+
) -> ConsultPayResponse:
|
|
74
|
+
"""Consult Pay API
|
|
75
|
+
|
|
76
|
+
This API is used to consult the list of payment methods or payment channels that user has and used in certain transactions or orders
|
|
77
|
+
|
|
78
|
+
:param consult_pay_request: (required)
|
|
79
|
+
:type consult_pay_request: ConsultPayRequest
|
|
80
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
81
|
+
number provided, it will be total request
|
|
82
|
+
timeout. It can also be a pair (tuple) of
|
|
83
|
+
(connection, read) timeouts.
|
|
84
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
85
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
86
|
+
request; this effectively ignores the
|
|
87
|
+
authentication in the spec for a single request.
|
|
88
|
+
:type _request_auth: dict, optional
|
|
89
|
+
:param _content_type: force content-type for the request.
|
|
90
|
+
:type _content_type: str, Optional
|
|
91
|
+
:param _headers: set to override the headers for a single
|
|
92
|
+
request; this effectively ignores the headers
|
|
93
|
+
in the spec for a single request.
|
|
94
|
+
:type _headers: dict, optional
|
|
95
|
+
:param _host_index: set to override the host_index for a single
|
|
96
|
+
request; this effectively ignores the host_index
|
|
97
|
+
in the spec for a single request.
|
|
98
|
+
:type _host_index: int, optional
|
|
99
|
+
:return: Returns the result object.
|
|
100
|
+
""" # noqa: E501
|
|
101
|
+
|
|
102
|
+
_param = self._consult_pay_serialize(
|
|
103
|
+
consult_pay_request=consult_pay_request,
|
|
104
|
+
_request_auth=_request_auth,
|
|
105
|
+
_content_type=_content_type,
|
|
106
|
+
_headers=_headers,
|
|
107
|
+
_host_index=_host_index
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
111
|
+
'200': "ConsultPayResponse",
|
|
112
|
+
}
|
|
113
|
+
response_data = self.api_client.call_api(
|
|
114
|
+
*_param,
|
|
115
|
+
_request_timeout=_request_timeout
|
|
116
|
+
)
|
|
117
|
+
response_data.read()
|
|
118
|
+
return self.api_client.response_deserialize(
|
|
119
|
+
response_data=response_data,
|
|
120
|
+
response_types_map=_response_types_map,
|
|
121
|
+
).data
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
@validate_call
|
|
125
|
+
def consult_pay_with_http_info(
|
|
126
|
+
self,
|
|
127
|
+
consult_pay_request: ConsultPayRequest,
|
|
128
|
+
_request_timeout: Union[
|
|
129
|
+
None,
|
|
130
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
131
|
+
Tuple[
|
|
132
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
133
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
134
|
+
]
|
|
135
|
+
] = None,
|
|
136
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
137
|
+
_content_type: Optional[StrictStr] = None,
|
|
138
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
139
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
140
|
+
) -> ApiResponse[ConsultPayResponse]:
|
|
141
|
+
"""Consult Pay API
|
|
142
|
+
|
|
143
|
+
This API is used to consult the list of payment methods or payment channels that user has and used in certain transactions or orders
|
|
144
|
+
|
|
145
|
+
:param consult_pay_request: (required)
|
|
146
|
+
:type consult_pay_request: ConsultPayRequest
|
|
147
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
148
|
+
number provided, it will be total request
|
|
149
|
+
timeout. It can also be a pair (tuple) of
|
|
150
|
+
(connection, read) timeouts.
|
|
151
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
152
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
153
|
+
request; this effectively ignores the
|
|
154
|
+
authentication in the spec for a single request.
|
|
155
|
+
:type _request_auth: dict, optional
|
|
156
|
+
:param _content_type: force content-type for the request.
|
|
157
|
+
:type _content_type: str, Optional
|
|
158
|
+
:param _headers: set to override the headers for a single
|
|
159
|
+
request; this effectively ignores the headers
|
|
160
|
+
in the spec for a single request.
|
|
161
|
+
:type _headers: dict, optional
|
|
162
|
+
:param _host_index: set to override the host_index for a single
|
|
163
|
+
request; this effectively ignores the host_index
|
|
164
|
+
in the spec for a single request.
|
|
165
|
+
:type _host_index: int, optional
|
|
166
|
+
:return: Returns the result object.
|
|
167
|
+
""" # noqa: E501
|
|
168
|
+
|
|
169
|
+
_param = self._consult_pay_serialize(
|
|
170
|
+
consult_pay_request=consult_pay_request,
|
|
171
|
+
_request_auth=_request_auth,
|
|
172
|
+
_content_type=_content_type,
|
|
173
|
+
_headers=_headers,
|
|
174
|
+
_host_index=_host_index
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
178
|
+
'200': "ConsultPayResponse",
|
|
179
|
+
}
|
|
180
|
+
response_data = self.api_client.call_api(
|
|
181
|
+
*_param,
|
|
182
|
+
_request_timeout=_request_timeout
|
|
183
|
+
)
|
|
184
|
+
response_data.read()
|
|
185
|
+
return self.api_client.response_deserialize(
|
|
186
|
+
response_data=response_data,
|
|
187
|
+
response_types_map=_response_types_map,
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
@validate_call
|
|
192
|
+
def consult_pay_without_preload_content(
|
|
193
|
+
self,
|
|
194
|
+
consult_pay_request: ConsultPayRequest,
|
|
195
|
+
_request_timeout: Union[
|
|
196
|
+
None,
|
|
197
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
198
|
+
Tuple[
|
|
199
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
200
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
201
|
+
]
|
|
202
|
+
] = None,
|
|
203
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
204
|
+
_content_type: Optional[StrictStr] = None,
|
|
205
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
206
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
207
|
+
) -> RESTResponseType:
|
|
208
|
+
"""Consult Pay API
|
|
209
|
+
|
|
210
|
+
This API is used to consult the list of payment methods or payment channels that user has and used in certain transactions or orders
|
|
211
|
+
|
|
212
|
+
:param consult_pay_request: (required)
|
|
213
|
+
:type consult_pay_request: ConsultPayRequest
|
|
214
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
215
|
+
number provided, it will be total request
|
|
216
|
+
timeout. It can also be a pair (tuple) of
|
|
217
|
+
(connection, read) timeouts.
|
|
218
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
219
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
220
|
+
request; this effectively ignores the
|
|
221
|
+
authentication in the spec for a single request.
|
|
222
|
+
:type _request_auth: dict, optional
|
|
223
|
+
:param _content_type: force content-type for the request.
|
|
224
|
+
:type _content_type: str, Optional
|
|
225
|
+
:param _headers: set to override the headers for a single
|
|
226
|
+
request; this effectively ignores the headers
|
|
227
|
+
in the spec for a single request.
|
|
228
|
+
:type _headers: dict, optional
|
|
229
|
+
:param _host_index: set to override the host_index for a single
|
|
230
|
+
request; this effectively ignores the host_index
|
|
231
|
+
in the spec for a single request.
|
|
232
|
+
:type _host_index: int, optional
|
|
233
|
+
:return: Returns the result object.
|
|
234
|
+
""" # noqa: E501
|
|
235
|
+
|
|
236
|
+
_param = self._consult_pay_serialize(
|
|
237
|
+
consult_pay_request=consult_pay_request,
|
|
238
|
+
_request_auth=_request_auth,
|
|
239
|
+
_content_type=_content_type,
|
|
240
|
+
_headers=_headers,
|
|
241
|
+
_host_index=_host_index
|
|
242
|
+
)
|
|
243
|
+
|
|
244
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
245
|
+
'200': "ConsultPayResponse",
|
|
246
|
+
}
|
|
247
|
+
response_data = self.api_client.call_api(
|
|
248
|
+
*_param,
|
|
249
|
+
_request_timeout=_request_timeout
|
|
250
|
+
)
|
|
251
|
+
return response_data.response
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
def _consult_pay_serialize(
|
|
255
|
+
self,
|
|
256
|
+
consult_pay_request: Type[BaseSdkModel],
|
|
257
|
+
_request_auth,
|
|
258
|
+
_content_type,
|
|
259
|
+
_headers,
|
|
260
|
+
_host_index,
|
|
261
|
+
) -> RequestSerialized:
|
|
262
|
+
|
|
263
|
+
_host = None
|
|
264
|
+
|
|
265
|
+
_collection_formats: Dict[str, str] = {
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
_path_params: Dict[str, str] = {}
|
|
269
|
+
_query_params: List[Tuple[str, str]] = []
|
|
270
|
+
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
271
|
+
_form_params: List[Tuple[str, str]] = []
|
|
272
|
+
_files: Dict[
|
|
273
|
+
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
274
|
+
] = {}
|
|
275
|
+
_body_params: Optional[bytes] = None
|
|
276
|
+
|
|
277
|
+
# process the path parameters
|
|
278
|
+
# process the query parameters
|
|
279
|
+
# process the header parameters
|
|
280
|
+
# process the form parameters
|
|
281
|
+
# process the body parameter
|
|
282
|
+
if consult_pay_request is not None:
|
|
283
|
+
_body_params = consult_pay_request
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
# set the HTTP header `Accept`
|
|
287
|
+
if 'Accept' not in _header_params:
|
|
288
|
+
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
289
|
+
[
|
|
290
|
+
'application/json'
|
|
291
|
+
]
|
|
292
|
+
)
|
|
293
|
+
|
|
294
|
+
# set the HTTP header `Content-Type`
|
|
295
|
+
if _content_type:
|
|
296
|
+
_header_params['Content-Type'] = _content_type
|
|
297
|
+
else:
|
|
298
|
+
_default_content_type = (
|
|
299
|
+
self.api_client.select_header_content_type(
|
|
300
|
+
[
|
|
301
|
+
'application/json'
|
|
302
|
+
]
|
|
303
|
+
)
|
|
304
|
+
)
|
|
305
|
+
if _default_content_type is not None:
|
|
306
|
+
_header_params['Content-Type'] = _default_content_type
|
|
307
|
+
|
|
308
|
+
# authentication setting
|
|
309
|
+
_auth_settings: List[str] = [
|
|
310
|
+
'ORIGIN',
|
|
311
|
+
'X_PARTNER_ID',
|
|
312
|
+
'CHANNEL_ID',
|
|
313
|
+
'PRIVATE_KEY',
|
|
314
|
+
'PRIVATE_KEY_PATH',
|
|
315
|
+
'ENV'
|
|
316
|
+
]
|
|
317
|
+
|
|
318
|
+
# merge list of auth settings
|
|
319
|
+
# with list of auth generated at runtime for headers
|
|
320
|
+
_auth_settings = SnapHeader.merge_with_snap_runtime_headers(_auth_settings)
|
|
321
|
+
_generated_auth = SnapHeader.get_snap_generated_auth(
|
|
322
|
+
method='POST',
|
|
323
|
+
resource_path='/v1.0/payment-gateway/consult-pay.htm',
|
|
324
|
+
body=consult_pay_request.to_json(),
|
|
325
|
+
private_key=self.api_client.configuration.get_api_key_with_prefix('PRIVATE_KEY'),
|
|
326
|
+
private_key_path=self.api_client.configuration.get_api_key_with_prefix('PRIVATE_KEY_PATH')
|
|
327
|
+
)
|
|
328
|
+
|
|
329
|
+
return self.api_client.param_serialize(
|
|
330
|
+
method='POST',
|
|
331
|
+
resource_path='/v1.0/payment-gateway/consult-pay.htm',
|
|
332
|
+
path_params=_path_params,
|
|
333
|
+
query_params=_query_params,
|
|
334
|
+
header_params=_header_params,
|
|
335
|
+
body=_body_params,
|
|
336
|
+
post_params=_form_params,
|
|
337
|
+
files=_files,
|
|
338
|
+
auth_settings=_auth_settings,
|
|
339
|
+
collection_formats=_collection_formats,
|
|
340
|
+
_host=_host,
|
|
341
|
+
_request_auth=_request_auth,
|
|
342
|
+
_generated_auth=_generated_auth,
|
|
343
|
+
)
|