Subversion Repositories SmartDukaan

Rev

Rev 14995 | Rev 17072 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
14995 amit.gupta 1
'''
2
Created on Apr 28, 2015
3
 
4
@author: amit
5
'''
6
from dtr.main import client
7
from dtr.utils.utils import sendNotification
8
def main():
9
    #scrapepaytm()
10
    db = client.Dtr
16651 amit.gupta 11
 
12
    batchId = db.refund.find_one({"$query":{},"$orderby":{"batch":-1}}).get("batch")
13
    print "Batch Id recently Credited", batchId
14995 amit.gupta 14
    if batchId is None:
15
        return
16
    refunds = db.refund.find({"batch":batchId})
17
    sendNotification([8], 'Batch Credit', 'Cashback Credited', 'Rs.%s has been added to your wallet'%(250), 'url', 'http://api.profittill.com/cashbacks/mine?user_id=%s'%(8))
18
    sendNotification([14], 'Batch Credit', 'Cashback Credited', 'Rs.%s has been added to your wallet'%(250), 'url', 'http://api.profittill.com/cashbacks/mine?user_id=%s'%(14))
19
    for ref in refunds:
20
        print ref.get("userId"), ref.get("userAmount")
16651 amit.gupta 21
        sendNotification([ref.get("userId")], 'Batch Credit', 'Cashback Credited', 'Rs.%s has been added to your wallet'%(int(ref.get("userAmount"))), 'url', 'http://api.profittill.com/cashbacks/mine?user_id=%s'%(ref.get("userId")))
14995 amit.gupta 22
        pass
23
 
24
if __name__ == '__main__':
25
    main()