Subversion Repositories SmartDukaan

Rev

Rev 14983 | Blame | Compare with Previous | Last modification | View Log | RSS feed

'''
Created on Apr 26, 2015

@author: amit
'''
from dtr.storage.Mongo import get_mongo_connection
from dtr.utils.utils import sendNotification



def sendAmazonNotificationsToUsersWithMissingOrderDetails():
    db = get_mongo_connection().Dtr
    userIds = []
    orders = db.merchantOrder.find({'status':'html_required', 'storeId':1, 'subOrders':{'$exists':0}})
    for o in orders:
        if o['userId'] not in userIds:
            print o['userId'], o['orderSuccessUrl']
            o.append(o['userId'])
            sendNotification([o['userId']], 'AmazonNotifications', 'Claim cashback on  your Amazon orders', 'Login to your Amazon account now.', 'url', o['orderSuccessUrl']) 
            


def main():
    sendAmazonNotificationsToUsersWithMissingOrderDetails()

if __name__=='__main__':
    main()