Notifications Testing 2
This commit is contained in:
@@ -40,10 +40,13 @@ class NotificationService:
|
||||
response = self.client.send_notification(notification_payload)
|
||||
return response
|
||||
|
||||
def payment_success_notification(self, principal, subscription, amount):
|
||||
def payment_success_notification(
|
||||
self, principal, subscription, principal_subscription, amount
|
||||
):
|
||||
print("payment_success_notification: ", principal.player_id)
|
||||
title = "Payment Successful"
|
||||
message = f"Your payment for {subscription} of ${amount} was successfully processed. Your subscription is valid till {subscription.end_date}"
|
||||
end_date = principal_subscription.end_date
|
||||
message = f"Your payment for {subscription} of ${amount} was successfully processed. Your subscription is valid till {end_date}"
|
||||
self.send_notification(title, message, principal.player_id)
|
||||
|
||||
def referral_received_notification(self, principal, amount, email):
|
||||
@@ -79,9 +82,7 @@ class WebhookService:
|
||||
def get_transaction(self):
|
||||
transaction_id = self.charge_data["metadata"]["transaction_id"]
|
||||
try:
|
||||
return Transaction.objects.get(
|
||||
id=int(transaction_id)
|
||||
)
|
||||
return Transaction.objects.get(id=int(transaction_id))
|
||||
except (ObjectDoesNotExist, ValueError):
|
||||
logger.error(f"Invalid transaction ID: {transaction_id}")
|
||||
raise ValueError(f"Invalid transaction ID: {transaction_id}")
|
||||
@@ -256,7 +257,7 @@ class PaymentProcessingService:
|
||||
referral_service.credit_referral_reward_if_applicable()
|
||||
print("Third Part Done....!!!!!")
|
||||
self.notification_service.payment_success_notification(
|
||||
self.principal, self.subscription, self.transaction.amount
|
||||
self.principal, self.subscription, self.principal_subscription, self.transaction.amount
|
||||
)
|
||||
|
||||
def handle_failure(self):
|
||||
|
||||
Reference in New Issue
Block a user