Subversion Repositories SmartDukaan

Rev

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

Rev 6316 Rev 6318
Line 141... Line 141...
141
        order.customer_email = t_order.customer_email
141
        order.customer_email = t_order.customer_email
142
    #new status and status description to be added    
142
    #new status and status description to be added    
143
    order.status = t_order.status  
143
    order.status = t_order.status  
144
    order.statusDescription = t_order.statusDescription
144
    order.statusDescription = t_order.statusDescription
145
    order.total_amount = t_order.total_amount
145
    order.total_amount = t_order.total_amount
-
 
146
    order.gvAmount = t_order.gvAmount
146
    order.total_weight = t_order.total_weight
147
    order.total_weight = t_order.total_weight
147
    if t_order.created_timestamp:
148
    if t_order.created_timestamp:
148
        order.created_timestamp = to_py_date(t_order.created_timestamp)
149
        order.created_timestamp = to_py_date(t_order.created_timestamp)
149
    else:
150
    else:
150
        order.created_timestamp = datetime.datetime.now()
151
        order.created_timestamp = datetime.datetime.now()
Line 479... Line 480...
479
        <br><i>$store_address</i><br>
480
        <br><i>$store_address</i><br>
480
        """
481
        """
481
 
482
 
482
        if orders[0].cod:
483
        if orders[0].cod:
483
            html_pickup_text = html_pickup_text + """
484
            html_pickup_text = html_pickup_text + """
484
            2) Pay Rs. $total_amount, present a valid Photo Identity Proof* and use your Secret Code <b><i>$secret_code</i></b> to claim your Product(s).<br><br>
485
            2) Pay Rs. $net_amount, present a valid Photo Identity Proof* and use your Secret Code <b><i>$secret_code</i></b> to claim your Product(s).<br><br>
485
            *Valid Photo Identity Proof are Driving License, Passport, PAN Card, Voter ID, Company Issued ID Card, College issued Student ID Card Or any other Government approved Photo Id.<br>
486
            *Valid Photo Identity Proof are Driving License, Passport, PAN Card, Voter ID, Company Issued ID Card, College issued Student ID Card Or any other Government approved Photo Id.<br>
486
            <br>
487
            <br>
487
            In case you have any questions please visit <a href="$source_url/static/buy-online-and-pickup-in-store">Details on Pickup in Store</a>. If you still have more questions feel free to contact us 24/7 via <a href="$source_url/contact-us">$source_url/contact-us</a>
488
            In case you have any questions please visit <a href="$source_url/static/buy-online-and-pickup-in-store">Details on Pickup in Store</a>. If you still have more questions feel free to contact us 24/7 via <a href="$source_url/contact-us">$source_url/contact-us</a>
488
            </br><hr />
489
            </br><hr />
489
            """
490
            """
Line 511... Line 512...
511
 
512
 
512
    sdt = datetime.datetime.strptime(str(orders[0].expected_delivery_time), "%Y-%m-%d %H:%M:%S")
513
    sdt = datetime.datetime.strptime(str(orders[0].expected_delivery_time), "%Y-%m-%d %H:%M:%S")
513
    store_delivery_date = sdt.strftime("%A, %d %B %Y")
514
    store_delivery_date = sdt.strftime("%A, %d %B %Y")
514
 
515
 
515
    email_header = Template(html_header).substitute(dict(order_date = formated_order_date, customer_name = customer_name, source_url = source_url))
516
    email_header = Template(html_header).substitute(dict(order_date = formated_order_date, customer_name = customer_name, source_url = source_url))
516
    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, source_url = source_url, source_name = source_name))
517
    email_footer = Template(html_footer).substitute(dict(total_amount = "%.2f" % total_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))
517
    
518
    
518
    try:
519
    try:
519
        helper_client = HelperClient().get_client()
520
        helper_client = HelperClient().get_client()
520
        helper_client.saveUserEmailForSending([user_email], "", source_name + " - Order Details", email_header + html_table + email_footer, str(transaction_id), "TransactionInfo", [], [])
