fix: don't capture payments with invoice_id as donations

- if donations and subscriptions are set up in the same dashboard, membership payments also trigger payment webhook

- in order to differentiate there is already a check for RP's auto generated description but if subscriptions are configured using subscription links, RP doesn't send descriptions

- use invoice_id to ignore such payments instead
This commit is contained in:
Rucha Mahabal
2022-05-24 18:16:56 +05:30
parent 34928d29f1
commit 168a9d417b

View File

@@ -100,7 +100,9 @@ def capture_razorpay_donations(*args, **kwargs):
return
# to avoid capturing subscription payments as donations
if payment.description and "subscription" in str(payment.description).lower():
if payment.invoice_id or (
payment.description and "subscription" in str(payment.description).lower()
):
return
donor = get_donor(payment.email)