Subversion Repositories SmartDukaan

Rev

Rev 6219 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#!/usr/bin/python
'''
It is used to process transactions for which the payment 
was received but the order was not processed.

@author: Rajveer
'''
import optparse
import sys



if __name__ == '__main__' and __package__ is None:
    import os
    sys.path.insert(0, os.getcwd())

from shop2020.thriftpy.model.v1.order.ttypes import RechargeOrderStatus
from shop2020.model.v1.order.impl import DataAccessors, DataService


def main():
    parser = optparse.OptionParser()
    parser.add_option("-o", "--order_id", dest="order_id",
                   type="int",
                   help="mark the recharge order id ORDER_ID as successful",
                   metavar="ORDER_ID")
    parser.add_option("-H", "--host", dest="hostname",
                      default="localhost",
                      type="string", help="The HOST where the DB server is running",
                      metavar="HOST")
    (options, args) = parser.parse_args()
    if len(args) != 0:
        parser.error("You've supplied extra arguments. Are you sure you want to run this program?")
    if options.order_id == None:
        parser.error("No Transaction id supplied")
        
        
    DataService.initialize(db_hostname=options.hostname, echoOn=True)
    DataAccessors.update_recharge_order_status(options.order_id, RechargeOrderStatus.PAYMENT_SUCCESSFUL)

if __name__ == '__main__':
    main()