* fix: Donation fixes - differentiate between subscription payment and payment - issue with donation amount * fix: existing membership validation * fix: ignore subscription payments while capturing donations
This commit is contained in:
parent
65165fcc80
commit
00cce433a5
@ -91,6 +91,10 @@ def capture_razorpay_donations(*args, **kwargs):
|
||||
if not data.event == 'payment.captured':
|
||||
return
|
||||
|
||||
# to avoid capturing subscription payments as donations
|
||||
if payment.description and 'subscription' in str(payment.description).lower():
|
||||
return
|
||||
|
||||
donor = get_donor(payment.email)
|
||||
if not donor:
|
||||
donor = create_donor(payment)
|
||||
@ -119,7 +123,7 @@ def create_donation(donor, payment):
|
||||
'donor_name': donor.donor_name,
|
||||
'email': donor.email,
|
||||
'date': getdate(),
|
||||
'amount': flt(payment.amount),
|
||||
'amount': flt(payment.amount) / 100, # Convert to rupees from paise
|
||||
'mode_of_payment': payment.method,
|
||||
'razorpay_payment_id': payment.id
|
||||
}).insert(ignore_mandatory=True)
|
||||
|
@ -48,7 +48,7 @@ class Membership(Document):
|
||||
last_membership = erpnext.get_last_membership(self.member)
|
||||
|
||||
# if person applied for offline membership
|
||||
if last_membership and not frappe.session.user == "Administrator":
|
||||
if last_membership and last_membership != self.name and not frappe.session.user == "Administrator":
|
||||
# if last membership does not expire in 30 days, then do not allow to renew
|
||||
if getdate(add_days(last_membership.to_date, -30)) > getdate(nowdate()) :
|
||||
frappe.throw(_("You can only renew if your membership expires within 30 days"))
|
||||
@ -287,7 +287,7 @@ def trigger_razorpay_subscription(*args, **kwargs):
|
||||
membership.generate_invoice(with_payment_entry=settings.automate_membership_payment_entries, save=True)
|
||||
|
||||
except Exception as e:
|
||||
message = "{0}\n\n{1}\n\n{2}: {3}".format(e, frappe.get_traceback(), __("Payment ID"), payment.id)
|
||||
message = "{0}\n\n{1}\n\n{2}: {3}".format(e, frappe.get_traceback(), _("Payment ID"), payment.id)
|
||||
log = frappe.log_error(message, _("Error creating membership entry for {0}").format(member.name))
|
||||
notify_failure(log)
|
||||
return { "status": "Failed", "reason": e}
|
||||
|
@ -29,7 +29,10 @@ class TaxExemption80GCertificate(Document):
|
||||
|
||||
def validate_duplicates(self):
|
||||
if self.recipient == 'Donor':
|
||||
certificate = frappe.db.exists(self.doctype, {'donation': self.donation})
|
||||
certificate = frappe.db.exists(self.doctype, {
|
||||
'donation': self.donation,
|
||||
'name': ('!=', self.name)
|
||||
})
|
||||
if certificate:
|
||||
frappe.throw(_('An 80G Certificate {0} already exists for the donation {1}').format(
|
||||
get_link_to_form(self.doctype, certificate), frappe.bold(self.donation)
|
||||
|
Loading…
Reference in New Issue
Block a user