Subversion Repositories SmartDukaan

Rev

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

Rev 14623 Rev 15007
Line 108... Line 108...
108
 
108
 
109
 
109
 
110
logging.basicConfig(level=logging.DEBUG)
110
logging.basicConfig(level=logging.DEBUG)
111
 
111
 
112
sourceId = int(ConfigClient().get_property("sourceid"))
112
sourceId = int(ConfigClient().get_property("sourceid"))
-
 
113
SaholicHelpEmailId = "Saholic <help@saholic.com>"
113
mail_user = 'cnc.center@shop2020.in'
114
mail_user = 'cnc.center@shop2020.in'
114
mail_password = '5h0p2o2o'
115
mail_password = '5h0p2o2o'
115
help_user = 'help@shop2020.in'
116
help_user = 'help@shop2020.in'
116
help_password = '5h0p2o2o'
117
help_password = '5h0p2o2o'
117
source_url = 'www.saholic.com'
118
source_url = 'www.saholic.com'
Line 612... Line 613...
612
                    content += "<h2>Note 1: If this discount price is approved then reply 'Approved' otherwise 'Not Approved' without changing anythig in the Mail.</h2>"  
613
                    content += "<h2>Note 1: If this discount price is approved then reply 'Approved' otherwise 'Not Approved' without changing anythig in the Mail.</h2>"  
613
                    content += "<h2>Note 2: For Quick approval using browser <a href='http://support.shop2020.in:8080/Support/price-approval?xszbg=" + base64.b64encode(str(order.id))  + "'>Click Here</a></h2>"
614
                    content += "<h2>Note 2: For Quick approval using browser <a href='http://support.shop2020.in:8080/Support/price-approval?xszbg=" + base64.b64encode(str(order.id))  + "'>Click Here</a></h2>"
614
                    content += "<br><br></body></html>"
615
                    content += "<br><br></body></html>"
615
                    store = get_hotspot_store(order.storeId, "")
616
                    store = get_hotspot_store(order.storeId, "")
616
                    helper_client = HelperClient().get_client()
617
                    helper_client = HelperClient().get_client()
617
                    helper_client.saveUserEmailForSending(store.approvalEmail.split(';'), "", "Price approval requested for " + str(order.lineitems[0]) + " order Id " + str(order.id) + " in store " + store.hotspotId , content, str(transaction_id), "PriceApproval", [], [], 1)
618
                    helper_client.saveUserEmailForSending(store.approvalEmail.split(';'), SaholicHelpEmailId, "Price approval requested for " + str(order.lineitems[0]) + " order Id " + str(order.id) + " in store " + store.hotspotId , content, str(transaction_id), "PriceApproval", [], [], 1)
618
                    session.commit()
619
                    session.commit()
619
            else:
620
            else:
620
                order.otg = False
621
                order.otg = False
621
                session.commit()
622
                session.commit()
622
        except Exception as e:
623
        except Exception as e:
Line 938... Line 939...
938
    email_header = Template(html_header).substitute(dict(order_date = formated_order_date, customer_name = customer_name, source_url = source_url, otgLink = otgLink, saddress = saddress))
939
    email_header = Template(html_header).substitute(dict(order_date = formated_order_date, customer_name = customer_name, source_url = source_url, otgLink = otgLink, saddress = saddress))
939
    email_footer = Template(html_footer).substitute(dict(total_amount = "%.2f" % total_amount, emi_amount = "%.2f" % emi_amount, advance_amount = "%.2f" % advance_amount, net_amount = "%.2f" % (total_amount-order.gvAmount), secret_code = random_text, store_address = store_address, store_delivery_date = store_delivery_date, source_url = source_url, source_name = source_name, amount_string = amount_string))
940
    email_footer = Template(html_footer).substitute(dict(total_amount = "%.2f" % total_amount, emi_amount = "%.2f" % emi_amount, advance_amount = "%.2f" % advance_amount, net_amount = "%.2f" % (total_amount-order.gvAmount), secret_code = random_text, store_address = store_address, store_delivery_date = store_delivery_date, source_url = source_url, source_name = source_name, amount_string = amount_string))
940
 
941
 
941
    try:
942
    try:
942
        helper_client = HelperClient().get_client()
943
        helper_client = HelperClient().get_client()
943
        helper_client.saveUserEmailForSending([user_email], "", subject, email_header + html_table + email_footer, str(transaction_id), "TransactionInfo", [], bcc, orders[0].source)
944
        helper_client.saveUserEmailForSending([user_email], SaholicHelpEmailId, subject, email_header + html_table + email_footer, str(transaction_id), "TransactionInfo", [], bcc, orders[0].source)
944
        
945
        
945
        if sendSms:
946
        if sendSms:
946
            send_transaction_sms(customerId, mobileNo, smsText, SmsType.TRANSACTIONAL, False)
