From 78cd216c0fd25e74957dae11bbd41cf2b7312d76 Mon Sep 17 00:00:00 2001 From: rizwanisready Date: Fri, 8 Mar 2024 12:36:41 +0530 Subject: [PATCH] webhook corrected --- goodtimes/services.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/goodtimes/services.py b/goodtimes/services.py index cfaf6fa..324c762 100644 --- a/goodtimes/services.py +++ b/goodtimes/services.py @@ -202,7 +202,7 @@ class PaymentProcessingService: self.charge_data = webhook_data["data"]["object"] self.customer_id = self._get_customer_id() self.transaction = self._get_transaction_by_id() - self.principal_id = self.transaction.principal_id + self.principal_id = self.transaction.principal.id def _get_customer_id(self): # Access the customer ID from the charge object @@ -219,7 +219,7 @@ class PaymentProcessingService: def _get_subscription_by_id(self): # Extract transaction_id from webhook metadata - subscription = int(self.charge_data["metadata"]["subscription"]) + subscription = int(self.charge_data["metadata"]["subscription_id"]) # Fetch the Transaction instance using the transaction_id return Subscription.objects.get(id=subscription)