コード例 #1
0
ファイル: order_events.py プロジェクト: TheAnou/Cobra
def communicateOrderCreated(order):
  try: #message each artisan that their product has sold and for how much
    artisan_msg = "%d \r\n %d Dh" % (order.product.id, order.product.price)
    for artisan in order.product.assets.filter(ilk='artisan'):
      sendSMSForOrder(artisan_msg, artisan.phone, order)
  except Exception as e:
    ExceptionHandler(e, "in order_events.communicateOrdersCreated-A")

  #message the seller with the address
  address_string = order.checkout.cart.shipping_address.replace('\n','\n\r')
  seller_msg = "%d \r\n %s" % (order.product.id, address_string)
  seller_phone = order.seller.phone
  sendSMSForOrder(seller_msg, seller_phone, order)

  #notify the team
  try:
    order.seller_msg = seller_msg.replace('\n', '<br>')
    emails = [person.email for person in operations_team]
    for address in emails:
      Email('order/created_copy_director', order).sendTo(address)
  except Exception as e:
    ExceptionHandler(e, "in order_events.communicateOrdersCreated-B")
コード例 #2
0
ファイル: order_events.py プロジェクト: TheAnou/Cobra
def communicateOrderConfirmed(order, gimme_reply_sms=False):
  try:
    if DEBUG: sms_reply = '(shukran) order confirmed'
    else: sms_reply = 'shukran'

    #send email to buyer
    email = Email('order/confirmed', order)
    email.assignToOrder(order)
    email.sendTo(order.checkout.cart.email_with_name)

    if gimme_reply_sms:
      return sms_reply

    else:
      seller_phone = order.seller.phone
      sendSMSForOrder(sms_reply, seller_phone, order)

  except Exception as e:
    if DEBUG: return '(xata) ' + str(e)
    else:
      return 'xata'
      ExceptionHandler(e, "in order_events.communicateOrderConfimed")