| 2133 |
chandransh |
1 |
#!/usr/bin/python
|
|
|
2 |
|
|
|
3 |
import optparse
|
|
|
4 |
import sys
|
|
|
5 |
|
|
|
6 |
if __name__ == '__main__' and __package__ is None:
|
|
|
7 |
import os
|
|
|
8 |
sys.path.insert(0, os.getcwd())
|
|
|
9 |
|
|
|
10 |
from shop2020.model.v1.order.impl import DataAccessors, DataService
|
|
|
11 |
from shop2020.thriftpy.model.v1.order.ttypes import TransactionStatus
|
|
|
12 |
|
|
|
13 |
def main():
|
|
|
14 |
parser = optparse.OptionParser()
|
|
|
15 |
parser.add_option("-t", "--txn-id", dest="txn_id",
|
|
|
16 |
type="int",
|
|
|
17 |
help="mark the transaction TXN_ID and all its orders as successful",
|
|
|
18 |
metavar="TXN_ID")
|
|
|
19 |
(options, args) = parser.parse_args()
|
|
|
20 |
if len(args) != 0:
|
|
|
21 |
parser.error("You've supplied extra arguments. Are you sure you want to run this program?")
|
|
|
22 |
if options.txn_id == None:
|
|
|
23 |
parser.error("No Transaction id supplied")
|
|
|
24 |
DataService.initialize(echoOn=True)
|
|
|
25 |
DataAccessors.change_transaction_status(options.txn_id, TransactionStatus.IN_PROCESS, "Payment received for the order")
|
|
|
26 |
|
|
|
27 |
if __name__ == '__main__':
|
|
|
28 |
main()
|