Fix refunding of additional options invoices
authorMagnus Hagander <magnus@hagander.net>
Fri, 7 Sep 2018 17:04:54 +0000 (10:04 -0700)
committerMagnus Hagander <magnus@hagander.net>
Fri, 7 Sep 2018 17:05:52 +0000 (10:05 -0700)
When there is no way to automatically remove something because of a
refund, don't block the refund completely. Instead allow it to go
through and leave it up to the operator to manually verify.

postgresqleu/confreg/invoicehandler.py
postgresqleu/confsponsor/invoicehandler.py
postgresqleu/invoices/util.py
postgresqleu/membership/invoicehandler.py

index d2877310dc3dba0638e60d5a3810ec227cb22b9f..428e40332b1f68771c88660b49b6937161e07d64 100644 (file)
@@ -223,6 +223,7 @@ class BulkInvoiceProcessor(object):
 
 
 class AddonInvoiceProcessor(object):
+       can_refund=False
        # Process invoices for additional options added to an existing
        # registration.
        #
@@ -259,9 +260,6 @@ class AddonInvoiceProcessor(object):
                # here.
                order.delete()
 
-       def process_invoice_refund(self, invoice):
-               raise Exception("Don't know how to process refunds for this!")
-
        # Return the user to their dashboard
        def get_return_url(self, invoice):
                try:
index 7b8cde8e0a28b70295e6e7d0962144354ebacfd6..98cc0222582f643b26ddf5baf175dba569e5dbff 100644 (file)
@@ -99,6 +99,7 @@ class InvoiceProcessor(object):
                                                         msgtxt,
                                                         sendername=sponsor.conference.conferencename)
 
+
        # Return the user to the sponsor page if they have paid.
        def get_return_url(self, invoice):
                try:
index 2fa56999b0f481d71f3990afa5a699361dd1fa4f..5cc5e05dbdc6eddb414ffa891bcc6355d31654e6 100644 (file)
@@ -463,9 +463,9 @@ class InvoiceManager(object):
 
                # If this invoice has a processor, we need to start by calling it
                processor = self.get_invoice_processor(invoice)
-               if processor:
+               if processor and getattr(processor, 'can_refund', True):
                        try:
-                               processor.process_invoice_refund(invoice)
+                               r = processor.process_invoice_refund(invoice)
                        except Exception, ex:
                                raise Exception("Failed to run invoice processor '%s': %s" % (invoice.processor, ex))
 
index be8da09dd3c26f6c700676574c6b0b10b82a4665..64e8426a933a8271413fbff54eb3d0f2230e2d0d 100644 (file)
@@ -5,6 +5,7 @@ from models import Member, MemberLog
 from datetime import datetime, timedelta, date
 
 class InvoiceProcessor(object):
+       can_refund=False
        # Process invoices once they're getting paid
        #
        # In the case of membership, that simply means extending the
@@ -52,10 +53,6 @@ class InvoiceProcessor(object):
                member.activeinvoice = None
                member.save()
 
-       # We don't implement this yet
-       def process_invoice_refund(self, invoice):
-               raise Exception("Unable to refund membership invoices at this time")
-
        # Return the user to a page showing what happened as a result
        # of their payment. In our case, we just return the user directly
        # to the membership page.