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

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Added logs for ios refund exception
Browse files Browse the repository at this point in the history
jawad-khan committed Oct 23, 2023
1 parent 5ee776c commit e46367a
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
@@ -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]"
6 changes: 4 additions & 2 deletions ecommerce/extensions/iap/api/v1/views.py
Original file line number Diff line number Diff line change
@@ -39,6 +39,7 @@
ERROR_ALREADY_PURCHASED,
ERROR_BASKET_ID_NOT_PROVIDED,
ERROR_BASKET_NOT_FOUND,
ERROR_DURING_IOS_REFUND_EXECUTION,
ERROR_DURING_ORDER_CREATION,
ERROR_DURING_PAYMENT_HANDLING,
ERROR_DURING_POST_ORDER_OP,
@@ -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)

Check warning on line 365 in ecommerce/extensions/iap/api/v1/views.py

Codecov / codecov/patch

ecommerce/extensions/iap/api/v1/views.py#L363-L365

Added lines #L363 - L365 were not covered by tests

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 e46367a

Please sign in to comment.