947
            send_transaction_sms(customerId, mobileNo, smsText, SmsType.TRANSACTIONAL, False)
947
        
948
        
948
        return True
949
        return True
Line 1102... Line 1103...
1102
    email_header = Template(html_header).substitute(dict(order_date = formated_order_date, customer_name = customer_name, order_expiry_date = formated_order_expiry_date, source_url = source_url, source_name = source_name))
1103
    email_header = Template(html_header).substitute(dict(order_date = formated_order_date, customer_name = customer_name, order_expiry_date = formated_order_expiry_date, source_url = source_url, source_name = source_name))
1103
    email_footer = Template(html_footer).substitute(dict(total_amount = "%.2f" % total_amount, net_amount = "%.2f" % (total_amount-order.netAmount), secret_code = random_text, store_address = store_address, order_expiry_date = formated_order_expiry_date, source_url = source_url, source_name = source_name))
1104
    email_footer = Template(html_footer).substitute(dict(total_amount = "%.2f" % total_amount, net_amount = "%.2f" % (total_amount-order.netAmount), secret_code = random_text, store_address = store_address, order_expiry_date = formated_order_expiry_date, source_url = source_url, source_name = source_name))
1104
    
1105
    
1105
    try:
1106
    try:
1106
        helper_client = HelperClient(host_key = "helper_service_server_host_prod").get_client()
1107
        helper_client = HelperClient(host_key = "helper_service_server_host_prod").get_client()
1107
        helper_client.saveUserEmailForSending([user_email], "", subject, email_header + html_table + email_footer, str(order.id), "ReceivedAtStore", [], [], order.source)
1108
        helper_client.saveUserEmailForSending([user_email], SaholicHelpEmailId, subject, email_header + html_table + email_footer, str(order.id), "ReceivedAtStore", [], [], order.source)
1108
        return True
1109
        return True
1109
    except Exception as e:
1110
    except Exception as e:
1110
        print e
1111
        print e
1111
        return False
1112
        return False
1112
 
1113
 
Line 1316... Line 1317...
1316
    
1317
    
1317
    email_html = Template(complete_html).substitute(dict(master_order_id = logisticsTxnId, order_date = formated_order_date, customer_name = customer_name, pickup_text = pickup_text, source_url = source_url, source_name = source_name, freebie_text = freebie_text, insurance_text = insuranceText))
1318
    email_html = Template(complete_html).substitute(dict(master_order_id = logisticsTxnId, order_date = formated_order_date, customer_name = customer_name, pickup_text = pickup_text, source_url = source_url, source_name = source_name, freebie_text = freebie_text, insurance_text = insuranceText))
1318
    
1319
    
1319
    try:
1320
    try:
1320
        helper_client = HelperClient(host_key = "helper_service_server_host_prod").get_client()
1321
        helper_client = HelperClient(host_key = "helper_service_server_host_prod").get_client()
1321
        helper_client.saveUserEmailForSending([user_email], "", subject, email_html, logisticsTxnId, "DeliverySuccess", [], [], order.source)
1322
        helper_client.saveUserEmailForSending([user_email], SaholicHelpEmailId, subject, email_html, logisticsTxnId, "DeliverySuccess", [], [], order.source)
1322
        
1323
        
1323
        if order.source == OrderSource.WEBSITE:
1324
        if order.source == OrderSource.WEBSITE:
1324
            send_transaction_sms(order.customer_id, order.customer_mobilenumber, "Dear Customer, Your order: " + logisticsTxnId + " has been delivered now. For any queries please call 0120-2479977." , SmsType.TRANSACTIONAL, True)
1325
            send_transaction_sms(order.customer_id, order.customer_mobilenumber, "Dear Customer, Your order: " + logisticsTxnId + " has been delivered now. For any queries please call 0120-2479977." , SmsType.TRANSACTIONAL, True)
1325
        
1326
        
1326
        return True
1327
        return True
Line 4856... Line 4857...
4856
    # Calling helper service on production
4857
    # Calling helper service on production
4857
    order = orderList[0]
4858
    order = orderList[0]
4858
    helperClient = HelperClient(host_key = "helper_service_server_host_prod").get_client()
4859
    helperClient = HelperClient(host_key = "helper_service_server_host_prod").get_client()
4859
    emailSubject = 'Shipping Details for Master Order ID: ' + logisticsTxnId
4860
    emailSubject = 'Shipping Details for Master Order ID: ' + logisticsTxnId
4860
    emailBody = get_shipping_confirmation_email_body(logisticsTxnId, orderList)
4861
    emailBody = get_shipping_confirmation_email_body(logisticsTxnId, orderList)
4861
    helperClient.saveUserEmailForSending([order.customer_email], None, emailSubject, emailBody, logisticsTxnId, 'ShippingConfirmation', [], [], order.source)
