refactored webhook realted to coupon 3

This commit is contained in:
rizwanisready
2024-08-05 19:19:20 +05:30
parent 3ac7e0d522
commit fccd7378f7
2 changed files with 43 additions and 41 deletions

View File

@@ -219,18 +219,8 @@ class StripeWebhookTest(APIView):
current_period_start=current_period_start,
current_period_end=current_period_end,
)
transaction = payment_service.create_transaction()
try:
payment_service.process_event(transaction)
transaction.transaction_status = TransactionStatus.SUCCESS
except Exception as e:
transaction.transaction_status = TransactionStatus.FAIL
transaction.error_message = str(e)
logger.error(f"Transaction Error: {str(e)}")
raise e
finally:
transaction.save()
payment_service.process_event()
webhook_event.status = "processed"
webhook_event.processed_at = timezone.now()
webhook_event.save()