webhook corrected
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user