Subversion Repositories SmartDukaan

Rev

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

Rev 7371 Rev 7385
Line 438... Line 438...
438
                catalog_client = CatalogClient().get_client() 
438
                catalog_client = CatalogClient().get_client() 
439
                sourcePricing = catalog_client.getStorePricing(order.lineitems[0].item_id)
439
                sourcePricing = catalog_client.getStorePricing(order.lineitems[0].item_id)
440
                if order.total_amount >= sourcePricing.minPrice:
440
                if order.total_amount >= sourcePricing.minPrice:
441
                    order.status = OrderStatus.SUBMITTED_FOR_PROCESSING
441
                    order.status = OrderStatus.SUBMITTED_FOR_PROCESSING
442
                    session.commit()
442
                    session.commit()
443
                    __push_collection_to_hotspot(order, "SALE", True)
443
                    __push_store_collection_to_hotspot(order, "advance")
444
                    
444
                    
445
                else: 
445
                else: 
446
                    order.status = OrderStatus.COD_VERIFICATION_PENDING
446
                    order.status = OrderStatus.COD_VERIFICATION_PENDING
447
                    content = "<html><body>"
447
                    content = "<html><body>"
448
                    content += "<h4>Order Id:  " + str(order.id) + "</h4>"
448
                    content += "<h4>Order Id:  " + str(order.id) + "</h4>"
Line 2776... Line 2776...
2776
    pdf.drawText(order_text)
2776
    pdf.drawText(order_text)
2777
    pdf.showPage()
2777
    pdf.showPage()
2778
    pdf.save()
2778
    pdf.save()
2779
    return filename
2779
    return filename
2780
 
2780
 
-
 
2781
def __push_store_collection_to_hotspot(order, type):
-
 
2782
    try:
-
 
2783
        ts = order.created_timestamp
-
 
2784
        store =  get_hotspot_store(order.storeId, "")
-
 
2785
        storeName = store.hotspotId
-
 
2786
        store_string = "<Store>" + storeName + "</Store>"
-
 
2787
        order_string = "<OrderID>" + str(order.id) + "</OrderID>"
-
 
2788
        product_string = "<Product>" + str(order.lineitems[0]) + "</Product>"
-
 
2789
        collection_type = "<CollectionType>" + type + "</CollectionType>"
-
 
2790
        if type == 'advance':
-
 
2791
            amount_string = "<AdvanceAmount>" + order.advanceAmount + "</AdvanceAmount>"
-
 
2792
        date_string = "<TimeStamp>" + ts.strftime("%Y%m%d%H%M%S") + "</TimeStamp>"
-
 
2793
        cash_string = "<CashAmount>" + order.advanceAmount + "</CashAmount>"
-
 
2794
        card_string = "<CardAmount>" + "0" + "</CardAmount>"
-
 
2795
          
-
 
2796
        #advance, saleClosure, advanceRefund, saleRefund
-
 
2797
        
-
 
2798
        conn = httplib.HTTPConnection("182.71.104.186")
-
 
2799
        XML="""
-
 
2800
        <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
-
 
2801
          <soap:Body>
-
 
2802
            <SaholicAdvanceTransfer xmlns="http://tempuri.org/">
-
 
2803
        """
-
 
2804
        
-
 
2805
        XML = XML + store_string + order_string + product_string + collection_type + amount_string + cash_string + card_string + date_string 
-
 
2806
        
-
 
2807
        footer = """
-
 
2808
            </SaholicAdvanceTransfer>
-
 
2809
          </soap:Body>
-
 
2810
        </soap:Envelope>
-
 
2811
        """
-
 
2812
        XML = XML + footer
-
 
2813
        
-
 
2814
        params = urllib.urlencode({'op': 'SaholicAdvanceTransfer'})
-
 
2815
        headers = { "Content-type": "text/xml", "Content-Length": "%d" % len(XML)}
-
 
2816
        conn.request("POST", "/loaddetect/Service.asmx?"+params, "", headers)
-
 
2817
        conn.send(XML)
-
 
2818
        response = conn.getresponse()
-
 
2819
        print response.status, response.reason
-
 
2820
        resp = response.read()
-
 
2821
        conn.close()
-
 
2822
        print resp
-
 
2823
        if "Saved Successfully" in resp:
-
 
2824
            return True
-
 
2825
        elif "Error in Saving Data" in resp:
-
 
2826
            return False
-
 
2827
        else: 
-
 
2828
            return False
-
 
2829
    except Exception as e:
-
 
2830
        print e
-
 
2831
        return False
-
 
2832
 
2781
def __push_collection_to_hotspot(order, type, storeOrder = False):
2833
def __push_collection_to_hotspot(order, type, storeOrder = False):
2782
    try:
2834
    try:
2783
        storeName = '109'
2835
        storeName = '109'
2784
        if storeOrder:
2836
        if storeOrder:
2785
            store =  get_hotspot_store(order.storeId, "")
2837
            store =  get_hotspot_store(order.storeId, "")