Subversion Repositories SmartDukaan

Rev

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

Rev 7547 Rev 7551
Line 428... Line 428...
428
                order.statusDescription = "Note 2 Buy Back Offer - Approval Pending from CRM Team"
428
                order.statusDescription = "Note 2 Buy Back Offer - Approval Pending from CRM Team"
429
                order.otg = False
429
                order.otg = False
430
                                    
430
                                    
431
    session.commit()
431
    session.commit()
432
 
432
 
-
 
433
    if new_status in (TransactionStatus.AUTHORIZED, TransactionStatus.FLAGGED, TransactionStatus.COD_IN_PROCESS):
433
    try:
434
        try:
434
        if order.source == OrderSource.WEBSITE:    
435
            if order.source == OrderSource.WEBSITE:    
435
            if new_status == TransactionStatus.COD_IN_PROCESS:
436
                if new_status == TransactionStatus.COD_IN_PROCESS:
436
                transaction_requiring_extra_processing = TransactionRequiringExtraProcessing()
437
                    transaction_requiring_extra_processing = TransactionRequiringExtraProcessing()
437
                transaction_requiring_extra_processing.category = 'COD_VERIFICATION'
438
                    transaction_requiring_extra_processing.category = 'COD_VERIFICATION'
438
                transaction_requiring_extra_processing.transaction_id = transaction_id
439
                    transaction_requiring_extra_processing.transaction_id = transaction_id
439
                session.commit()
440
                    session.commit()
440
            elif new_status == TransactionStatus.FLAGGED:
441
                elif new_status == TransactionStatus.FLAGGED:
441
                transaction_requiring_extra_processing = TransactionRequiringExtraProcessing()
442
                    transaction_requiring_extra_processing = TransactionRequiringExtraProcessing()
442
                transaction_requiring_extra_processing.category = 'PAYMENT_FLAGGED'
443
                    transaction_requiring_extra_processing.category = 'PAYMENT_FLAGGED'
443
                transaction_requiring_extra_processing.transaction_id = transaction_id
444
                    transaction_requiring_extra_processing.transaction_id = transaction_id
444
                session.commit()
-
 
445
        elif order.source == OrderSource.STORE:
-
 
446
                order.otg = False
-
 
447
                session.commit()
-
 
448
                catalog_client = CatalogClient().get_client() 
-
 
449
                sourcePricing = catalog_client.getStorePricing(order.lineitems[0].item_id)
-
 
450
                if order.total_amount >= sourcePricing.minPrice:
-
 
451
                    order.status = OrderStatus.SUBMITTED_FOR_PROCESSING
-
 
452
                    order.statusDescription = "Order Accepted"
-
 
453
                    session.commit()
445
                    session.commit()
454
                    sod = StoreOrderDetail.get_by(orderId = order.id)
-
 
455
                    __push_store_collection_to_hotspot(order, "advance", sod.cashAmount, sod.cardAmount)
-
 
456
                    
-
 
457
                else: 
-
 
458
                    order.status = OrderStatus.COD_VERIFICATION_PENDING
446
            elif order.source == OrderSource.STORE:
459
                    order.statusDescription = "Approval Pending"
-
 
460
                    content = "<html><body>"
-
 
461
                    content += "<h4>Order Id:  " + str(order.id) + "</h4>"
-
 
462
                    content += "<h4>Product:  " + str(order.lineitems[0]) + "</h4>"
-
 
463
                    content += "<h4>Min Price: " +  str(sourcePricing.minPrice) + "</h4>"
-
 
464
                    content += "<h4>Recommended Price: " +  str(sourcePricing.recommendedPrice) + "</h4>"
-
 
465
                    content += "<h2>Approval Requested for Price: " +  str(order.total_amount) + "</h2>"
-
 
466
                    content += "<h2>Note 1: If this discount price is approved then reply 'Approved' otherwise 'Not Approved' without changing anythig in the Mail.</h2>"  
-
 
467
                    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>"
-
 
468
                    content += "<br><br></body></html>"
-
 
469
                    store = get_hotspot_store(order.storeId, "")
-
 
470
                    helper_client = HelperClient().get_client()
-
 
471
                    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", [], [])
447
                    order.otg = False
472
                    session.commit()
448
                    session.commit()
-
 
449
                    catalog_client = CatalogClient().get_client() 
-
 
450
                    sourcePricing = catalog_client.getStorePricing(order.lineitems[0].item_id)
-
 
451
                    if order.total_amount >= sourcePricing.minPrice:
-
 
452
                        order.status = OrderStatus.SUBMITTED_FOR_PROCESSING
-
 
453
                        order.statusDescription = "Order Accepted"
-
 
454
                        session.commit()
-
 
455
                        sod = StoreOrderDetail.get_by(orderId = order.id)
-
 
456
                        __push_store_collection_to_hotspot(order, "advance", sod.cashAmount, sod.cardAmount)
-
 
457
                        
-
 
458
                    else: 
-
 
459
                        order.status = OrderStatus.COD_VERIFICATION_PENDING
-
 
460
                        order.statusDescription = "Approval Pending"
-
 
461
                        content = "<html><body>"
-
 
462
                        content += "<h4>Order Id:  " + str(order.id) + "</h4>"
-
 
463
                        content += "<h4>Product:  " + str(order.lineitems[0]) + "</h4>"
-
 
464
                        content += "<h4>Min Price: " +  str(sourcePricing.minPrice) + "</h4>"
-
 
465
                        content += "<h4>Recommended Price: " +  str(sourcePricing.recommendedPrice) + "</h4>"
-
 
466
                        content += "<h2>Approval Requested for Price: " +  str(order.total_amount) + "</h2>"
-
 
467
                        content += "<h2>Note 1: If this discount price is approved then reply 'Approved' otherwise 'Not Approved' without changing anythig in the Mail.</h2>"  
-
 
468
                        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>"
-
 
469
                        content += "<br><br></body></html>"
-
 
470
                        store = get_hotspot_store(order.storeId, "")
-
 
471
                        helper_client = HelperClient().get_client()
-
 
472
                        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", [], [])
-
 
473
                        session.commit()
473
    except Exception as e:
474
        except Exception as e:
474
        print "Error inserting transaction Id: " + str(transaction_id) + " due to " + str(e)
475
            print "Error inserting transaction Id: " + str(transaction_id) + " due to " + str(e)
475
 
476
 
476
    return True
477
    return True
477
 
478
 
478
def __create_recharge_voucher_tracker(order, amount, voucherType):
479
def __create_recharge_voucher_tracker(order, amount, voucherType):
479
    rvt = RechargeVoucherTracker()
480
    rvt = RechargeVoucherTracker()