Commit ad8e1b4f authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg

Remove and move code that is either not required or in the wrong place

parent 2995bf92
......@@ -233,12 +233,15 @@ def _create_payment_for_entry(entry: Entry) -> Payment:
amount = settings.MEMBERSHIP_PRICES[entry.length]
if entry.contribution and entry.membership_type == Membership.BENEFACTOR:
amount = entry.contribution
notes = f"Membership registration. {entry.get_membership_type_display()}."
notes = (
f"Membership registration created on {entry.created_at}. "
f"{entry.get_membership_type_display()}."
)
try:
renewal = entry.renewal
membership = renewal.member.latest_membership
notes = f"Membership renewal. {entry.get_membership_type_display()}."
notes = f"Membership renewal created on {entry.created_at}. {entry.get_membership_type_display()}."
# Having a latest membership which has an until date implies that this
# membership lasts/lasted till the end of the lecture year
# This means it's possible to renew the 'year' membership
......@@ -447,17 +450,11 @@ def process_tpay_payment(renewal):
:param renewal: the renewal
"""
if renewal.member.tpay_enabled:
if renewal.payment is None:
renewal.payment = _create_payment_for_entry(renewal)
renewal.save()
if renewal.payment.type == Payment.NONE:
renewal.payment.type = Payment.TPAY
renewal.payment.notes += f" Requested on {renewal.created_at}."
renewal.payment.processed_by = renewal.member
renewal.payment.save()
renewal.save()
process_payment(renewal.payment)
else:
raise ValueError(_("You have already paid."))
else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment