Subversion Repositories SmartDukaan

Rev

Rev 5863 | Rev 5868 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5863 Rev 5866
Line 476... Line 476...
476
    email_header = Template(html_header).substitute(dict(order_date = formated_order_date, customer_name = customer_name))
476
    email_header = Template(html_header).substitute(dict(order_date = formated_order_date, customer_name = customer_name))
477
    email_footer = Template(html_footer).substitute(dict(total_amount = "%.2f" % total_amount, secret_code = random_text, store_address = store_address, store_delivery_date = store_delivery_date))
477
    email_footer = Template(html_footer).substitute(dict(total_amount = "%.2f" % total_amount, secret_code = random_text, store_address = store_address, store_delivery_date = store_delivery_date))
478
    
478
    
479
    try:
479
    try:
480
        helper_client = HelperClient().get_client()
480
        helper_client = HelperClient().get_client()
481
        helper_client.saveUserEmailForSending(user_email, "", "Saholic - Order Details", email_header + html_table + email_footer, str(transaction_id), "TransactionInfo")
-
 
482
        ##FIXME Remove once tesing is done
481
        ##FIXME Remove once tesing is done
483
        if orders[0].pickupStoreId:
482
        if orders[0].pickupStoreId:
-
 
483
            helper_client.saveUserEmailForSending([user_email], "", "Saholic - Order Details", email_header + html_table + email_footer, str(transaction_id), "TransactionInfo", [], ["abhishek.mathur@shop2020.in"])
-
 
484
        else:
484
            helper_client.saveUserEmailForSending("abhishek.mathur@shop2020.in", "", "Saholic - Order Details", email_header + html_table + email_footer, str(transaction_id), "TransactionInfo") 
485
            helper_client.saveUserEmailForSending([user_email], "", "Saholic - Order Details", email_header + html_table + email_footer, str(transaction_id), "TransactionInfo", [], [])
-
 
486
         
485
        return True
487
        return True
486
    except Exception as e:
488
    except Exception as e:
487
        print e
489
        print e
488
        return False
490
        return False
489
 
491
 
Line 593... Line 595...
593
    email_header = Template(html_header).substitute(dict(order_date = formated_order_date, customer_name = customer_name, order_expiry_date = formated_order_expiry_date))
595
    email_header = Template(html_header).substitute(dict(order_date = formated_order_date, customer_name = customer_name, order_expiry_date = formated_order_expiry_date))
594
    email_footer = Template(html_footer).substitute(dict(total_amount = "%.2f" % total_amount, secret_code = random_text, store_address = store_address, order_expiry_date = formated_order_expiry_date))
596
    email_footer = Template(html_footer).substitute(dict(total_amount = "%.2f" % total_amount, secret_code = random_text, store_address = store_address, order_expiry_date = formated_order_expiry_date))
595
    
597
    
596
    try:
598
    try:
597
        helper_client = HelperClient(host_key = "helper_service_server_host_prod").get_client()
599
        helper_client = HelperClient(host_key = "helper_service_server_host_prod").get_client()
598
        helper_client.saveUserEmailForSending(user_email, "", subject, email_header + html_table + email_footer, str(order.id), "ReceivedAtStore")
-
 
599
        ##FIXME Remove once tesing is done
600
        ##FIXME Remove once tesing is done
600
        if order.pickupStoreId:
601
        if order.pickupStoreId:
-
 
602
            helper_client.saveUserEmailForSending([user_email], "", subject, email_header + html_table + email_footer, str(order.id), "ReceivedAtStore", [], ["abhishek.mathur@shop2020.in"])
-
 
603
        else:
601
            helper_client.saveUserEmailForSending("abhishek.mathur@shop2020.in", "", subject, email_header + html_table + email_footer, str(order.id), "ReceivedAtStore")
604
            helper_client.saveUserEmailForSending([user_email], "", subject, email_header + html_table + email_footer, str(order.id), "ReceivedAtStore", [], [])
602
        return True
605
        return True
603
    except Exception as e:
606
    except Exception as e:
604
        print e
607
        print e
605
        return False
608
        return False
606
 
609
 
Line 689... Line 692...
689
    email_header = Template(html_header).substitute(dict(order_date = formated_order_date, customer_name = customer_name, pickup_text = pickup_text))
692
    email_header = Template(html_header).substitute(dict(order_date = formated_order_date, customer_name = customer_name, pickup_text = pickup_text))
690
    email_footer = Template(html_footer).substitute(dict(total_amount = "%.2f" % total_amount))
693
    email_footer = Template(html_footer).substitute(dict(total_amount = "%.2f" % total_amount))
691
    
694
    
692
    try:
695
    try:
693
        helper_client = HelperClient(host_key = "helper_service_server_host_prod").get_client()
696
        helper_client = HelperClient(host_key = "helper_service_server_host_prod").get_client()
694
        helper_client.saveUserEmailForSending(user_email, "", subject, email_header + html_table + email_footer, str(order.id), "DeliverySuccess")
-
 
695
        ##FIXME Remove once tesing is done
697
        ##FIXME Remove once tesing is done
696
        if order.pickupStoreId:
698
        if order.pickupStoreId:
-
 
699
            helper_client.saveUserEmailForSending([user_email], "", subject, email_header + html_table + email_footer, str(order.id), "DeliverySuccess", [], ["abhishek.mathur@shop2020.in"])
-
 
700
        else:
697
            helper_client.saveUserEmailForSending("abhishek.mathur@shop2020.in", "", subject, email_header + html_table + email_footer, str(order.id), "DeliverySuccess")
701
            helper_client.saveUserEmailForSending([user_email], "", subject, email_header + html_table + email_footer, str(order.id), "DeliverySuccess", [], [])
698
        return True
702
        return True
699
    except Exception as e:
703
    except Exception as e:
700
        print e
704
        print e
701
        return False
705
        return False
702
 
706
 
Line 3207... Line 3211...
3207
    # Calling helper service on production
3211
    # Calling helper service on production
3208
    helperClient = HelperClient(host_key = "helper_service_server_host_prod").get_client()
3212
    helperClient = HelperClient(host_key = "helper_service_server_host_prod").get_client()
3209
    try:
3213
    try:
3210
        emailSubject = 'Shipping Details for Order ID: ' + str(order.id)
3214
        emailSubject = 'Shipping Details for Order ID: ' + str(order.id)
3211
        emailBody = get_shipping_confirmation_email_body(order)
3215
        emailBody = get_shipping_confirmation_email_body(order)
3212
        helperClient.saveUserEmailForSending(order.customer_email, None, emailSubject, emailBody, str(order.id), 'ShippingConfirmation')
3216
        helperClient.saveUserEmailForSending([order.customer_email], None, emailSubject, emailBody, str(order.id), 'ShippingConfirmation', [], [])
3213
    except Exception as e:
3217
    except Exception as e:
3214
        print e
3218
        print e
3215
    
3219
    
3216
def get_order_distribution_by_status(start_date, end_date):
3220
def get_order_distribution_by_status(start_date, end_date):
3217
    query = session.query(Order.status, func.count(Order.id)).group_by(Order.status)
3221
    query = session.query(Order.status, func.count(Order.id)).group_by(Order.status)