Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
14982 amit.gupta 1
'''
2
Created on Apr 26, 2015
3
 
4
@author: amit
5
'''
6
from dtr.storage.Mongo import get_mongo_connection
7
from dtr.utils.utils import sendNotification
8
 
9
 
10
 
11
def sendAmazonNotificationsToUsersWithMissingOrderDetails():
12
    db = get_mongo_connection().Dtr
13
    userIds = []
14
    orders = db.merchantOrder.find({'status':'html_required', 'storeId':1, 'subOrders':{'$exists':0}})
15
    for o in orders:
16
        if o['userId'] not in userIds:
17
            print o['userId'], o['orderSuccessUrl']
14983 amit.gupta 18
            o.append(o['userId'])
14986 amit.gupta 19
            sendNotification([o['userId']], 'AmazonNotifications', 'Claim cashback on  your Amazon orders', 'Login to your Amazon account now.', 'url', o['orderSuccessUrl']) 
14982 amit.gupta 20
 
21
 
22
 
23
def main():
24
    sendAmazonNotificationsToUsersWithMissingOrderDetails()
25
 
26
if __name__=='__main__':
27
    main()