Subversion Repositories SmartDukaan

Rev

Rev 6219 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
6147 rajveer 1
#!/usr/bin/python
2
'''
3
It is used to process transactions for which the payment 
4
was received but the order was not processed.
5
 
6
@author: Rajveer
7
'''
8
import optparse
9
import sys
10
 
11
 
12
 
13
if __name__ == '__main__' and __package__ is None:
14
    import os
15
    sys.path.insert(0, os.getcwd())
16
 
17
from shop2020.thriftpy.model.v1.order.ttypes import RechargeOrderStatus
18
from shop2020.model.v1.order.impl import DataAccessors, DataService
19
 
20
 
21
def main():
22
    parser = optparse.OptionParser()
23
    parser.add_option("-o", "--order_id", dest="order_id",
24
                   type="int",
25
                   help="mark the recharge order id ORDER_ID as successful",
26
                   metavar="ORDER_ID")
27
    parser.add_option("-H", "--host", dest="hostname",
28
                      default="localhost",
29
                      type="string", help="The HOST where the DB server is running",
30
                      metavar="HOST")
31
    (options, args) = parser.parse_args()
32
    if len(args) != 0:
33
        parser.error("You've supplied extra arguments. Are you sure you want to run this program?")
34
    if options.order_id == None:
35
        parser.error("No Transaction id supplied")
36
 
37
 
38
    DataService.initialize(db_hostname=options.hostname, echoOn=True)
39
    DataAccessors.update_recharge_order_status(options.order_id, RechargeOrderStatus.PAYMENT_SUCCESSFUL)
40
 
41
if __name__ == '__main__':
42
    main()