521
        helper_client.saveUserEmailForSending([user_email], "", source_name + " - Order Details", email_header + html_table + email_footer, str(transaction_id), "TransactionInfo", [], [])
521
         
522
         
Line 592... Line 593...
592
        <br><i>$store_address</i><br>
593
        <br><i>$store_address</i><br>
593
        """
594
        """
594
 
595
 
595
        if order.cod:
596
        if order.cod:
596
            html_pickup_text = html_pickup_text + """
597
            html_pickup_text = html_pickup_text + """
597
            2) Pay Rs. $total_amount, present a valid Photo Identity Proof* and quote your Secret Code <b><i>$secret_code</i></b> to claim your Product.<br><br>
598
            2) Pay Rs. $net_amount, present a valid Photo Identity Proof* and quote your Secret Code <b><i>$secret_code</i></b> to claim your Product.<br><br>
598
            *Valid Photo Identity Proof are Driving License, Passport, PAN Card, Voter ID, Company Issued ID Card, College issued Student ID Card Or any other Government approved Photo Id.<br>
599
            *Valid Photo Identity Proof are Driving License, Passport, PAN Card, Voter ID, Company Issued ID Card, College issued Student ID Card Or any other Government approved Photo Id.<br>
599
            <br>
600
            <br>
600
            In case you have any questions please visit <a href="$source_url/static/buy-online-and-pickup-in-store">Details on Pickup in Store</a>. If you still have more questions feel free to contact us 24/7 via <a href="$source_url/contact-us">$source_url/contact-us</a>
601
            In case you have any questions please visit <a href="$source_url/static/buy-online-and-pickup-in-store">Details on Pickup in Store</a>. If you still have more questions feel free to contact us 24/7 via <a href="$source_url/contact-us">$source_url/contact-us</a>
601
            </br><hr />
602
            </br><hr />
602
            """
603
            """
Line 626... Line 627...
626
    oetd = datetime.datetime.now() + datetime.timedelta(days=4)
627
    oetd = datetime.datetime.now() + datetime.timedelta(days=4)
627
    formated_order_expiry_date = oetd.strftime("%A, %d %B %Y")
628
    formated_order_expiry_date = oetd.strftime("%A, %d %B %Y")
628
    
629
    
629
 
630
 
630
    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))
631
    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))
631
    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, source_url = source_url, source_name = source_name))
632
    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))
632
    
633
    
633
    try:
634
    try:
634
        helper_client = HelperClient(host_key = "helper_service_server_host_prod").get_client()
635
        helper_client = HelperClient(host_key = "helper_service_server_host_prod").get_client()
635
        helper_client.saveUserEmailForSending([user_email], "", subject, email_header + html_table + email_footer, str(order.id), "ReceivedAtStore", [], [])
636
        helper_client.saveUserEmailForSending([user_email], "", subject, email_header + html_table + email_footer, str(order.id), "ReceivedAtStore", [], [])
636
        return True
637
        return True
Line 1218... Line 1219...
1218
    
1219
    
1219
    payMode = 'Prepaid'
1220
    payMode = 'Prepaid'
1220
    note = ''
1221
    note = ''
1221
    if order.cod:
1222
    if order.cod:
1222
        payMode = 'COD'
1223
        payMode = 'COD'
1223
        note = 'Note: Please collect Rs. ' + str(order.total_amount) + ' from customer'
1224
        note = 'Note: Please collect Rs. ' + str(order.total_amount-order.gvAmount) + ' from customer'
1224
 
1225
 
