modified subscriptions webhook
This commit is contained in:
@@ -214,8 +214,8 @@ class PaymentProcessingService:
|
||||
return self.charge_data.get("customer", None)
|
||||
|
||||
def _get_transaction_by_id(self):
|
||||
print("self.webhook_data: ", self.webhook_data)
|
||||
print("self.charge_data: ", self.charge_data)
|
||||
# print("self.webhook_data: ", self.webhook_data)
|
||||
# print("self.charge_data: ", self.charge_data)
|
||||
print("self.metadata: ", self.charge_data["metadata"])
|
||||
# Extract transaction_id from webhook metadata
|
||||
transaction_id = self.charge_data["metadata"]["transaction_id"]
|
||||
@@ -273,7 +273,7 @@ class PaymentProcessingService:
|
||||
self._update_reward(
|
||||
referral_record=referral_record,
|
||||
active_subscription=active_subscription,
|
||||
create_subscription_method=self._create_principal_subscription(),
|
||||
create_subscription_method=self._update_principal_subscription(),
|
||||
has_active_subscription=True,
|
||||
)
|
||||
else:
|
||||
@@ -281,7 +281,7 @@ class PaymentProcessingService:
|
||||
self._update_reward(
|
||||
referral_record=referral_record,
|
||||
active_subscription=None,
|
||||
create_subscription_method=self._create_principal_subscription,
|
||||
create_subscription_method=self._update_principal_subscription,
|
||||
has_active_subscription=False,
|
||||
)
|
||||
|
||||
@@ -306,6 +306,7 @@ class PaymentProcessingService:
|
||||
|
||||
def _update_principal_subscription(self):
|
||||
# Fetch the subscription object once and use it
|
||||
print("Inside _update_principal_subscription")
|
||||
principal_subscription = self._get_principal_subscription_by_id()
|
||||
|
||||
# Update IS_PAID PrincipalSubscription instance
|
||||
@@ -331,7 +332,7 @@ class PaymentProcessingService:
|
||||
)
|
||||
|
||||
# Create a new subscription for the referred principal
|
||||
referred_subscription_id = self._create_principal_subscription()
|
||||
referred_subscription_id = self._update_principal_subscription()
|
||||
|
||||
# Create or update the ReferralTracking record
|
||||
ReferralTracking.objects.create(
|
||||
|
||||
Reference in New Issue
Block a user