fix(pg): new wallet client to handle category uuid
new wallet client to handle category uuid notice: add WALLET_RIAL_CATEGORY to .env
This commit is contained in:
parent
a54a10cd0e
commit
1084ed0b5c
3 changed files with 10 additions and 14 deletions
|
|
@ -14,7 +14,7 @@ from apps.core.models import BaseModel, BasePGModel
|
||||||
from apps.pg.constans import StateChoices
|
from apps.pg.constans import StateChoices
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from utils.wallet_client import deposit_to_user_wallet_submit, withdraw_from_user_wallet_verify, \
|
from utils.wallet_client import deposit_to_user_wallet_submit, \
|
||||||
deposit_to_user_wallet_verify
|
deposit_to_user_wallet_verify
|
||||||
|
|
||||||
from utils.pna import PNAClient
|
from utils.pna import PNAClient
|
||||||
|
|
@ -129,7 +129,7 @@ class PaymentRequest(models.Model):
|
||||||
'application_details_url': ''
|
'application_details_url': ''
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
submit_response = deposit_to_user_wallet_submit(settings.WALLET_CATEGORY_UUID, data)
|
submit_response = deposit_to_user_wallet_submit(settings.WALLET_RIAL_CATEGORY, data)
|
||||||
|
|
||||||
if not submit_response or 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}")
|
logger.error(f"[Deposit Submit] Wallet submission failed | payment_id={self.pk}")
|
||||||
|
|
@ -147,7 +147,7 @@ class PaymentRequest(models.Model):
|
||||||
return to_success
|
return to_success
|
||||||
|
|
||||||
def deposit_verify(self):
|
def deposit_verify(self):
|
||||||
verify_response = deposit_to_user_wallet_verify(settings.WALLET_CATEGORY_UUID, self.uuid)
|
verify_response = deposit_to_user_wallet_verify(settings.WALLET_RIAL_CATEGORY, self.uuid)
|
||||||
|
|
||||||
if not verify_response:
|
if not verify_response:
|
||||||
logger.error(f"[Deposit Verify] Failed to get response from wallet service | payment_id={self.pk}")
|
logger.error(f"[Deposit Verify] Failed to get response from wallet service | payment_id={self.pk}")
|
||||||
|
|
|
||||||
|
|
@ -255,5 +255,5 @@ CACHES = {
|
||||||
|
|
||||||
PNA_CORPORATION_PIN = config('PNA_CORPORATION_PIN')
|
PNA_CORPORATION_PIN = config('PNA_CORPORATION_PIN')
|
||||||
WALLET_BASE_PUBLIC_URL = config('WALLET_BASE_PUBLIC_URL')
|
WALLET_BASE_PUBLIC_URL = config('WALLET_BASE_PUBLIC_URL')
|
||||||
WALLET_CATEGORY_UUID = config('WALLET_CATEGORY_UUID')
|
WALLET_RIAL_CATEGORY = config('WALLET_RIAL_CATEGORY')
|
||||||
IPG_BASE_PUBLIC_URL = config('IPG_BASE_PUBLIC_URL')
|
IPG_BASE_PUBLIC_URL = config('IPG_BASE_PUBLIC_URL')
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ from gooyal_wallet_client import AuthenticatedClient
|
||||||
from gooyal_wallet_client.models import MyWallet, UserTransaction, ApplicationDeposit, ApplicationWithdraw
|
from gooyal_wallet_client.models import MyWallet, UserTransaction, ApplicationDeposit, ApplicationWithdraw
|
||||||
from gooyal_wallet_client.api.wallet import (wallet_api_application_deposit_create_2,
|
from gooyal_wallet_client.api.wallet import (wallet_api_application_deposit_create_2,
|
||||||
wallet_api_application_deposit_verify_retrieve_2,
|
wallet_api_application_deposit_verify_retrieve_2,
|
||||||
wallet_api_application_withdraw_create,
|
wallet_api_application_withdraw_create_2,
|
||||||
wallet_api_application_withdraw_verify_retrieve)
|
wallet_api_application_withdraw_verify_retrieve_2)
|
||||||
from gooyal_wallet_client.types import Response
|
from gooyal_wallet_client.types import Response
|
||||||
|
|
||||||
from django.conf import Settings
|
from django.conf import Settings
|
||||||
|
|
@ -84,7 +84,6 @@ def deposit_to_user_wallet_submit(category_uuid, data):
|
||||||
client=client,
|
client=client,
|
||||||
body=deposit_data)
|
body=deposit_data)
|
||||||
print(response)
|
print(response)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -92,28 +91,25 @@ def deposit_to_user_wallet_verify(category_uuid, uuid):
|
||||||
client = get_client()
|
client = get_client()
|
||||||
response: ApplicationDeposit = wallet_api_application_deposit_verify_retrieve_2.sync(category_uuid=category_uuid, uuid=uuid, client=client)
|
response: ApplicationDeposit = wallet_api_application_deposit_verify_retrieve_2.sync(category_uuid=category_uuid, uuid=uuid, client=client)
|
||||||
print(response)
|
print(response)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
def withdraw_from_user_wallet_submit(data):
|
def withdraw_from_user_wallet_submit(category_uuid, data):
|
||||||
class Tmp():
|
class Tmp():
|
||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
return data
|
return data
|
||||||
|
|
||||||
withdraw_data = Tmp()
|
withdraw_data = Tmp()
|
||||||
client = get_client()
|
client = get_client()
|
||||||
response: ApplicationWithdraw = wallet_api_application_withdraw_create.sync(client=client, body=withdraw_data)
|
response: ApplicationWithdraw = wallet_api_application_withdraw_create_2.sync(category_uuid=category_uuid, client=client, body=withdraw_data)
|
||||||
print(response)
|
print(response)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
def withdraw_from_user_wallet_verify(uuid):
|
def withdraw_from_user_wallet_verify(category_uuid, uuid):
|
||||||
client = get_client()
|
client = get_client()
|
||||||
response: ApplicationWithdraw = wallet_api_application_withdraw_verify_retrieve.sync(uuid=uuid, client=client)
|
response: ApplicationWithdraw = wallet_api_application_withdraw_verify_retrieve_2.sync(category_uuid=category_uuid, uuid=uuid, client=client)
|
||||||
print(response)
|
print(response)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue