Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
fix: Added logs for ios refund exception
Browse files Browse the repository at this point in the history
  • Loading branch information
jawad-khan committed Oct 23, 2023
1 parent 5ee776c commit e849b4d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions ecommerce/extensions/iap/api/v1/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
ERROR_ALREADY_PURCHASED = "You have already purchased these products"
ERROR_BASKET_NOT_FOUND = "Basket [{}] not found."
ERROR_BASKET_ID_NOT_PROVIDED = "Basket id is not provided"
ERROR_DURING_IOS_REFUND_EXECUTION = "Could not execute IOS refund."
ERROR_DURING_ORDER_CREATION = "An error occurred during order creation."
ERROR_DURING_PAYMENT_HANDLING = "An error occurred during payment handling."
ERROR_ORDER_NOT_FOUND_FOR_REFUND = "Could not find any order to refund for [%s] by processor [%s]"
Expand Down
6 changes: 4 additions & 2 deletions ecommerce/extensions/iap/api/v1/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
COURSE_ALREADY_PAID_ON_DEVICE,
ERROR_ALREADY_PURCHASED,
ERROR_BASKET_ID_NOT_PROVIDED,
ERROR_DURING_IOS_REFUND_EXECUTION,
ERROR_BASKET_NOT_FOUND,
ERROR_DURING_ORDER_CREATION,
ERROR_DURING_PAYMENT_HANDLING,
Expand Down Expand Up @@ -359,8 +360,9 @@ def post(self, request):
logger.info(IGNORE_NON_REFUND_NOTIFICATION_FROM_APPLE)
return Response(status=status.HTTP_200_OK)

except Exception: # pylint: disable=broad-except
pass
except Exception as e: # pylint: disable=broad-except
logger.error(ERROR_DURING_IOS_REFUND_EXECUTION)
logger.error(e)

status_code = status.HTTP_200_OK if is_refunded else status.HTTP_500_INTERNAL_SERVER_ERROR
return Response(status=status_code)

0 comments on commit e849b4d

Please sign in to comment.