Subversion Repositories SmartDukaan

Rev

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

Rev 15932 Rev 16204
Line 429... Line 429...
429
        orderId = row1[0]
429
        orderId = row1[0]
430
        order = db.merchantOrder.find_one({"orderId":orderId})
430
        order = db.merchantOrder.find_one({"orderId":orderId})
431
        if order is None:
431
        if order is None:
432
            continue
432
            continue
433
        #saleTime = int(time.mktime(datetime.strptime(order['placedOn'], "%b %d, %Y, %I:%M %p").timetuple()))  26 May 2015 02:12 PM
433
        #saleTime = int(time.mktime(datetime.strptime(order['placedOn'], "%b %d, %Y, %I:%M %p").timetuple()))  26 May 2015 02:12 PM
434
        aff = list(db.shopcluesOrderAffiliateInfo.find({"orderRef":order["merchantOrderId"]}))
434
        aff = list(db.shopcluesOrderAffiliateInfo.find({"merchantOrderId":order["merchantOrderId"]}))
435
        anotherrow += 1
435
        anotherrow += 1
436
        try:
436
        try:
437
            formattedTimestamp = order['placedOn']
437
            formattedTimestamp = order['placedOn']
438
            timestamp1 = int(time.mktime(datetime.strptime(order['placedOn'], "%d %b %Y %I:%M %p").timetuple()))
438
            timestamp1 = int(time.mktime(datetime.strptime(order['placedOn'], "%d %b %Y %I:%M %p").timetuple()))
439
        except:
439
        except:
440
            timestamp1 = int(time.mktime(row1[-4].timetuple()))
440
            timestamp1 = int(time.mktime(row1[-4].timetuple()))
441
            formattedTimestamp = datetime.strftime(fromTimeStamp(timestamp1), "%d %b %Y %I:%M %p")
441
            formattedTimestamp = datetime.strftime(fromTimeStamp(timestamp1), "%d %b %Y %I:%M %p")
442
        
442
        
443
        if len(aff) > 0 and order["subTagId"] not in matchedList and long(order["paidAmount"])==long(float(aff[0]["transactionValue"])): 
443
        if len(aff) > 0 and order["subTagId"] not in matchedList and long(order["paidAmount"])==long(float(aff[0]["transactionValue"])): 
444
            matchedList.append(order["subTagId"])
444
            matchedList.append(order["subTagId"])
445
            db.shopcluesOrderAffiliateInfo.update({"orderRef":aff[0].get("orderRef")}, {"$set":{"reconciled":True, "orderId":orderId}}, multi=True)
445
            db.shopcluesOrderAffiliateInfo.update({"merchantOrderId":aff[0].get("merchantOrderId")}, {"$set":{"reconciled":True, "orderId":orderId}}, multi=True)
446
            order['reconciled'] = True
446
            order['reconciled'] = True
447
            order['adId'] = aff[0].get("uniqueKey")
447
            order['adId'] = aff[0].get("uniqueKey")
448
            db.merchantOrder.save(order)
448
            db.merchantOrder.save(order)
449
            row += 1
449
            row += 1
450
            i=-1 
450
            i=-1