Subversion Repositories SmartDukaan

Rev

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

Rev 18483 Rev 19338
Line 8... Line 8...
8
import sys
8
import sys
9
import getopt
9
import getopt
10
import traceback
10
import traceback
11
from dtr.main import tprint
11
from dtr.main import tprint
12
 
12
 
-
 
13
mongoHost = "45.33.50.227"
-
 
14
 
13
def main(argv):
15
def main(argv):
14
    #scrapepaytm()
16
    #scrapepaytm()
15
    credittype = 'Order'
17
    credittype = 'Order'
16
    try:
18
    try:
17
        opts, args = getopt.getopt(argv,"ht:",["credittype="])
19
        opts, args = getopt.getopt(argv,"ht:",["credittype="])
Line 40... Line 42...
40
    batchId = db.refund.find_one({"$query":{"type":credittype},"$orderby":{"batch":-1}}).get("batch")
42
    batchId = db.refund.find_one({"$query":{"type":credittype},"$orderby":{"batch":-1}}).get("batch")
41
    print "Batch Id recently Credited", batchId
43
    print "Batch Id recently Credited", batchId
42
    if batchId is None:
44
    if batchId is None:
43
        return
45
        return
44
    refunds = db.refund.find({"batch":batchId})
46
    refunds = db.refund.find({"batch":batchId})
45
    sendNotification([8], 'Batch Credit', 'Cashback Credited for %ss'%(str(credittype)), 'Rs.%s has been added to your wallet'%(250), 'url', 'http://api.profittill.com/cashbacks/mine?user_id=%s'%(8), '2999-01-01', True, "TRAN_SMS Dear Customer, Cashback credited for %ss. Rs.%s has been added to your wallet"%(str(credittype),250))
47
    sendNotification([8], 'Batch Credit', 'Cashback Credited for %ss'%(str(credittype)), 'Rs.%s has been added to your wallet'%(250), 'url', 'http://api.profittill.com/cashbacks/mine?user_id=%s'%(8), '2999-01-01', True, "TRAN_SMS Dear Customer, Cashback credited for %ss. Rs.%s has been added to your wallet"%(str(credittype),250),mongoHost)
46
    #sendNotification([14], 'Batch Credit', 'Cashback Credited for %ss'%(str(credittype)), 'Rs.%s has been added to your wallet'%(250), 'url', 'http://api.profittill.com/cashbacks/mine?user_id=%s'%(14))
48
    #sendNotification([14], 'Batch Credit', 'Cashback Credited for %ss'%(str(credittype)), 'Rs.%s has been added to your wallet'%(250), 'url', 'http://api.profittill.com/cashbacks/mine?user_id=%s'%(14))
47
    sendNotification([14], 'Batch Credit', 'Cashback Credited for %ss'%(str(credittype)), 'Rs.%s has been added to your wallet'%(250), 'url', 'http://api.profittill.com/cashbacks/mine?user_id=%s'%(8), '2999-01-01',True, "TRAN_SMS Dear Customer, Cashback credited for %ss. Rs.%s has been added to your wallet"%(str(credittype),250))
49
    sendNotification([14], 'Batch Credit', 'Cashback Credited for %ss'%(str(credittype)), 'Rs.%s has been added to your wallet'%(250), 'url', 'http://api.profittill.com/cashbacks/mine?user_id=%s'%(8), '2999-01-01',True, "TRAN_SMS Dear Customer, Cashback credited for %ss. Rs.%s has been added to your wallet"%(str(credittype),250),mongoHost)
48
    for ref in refunds:
50
    for ref in refunds:
49
        print ref.get("userId"), ref.get("userAmount")
51
        print ref.get("userId"), ref.get("userAmount")
50
        sendNotification([ref.get("userId")], 'Batch Credit', 'Cashback Credited for %ss'%(str(credittype)), '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")), '2999-01-01', True, "TRAN_SMS Dear Customer, Cashback Credited for %ss. Rs.%s has been added to your wallet"%(str(credittype),int(ref.get("userAmount"))))
52
        sendNotification([ref.get("userId")], 'Batch Credit', 'Cashback Credited for %ss'%(str(credittype)), '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")), '2999-01-01', True, "TRAN_SMS Dear Customer, Cashback Credited for %ss. Rs.%s has been added to your wallet"%(str(credittype),int(ref.get("userAmount"))), mongoHost)
51
 
53
 
52
if __name__ == '__main__':
54
if __name__ == '__main__':
53
    main(sys.argv[1:])
55
    main(sys.argv[1:])
54
56