Source

cciw-website / cciw / bookings / hooks.py

Diff from to

File cciw/bookings/hooks.py

 
 from .signals import places_confirmed
 from .email import send_unrecognised_payment_email, send_places_confirmed_email
-from .models import BookingAccount, ChequePayment, send_payment
+from .models import BookingAccount, ChequePayment, RefundPayment, send_payment
 
 #### Handlers #####
 
     send_payment(-instance.amount, instance.account, instance)
 
 
+def refund_payment_sent(sender, **kwargs):
+    instance = kwargs['instance']
+    send_payment(-instance.amount, instance.account, instance)
+
+
+def refund_payment_deleted(sender, **kwargs):
+    instance = kwargs['instance']
+    send_payment(instance.amount, instance.account, instance)
+
+
 ### Place confirmation ###
 
 def places_confirmed_handler(sender, **kwargs):
 places_confirmed.connect(places_confirmed_handler)
 post_save.connect(cheque_payment_received, sender=ChequePayment)
 post_delete.connect(cheque_payment_deleted, sender=ChequePayment)
+post_save.connect(refund_payment_sent, sender=RefundPayment)
+post_delete.connect(refund_payment_deleted, sender=RefundPayment)