webhook separate file 6

This commit is contained in:
rizwanisready
2024-05-05 00:17:10 +05:30
parent 59d70ed0a0
commit e70f371d44

View File

@@ -182,14 +182,13 @@ class SubscriptionService:
class PaymentProcessingService:
def __init__(self, webhook_data):
self.webhook_service = WebhookService(webhook_data)
self.subscription_service = SubscriptionService()
# self.notification_service = NotificationService()
# Retrieve objects
self.principal = self.webhook_service.get_principal()
self.transaction = self.webhook_service.get_transaction()
self.subscription = self.webhook_service.get_subscription()
self.order_id = self.webhook_service.get_order_id()
self.subscription_service = SubscriptionService()
self.principal_subscription = None
def process_event(self):
@@ -206,19 +205,19 @@ class PaymentProcessingService:
self.principal, self.subscription, self.order_id
)
)
print("First Part Done....!!!!!")
# Update transaction status to success
self.subscription_service.update_transaction_success(
self.transaction, self.principal_subscription
)
print("Second Part Done....!!!!!")
# Now handle referral rewards, if applicable
if self.principal_subscription:
referral_service = ReferralRewardService(
self.principal, self.principal_subscription, self.subscription
)
referral_service.credit_referral_reward_if_applicable()
print("Third Part Done....!!!!!")
# self.notification_service.payment_success_notification(
# self.principal, self.subscription, self.transaction.amount
# )