1225
    message = dedent(raw_message) % { 'order_id' : str(order.id),
1226
    message = dedent(raw_message) % { 'order_id' : str(order.id),
1226
                                     'store_id' : str(store.hotspotId),
1227
                                     'store_id' : str(store.hotspotId),
1227
                                  'provider' : provider.name,
1228
                                  'provider' : provider.name,
1228
                                  'product' : str(order.lineitems[0]),
1229
                                  'product' : str(order.lineitems[0]),
Line 2274... Line 2275...
2274
    new_order.customer_pincode = order.customer_pincode
2275
    new_order.customer_pincode = order.customer_pincode
2275
    new_order.customer_address1 = order.customer_address1
2276
    new_order.customer_address1 = order.customer_address1
2276
    new_order.customer_address2 = order.customer_address2
2277
    new_order.customer_address2 = order.customer_address2
2277
    new_order.customer_email = order.customer_email
2278
    new_order.customer_email = order.customer_email
2278
    new_order.total_amount = order.total_amount
2279
    new_order.total_amount = order.total_amount
-
 
2280
    new_order.gvAmount = order.gvAmount
2279
    new_order.total_weight = order.total_weight
2281
    new_order.total_weight = order.total_weight
2280
    new_order.status = OrderStatus.SUBMITTED_FOR_PROCESSING
2282
    new_order.status = OrderStatus.SUBMITTED_FOR_PROCESSING
2281
    new_order.statusDescription = 'Submitted for Processing'
2283
    new_order.statusDescription = 'Submitted for Processing'
2282
    new_order.created_timestamp = current_time
2284
    new_order.created_timestamp = current_time
2283
    new_order.originalOrderId = order.originalOrderId if order.originalOrderId is not None else order.id 
2285
    new_order.originalOrderId = order.originalOrderId if order.originalOrderId is not None else order.id 
Line 2417... Line 2419...
2417
        store_string = "<store>" + store.hotspotId + "</store>"
2419
        store_string = "<store>" + store.hotspotId + "</store>"
2418
        order_string = "<orderno>" + str(order.id) + "</orderno>"
2420
        order_string = "<orderno>" + str(order.id) + "</orderno>"
2419
        collection_type = "<Type>" + type + "</Type>"
2421
        collection_type = "<Type>" + type + "</Type>"
2420
        payment_mode = get_order_attribute_value(order.id, "PAYMENT_MODE")
2422
        payment_mode = get_order_attribute_value(order.id, "PAYMENT_MODE")
2421
        if type == "SALE":
2423
        if type == "SALE":
2422
            amount = int(order.total_amount)
2424
            amount = int(order.total_amount-order.gvAmount)
2423
            ts = order.delivery_timestamp
2425
            ts = order.delivery_timestamp
2424
        if type == "SALE RETURN":
2426
        if type == "SALE RETURN":
2425
            amount = -int(order.total_amount)
2427
            amount = -int(order.total_amount-order.gvAmount)
2426
            ts = order.refund_timestamp
2428
            ts = order.refund_timestamp
2427
        if payment_mode == "Cash":
2429
        if payment_mode == "Cash":
2428
            cash_string = "<cash>" + str(amount) + "</cash>"
2430
            cash_string = "<cash>" + str(amount) + "</cash>"
2429
            card_string = "<hdfc>0</hdfc>"
2431
            card_string = "<hdfc>0</hdfc>"
2430
        if payment_mode == "Card":
2432
        if payment_mode == "Card":
Line 2674... Line 2676...
2674
            #Order has not been delivered yet. No way we can receive the payment.
2676
            #Order has not been delivered yet. No way we can receive the payment.
2675
            unprocessed_awbs[awb] = "Payment has been received for order: " + str(order.id) + " before delivery reconciliation"
2677
            unprocessed_awbs[awb] = "Payment has been received for order: " + str(order.id) + " before delivery reconciliation"
2676
            continue
2678
            continue
2677
        
2679
        
2678
        ##As per ticket #743 if amount difference less than 0.5 we should reconcile
2680
        ##As per ticket #743 if amount difference less than 0.5 we should reconcile
2679
        if abs(amount - order.total_amount) > 0.5:
2681
        if abs(amount - (order.total_amount - order.gvAmount)) > 0.5:
2680
            #Received amount is less than or more than the order amount. Mustn't let the user proceed.
2682
            #Received amount is less than or more than the order amount. Mustn't let the user proceed.
2681
            unprocessed_awbs[awb] = "Payment of Rs. " + str(amount) + " has been received against the total value of Rs. " + str(order.total_amount) + " for order: " + str(order.id)
2683
            unprocessed_awbs[awb] = "Payment of Rs. " + str(amount) + " has been received against the total value of Rs. " + str(order.total_amount-order.gvAmount) + " for order: " + str(order.id)
2682
            continue
2684
            continue
2683
        
2685
        
2684
        try:
2686
        try:
2685
            payment_client = PaymentClient().get_client()
2687
            payment_client = PaymentClient().get_client()
2686
            payment_client.partiallyCapturePayment(order.transaction.id, amount, xferBy, xferTxnId, xferDate)
2688
            payment_client.partiallyCapturePayment(order.transaction.id, amount, xferBy, xferTxnId, xferDate)
Line 3431... Line 3433...
3431
            
3433
            
3432
 
3434
 
3433
def allocate_gift_voucher(recharge_order):            
3435
def allocate_gift_voucher(recharge_order):            
3434
    totalAmount = recharge_order.totalAmount
3436
    totalAmount = recharge_order.totalAmount
3435
    gvs = {}
3437
    gvs = {}
3436
    return gvs
-
 
3437
    if totalAmount > 100:
3438
    if totalAmount > 100:
3438
        totalAmount=500 if totalAmount > 500 else totalAmount
3439
        totalAmount=500 if totalAmount > 500 else totalAmount
3439
        try:
3440
        try:
3440
            pc = PromotionClient().get_client()
3441
            pc = PromotionClient().get_client()
3441
            enddate = datetime.datetime.now() + datetime.timedelta(days=60)
3442
            enddate = datetime.datetime.now() + datetime.timedelta(days=60)
Line 3637... Line 3638...
3637
    amounts['(e) Account Balance'] = balance
3638
    amounts['(e) Account Balance'] = balance
3638
    #amounts['Total Payment Amount'] = tra[0] + twa[0] - gwa[0]
3639
    #amounts['Total Payment Amount'] = tra[0] + twa[0] - gwa[0]
3639
    amounts['Saholic Mismatch = (a+b-c-d)'] = tpa[0] + gwa[0] - tra[0] - twa[0]
3640
    amounts['Saholic Mismatch = (a+b-c-d)'] = tpa[0] + gwa[0] - tra[0] - twa[0]
3640
    amounts['SpiceDeck Mismatch = (d-e)'] = 100000 - tra[0] - balance 
3641
    amounts['SpiceDeck Mismatch = (d-e)'] = 100000 - tra[0] - balance 
3641
    
3642
    
3642
    
-
 
-
 
3643
    if amounts['SpiceDeck Mismatch = (d-e)'] != -739:
-
 
3644
        mail(mail_user, mail_password, ['rajneesh.arora@shop2020.in', 'rajveer.singh@shop2020.in', 'anupam.singh@shop2020.in'], "SpiceDeck Account mismatch of amount " + str(amounts['SpiceDeck Mismatch = (d-e)']), "", [], [], [])
-
 
3645
    if amounts['Saholic Mismatch = (a+b-c-d)'] != -1919:
-
 
3646
        mail(mail_user, mail_password, ['rajneesh.arora@shop2020.in', 'rajveer.singh@shop2020.in', 'anupam.singh@shop2020.in'], "Saholic Recharge Account mismatch of amount " + str(amounts['Saholic Mismatch = (a+b-c-d)']), "", [], [], [])
3643
     
3647
                
3644
    
-
 
3645
    rs.statusCounts = statusCounts
3648
    rs.statusCounts = statusCounts
3646
    rs.operatorCounts = operatorCounts    
3649
    rs.operatorCounts = operatorCounts    
3647
    rs.currentOrders = currentOrders
3650
    rs.currentOrders = currentOrders
3648
    rs.amounts = amounts
3651
    rs.amounts = amounts
3649
    
3652