refactor: do nothing if member is not found
diff --git a/erpnext/non_profit/doctype/membership/membership.py b/erpnext/non_profit/doctype/membership/membership.py
index c4f4318..7a0caed 100644
--- a/erpnext/non_profit/doctype/membership/membership.py
+++ b/erpnext/non_profit/doctype/membership/membership.py
@@ -62,7 +62,10 @@
'subscription_id': subscription_id,
'email_id': email
}, order_by="creation desc")
- return frappe.get_doc("Member", members[0]['name'])
+ try:
+ return frappe.get_doc("Member", members[0]['name'])
+ except:
+ return None
def verify_signature(data):
signature = frappe.request.headers.get('X-Razorpay-Signature')
@@ -96,7 +99,10 @@
except Exception as e:
error_log = frappe.log_error(frappe.get_traceback() + '\n' + data_json , _("Membership Webhook Failed"))
notify_failure(error_log)
- raise e
+ return False
+
+ if not member:
+ return False
if data.event == "subscription.activated":
member.customer_id = payment.customer_id