paymentsgate 1.4.7__tar.gz → 1.4.9__tar.gz
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.
- {paymentsgate-1.4.7 → paymentsgate-1.4.9}/PKG-INFO +1 -1
- {paymentsgate-1.4.7 → paymentsgate-1.4.9}/paymentsgate/client.py +22 -4
- {paymentsgate-1.4.7 → paymentsgate-1.4.9}/paymentsgate/models.py +5 -0
- {paymentsgate-1.4.7 → paymentsgate-1.4.9}/pyproject.toml +1 -1
- {paymentsgate-1.4.7 → paymentsgate-1.4.9}/setup.py +1 -1
- {paymentsgate-1.4.7 → paymentsgate-1.4.9}/LICENSE +0 -0
- {paymentsgate-1.4.7 → paymentsgate-1.4.9}/README.md +0 -0
- {paymentsgate-1.4.7 → paymentsgate-1.4.9}/paymentsgate/__init__.py +0 -0
- {paymentsgate-1.4.7 → paymentsgate-1.4.9}/paymentsgate/cache.py +0 -0
- {paymentsgate-1.4.7 → paymentsgate-1.4.9}/paymentsgate/enums.py +0 -0
- {paymentsgate-1.4.7 → paymentsgate-1.4.9}/paymentsgate/exceptions.py +0 -0
- {paymentsgate-1.4.7 → paymentsgate-1.4.9}/paymentsgate/logger.py +0 -0
- {paymentsgate-1.4.7 → paymentsgate-1.4.9}/paymentsgate/tokens.py +0 -0
- {paymentsgate-1.4.7 → paymentsgate-1.4.9}/paymentsgate/transport.py +0 -0
|
@@ -19,7 +19,8 @@ from paymentsgate.models import (
|
|
|
19
19
|
PayInModel,
|
|
20
20
|
PayInResponseModel,
|
|
21
21
|
PayOutModel,
|
|
22
|
-
PayOutResponseModel
|
|
22
|
+
PayOutResponseModel,
|
|
23
|
+
InvoiceModel
|
|
23
24
|
)
|
|
24
25
|
from paymentsgate.enums import ApiPaths
|
|
25
26
|
from paymentsgate.transport import (
|
|
@@ -34,7 +35,6 @@ from paymentsgate.cache import (
|
|
|
34
35
|
|
|
35
36
|
import requests
|
|
36
37
|
|
|
37
|
-
|
|
38
38
|
@dataclass
|
|
39
39
|
class ApiClient:
|
|
40
40
|
baseUrl: str = field(default="", init=False)
|
|
@@ -90,7 +90,7 @@ class ApiClient:
|
|
|
90
90
|
else:
|
|
91
91
|
raise APIResponseError(response)
|
|
92
92
|
|
|
93
|
-
def Quote(self,
|
|
93
|
+
def Quote(self, params: GetQuoteModel) -> GetQuoteResponseModel:
|
|
94
94
|
# Prepare request
|
|
95
95
|
request = Request(
|
|
96
96
|
method="get",
|
|
@@ -98,7 +98,7 @@ class ApiClient:
|
|
|
98
98
|
content_type='application/json',
|
|
99
99
|
noAuth=False,
|
|
100
100
|
signature=False,
|
|
101
|
-
body=
|
|
101
|
+
body=params
|
|
102
102
|
)
|
|
103
103
|
|
|
104
104
|
# Handle response
|
|
@@ -108,6 +108,24 @@ class ApiClient:
|
|
|
108
108
|
raise APIResponseError(response)
|
|
109
109
|
|
|
110
110
|
return response.cast(GetQuoteResponseModel, APIResponseError)
|
|
111
|
+
|
|
112
|
+
def Status(self, id: str) -> InvoiceModel:
|
|
113
|
+
# Prepare request
|
|
114
|
+
request = Request(
|
|
115
|
+
method="get",
|
|
116
|
+
path=ApiPaths.invoices_info.replace(':id', id),
|
|
117
|
+
content_type='application/json',
|
|
118
|
+
noAuth=False,
|
|
119
|
+
signature=False,
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
# Handle response
|
|
123
|
+
response = self._send_request(request)
|
|
124
|
+
self.logger(request, response)
|
|
125
|
+
if not response.success:
|
|
126
|
+
raise APIResponseError(response)
|
|
127
|
+
|
|
128
|
+
return response.cast(InvoiceModel, APIResponseError)
|
|
111
129
|
|
|
112
130
|
@property
|
|
113
131
|
def token(self) -> AccessToken | None:
|
|
@@ -200,9 +200,11 @@ class InvoiceAmountModel:
|
|
|
200
200
|
class InvoiceMetadataModel:
|
|
201
201
|
invoiceId: Optional[str]
|
|
202
202
|
clientId: Optional[str]
|
|
203
|
+
fiatAmount: Optional[float]
|
|
203
204
|
|
|
204
205
|
@dataclass
|
|
205
206
|
class InvoiceModel:
|
|
207
|
+
_id: str
|
|
206
208
|
orderId: str
|
|
207
209
|
projectId: str
|
|
208
210
|
currencyFrom: CurrencyModel
|
|
@@ -212,6 +214,8 @@ class InvoiceModel:
|
|
|
212
214
|
status: InvoiceStatusModel
|
|
213
215
|
amounts: InvoiceAmountModel
|
|
214
216
|
metadata: InvoiceMetadataModel
|
|
217
|
+
receiptUrls: List[str]
|
|
218
|
+
isExpired: bool
|
|
215
219
|
createdAt: datetime
|
|
216
220
|
updatedAt: datetime
|
|
217
221
|
expiredAt: datetime
|
|
@@ -226,3 +230,4 @@ class AssetsAccountModel:
|
|
|
226
230
|
@dataclass
|
|
227
231
|
class AssetsResponseModel:
|
|
228
232
|
assets: List[AssetsAccountModel]
|
|
233
|
+
|
|
@@ -15,7 +15,7 @@ install_requires = \
|
|
|
15
15
|
|
|
16
16
|
setup_kwargs = {
|
|
17
17
|
'name': 'paymentsgate',
|
|
18
|
-
'version': '1.4.
|
|
18
|
+
'version': '1.4.9',
|
|
19
19
|
'description': "PaymentsGate's Python SDK for REST API",
|
|
20
20
|
'long_description': '\n# Paymentsgate Python SDK for Payments REST API\n\n\n## Requirements\n\n- Python >= 3.8.1\n- dependencies:\n - [`requests`](https://github.com/kennethreitz/requests)\n - [`pydantic`](https://docs.pydantic.dev/latest/)\n - [`jwt`](https://pyjwt.readthedocs.io/en/stable/)\n \n## Installation\n\nThe simplest way to install SDK is to use [PIP](https://docs.python.org/3/installing/):\n\n```bash\npip install paymentsgate\n```\n\n## Basic usage\n\n```python\nfrom paymentsgate import ApiClient, Credentials, Currencies\n\n\n# minimal configuration\nconfig = Credentials().fromFile(\'/path/to/credentials.json\');\n\n# create ApiClient\nclient = ApiClient(config, baseUrl=\'https://api.example.com\');\n\n# request quote\nres = cli.Quote(\n {\n "amount": 10.10,\n "currency_from": Currencies.EUR,\n "currency_to": Currencies.AZN,\n }\n)\nprint(res);\n```\n\nThe `credentials.json` file is used to connect to the client and contains all necessary data to use the API. This file can be obtained in your personal cabinet, in the service accounts section. Follow the instructions in the documentation to issue new keys. If you already have keys, but you don\'t feel comfortable storing them in a file, you can use client initialization via variables. In this case, the key data can be stored in external storage instead of on the file system:\n\n```python\nfrom paymentsgate import ApiClient, Credentials\n\nconfig = Credentials(\n account_id="00000000-4000-4000-0000-00000000000a" \n public_key="LS0tLS1CRUdJTiBSU0EgUFJJVkFUNSUlFb3dJQk..."\n)\n\nclient = ApiClient(config, baseUrl=\'https://api.example.com\');\n\n...\n```\n*It is important to note that the data format for key transfer is base46.\n\n## Examples\n\n### create PayIn\n\n```python\nres = cli.PayIn(\n {\n "amount": 10.10,\n "currency": Currencies.AZN,\n "invoiceId": "INVOICE-112123124",\n "clientId": "",\n "successUrl": "https://example.com/success",\n "failUrl": "https://example.com/fail",\n "type": InvoiceTypes.m10\n }\n)\nprint(res);\n```\n\n### create PayOut\n\n```python\nres = cli.PayOut(\n {\n "amount": 5.12,\n "currencyTo": Currencies.EUR,\n "invoiceId": "INVOICE-112123124",\n "clientId": "CLIENT-003010023004",\n "baseCurrency": CurrencyTypes.fiat,\n "feesStrategy": FeesStrategy.add,\n "recipient": {\n "account_number": "4000000000000012",\n "account_owner": "CARD HOLDER",\n "type": CredentialsTypes.card\n }\n }\n)\nprint(res);\n```\n\n### Error handling\n\n```python\ntry:\n res = cli.PayOut(\n {\n "amount": 5.12,\n "currencyTo": Currencies.EUR,\n "invoiceId": "INVOICE-112123124",\n "clientId": "CLIENT-003010023004",\n "baseCurrency": CurrencyTypes.fiat,\n "feesStrategy": FeesStrategy.add,\n "recipient": {\n "account_number": "4000000000000012",\n "account_owner": "CARD HOLDER",\n "type": CredentialsTypes.card\n }\n }\n )\n print(res);\nexcept APIAuthenticationError as err:\n print(f"Authentication fail: {err.message}")\nexcept APIResponseError as err:\n print(f"Exception: {err.error}; Message: {err.message}")\n```',
|
|
21
21
|
'author': 'PaymentsGate',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|