4862
    helperClient.saveUserEmailForSending([order.customer_email], SaholicHelpEmailId, emailSubject, emailBody, logisticsTxnId, 'ShippingConfirmation', [], [], order.source)
4862
    
4863
    
4863
    logistics_providers = {1: {'name': 'BlueDart', 'phone': '011-66111234'}, 6: {'name': 'RedExpress', 'phone': '8373915813'}, 3: {'name': 'Delhivery', 'phone' : '0124- 4212200'}, 7: {'name': 'FedEx', 'phone' : '0120-4354176'}}
4864
    logistics_providers = {1: {'name': 'BlueDart', 'phone': '011-66111234'}, 6: {'name': 'RedExpress', 'phone': '8373915813'}, 3: {'name': 'Delhivery', 'phone' : '0124- 4212200'}, 7: {'name': 'FedEx', 'phone' : '0120-4354176'}}
4864
    provider_name = logistics_providers[order.logistics_provider_id]['name']
4865
    provider_name = logistics_providers[order.logistics_provider_id]['name']
4865
    if order.source == OrderSource.WEBSITE :
4866
    if order.source == OrderSource.WEBSITE :
4866
        send_transaction_sms(order.customer_id, order.customer_mobilenumber, "Dear Customer, We have shipped your order: " + logisticsTxnId + " through "+provider_name + " AWB No. " + order.airwaybill_no, SmsType.TRANSACTIONAL, True)    
4867
        send_transaction_sms(order.customer_id, order.customer_mobilenumber, "Dear Customer, We have shipped your order: " + logisticsTxnId + " through "+provider_name + " AWB No. " + order.airwaybill_no, SmsType.TRANSACTIONAL, True)    
Line 5514... Line 5515...
5514
        
5515
        
5515
    if recharge_order.status == RechargeOrderStatus.RECHARGE_UNKNOWN:
5516
    if recharge_order.status == RechargeOrderStatus.RECHARGE_UNKNOWN:
5516
        return True
5517
        return True
5517
    try:
5518
    try:
5518
        helper_client = HelperClient().get_client()
5519
        helper_client = HelperClient().get_client()
5519
        helper_client.saveUserEmailForSending([email], "", source_name + " - Recharge Order Details", email_header + email_footer, str(recharge_order.id), "RechargeInfo", [], [], 1)
5520
        helper_client.saveUserEmailForSending([email], SaholicHelpEmailId, source_name + " - Recharge Order Details", email_header + email_footer, str(recharge_order.id), "RechargeInfo", [], [], 1)
5520
        return True
5521
        return True
5521
    except Exception as e:
5522
    except Exception as e:
5522
        print e
5523
        print e
5523
        return False
5524
        return False
5524
 
5525
 
Line 7596... Line 7597...
7596
                    content += "<h2>Note 1: If this discount price is approved then reply 'Approved' otherwise 'Not Approved' without changing anythig in the Mail.</h2>"  
7597
                    content += "<h2>Note 1: If this discount price is approved then reply 'Approved' otherwise 'Not Approved' without changing anythig in the Mail.</h2>"  
7597
                    content += "<h2>Note 2: For Quick approval using browser <a href='http://support.shop2020.in:8080/Support/price-approval?xszbg=" + base64.b64encode(str(order.id))  + "'>Click Here</a></h2>"
7598
                    content += "<h2>Note 2: For Quick approval using browser <a href='http://support.shop2020.in:8080/Support/price-approval?xszbg=" + base64.b64encode(str(order.id))  + "'>Click Here</a></h2>"
7598
                    content += "<br><br></body></html>"
7599
                    content += "<br><br></body></html>"
7599
                    store = get_hotspot_store(order.storeId, "")
7600
                    store = get_hotspot_store(order.storeId, "")
7600
                    helper_client = HelperClient().get_client()
7601
                    helper_client = HelperClient().get_client()
7601
                    helper_client.saveUserEmailForSending(store.approvalEmail.split(';'), "", "Price approval requested for " + str(order.lineitems[0]) + " order Id " + str(order.id) + " in store " + store.hotspotId , content, str(transaction_id), "PriceApproval", [], [], order.source)
7602
                    helper_client.saveUserEmailForSending(store.approvalEmail.split(';'), SaholicHelpEmailId, "Price approval requested for " + str(order.lineitems[0]) + " order Id " + str(order.id) + " in store " + store.hotspotId , content, str(transaction_id), "PriceApproval", [], [], order.source)
7602
                    session.commit()
7603
                    session.commit()
7603
            else:
7604
            else:
7604
                order.otg = False
7605
                order.otg = False
7605
                session.commit()
7606
                session.commit()
7606
        except Exception as e:
7607
        except Exception as e: