daily pastebin goal
66%
SHARE
TWEET

Untitled

a guest Dec 16th, 2018 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def handle_order_status_change(self, order, new_status, note_msg=None):
  2.         # First we need to update each order line statuses before continuing on the order
  3.         for line in order.lines.all():
  4.             self.handle_line_status_change(order, line, new_status)
  5.  
  6.         commtype = None
  7.  
  8.         if new_status == 'Shipping': # send an email to the customer that says your item is one its way.
  9.             commtype = "ORDER_SHIPPING"
  10.         elif new_status == 'Delivered':
  11.             if order.lines.filter(product__product_class__is_digital=True).exists():
  12.                 commtype = "ORDER_DELIVERED_DIGITAL"
  13.             else:
  14.                 commtype = "ORDER_DELIVERED"
  15.         elif new_status == 'Cancelled':
  16.             commtype = "ORDER_CANCELLED"
  17.         elif new_status == 'Refund requested':
  18.             commtype = "ORDER_REFUND_REQUESTED"
  19.         elif new_status == 'Refunded':
  20.             commtype = "ORDER_REFUNDED"
  21.      
  22.         super().handle_order_status_change(order, new_status, note_msg) #updating of order happens here.
  23.  
  24.         if commtype:
  25.             self.send_confirmation_message(order, commtype)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top