Subversion Repositories SmartDukaan

Rev

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

Rev 6279 Rev 6451
Line 35... Line 35...
35
                      action="store_true",
35
                      action="store_true",
36
                      help="")
36
                      help="")
37
    parser.add_option("-u", "--unknown", dest="unknown",
37
    parser.add_option("-u", "--unknown", dest="unknown",
38
                      action="store_true",
38
                      action="store_true",
39
                      help="")
39
                      help="")
-
 
40
    parser.add_option("-u", "--authorized", dest="authorized",
-
 
41
                      action="store_true",
-
 
42
                      help="")
-
 
43
    parser.add_option("-t", "--txn-id", dest="txn_id",
-
 
44
                   type="int",
-
 
45
                   help="mark the transaction(recharge order id) TXN_ID as successful",
-
 
46
                   metavar="TXN_ID")
40
 
47
 
41
    (options, args) = parser.parse_args()
48
    (options, args) = parser.parse_args()
42
    if len(args) != 0:
49
    if len(args) != 0:
43
        parser.error("You've supplied extra arguments. Are you sure you want to run this program?")
50
        parser.error("You've supplied extra arguments. Are you sure you want to run this program?")
44
    DataService.initialize(db_hostname=options.hostname, echoOn=True)
51
    DataService.initialize(db_hostname=options.hostname, echoOn=True)
45
        
52
        
46
    if options.refund:
53
    if options.refund:
47
        processRefunds()
54
        processRefunds()
48
    if options.unknown:
55
    if options.unknown:
49
        processUnknownTransactions()
56
        processUnknownTransactions()
-
 
57
    if options.authorized:
-
 
58
        processAuthorizedTransactions(options.txn_id)
50
 
59
 
51
def processRefunds():
60
def processRefunds():
52
    todate = datetime.datetime.now()
61
    todate = datetime.datetime.now()
53
    for i in range(15):
62
    for i in range(15):
54
        orderDate = todate + datetime.timedelta(days= -i)
63
        orderDate = todate + datetime.timedelta(days= -i)
Line 80... Line 89...
80
                    update_recharge_order_status(order.id, RechargeOrderStatus.RECHARGE_SUCCESSFUL)
89
                    update_recharge_order_status(order.id, RechargeOrderStatus.RECHARGE_SUCCESSFUL)
81
                else:
90
                else:
82
                    update_recharge_order_status(order.id, RechargeOrderStatus.RECHARGE_FAILED)
91
                    update_recharge_order_status(order.id, RechargeOrderStatus.RECHARGE_FAILED)
83
        except:
92
        except:
84
            print "Do Nothing"
93
            print "Do Nothing"
-
 
94
 
-
 
95
def processAuthorizedTransactions(txn_id):
-
 
96
    update_recharge_order_status(txn_id, RechargeOrderStatus.PAYMENT_SUCCESSFUL)
85
                
97
                
86
if __name__ == '__main__':
98
if __name__ == '__main__':
87
    main()
99
    main()
88
100