mirror of
https://github.com/i701/sarlink-portal-api.git
synced 2025-07-07 12:16:30 +00:00
fix(views-verifypayment): improve error handling in payment verification process 🐛
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 5m23s
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 5m23s
This commit is contained in:
@ -220,15 +220,18 @@ class VerifyPaymentView(StaffEditorPermissionMixin, generics.UpdateAPIView):
|
|||||||
raise ValueError(
|
raise ValueError(
|
||||||
"PAYMENT_BASE_URL is not set. Please set it in your environment variables."
|
"PAYMENT_BASE_URL is not set. Please set it in your environment variables."
|
||||||
)
|
)
|
||||||
logger.info(data)
|
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
f"{PAYMENT_BASE_URL}/verify-payment",
|
f"{PAYMENT_BASE_URL}/verify-payment",
|
||||||
json=data,
|
json=data,
|
||||||
headers={"Content-Type": "application/json"},
|
headers={"Content-Type": "application/json"},
|
||||||
)
|
)
|
||||||
|
try:
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
|
except requests.exceptions.HTTPError as e:
|
||||||
|
logger.error(f"HTTPError: {e}")
|
||||||
|
return False
|
||||||
mib_resp = response.json()
|
mib_resp = response.json()
|
||||||
print(mib_resp)
|
logger.info("MIB Verification Response ->", mib_resp)
|
||||||
if not response.json().get("success"):
|
if not response.json().get("success"):
|
||||||
return mib_resp["success"]
|
return mib_resp["success"]
|
||||||
else:
|
else:
|
||||||
|
Reference in New Issue
Block a user