Merge pull request 'FEATURE(pg):batch change payments to success/failed' (#1) from FEATURE/batch-change-payments-to-success/failed into master

Reviewed-on: addwin/pg#1
Reviewed-by: Sayyid Hamid Mahdavi <sahama@noreply.localhost>
This commit is contained in:
Sayyid Hamid Mahdavi 2025-10-25 07:48:02 -04:00
commit 48789debac
40 changed files with 2487 additions and 606 deletions

View file

@ -1,14 +1,20 @@
import logging
import io
import jdatetime
import xlsxwriter
from django.contrib import admin
from django.contrib import admin, messages
from django.db.models import Sum
from django.http import HttpResponse
from django.utils import timezone
from django.utils.html import format_html
from django.shortcuts import redirect, get_object_or_404
from django.urls import path
from .constans import StateChoices
from .models import PaymentRequest, PNA, Fake
logger = logging.getLogger(__name__)
class PNAAdmin(admin.ModelAdmin):
list_display = ['pna_status_code', 'pna_status_message', 'jajali_datetime', 'payment_request']
@ -48,14 +54,22 @@ def export_exel(modeladmin, request, queryset):
# return the response
return response
@admin.action(description="change to success")
def change_to_success(model_admin, request, queryset):
for obj in queryset:
obj.change_state(StateChoices.WALLET_SUBMIT_SUCCESS, StateChoices.SUCCESS, 'change to success by admin')
@admin.action(description="change to failed")
def change_to_failed(model_admin, request, queryset):
for obj in queryset:
obj.change_state(StateChoices.WALLET_SUBMIT_SUCCESS, StateChoices.FAILED, 'change to failed by admin')
class PaymentRequestAdmin(admin.ModelAdmin):
list_display = ['state', 'uuid', 'splited_amount', 'user_id', 'jajali_datetime', 'created_at', 'application', 'gateway']
list_display = ['state', 'check_success_again', 'uuid', 'splited_amount', 'user_id', 'jajali_datetime', 'created_at', 'application', 'gateway']
search_fields = ['application__uuid','application__client_id', 'amount', 'user__uuid']
list_filter = ['application', 'state', 'gateway']
actions = [export_exel]
actions = [export_exel, change_to_success, change_to_failed]
def changelist_view(self, request, extra_context=None):
@ -69,6 +83,35 @@ class PaymentRequestAdmin(admin.ModelAdmin):
extra_context['totals'] = totals
return super().changelist_view(request, extra_context=extra_context)
def check_success_again(self, obj):
if obj.state in [StateChoices.IPG_SUCCESS, StateChoices.WALLET_SUBMIT_PENDING, StateChoices.WALLET_SUBMIT_SUCCESS]:
return format_html(
'<a class="button" href="{}">بررسی دوباره موفقیت</a>',
f'{obj.uuid}/check_success_again/'
)
return ''
def get_urls(self):
urls = super().get_urls()
custom_urls = [
path('<uuid:payment_request_uuid>/check_success_again/', self.admin_site.admin_view(self.check_success_again_view))
]
return custom_urls + urls
def check_success_again_view(self, request, payment_request_uuid):
logger.info(f"[Admin panel] Check success again for payment_request_uuid={payment_request_uuid}")
payment_request: PaymentRequest = get_object_or_404(PaymentRequest, uuid=payment_request_uuid)
logger.info(f"[Admin panel] initial payment_request state={payment_request.state}")
if payment_request.state == StateChoices.IPG_SUCCESS:
payment_request.charge_wallet_balance()
elif payment_request.state == StateChoices.WALLET_SUBMIT_PENDING:
payment_request.deposit_submit()
elif payment_request.state == StateChoices.WALLET_SUBMIT_SUCCESS:
payment_request.deposit_verify()
payment_request.refresh_from_db()
logger.info(f"[Admin panel] final payment_request state={payment_request.state}")
self.message_user(request, f"درخواست {payment_request_uuid} بررسی شد ✅")
return redirect(request.META.get("HTTP_REFERER", ".."))
class FakeAdmin(admin.ModelAdmin):
list_display = [ 'created_at']

View file

@ -1,5 +1,6 @@
import logging
import urllib.parse
from mimetypes import guess_all_extensions
import jdatetime
from django.conf import settings
@ -18,7 +19,7 @@ from utils.wallet_client import deposit_to_user_wallet_submit, withdraw_from_use
from utils.pna import PNAClient
from django.utils.translation import gettext_lazy as _
logger = logging.getLogger(__name__)
class GatewayChoise(TextChoices):
FAKE = "fake", _("fake")
@ -114,16 +115,7 @@ class PaymentRequest(models.Model):
else:
raise Exception(error_message)
def charge_wallet_balance(self):
if self.state in [StateChoices.IPG_SUCCESS]:
to_pending = PaymentRequest.objects.filter(
pk=self.pk,
state=StateChoices.IPG_SUCCESS.value,
).update(
state=StateChoices.WALLET_SUBMIT_PENDING.value)
if not to_pending:
raise Exception('Cannot charge balance because state')
def deposit_submit(self):
data = {
"uuid": str(self.uuid),
"payee_id": str(self.user.uuid),
@ -135,9 +127,10 @@ class PaymentRequest(models.Model):
'application_details_url': ''
},
}
submit_response = deposit_to_user_wallet_submit(data)
submit_response = deposit_to_user_wallet_submit(settings.WALLET_CATEGORY_UUID, data)
if not submit_response.uuid:
if not submit_response or not submit_response.uuid:
logger.error(f"[Deposit Submit] Wallet submission failed | payment_id={self.pk}")
raise Exception('Failed to submit payment in wallet')
to_success = PaymentRequest.objects.filter(
@ -147,11 +140,19 @@ class PaymentRequest(models.Model):
state=StateChoices.WALLET_SUBMIT_SUCCESS.value)
if not to_success:
logger.error(f"[Deposit Submit] Failed to update state to WALLET_SUBMIT_SUCCESS | payment_id={self.pk}")
raise Exception('Cannot charge balance because state')
return to_success
verify_response = deposit_to_user_wallet_verify(self.uuid)
def deposit_verify(self):
verify_response = deposit_to_user_wallet_verify(settings.WALLET_CATEGORY_UUID, self.uuid)
if not verify_response:
logger.error(f"[Deposit Verify] Failed to get response from wallet service | payment_id={self.pk}")
raise Exception('Failed to get response from wallet service')
if not verify_response.uuid or verify_response.state != 5:
logger.error(f"[Deposit Verify] Wallet verification failed | payment_id={self.pk}, response={verify_response}")
to_pay_failed = PaymentRequest.objects.filter(
pk=self.pk,
state=StateChoices.WALLET_SUBMIT_SUCCESS.value
@ -168,8 +169,29 @@ class PaymentRequest(models.Model):
)
if not to_pay_success:
logger.error(f"[Deposit Verify] Failed to update state to SUCCESS | payment_id={self.pk}")
raise Exception('Failed to update state payment')
return to_pay_success
def charge_wallet_balance(self):
logger.info(f"[Charge Wallet] Starting wallet charge process | payment_id={self.pk}")
if self.state in [StateChoices.IPG_SUCCESS]:
to_pending = PaymentRequest.objects.filter(
pk=self.pk,
state=StateChoices.IPG_SUCCESS.value,
).update(
state=StateChoices.WALLET_SUBMIT_PENDING.value)
if not to_pending:
logger.error(f"[Charge Wallet] Failed to update state to WALLET_SUBMIT_PENDING | payment_id={self.pk}")
raise Exception('Cannot charge balance because state')
logger.info(f"[Charge Wallet] State updated to WALLET_SUBMIT_PENDING | payment_id={self.pk}")
self.deposit_submit()
to_pay_success = self.deposit_verify()
if to_pay_success:
logger.info(f"[Charge Wallet] Wallet charged successfully | payment_id={self.pk}")
else:
logger.warning(f"[Charge Wallet] Wallet charge verification failed | payment_id={self.pk}")
return bool(to_pay_success)

View file

@ -0,0 +1 @@
"""Contains endpoint functions for accessing the API"""

View file

@ -0,0 +1,151 @@
from http import HTTPStatus
from typing import Any, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.charge import Charge
from ...types import Response
def _get_kwargs(
*,
body: Charge,
) -> dict[str, Any]:
headers: dict[str, Any] = {}
_kwargs: dict[str, Any] = {
"method": "post",
"url": "/api/charge_create",
}
_kwargs["json"] = body.to_dict()
headers["Content-Type"] = "application/json"
_kwargs["headers"] = headers
return _kwargs
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Charge]:
if response.status_code == 201:
response_201 = Charge.from_dict(response.json())
return response_201
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Charge]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
*,
client: AuthenticatedClient,
body: Charge,
) -> Response[Charge]:
"""
Args:
body (Charge):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Charge]
"""
kwargs = _get_kwargs(
body=body,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
def sync(
*,
client: AuthenticatedClient,
body: Charge,
) -> Optional[Charge]:
"""
Args:
body (Charge):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Charge
"""
return sync_detailed(
client=client,
body=body,
).parsed
async def asyncio_detailed(
*,
client: AuthenticatedClient,
body: Charge,
) -> Response[Charge]:
"""
Args:
body (Charge):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Charge]
"""
kwargs = _get_kwargs(
body=body,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)
async def asyncio(
*,
client: AuthenticatedClient,
body: Charge,
) -> Optional[Charge]:
"""
Args:
body (Charge):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Charge
"""
return (
await asyncio_detailed(
client=client,
body=body,
)
).parsed

View file

@ -0,0 +1 @@
"""Contains endpoint functions for accessing the API"""

View file

@ -25,6 +25,7 @@ def _parse_response(
response_200 = ApplicationBalance.from_dict(response.json())
return response_200
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:

View file

@ -0,0 +1,151 @@
from http import HTTPStatus
from typing import Any, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.application_balance import ApplicationBalance
from ...types import Response
def _get_kwargs(
category_uuid: str,
) -> dict[str, Any]:
_kwargs: dict[str, Any] = {
"method": "get",
"url": f"/wallet/api/application/{category_uuid}/balance",
}
return _kwargs
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[ApplicationBalance]:
if response.status_code == 200:
response_200 = ApplicationBalance.from_dict(response.json())
return response_200
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[ApplicationBalance]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
category_uuid: str,
*,
client: AuthenticatedClient,
) -> Response[ApplicationBalance]:
"""API for getting specified user or application balance.
Args:
category_uuid (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[ApplicationBalance]
"""
kwargs = _get_kwargs(
category_uuid=category_uuid,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
def sync(
category_uuid: str,
*,
client: AuthenticatedClient,
) -> Optional[ApplicationBalance]:
"""API for getting specified user or application balance.
Args:
category_uuid (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
ApplicationBalance
"""
return sync_detailed(
category_uuid=category_uuid,
client=client,
).parsed
async def asyncio_detailed(
category_uuid: str,
*,
client: AuthenticatedClient,
) -> Response[ApplicationBalance]:
"""API for getting specified user or application balance.
Args:
category_uuid (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[ApplicationBalance]
"""
kwargs = _get_kwargs(
category_uuid=category_uuid,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)
async def asyncio(
category_uuid: str,
*,
client: AuthenticatedClient,
) -> Optional[ApplicationBalance]:
"""API for getting specified user or application balance.
Args:
category_uuid (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
ApplicationBalance
"""
return (
await asyncio_detailed(
category_uuid=category_uuid,
client=client,
)
).parsed

View file

@ -20,9 +20,8 @@ def _get_kwargs(
"url": "/wallet/api/application/deposit/",
}
_body = body.to_dict()
_kwargs["json"] = body.to_dict()
_kwargs["json"] = _body
headers["Content-Type"] = "application/json"
_kwargs["headers"] = headers
@ -36,6 +35,7 @@ def _parse_response(
response_201 = ApplicationDeposit.from_dict(response.json())
return response_201
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:

View file

@ -0,0 +1,168 @@
from http import HTTPStatus
from typing import Any, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.application_deposit import ApplicationDeposit
from ...types import Response
def _get_kwargs(
category_uuid: str,
*,
body: ApplicationDeposit,
) -> dict[str, Any]:
headers: dict[str, Any] = {}
_kwargs: dict[str, Any] = {
"method": "post",
"url": f"/wallet/api/application/{category_uuid}/deposit/",
}
_kwargs["json"] = body.to_dict()
headers["Content-Type"] = "application/json"
_kwargs["headers"] = headers
return _kwargs
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[ApplicationDeposit]:
if response.status_code == 201:
response_201 = ApplicationDeposit.from_dict(response.json())
return response_201
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[ApplicationDeposit]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
category_uuid: str,
*,
client: AuthenticatedClient,
body: ApplicationDeposit,
) -> Response[ApplicationDeposit]:
"""
Args:
category_uuid (str):
body (ApplicationDeposit):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[ApplicationDeposit]
"""
kwargs = _get_kwargs(
category_uuid=category_uuid,
body=body,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
def sync(
category_uuid: str,
*,
client: AuthenticatedClient,
body: ApplicationDeposit,
) -> Optional[ApplicationDeposit]:
"""
Args:
category_uuid (str):
body (ApplicationDeposit):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
ApplicationDeposit
"""
return sync_detailed(
category_uuid=category_uuid,
client=client,
body=body,
).parsed
async def asyncio_detailed(
category_uuid: str,
*,
client: AuthenticatedClient,
body: ApplicationDeposit,
) -> Response[ApplicationDeposit]:
"""
Args:
category_uuid (str):
body (ApplicationDeposit):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[ApplicationDeposit]
"""
kwargs = _get_kwargs(
category_uuid=category_uuid,
body=body,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)
async def asyncio(
category_uuid: str,
*,
client: AuthenticatedClient,
body: ApplicationDeposit,
) -> Optional[ApplicationDeposit]:
"""
Args:
category_uuid (str):
body (ApplicationDeposit):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
ApplicationDeposit
"""
return (
await asyncio_detailed(
category_uuid=category_uuid,
client=client,
body=body,
)
).parsed

View file

@ -27,6 +27,7 @@ def _parse_response(
response_200 = ApplicationDeposit.from_dict(response.json())
return response_200
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:

View file

@ -0,0 +1,160 @@
from http import HTTPStatus
from typing import Any, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.application_deposit import ApplicationDeposit
from ...types import Response
def _get_kwargs(
category_uuid: str,
uuid: str,
) -> dict[str, Any]:
_kwargs: dict[str, Any] = {
"method": "get",
"url": f"/wallet/api/application/{category_uuid}/deposit/{uuid}/verify",
}
return _kwargs
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[ApplicationDeposit]:
if response.status_code == 200:
response_200 = ApplicationDeposit.from_dict(response.json())
return response_200
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[ApplicationDeposit]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
category_uuid: str,
uuid: str,
*,
client: AuthenticatedClient,
) -> Response[ApplicationDeposit]:
"""
Args:
category_uuid (str):
uuid (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[ApplicationDeposit]
"""
kwargs = _get_kwargs(
category_uuid=category_uuid,
uuid=uuid,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
def sync(
category_uuid: str,
uuid: str,
*,
client: AuthenticatedClient,
) -> Optional[ApplicationDeposit]:
"""
Args:
category_uuid (str):
uuid (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
ApplicationDeposit
"""
return sync_detailed(
category_uuid=category_uuid,
uuid=uuid,
client=client,
).parsed
async def asyncio_detailed(
category_uuid: str,
uuid: str,
*,
client: AuthenticatedClient,
) -> Response[ApplicationDeposit]:
"""
Args:
category_uuid (str):
uuid (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[ApplicationDeposit]
"""
kwargs = _get_kwargs(
category_uuid=category_uuid,
uuid=uuid,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)
async def asyncio(
category_uuid: str,
uuid: str,
*,
client: AuthenticatedClient,
) -> Optional[ApplicationDeposit]:
"""
Args:
category_uuid (str):
uuid (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
ApplicationDeposit
"""
return (
await asyncio_detailed(
category_uuid=category_uuid,
uuid=uuid,
client=client,
)
).parsed

View file

@ -11,11 +11,14 @@ from ...types import UNSET, Response, Unset
def _get_kwargs(
*,
page: Union[Unset, int] = UNSET,
limit: Union[Unset, int] = UNSET,
offset: Union[Unset, int] = UNSET,
) -> dict[str, Any]:
params: dict[str, Any] = {}
params["page"] = page
params["limit"] = limit
params["offset"] = offset
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
@ -35,6 +38,7 @@ def _parse_response(
response_200 = PaginatedApplicationTransactionList.from_dict(response.json())
return response_200
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
@ -55,11 +59,13 @@ def _build_response(
def sync_detailed(
*,
client: AuthenticatedClient,
page: Union[Unset, int] = UNSET,
limit: Union[Unset, int] = UNSET,
offset: Union[Unset, int] = UNSET,
) -> Response[PaginatedApplicationTransactionList]:
"""
Args:
page (Union[Unset, int]):
limit (Union[Unset, int]):
offset (Union[Unset, int]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@ -70,7 +76,8 @@ def sync_detailed(
"""
kwargs = _get_kwargs(
page=page,
limit=limit,
offset=offset,
)
response = client.get_httpx_client().request(
@ -83,11 +90,13 @@ def sync_detailed(
def sync(
*,
client: AuthenticatedClient,
page: Union[Unset, int] = UNSET,
limit: Union[Unset, int] = UNSET,
offset: Union[Unset, int] = UNSET,
) -> Optional[PaginatedApplicationTransactionList]:
"""
Args:
page (Union[Unset, int]):
limit (Union[Unset, int]):
offset (Union[Unset, int]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@ -99,18 +108,21 @@ def sync(
return sync_detailed(
client=client,
page=page,
limit=limit,
offset=offset,
).parsed
async def asyncio_detailed(
*,
client: AuthenticatedClient,
page: Union[Unset, int] = UNSET,
limit: Union[Unset, int] = UNSET,
offset: Union[Unset, int] = UNSET,
) -> Response[PaginatedApplicationTransactionList]:
"""
Args:
page (Union[Unset, int]):
limit (Union[Unset, int]):
offset (Union[Unset, int]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@ -121,7 +133,8 @@ async def asyncio_detailed(
"""
kwargs = _get_kwargs(
page=page,
limit=limit,
offset=offset,
)
response = await client.get_async_httpx_client().request(**kwargs)
@ -132,11 +145,13 @@ async def asyncio_detailed(
async def asyncio(
*,
client: AuthenticatedClient,
page: Union[Unset, int] = UNSET,
limit: Union[Unset, int] = UNSET,
offset: Union[Unset, int] = UNSET,
) -> Optional[PaginatedApplicationTransactionList]:
"""
Args:
page (Union[Unset, int]):
limit (Union[Unset, int]):
offset (Union[Unset, int]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@ -149,6 +164,7 @@ async def asyncio(
return (
await asyncio_detailed(
client=client,
page=page,
limit=limit,
offset=offset,
)
).parsed

View file

@ -0,0 +1,183 @@
from http import HTTPStatus
from typing import Any, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.paginated_application_transaction_list import PaginatedApplicationTransactionList
from ...types import UNSET, Response, Unset
def _get_kwargs(
category_uuid: str,
*,
limit: Union[Unset, int] = UNSET,
offset: Union[Unset, int] = UNSET,
) -> dict[str, Any]:
params: dict[str, Any] = {}
params["limit"] = limit
params["offset"] = offset
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
_kwargs: dict[str, Any] = {
"method": "get",
"url": f"/wallet/api/application/{category_uuid}/",
"params": params,
}
return _kwargs
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[PaginatedApplicationTransactionList]:
if response.status_code == 200:
response_200 = PaginatedApplicationTransactionList.from_dict(response.json())
return response_200
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[PaginatedApplicationTransactionList]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
category_uuid: str,
*,
client: AuthenticatedClient,
limit: Union[Unset, int] = UNSET,
offset: Union[Unset, int] = UNSET,
) -> Response[PaginatedApplicationTransactionList]:
"""
Args:
category_uuid (str):
limit (Union[Unset, int]):
offset (Union[Unset, int]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[PaginatedApplicationTransactionList]
"""
kwargs = _get_kwargs(
category_uuid=category_uuid,
limit=limit,
offset=offset,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
def sync(
category_uuid: str,
*,
client: AuthenticatedClient,
limit: Union[Unset, int] = UNSET,
offset: Union[Unset, int] = UNSET,
) -> Optional[PaginatedApplicationTransactionList]:
"""
Args:
category_uuid (str):
limit (Union[Unset, int]):
offset (Union[Unset, int]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
PaginatedApplicationTransactionList
"""
return sync_detailed(
category_uuid=category_uuid,
client=client,
limit=limit,
offset=offset,
).parsed
async def asyncio_detailed(
category_uuid: str,
*,
client: AuthenticatedClient,
limit: Union[Unset, int] = UNSET,
offset: Union[Unset, int] = UNSET,
) -> Response[PaginatedApplicationTransactionList]:
"""
Args:
category_uuid (str):
limit (Union[Unset, int]):
offset (Union[Unset, int]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[PaginatedApplicationTransactionList]
"""
kwargs = _get_kwargs(
category_uuid=category_uuid,
limit=limit,
offset=offset,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)
async def asyncio(
category_uuid: str,
*,
client: AuthenticatedClient,
limit: Union[Unset, int] = UNSET,
offset: Union[Unset, int] = UNSET,
) -> Optional[PaginatedApplicationTransactionList]:
"""
Args:
category_uuid (str):
limit (Union[Unset, int]):
offset (Union[Unset, int]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
PaginatedApplicationTransactionList
"""
return (
await asyncio_detailed(
category_uuid=category_uuid,
client=client,
limit=limit,
offset=offset,
)
).parsed

View file

@ -10,11 +10,12 @@ from ...types import Response
def _get_kwargs(
category_uuid: str,
uuid: str,
) -> dict[str, Any]:
_kwargs: dict[str, Any] = {
"method": "get",
"url": f"/wallet/api/application/{uuid}/",
"url": f"/wallet/api/application/{category_uuid}/{uuid}/",
}
return _kwargs
@ -27,6 +28,7 @@ def _parse_response(
response_200 = ApplicationTransaction.from_dict(response.json())
return response_200
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
@ -45,12 +47,14 @@ def _build_response(
def sync_detailed(
category_uuid: str,
uuid: str,
*,
client: AuthenticatedClient,
) -> Response[ApplicationTransaction]:
"""
Args:
category_uuid (str):
uuid (str):
Raises:
@ -62,6 +66,7 @@ def sync_detailed(
"""
kwargs = _get_kwargs(
category_uuid=category_uuid,
uuid=uuid,
)
@ -73,12 +78,14 @@ def sync_detailed(
def sync(
category_uuid: str,
uuid: str,
*,
client: AuthenticatedClient,
) -> Optional[ApplicationTransaction]:
"""
Args:
category_uuid (str):
uuid (str):
Raises:
@ -90,18 +97,21 @@ def sync(
"""
return sync_detailed(
category_uuid=category_uuid,
uuid=uuid,
client=client,
).parsed
async def asyncio_detailed(
category_uuid: str,
uuid: str,
*,
client: AuthenticatedClient,
) -> Response[ApplicationTransaction]:
"""
Args:
category_uuid (str):
uuid (str):
Raises:
@ -113,6 +123,7 @@ async def asyncio_detailed(
"""
kwargs = _get_kwargs(
category_uuid=category_uuid,
uuid=uuid,
)
@ -122,12 +133,14 @@ async def asyncio_detailed(
async def asyncio(
category_uuid: str,
uuid: str,
*,
client: AuthenticatedClient,
) -> Optional[ApplicationTransaction]:
"""
Args:
category_uuid (str):
uuid (str):
Raises:
@ -140,6 +153,7 @@ async def asyncio(
return (
await asyncio_detailed(
category_uuid=category_uuid,
uuid=uuid,
client=client,
)

View file

@ -0,0 +1,147 @@
from http import HTTPStatus
from typing import Any, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.application_transaction import ApplicationTransaction
from ...types import Response
def _get_kwargs(
uuid: str,
) -> dict[str, Any]:
_kwargs: dict[str, Any] = {
"method": "get",
"url": f"/wallet/api/application/{uuid}/",
}
return _kwargs
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[ApplicationTransaction]:
if response.status_code == 200:
response_200 = ApplicationTransaction.from_dict(response.json())
return response_200
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[ApplicationTransaction]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
uuid: str,
*,
client: AuthenticatedClient,
) -> Response[ApplicationTransaction]:
"""
Args:
uuid (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[ApplicationTransaction]
"""
kwargs = _get_kwargs(
uuid=uuid,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
def sync(
uuid: str,
*,
client: AuthenticatedClient,
) -> Optional[ApplicationTransaction]:
"""
Args:
uuid (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
ApplicationTransaction
"""
return sync_detailed(
uuid=uuid,
client=client,
).parsed
async def asyncio_detailed(
uuid: str,
*,
client: AuthenticatedClient,
) -> Response[ApplicationTransaction]:
"""
Args:
uuid (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[ApplicationTransaction]
"""
kwargs = _get_kwargs(
uuid=uuid,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)
async def asyncio(
uuid: str,
*,
client: AuthenticatedClient,
) -> Optional[ApplicationTransaction]:
"""
Args:
uuid (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
ApplicationTransaction
"""
return (
await asyncio_detailed(
uuid=uuid,
client=client,
)
).parsed

View file

@ -0,0 +1,147 @@
from http import HTTPStatus
from typing import Any, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.my_wallet import MyWallet
from ...types import Response
def _get_kwargs(
uuid: str,
) -> dict[str, Any]:
_kwargs: dict[str, Any] = {
"method": "get",
"url": f"/wallet/api/application/user_balance/{uuid}",
}
return _kwargs
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[MyWallet]:
if response.status_code == 200:
response_200 = MyWallet.from_dict(response.json())
return response_200
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[MyWallet]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
uuid: str,
*,
client: AuthenticatedClient,
) -> Response[MyWallet]:
"""API for getting specified user or application balance.
Args:
uuid (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[MyWallet]
"""
kwargs = _get_kwargs(
uuid=uuid,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
def sync(
uuid: str,
*,
client: AuthenticatedClient,
) -> Optional[MyWallet]:
"""API for getting specified user or application balance.
Args:
uuid (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
MyWallet
"""
return sync_detailed(
uuid=uuid,
client=client,
).parsed
async def asyncio_detailed(
uuid: str,
*,
client: AuthenticatedClient,
) -> Response[MyWallet]:
"""API for getting specified user or application balance.
Args:
uuid (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[MyWallet]
"""
kwargs = _get_kwargs(
uuid=uuid,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)
async def asyncio(
uuid: str,
*,
client: AuthenticatedClient,
) -> Optional[MyWallet]:
"""API for getting specified user or application balance.
Args:
uuid (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
MyWallet
"""
return (
await asyncio_detailed(
uuid=uuid,
client=client,
)
).parsed

View file

@ -0,0 +1,160 @@
from http import HTTPStatus
from typing import Any, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.my_wallet import MyWallet
from ...types import Response
def _get_kwargs(
category_uuid: str,
uuid: str,
) -> dict[str, Any]:
_kwargs: dict[str, Any] = {
"method": "get",
"url": f"/wallet/api/application/{category_uuid}/user/{uuid}/balance",
}
return _kwargs
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[MyWallet]:
if response.status_code == 200:
response_200 = MyWallet.from_dict(response.json())
return response_200
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[MyWallet]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
category_uuid: str,
uuid: str,
*,
client: AuthenticatedClient,
) -> Response[MyWallet]:
"""API for getting specified user or application balance.
Args:
category_uuid (str):
uuid (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[MyWallet]
"""
kwargs = _get_kwargs(
category_uuid=category_uuid,
uuid=uuid,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
def sync(
category_uuid: str,
uuid: str,
*,
client: AuthenticatedClient,
) -> Optional[MyWallet]:
"""API for getting specified user or application balance.
Args:
category_uuid (str):
uuid (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
MyWallet
"""
return sync_detailed(
category_uuid=category_uuid,
uuid=uuid,
client=client,
).parsed
async def asyncio_detailed(
category_uuid: str,
uuid: str,
*,
client: AuthenticatedClient,
) -> Response[MyWallet]:
"""API for getting specified user or application balance.
Args:
category_uuid (str):
uuid (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[MyWallet]
"""
kwargs = _get_kwargs(
category_uuid=category_uuid,
uuid=uuid,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)
async def asyncio(
category_uuid: str,
uuid: str,
*,
client: AuthenticatedClient,
) -> Optional[MyWallet]:
"""API for getting specified user or application balance.
Args:
category_uuid (str):
uuid (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
MyWallet
"""
return (
await asyncio_detailed(
category_uuid=category_uuid,
uuid=uuid,
client=client,
)
).parsed

View file

@ -20,9 +20,8 @@ def _get_kwargs(
"url": "/wallet/api/application/withdraw/",
}
_body = body.to_dict()
_kwargs["json"] = body.to_dict()
_kwargs["json"] = _body
headers["Content-Type"] = "application/json"
_kwargs["headers"] = headers
@ -36,6 +35,7 @@ def _parse_response(
response_201 = ApplicationWithdraw.from_dict(response.json())
return response_201
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:

View file

@ -0,0 +1,168 @@
from http import HTTPStatus
from typing import Any, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.application_withdraw import ApplicationWithdraw
from ...types import Response
def _get_kwargs(
category_uuid: str,
*,
body: ApplicationWithdraw,
) -> dict[str, Any]:
headers: dict[str, Any] = {}
_kwargs: dict[str, Any] = {
"method": "post",
"url": f"/wallet/api/application/{category_uuid}/withdraw/",
}
_kwargs["json"] = body.to_dict()
headers["Content-Type"] = "application/json"
_kwargs["headers"] = headers
return _kwargs
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[ApplicationWithdraw]:
if response.status_code == 201:
response_201 = ApplicationWithdraw.from_dict(response.json())
return response_201
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[ApplicationWithdraw]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
category_uuid: str,
*,
client: AuthenticatedClient,
body: ApplicationWithdraw,
) -> Response[ApplicationWithdraw]:
"""
Args:
category_uuid (str):
body (ApplicationWithdraw):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[ApplicationWithdraw]
"""
kwargs = _get_kwargs(
category_uuid=category_uuid,
body=body,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
def sync(
category_uuid: str,
*,
client: AuthenticatedClient,
body: ApplicationWithdraw,
) -> Optional[ApplicationWithdraw]:
"""
Args:
category_uuid (str):
body (ApplicationWithdraw):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
ApplicationWithdraw
"""
return sync_detailed(
category_uuid=category_uuid,
client=client,
body=body,
).parsed
async def asyncio_detailed(
category_uuid: str,
*,
client: AuthenticatedClient,
body: ApplicationWithdraw,
) -> Response[ApplicationWithdraw]:
"""
Args:
category_uuid (str):
body (ApplicationWithdraw):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[ApplicationWithdraw]
"""
kwargs = _get_kwargs(
category_uuid=category_uuid,
body=body,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)
async def asyncio(
category_uuid: str,
*,
client: AuthenticatedClient,
body: ApplicationWithdraw,
) -> Optional[ApplicationWithdraw]:
"""
Args:
category_uuid (str):
body (ApplicationWithdraw):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
ApplicationWithdraw
"""
return (
await asyncio_detailed(
category_uuid=category_uuid,
client=client,
body=body,
)
).parsed

View file

@ -27,6 +27,7 @@ def _parse_response(
response_200 = ApplicationWithdraw.from_dict(response.json())
return response_200
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:

View file

@ -0,0 +1,160 @@
from http import HTTPStatus
from typing import Any, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.application_withdraw import ApplicationWithdraw
from ...types import Response
def _get_kwargs(
category_uuid: str,
uuid: str,
) -> dict[str, Any]:
_kwargs: dict[str, Any] = {
"method": "get",
"url": f"/wallet/api/application/{category_uuid}/withdraw/{uuid}/verify",
}
return _kwargs
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[ApplicationWithdraw]:
if response.status_code == 200:
response_200 = ApplicationWithdraw.from_dict(response.json())
return response_200
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[ApplicationWithdraw]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
category_uuid: str,
uuid: str,
*,
client: AuthenticatedClient,
) -> Response[ApplicationWithdraw]:
"""
Args:
category_uuid (str):
uuid (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[ApplicationWithdraw]
"""
kwargs = _get_kwargs(
category_uuid=category_uuid,
uuid=uuid,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
def sync(
category_uuid: str,
uuid: str,
*,
client: AuthenticatedClient,
) -> Optional[ApplicationWithdraw]:
"""
Args:
category_uuid (str):
uuid (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
ApplicationWithdraw
"""
return sync_detailed(
category_uuid=category_uuid,
uuid=uuid,
client=client,
).parsed
async def asyncio_detailed(
category_uuid: str,
uuid: str,
*,
client: AuthenticatedClient,
) -> Response[ApplicationWithdraw]:
"""
Args:
category_uuid (str):
uuid (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[ApplicationWithdraw]
"""
kwargs = _get_kwargs(
category_uuid=category_uuid,
uuid=uuid,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)
async def asyncio(
category_uuid: str,
uuid: str,
*,
client: AuthenticatedClient,
) -> Optional[ApplicationWithdraw]:
"""
Args:
category_uuid (str):
uuid (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
ApplicationWithdraw
"""
return (
await asyncio_detailed(
category_uuid=category_uuid,
uuid=uuid,
client=client,
)
).parsed

View file

@ -11,11 +11,14 @@ from ...types import UNSET, Response, Unset
def _get_kwargs(
*,
page: Union[Unset, int] = UNSET,
limit: Union[Unset, int] = UNSET,
offset: Union[Unset, int] = UNSET,
) -> dict[str, Any]:
params: dict[str, Any] = {}
params["page"] = page
params["limit"] = limit
params["offset"] = offset
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
@ -35,6 +38,7 @@ def _parse_response(
response_200 = PaginatedUserTransactionList.from_dict(response.json())
return response_200
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
@ -55,7 +59,8 @@ def _build_response(
def sync_detailed(
*,
client: AuthenticatedClient,
page: Union[Unset, int] = UNSET,
limit: Union[Unset, int] = UNSET,
offset: Union[Unset, int] = UNSET,
) -> Response[PaginatedUserTransactionList]:
"""GET: API for getting list of transactions for authenticated user
POST: API for creating transaction for transferring funds from authenticated user to application
@ -64,7 +69,8 @@ def sync_detailed(
- user: authenticated user
Args:
page (Union[Unset, int]):
limit (Union[Unset, int]):
offset (Union[Unset, int]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@ -75,7 +81,8 @@ def sync_detailed(
"""
kwargs = _get_kwargs(
page=page,
limit=limit,
offset=offset,
)
response = client.get_httpx_client().request(
@ -88,7 +95,8 @@ def sync_detailed(
def sync(
*,
client: AuthenticatedClient,
page: Union[Unset, int] = UNSET,
limit: Union[Unset, int] = UNSET,
offset: Union[Unset, int] = UNSET,
) -> Optional[PaginatedUserTransactionList]:
"""GET: API for getting list of transactions for authenticated user
POST: API for creating transaction for transferring funds from authenticated user to application
@ -97,7 +105,8 @@ def sync(
- user: authenticated user
Args:
page (Union[Unset, int]):
limit (Union[Unset, int]):
offset (Union[Unset, int]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@ -109,14 +118,16 @@ def sync(
return sync_detailed(
client=client,
page=page,
limit=limit,
offset=offset,
).parsed
async def asyncio_detailed(
*,
client: AuthenticatedClient,
page: Union[Unset, int] = UNSET,
limit: Union[Unset, int] = UNSET,
offset: Union[Unset, int] = UNSET,
) -> Response[PaginatedUserTransactionList]:
"""GET: API for getting list of transactions for authenticated user
POST: API for creating transaction for transferring funds from authenticated user to application
@ -125,7 +136,8 @@ async def asyncio_detailed(
- user: authenticated user
Args:
page (Union[Unset, int]):
limit (Union[Unset, int]):
offset (Union[Unset, int]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@ -136,7 +148,8 @@ async def asyncio_detailed(
"""
kwargs = _get_kwargs(
page=page,
limit=limit,
offset=offset,
)
response = await client.get_async_httpx_client().request(**kwargs)
@ -147,7 +160,8 @@ async def asyncio_detailed(
async def asyncio(
*,
client: AuthenticatedClient,
page: Union[Unset, int] = UNSET,
limit: Union[Unset, int] = UNSET,
offset: Union[Unset, int] = UNSET,
) -> Optional[PaginatedUserTransactionList]:
"""GET: API for getting list of transactions for authenticated user
POST: API for creating transaction for transferring funds from authenticated user to application
@ -156,7 +170,8 @@ async def asyncio(
- user: authenticated user
Args:
page (Union[Unset, int]):
limit (Union[Unset, int]):
offset (Union[Unset, int]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@ -169,6 +184,7 @@ async def asyncio(
return (
await asyncio_detailed(
client=client,
page=page,
limit=limit,
offset=offset,
)
).parsed

View file

@ -0,0 +1,147 @@
from http import HTTPStatus
from typing import Any, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.my_wallet import MyWallet
from ...types import Response
def _get_kwargs(
category_uuid: str,
) -> dict[str, Any]:
_kwargs: dict[str, Any] = {
"method": "get",
"url": f"/wallet/api/user/{category_uuid}/balance",
}
return _kwargs
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[MyWallet]:
if response.status_code == 200:
response_200 = MyWallet.from_dict(response.json())
return response_200
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[MyWallet]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
category_uuid: str,
*,
client: AuthenticatedClient,
) -> Response[MyWallet]:
"""API for getting authenticated user balance.
Args:
category_uuid (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[MyWallet]
"""
kwargs = _get_kwargs(
category_uuid=category_uuid,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
def sync(
category_uuid: str,
*,
client: AuthenticatedClient,
) -> Optional[MyWallet]:
"""API for getting authenticated user balance.
Args:
category_uuid (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
MyWallet
"""
return sync_detailed(
category_uuid=category_uuid,
client=client,
).parsed
async def asyncio_detailed(
category_uuid: str,
*,
client: AuthenticatedClient,
) -> Response[MyWallet]:
"""API for getting authenticated user balance.
Args:
category_uuid (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[MyWallet]
"""
kwargs = _get_kwargs(
category_uuid=category_uuid,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)
async def asyncio(
category_uuid: str,
*,
client: AuthenticatedClient,
) -> Optional[MyWallet]:
"""API for getting authenticated user balance.
Args:
category_uuid (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
MyWallet
"""
return (
await asyncio_detailed(
category_uuid=category_uuid,
client=client,
)
).parsed

View file

@ -0,0 +1,203 @@
from http import HTTPStatus
from typing import Any, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.paginated_user_transaction_list import PaginatedUserTransactionList
from ...types import UNSET, Response, Unset
def _get_kwargs(
category_uuid: str,
*,
limit: Union[Unset, int] = UNSET,
offset: Union[Unset, int] = UNSET,
) -> dict[str, Any]:
params: dict[str, Any] = {}
params["limit"] = limit
params["offset"] = offset
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
_kwargs: dict[str, Any] = {
"method": "get",
"url": f"/wallet/api/user/{category_uuid}/transactions/",
"params": params,
}
return _kwargs
def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[PaginatedUserTransactionList]:
if response.status_code == 200:
response_200 = PaginatedUserTransactionList.from_dict(response.json())
return response_200
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[PaginatedUserTransactionList]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
category_uuid: str,
*,
client: AuthenticatedClient,
limit: Union[Unset, int] = UNSET,
offset: Union[Unset, int] = UNSET,
) -> Response[PaginatedUserTransactionList]:
"""GET: API for getting list of transactions for authenticated user
POST: API for creating transaction for transferring funds from authenticated user to application
owner. (deprecated)
args:
- user: authenticated user
Args:
category_uuid (str):
limit (Union[Unset, int]):
offset (Union[Unset, int]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[PaginatedUserTransactionList]
"""
kwargs = _get_kwargs(
category_uuid=category_uuid,
limit=limit,
offset=offset,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
def sync(
category_uuid: str,
*,
client: AuthenticatedClient,
limit: Union[Unset, int] = UNSET,
offset: Union[Unset, int] = UNSET,
) -> Optional[PaginatedUserTransactionList]:
"""GET: API for getting list of transactions for authenticated user
POST: API for creating transaction for transferring funds from authenticated user to application
owner. (deprecated)
args:
- user: authenticated user
Args:
category_uuid (str):
limit (Union[Unset, int]):
offset (Union[Unset, int]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
PaginatedUserTransactionList
"""
return sync_detailed(
category_uuid=category_uuid,
client=client,
limit=limit,
offset=offset,
).parsed
async def asyncio_detailed(
category_uuid: str,
*,
client: AuthenticatedClient,
limit: Union[Unset, int] = UNSET,
offset: Union[Unset, int] = UNSET,
) -> Response[PaginatedUserTransactionList]:
"""GET: API for getting list of transactions for authenticated user
POST: API for creating transaction for transferring funds from authenticated user to application
owner. (deprecated)
args:
- user: authenticated user
Args:
category_uuid (str):
limit (Union[Unset, int]):
offset (Union[Unset, int]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[PaginatedUserTransactionList]
"""
kwargs = _get_kwargs(
category_uuid=category_uuid,
limit=limit,
offset=offset,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)
async def asyncio(
category_uuid: str,
*,
client: AuthenticatedClient,
limit: Union[Unset, int] = UNSET,
offset: Union[Unset, int] = UNSET,
) -> Optional[PaginatedUserTransactionList]:
"""GET: API for getting list of transactions for authenticated user
POST: API for creating transaction for transferring funds from authenticated user to application
owner. (deprecated)
args:
- user: authenticated user
Args:
category_uuid (str):
limit (Union[Unset, int]):
offset (Union[Unset, int]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
PaginatedUserTransactionList
"""
return (
await asyncio_detailed(
category_uuid=category_uuid,
client=client,
limit=limit,
offset=offset,
)
).parsed

View file

@ -23,6 +23,7 @@ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: htt
response_200 = MyWallet.from_dict(response.json())
return response_200
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:

View file

@ -4,11 +4,10 @@ from .application_balance import ApplicationBalance
from .application_deposit import ApplicationDeposit
from .application_transaction import ApplicationTransaction
from .application_withdraw import ApplicationWithdraw
from .charge import Charge
from .my_wallet import MyWallet
from .paginated_application_transaction_list import PaginatedApplicationTransactionList
from .paginated_user_transaction_list import PaginatedUserTransactionList
from .payee_type_enum import PayeeTypeEnum
from .payer_type_enum import PayerTypeEnum
from .state_enum import StateEnum
from .user_transaction import UserTransaction
@ -17,11 +16,10 @@ __all__ = (
"ApplicationDeposit",
"ApplicationTransaction",
"ApplicationWithdraw",
"Charge",
"MyWallet",
"PaginatedApplicationTransactionList",
"PaginatedUserTransactionList",
"PayeeTypeEnum",
"PayerTypeEnum",
"StateEnum",
"UserTransaction",
)

View file

@ -1,3 +1,4 @@
from collections.abc import Mapping
from typing import Any, TypeVar, Union
from attrs import define as _attrs_define
@ -30,8 +31,8 @@ class ApplicationBalance:
return field_dict
@classmethod
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
d = src_dict.copy()
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
d = dict(src_dict)
balance = d.pop("balance", UNSET)
application_balance = cls(

View file

@ -1,13 +1,12 @@
import datetime
from typing import Any, TypeVar, Union, cast
from collections.abc import Mapping
from typing import Any, TypeVar, Union
from uuid import UUID
from attrs import define as _attrs_define
from attrs import field as _attrs_field
from dateutil.parser import isoparse
from ..models.payee_type_enum import PayeeTypeEnum
from ..models.payer_type_enum import PayerTypeEnum
from ..models.state_enum import StateEnum
from ..types import UNSET, Unset
@ -18,11 +17,11 @@ T = TypeVar("T", bound="ApplicationDeposit")
class ApplicationDeposit:
"""
Attributes:
uuid (UUID):
payer_id (Union[None, UUID]):
payer_type (Union[None, PayerTypeEnum]):
payer_id (str):
payer_type (str):
payee_id (UUID):
created_at (Union[None, datetime.datetime]):
payee_type (int):
created_at (datetime.datetime):
state (StateEnum): * `1` - created
* `2` - delayed
* `3` - pending
@ -31,63 +30,43 @@ class ApplicationDeposit:
* `6` - failed
* `7` - expected_failure
amount (int):
updated_at (Union[None, datetime.datetime]):
payee_type (Union[None, PayeeTypeEnum, Unset]):
updated_at (datetime.datetime):
uuid (Union[Unset, UUID]):
details (Union[Unset, Any]):
"""
uuid: UUID
payer_id: Union[None, UUID]
payer_type: Union[None, PayerTypeEnum]
payer_id: str
payer_type: str
payee_id: UUID
created_at: Union[None, datetime.datetime]
payee_type: int
created_at: datetime.datetime
state: StateEnum
amount: int
updated_at: Union[None, datetime.datetime]
payee_type: Union[None, PayeeTypeEnum, Unset] = UNSET
updated_at: datetime.datetime
uuid: Union[Unset, UUID] = UNSET
details: Union[Unset, Any] = UNSET
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> dict[str, Any]:
uuid = str(self.uuid)
payer_id: Union[None, str]
if isinstance(self.payer_id, UUID):
payer_id = str(self.payer_id)
else:
payer_id = self.payer_id
payer_type: Union[None, int]
if isinstance(self.payer_type, PayerTypeEnum):
payer_type = self.payer_type.value
else:
payer_type = self.payer_type
payee_id = str(self.payee_id)
created_at: Union[None, str]
if isinstance(self.created_at, datetime.datetime):
payee_type = self.payee_type
created_at = self.created_at.isoformat()
else:
created_at = self.created_at
state = self.state.value
amount = self.amount
updated_at: Union[None, str]
if isinstance(self.updated_at, datetime.datetime):
updated_at = self.updated_at.isoformat()
else:
updated_at = self.updated_at
payee_type: Union[None, Unset, int]
if isinstance(self.payee_type, Unset):
payee_type = UNSET
elif isinstance(self.payee_type, PayeeTypeEnum):
payee_type = self.payee_type.value
else:
payee_type = self.payee_type
uuid: Union[Unset, str] = UNSET
if not isinstance(self.uuid, Unset):
uuid = str(self.uuid)
details = self.details
@ -95,123 +74,61 @@ class ApplicationDeposit:
field_dict.update(self.additional_properties)
field_dict.update(
{
"uuid": uuid,
"payer_id": payer_id,
"payer_type": payer_type,
"payee_id": payee_id,
"payee_type": payee_type,
"created_at": created_at,
"state": state,
"amount": amount,
"updated_at": updated_at,
}
)
if payee_type is not UNSET:
field_dict["payee_type"] = payee_type
if uuid is not UNSET:
field_dict["uuid"] = uuid
if details is not UNSET:
field_dict["details"] = details
return field_dict
@classmethod
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
d = src_dict.copy()
uuid = UUID(d.pop("uuid"))
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
d = dict(src_dict)
payer_id = d.pop("payer_id")
def _parse_payer_id(data: object) -> Union[None, UUID]:
if data is None:
return data
try:
if not isinstance(data, str):
raise TypeError()
payer_id_type_0 = UUID(data)
return payer_id_type_0
except: # noqa: E722
pass
return cast(Union[None, UUID], data)
payer_id = _parse_payer_id(d.pop("payer_id"))
def _parse_payer_type(data: object) -> Union[None, PayerTypeEnum]:
if data is None:
return data
try:
if not isinstance(data, int):
raise TypeError()
payer_type_type_0 = PayerTypeEnum(data)
return payer_type_type_0
except: # noqa: E722
pass
return cast(Union[None, PayerTypeEnum], data)
payer_type = _parse_payer_type(d.pop("payer_type"))
payer_type = d.pop("payer_type")
payee_id = UUID(d.pop("payee_id"))
def _parse_created_at(data: object) -> Union[None, datetime.datetime]:
if data is None:
return data
try:
if not isinstance(data, str):
raise TypeError()
created_at_type_0 = isoparse(data)
payee_type = d.pop("payee_type")
return created_at_type_0
except: # noqa: E722
pass
return cast(Union[None, datetime.datetime], data)
created_at = _parse_created_at(d.pop("created_at"))
created_at = isoparse(d.pop("created_at"))
state = StateEnum(d.pop("state"))
amount = d.pop("amount")
def _parse_updated_at(data: object) -> Union[None, datetime.datetime]:
if data is None:
return data
try:
if not isinstance(data, str):
raise TypeError()
updated_at_type_0 = isoparse(data)
updated_at = isoparse(d.pop("updated_at"))
return updated_at_type_0
except: # noqa: E722
pass
return cast(Union[None, datetime.datetime], data)
updated_at = _parse_updated_at(d.pop("updated_at"))
def _parse_payee_type(data: object) -> Union[None, PayeeTypeEnum, Unset]:
if data is None:
return data
if isinstance(data, Unset):
return data
try:
if not isinstance(data, int):
raise TypeError()
payee_type_type_0 = PayeeTypeEnum(data)
return payee_type_type_0
except: # noqa: E722
pass
return cast(Union[None, PayeeTypeEnum, Unset], data)
payee_type = _parse_payee_type(d.pop("payee_type", UNSET))
_uuid = d.pop("uuid", UNSET)
uuid: Union[Unset, UUID]
if isinstance(_uuid, Unset):
uuid = UNSET
else:
uuid = UUID(_uuid)
details = d.pop("details", UNSET)
application_deposit = cls(
uuid=uuid,
payer_id=payer_id,
payer_type=payer_type,
payee_id=payee_id,
payee_type=payee_type,
created_at=created_at,
state=state,
amount=amount,
updated_at=updated_at,
payee_type=payee_type,
uuid=uuid,
details=details,
)

View file

@ -1,12 +1,12 @@
import datetime
from typing import Any, TypeVar, Union, cast
from collections.abc import Mapping
from typing import Any, TypeVar, Union
from uuid import UUID
from attrs import define as _attrs_define
from attrs import field as _attrs_field
from dateutil.parser import isoparse
from ..models.payer_type_enum import PayerTypeEnum
from ..models.state_enum import StateEnum
from ..types import UNSET, Unset
@ -18,9 +18,11 @@ class ApplicationTransaction:
"""
Attributes:
uuid (UUID):
payer_id (str):
payer_type (str):
payee_id (UUID):
payee_type (UUID):
created_at (Union[None, datetime.datetime]):
created_at (datetime.datetime):
state (StateEnum): * `1` - created
* `2` - delayed
* `3` - pending
@ -29,71 +31,49 @@ class ApplicationTransaction:
* `6` - failed
* `7` - expected_failure
amount (int):
updated_at (Union[None, datetime.datetime]):
updated_at (datetime.datetime):
details (Any):
role (str):
payer_id (Union[None, UUID, Unset]):
payer_type (Union[None, PayerTypeEnum, Unset]):
delay (Union[Unset, int]):
"""
uuid: UUID
payer_id: str
payer_type: str
payee_id: UUID
payee_type: UUID
created_at: Union[None, datetime.datetime]
created_at: datetime.datetime
state: StateEnum
amount: int
updated_at: Union[None, datetime.datetime]
updated_at: datetime.datetime
details: Any
role: str
payer_id: Union[None, UUID, Unset] = UNSET
payer_type: Union[None, PayerTypeEnum, Unset] = UNSET
delay: Union[Unset, int] = UNSET
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> dict[str, Any]:
uuid = str(self.uuid)
payer_id = self.payer_id
payer_type = self.payer_type
payee_id = str(self.payee_id)
payee_type = str(self.payee_type)
created_at: Union[None, str]
if isinstance(self.created_at, datetime.datetime):
created_at = self.created_at.isoformat()
else:
created_at = self.created_at
state = self.state.value
amount = self.amount
updated_at: Union[None, str]
if isinstance(self.updated_at, datetime.datetime):
updated_at = self.updated_at.isoformat()
else:
updated_at = self.updated_at
details = self.details
role = self.role
payer_id: Union[None, Unset, str]
if isinstance(self.payer_id, Unset):
payer_id = UNSET
elif isinstance(self.payer_id, UUID):
payer_id = str(self.payer_id)
else:
payer_id = self.payer_id
payer_type: Union[None, Unset, int]
if isinstance(self.payer_type, Unset):
payer_type = UNSET
elif isinstance(self.payer_type, PayerTypeEnum):
payer_type = self.payer_type.value
else:
payer_type = self.payer_type
delay = self.delay
field_dict: dict[str, Any] = {}
@ -101,6 +81,8 @@ class ApplicationTransaction:
field_dict.update(
{
"uuid": uuid,
"payer_id": payer_id,
"payer_type": payer_type,
"payee_id": payee_id,
"payee_type": payee_type,
"created_at": created_at,
@ -111,100 +93,42 @@ class ApplicationTransaction:
"role": role,
}
)
if payer_id is not UNSET:
field_dict["payer_id"] = payer_id
if payer_type is not UNSET:
field_dict["payer_type"] = payer_type
if delay is not UNSET:
field_dict["delay"] = delay
return field_dict
@classmethod
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
d = src_dict.copy()
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
d = dict(src_dict)
uuid = UUID(d.pop("uuid"))
payer_id = d.pop("payer_id")
payer_type = d.pop("payer_type")
payee_id = UUID(d.pop("payee_id"))
payee_type = UUID(d.pop("payee_type"))
def _parse_created_at(data: object) -> Union[None, datetime.datetime]:
if data is None:
return data
try:
if not isinstance(data, str):
raise TypeError()
created_at_type_0 = isoparse(data)
return created_at_type_0
except: # noqa: E722
pass
return cast(Union[None, datetime.datetime], data)
created_at = _parse_created_at(d.pop("created_at"))
created_at = isoparse(d.pop("created_at"))
state = StateEnum(d.pop("state"))
amount = d.pop("amount")
def _parse_updated_at(data: object) -> Union[None, datetime.datetime]:
if data is None:
return data
try:
if not isinstance(data, str):
raise TypeError()
updated_at_type_0 = isoparse(data)
return updated_at_type_0
except: # noqa: E722
pass
return cast(Union[None, datetime.datetime], data)
updated_at = _parse_updated_at(d.pop("updated_at"))
updated_at = isoparse(d.pop("updated_at"))
details = d.pop("details")
role = d.pop("role")
def _parse_payer_id(data: object) -> Union[None, UUID, Unset]:
if data is None:
return data
if isinstance(data, Unset):
return data
try:
if not isinstance(data, str):
raise TypeError()
payer_id_type_0 = UUID(data)
return payer_id_type_0
except: # noqa: E722
pass
return cast(Union[None, UUID, Unset], data)
payer_id = _parse_payer_id(d.pop("payer_id", UNSET))
def _parse_payer_type(data: object) -> Union[None, PayerTypeEnum, Unset]:
if data is None:
return data
if isinstance(data, Unset):
return data
try:
if not isinstance(data, int):
raise TypeError()
payer_type_type_0 = PayerTypeEnum(data)
return payer_type_type_0
except: # noqa: E722
pass
return cast(Union[None, PayerTypeEnum, Unset], data)
payer_type = _parse_payer_type(d.pop("payer_type", UNSET))
delay = d.pop("delay", UNSET)
application_transaction = cls(
uuid=uuid,
payer_id=payer_id,
payer_type=payer_type,
payee_id=payee_id,
payee_type=payee_type,
created_at=created_at,
@ -213,8 +137,6 @@ class ApplicationTransaction:
updated_at=updated_at,
details=details,
role=role,
payer_id=payer_id,
payer_type=payer_type,
delay=delay,
)

View file

@ -1,13 +1,12 @@
import datetime
from typing import Any, TypeVar, Union, cast
from collections.abc import Mapping
from typing import Any, TypeVar, Union
from uuid import UUID
from attrs import define as _attrs_define
from attrs import field as _attrs_field
from dateutil.parser import isoparse
from ..models.payee_type_enum import PayeeTypeEnum
from ..models.payer_type_enum import PayerTypeEnum
from ..models.state_enum import StateEnum
from ..types import UNSET, Unset
@ -18,10 +17,11 @@ T = TypeVar("T", bound="ApplicationWithdraw")
class ApplicationWithdraw:
"""
Attributes:
uuid (UUID):
payee_id (UUID):
payee_type (Union[None, PayeeTypeEnum]):
created_at (Union[None, datetime.datetime]):
payer_id (UUID):
payer_type (int):
payee_id (str):
payee_type (str):
created_at (datetime.datetime):
state (StateEnum): * `1` - created
* `2` - delayed
* `3` - pending
@ -30,193 +30,106 @@ class ApplicationWithdraw:
* `6` - failed
* `7` - expected_failure
amount (int):
updated_at (Union[None, datetime.datetime]):
details (Any):
payer_id (Union[None, UUID, Unset]):
payer_type (Union[None, PayerTypeEnum, Unset]):
updated_at (datetime.datetime):
uuid (Union[Unset, UUID]):
details (Union[Unset, Any]):
"""
uuid: UUID
payee_id: UUID
payee_type: Union[None, PayeeTypeEnum]
created_at: Union[None, datetime.datetime]
payer_id: UUID
payer_type: int
payee_id: str
payee_type: str
created_at: datetime.datetime
state: StateEnum
amount: int
updated_at: Union[None, datetime.datetime]
details: Any
payer_id: Union[None, UUID, Unset] = UNSET
payer_type: Union[None, PayerTypeEnum, Unset] = UNSET
updated_at: datetime.datetime
uuid: Union[Unset, UUID] = UNSET
details: Union[Unset, Any] = UNSET
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> dict[str, Any]:
uuid = str(self.uuid)
payer_id = str(self.payer_id)
payee_id = str(self.payee_id)
payer_type = self.payer_type
payee_id = self.payee_id
payee_type: Union[None, int]
if isinstance(self.payee_type, PayeeTypeEnum):
payee_type = self.payee_type.value
else:
payee_type = self.payee_type
created_at: Union[None, str]
if isinstance(self.created_at, datetime.datetime):
created_at = self.created_at.isoformat()
else:
created_at = self.created_at
state = self.state.value
amount = self.amount
updated_at: Union[None, str]
if isinstance(self.updated_at, datetime.datetime):
updated_at = self.updated_at.isoformat()
else:
updated_at = self.updated_at
uuid: Union[Unset, str] = UNSET
if not isinstance(self.uuid, Unset):
uuid = str(self.uuid)
details = self.details
payer_id: Union[None, Unset, str]
if isinstance(self.payer_id, Unset):
payer_id = UNSET
elif isinstance(self.payer_id, UUID):
payer_id = str(self.payer_id)
else:
payer_id = self.payer_id
payer_type: Union[None, Unset, int]
if isinstance(self.payer_type, Unset):
payer_type = UNSET
elif isinstance(self.payer_type, PayerTypeEnum):
payer_type = self.payer_type.value
else:
payer_type = self.payer_type
field_dict: dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update(
{
"uuid": uuid,
"payer_id": payer_id,
"payer_type": payer_type,
"payee_id": payee_id,
"payee_type": payee_type,
"created_at": created_at,
"state": state,
"amount": amount,
"updated_at": updated_at,
"details": details,
}
)
if payer_id is not UNSET:
field_dict["payer_id"] = payer_id
if payer_type is not UNSET:
field_dict["payer_type"] = payer_type
if uuid is not UNSET:
field_dict["uuid"] = uuid
if details is not UNSET:
field_dict["details"] = details
return field_dict
@classmethod
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
d = src_dict.copy()
uuid = UUID(d.pop("uuid"))
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
d = dict(src_dict)
payer_id = UUID(d.pop("payer_id"))
payee_id = UUID(d.pop("payee_id"))
payer_type = d.pop("payer_type")
def _parse_payee_type(data: object) -> Union[None, PayeeTypeEnum]:
if data is None:
return data
try:
if not isinstance(data, int):
raise TypeError()
payee_type_type_0 = PayeeTypeEnum(data)
payee_id = d.pop("payee_id")
return payee_type_type_0
except: # noqa: E722
pass
return cast(Union[None, PayeeTypeEnum], data)
payee_type = d.pop("payee_type")
payee_type = _parse_payee_type(d.pop("payee_type"))
def _parse_created_at(data: object) -> Union[None, datetime.datetime]:
if data is None:
return data
try:
if not isinstance(data, str):
raise TypeError()
created_at_type_0 = isoparse(data)
return created_at_type_0
except: # noqa: E722
pass
return cast(Union[None, datetime.datetime], data)
created_at = _parse_created_at(d.pop("created_at"))
created_at = isoparse(d.pop("created_at"))
state = StateEnum(d.pop("state"))
amount = d.pop("amount")
def _parse_updated_at(data: object) -> Union[None, datetime.datetime]:
if data is None:
return data
try:
if not isinstance(data, str):
raise TypeError()
updated_at_type_0 = isoparse(data)
updated_at = isoparse(d.pop("updated_at"))
return updated_at_type_0
except: # noqa: E722
pass
return cast(Union[None, datetime.datetime], data)
_uuid = d.pop("uuid", UNSET)
uuid: Union[Unset, UUID]
if isinstance(_uuid, Unset):
uuid = UNSET
else:
uuid = UUID(_uuid)
updated_at = _parse_updated_at(d.pop("updated_at"))
details = d.pop("details")
def _parse_payer_id(data: object) -> Union[None, UUID, Unset]:
if data is None:
return data
if isinstance(data, Unset):
return data
try:
if not isinstance(data, str):
raise TypeError()
payer_id_type_0 = UUID(data)
return payer_id_type_0
except: # noqa: E722
pass
return cast(Union[None, UUID, Unset], data)
payer_id = _parse_payer_id(d.pop("payer_id", UNSET))
def _parse_payer_type(data: object) -> Union[None, PayerTypeEnum, Unset]:
if data is None:
return data
if isinstance(data, Unset):
return data
try:
if not isinstance(data, int):
raise TypeError()
payer_type_type_0 = PayerTypeEnum(data)
return payer_type_type_0
except: # noqa: E722
pass
return cast(Union[None, PayerTypeEnum, Unset], data)
payer_type = _parse_payer_type(d.pop("payer_type", UNSET))
details = d.pop("details", UNSET)
application_withdraw = cls(
uuid=uuid,
payer_id=payer_id,
payer_type=payer_type,
payee_id=payee_id,
payee_type=payee_type,
created_at=created_at,
state=state,
amount=amount,
updated_at=updated_at,
uuid=uuid,
details=details,
payer_id=payer_id,
payer_type=payer_type,
)
application_withdraw.additional_properties = d

View file

@ -0,0 +1,150 @@
import datetime
from collections.abc import Mapping
from typing import Any, TypeVar, Union, cast
from uuid import UUID
from attrs import define as _attrs_define
from attrs import field as _attrs_field
from dateutil.parser import isoparse
from ..models.state_enum import StateEnum
T = TypeVar("T", bound="Charge")
@_attrs_define
class Charge:
"""
Attributes:
uuid (UUID):
user (UUID):
created_at (Union[None, datetime.datetime]):
state (StateEnum): * `1` - created
* `2` - delayed
* `3` - pending
* `4` - incomplete
* `5` - success
* `6` - failed
* `7` - expected_failure
amount (Union[None, int]):
updated_at (Union[None, datetime.datetime]):
"""
uuid: UUID
user: UUID
created_at: Union[None, datetime.datetime]
state: StateEnum
amount: Union[None, int]
updated_at: Union[None, datetime.datetime]
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> dict[str, Any]:
uuid = str(self.uuid)
user = str(self.user)
created_at: Union[None, str]
if isinstance(self.created_at, datetime.datetime):
created_at = self.created_at.isoformat()
else:
created_at = self.created_at
state = self.state.value
amount: Union[None, int]
amount = self.amount
updated_at: Union[None, str]
if isinstance(self.updated_at, datetime.datetime):
updated_at = self.updated_at.isoformat()
else:
updated_at = self.updated_at
field_dict: dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update(
{
"uuid": uuid,
"user": user,
"created_at": created_at,
"state": state,
"amount": amount,
"updated_at": updated_at,
}
)
return field_dict
@classmethod
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
d = dict(src_dict)
uuid = UUID(d.pop("uuid"))
user = UUID(d.pop("user"))
def _parse_created_at(data: object) -> Union[None, datetime.datetime]:
if data is None:
return data
try:
if not isinstance(data, str):
raise TypeError()
created_at_type_0 = isoparse(data)
return created_at_type_0
except: # noqa: E722
pass
return cast(Union[None, datetime.datetime], data)
created_at = _parse_created_at(d.pop("created_at"))
state = StateEnum(d.pop("state"))
def _parse_amount(data: object) -> Union[None, int]:
if data is None:
return data
return cast(Union[None, int], data)
amount = _parse_amount(d.pop("amount"))
def _parse_updated_at(data: object) -> Union[None, datetime.datetime]:
if data is None:
return data
try:
if not isinstance(data, str):
raise TypeError()
updated_at_type_0 = isoparse(data)
return updated_at_type_0
except: # noqa: E722
pass
return cast(Union[None, datetime.datetime], data)
updated_at = _parse_updated_at(d.pop("updated_at"))
charge = cls(
uuid=uuid,
user=user,
created_at=created_at,
state=state,
amount=amount,
updated_at=updated_at,
)
charge.additional_properties = d
return charge
@property
def additional_keys(self) -> list[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View file

@ -1,3 +1,4 @@
from collections.abc import Mapping
from typing import Any, TypeVar, Union
from attrs import define as _attrs_define
@ -30,8 +31,8 @@ class MyWallet:
return field_dict
@classmethod
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
d = src_dict.copy()
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
d = dict(src_dict)
balance = d.pop("balance", UNSET)
my_wallet = cls(

View file

@ -1,3 +1,4 @@
from collections.abc import Mapping
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
from attrs import define as _attrs_define
@ -18,8 +19,8 @@ class PaginatedApplicationTransactionList:
Attributes:
count (int): Example: 123.
results (list['ApplicationTransaction']):
next_ (Union[None, Unset, str]): Example: http://api.example.org/accounts/?page=4.
previous (Union[None, Unset, str]): Example: http://api.example.org/accounts/?page=2.
next_ (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=400&limit=100.
previous (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=200&limit=100.
"""
count: int
@ -64,10 +65,10 @@ class PaginatedApplicationTransactionList:
return field_dict
@classmethod
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
from ..models.application_transaction import ApplicationTransaction
d = src_dict.copy()
d = dict(src_dict)
count = d.pop("count")
results = []

View file

@ -1,3 +1,4 @@
from collections.abc import Mapping
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
from attrs import define as _attrs_define
@ -18,8 +19,8 @@ class PaginatedUserTransactionList:
Attributes:
count (int): Example: 123.
results (list['UserTransaction']):
next_ (Union[None, Unset, str]): Example: http://api.example.org/accounts/?page=4.
previous (Union[None, Unset, str]): Example: http://api.example.org/accounts/?page=2.
next_ (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=400&limit=100.
previous (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=200&limit=100.
"""
count: int
@ -64,10 +65,10 @@ class PaginatedUserTransactionList:
return field_dict
@classmethod
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
from ..models.user_transaction import UserTransaction
d = src_dict.copy()
d = dict(src_dict)
count = d.pop("count")
results = []

View file

@ -1,9 +0,0 @@
from enum import IntEnum
class PayeeTypeEnum(IntEnum):
VALUE_1 = 1
VALUE_2 = 2
def __str__(self) -> str:
return str(self.value)

View file

@ -1,9 +0,0 @@
from enum import IntEnum
class PayerTypeEnum(IntEnum):
VALUE_1 = 1
VALUE_2 = 2
def __str__(self) -> str:
return str(self.value)

View file

@ -1,12 +1,12 @@
import datetime
from typing import Any, TypeVar, Union, cast
from collections.abc import Mapping
from typing import Any, TypeVar, Union
from uuid import UUID
from attrs import define as _attrs_define
from attrs import field as _attrs_field
from dateutil.parser import isoparse
from ..models.payer_type_enum import PayerTypeEnum
from ..models.state_enum import StateEnum
from ..types import UNSET, Unset
@ -18,9 +18,11 @@ class UserTransaction:
"""
Attributes:
uuid (UUID):
payer_id (str):
payer_type (str):
payee_id (UUID):
payee_type (UUID):
created_at (Union[None, datetime.datetime]):
created_at (datetime.datetime):
state (StateEnum): * `1` - created
* `2` - delayed
* `3` - pending
@ -29,71 +31,49 @@ class UserTransaction:
* `6` - failed
* `7` - expected_failure
amount (int):
updated_at (Union[None, datetime.datetime]):
updated_at (datetime.datetime):
details (Any):
role (int):
payer_id (Union[None, UUID, Unset]):
payer_type (Union[None, PayerTypeEnum, Unset]):
delay (Union[Unset, int]):
"""
uuid: UUID
payer_id: str
payer_type: str
payee_id: UUID
payee_type: UUID
created_at: Union[None, datetime.datetime]
created_at: datetime.datetime
state: StateEnum
amount: int
updated_at: Union[None, datetime.datetime]
updated_at: datetime.datetime
details: Any
role: int
payer_id: Union[None, UUID, Unset] = UNSET
payer_type: Union[None, PayerTypeEnum, Unset] = UNSET
delay: Union[Unset, int] = UNSET
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> dict[str, Any]:
uuid = str(self.uuid)
payer_id = self.payer_id
payer_type = self.payer_type
payee_id = str(self.payee_id)
payee_type = str(self.payee_type)
created_at: Union[None, str]
if isinstance(self.created_at, datetime.datetime):
created_at = self.created_at.isoformat()
else:
created_at = self.created_at
state = self.state.value
amount = self.amount
updated_at: Union[None, str]
if isinstance(self.updated_at, datetime.datetime):
updated_at = self.updated_at.isoformat()
else:
updated_at = self.updated_at
details = self.details
role = self.role
payer_id: Union[None, Unset, str]
if isinstance(self.payer_id, Unset):
payer_id = UNSET
elif isinstance(self.payer_id, UUID):
payer_id = str(self.payer_id)
else:
payer_id = self.payer_id
payer_type: Union[None, Unset, int]
if isinstance(self.payer_type, Unset):
payer_type = UNSET
elif isinstance(self.payer_type, PayerTypeEnum):
payer_type = self.payer_type.value
else:
payer_type = self.payer_type
delay = self.delay
field_dict: dict[str, Any] = {}
@ -101,6 +81,8 @@ class UserTransaction:
field_dict.update(
{
"uuid": uuid,
"payer_id": payer_id,
"payer_type": payer_type,
"payee_id": payee_id,
"payee_type": payee_type,
"created_at": created_at,
@ -111,100 +93,42 @@ class UserTransaction:
"role": role,
}
)
if payer_id is not UNSET:
field_dict["payer_id"] = payer_id
if payer_type is not UNSET:
field_dict["payer_type"] = payer_type
if delay is not UNSET:
field_dict["delay"] = delay
return field_dict
@classmethod
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
d = src_dict.copy()
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
d = dict(src_dict)
uuid = UUID(d.pop("uuid"))
payer_id = d.pop("payer_id")
payer_type = d.pop("payer_type")
payee_id = UUID(d.pop("payee_id"))
payee_type = UUID(d.pop("payee_type"))
def _parse_created_at(data: object) -> Union[None, datetime.datetime]:
if data is None:
return data
try:
if not isinstance(data, str):
raise TypeError()
created_at_type_0 = isoparse(data)
return created_at_type_0
except: # noqa: E722
pass
return cast(Union[None, datetime.datetime], data)
created_at = _parse_created_at(d.pop("created_at"))
created_at = isoparse(d.pop("created_at"))
state = StateEnum(d.pop("state"))
amount = d.pop("amount")
def _parse_updated_at(data: object) -> Union[None, datetime.datetime]:
if data is None:
return data
try:
if not isinstance(data, str):
raise TypeError()
updated_at_type_0 = isoparse(data)
return updated_at_type_0
except: # noqa: E722
pass
return cast(Union[None, datetime.datetime], data)
updated_at = _parse_updated_at(d.pop("updated_at"))
updated_at = isoparse(d.pop("updated_at"))
details = d.pop("details")
role = d.pop("role")
def _parse_payer_id(data: object) -> Union[None, UUID, Unset]:
if data is None:
return data
if isinstance(data, Unset):
return data
try:
if not isinstance(data, str):
raise TypeError()
payer_id_type_0 = UUID(data)
return payer_id_type_0
except: # noqa: E722
pass
return cast(Union[None, UUID, Unset], data)
payer_id = _parse_payer_id(d.pop("payer_id", UNSET))
def _parse_payer_type(data: object) -> Union[None, PayerTypeEnum, Unset]:
if data is None:
return data
if isinstance(data, Unset):
return data
try:
if not isinstance(data, int):
raise TypeError()
payer_type_type_0 = PayerTypeEnum(data)
return payer_type_type_0
except: # noqa: E722
pass
return cast(Union[None, PayerTypeEnum, Unset], data)
payer_type = _parse_payer_type(d.pop("payer_type", UNSET))
delay = d.pop("delay", UNSET)
user_transaction = cls(
uuid=uuid,
payer_id=payer_id,
payer_type=payer_type,
payee_id=payee_id,
payee_type=payee_type,
created_at=created_at,
@ -213,8 +137,6 @@ class UserTransaction:
updated_at=updated_at,
details=details,
role=role,
payer_id=payer_id,
payer_type=payer_type,
delay=delay,
)

View file

@ -1,8 +1,8 @@
"""Contains some shared types for properties"""
from collections.abc import MutableMapping
from collections.abc import Mapping, MutableMapping
from http import HTTPStatus
from typing import BinaryIO, Generic, Literal, Optional, TypeVar
from typing import IO, BinaryIO, Generic, Literal, Optional, TypeVar, Union
from attrs import define
@ -14,7 +14,15 @@ class Unset:
UNSET: Unset = Unset()
FileJsonType = tuple[Optional[str], BinaryIO, Optional[str]]
# The types that `httpx.Client(files=)` can accept, copied from that library.
FileContent = Union[IO[bytes], bytes, str]
FileTypes = Union[
# (filename, file (or bytes), content_type)
tuple[Optional[str], FileContent, Optional[str]],
# (filename, file (or bytes), content_type, headers)
tuple[Optional[str], FileContent, Optional[str], Mapping[str, str]],
]
RequestFiles = list[tuple[str, FileTypes]]
@define
@ -25,7 +33,7 @@ class File:
file_name: Optional[str] = None
mime_type: Optional[str] = None
def to_tuple(self) -> FileJsonType:
def to_tuple(self) -> FileTypes:
"""Return a tuple representation that httpx will accept for multipart/form-data"""
return self.file_name, self.payload, self.mime_type
@ -43,4 +51,4 @@ class Response(Generic[T]):
parsed: Optional[T]
__all__ = ["UNSET", "File", "FileJsonType", "Response", "Unset"]
__all__ = ["UNSET", "File", "FileTypes", "RequestFiles", "Response", "Unset"]

View file

@ -255,4 +255,5 @@ CACHES = {
PNA_CORPORATION_PIN = config('PNA_CORPORATION_PIN')
WALLET_BASE_PUBLIC_URL = config('WALLET_BASE_PUBLIC_URL')
WALLET_CATEGORY_UUID = config('WALLET_CATEGORY_UUID')
IPG_BASE_PUBLIC_URL = config('IPG_BASE_PUBLIC_URL')

View file

@ -8,8 +8,8 @@ from httpx import Request
from gooyal_wallet_client import AuthenticatedClient
from gooyal_wallet_client.models import MyWallet, UserTransaction, ApplicationDeposit, ApplicationWithdraw
from gooyal_wallet_client.api.wallet import (wallet_api_application_deposit_create,
wallet_api_application_deposit_verify_retrieve,
from gooyal_wallet_client.api.wallet import (wallet_api_application_deposit_create_2,
wallet_api_application_deposit_verify_retrieve_2,
wallet_api_application_withdraw_create,
wallet_api_application_withdraw_verify_retrieve)
from gooyal_wallet_client.types import Response
@ -73,22 +73,24 @@ def get_client():
return client
def deposit_to_user_wallet_submit(data):
def deposit_to_user_wallet_submit(category_uuid, data):
class Tmp():
def to_dict(self):
return data
deposit_data = Tmp()
client = get_client()
response: ApplicationDeposit = wallet_api_application_deposit_create.sync(client=client, body=deposit_data)
response: ApplicationDeposit = wallet_api_application_deposit_create_2.sync(category_uuid= category_uuid,
client=client,
body=deposit_data)
print(response)
return response
def deposit_to_user_wallet_verify(uuid):
def deposit_to_user_wallet_verify(category_uuid, uuid):
client = get_client()
response: ApplicationDeposit = wallet_api_application_deposit_verify_retrieve.sync(uuid=uuid, client=client)
response: ApplicationDeposit = wallet_api_application_deposit_verify_retrieve_2.sync(category_uuid=category_uuid, uuid=uuid, client=client)
print(response)
return response