1: | <?php
|
2: |
|
3: | namespace Mypos\IPC;
|
4: |
|
5: | |
6: | |
7: | |
8: |
|
9: | class GetTxnStatus extends Base
|
10: | {
|
11: | private $orderID;
|
12: |
|
13: | public function __construct(Config $cnf)
|
14: | {
|
15: | $this->setCnf($cnf);
|
16: | }
|
17: |
|
18: | |
19: | |
20: | |
21: | |
22: |
|
23: | public function process()
|
24: | {
|
25: | $this->validate();
|
26: |
|
27: | $this->_addPostParam('IPCmethod', 'IPCGetTxnStatus');
|
28: | $this->_addPostParam('IPCVersion', $this->getCnf()->getVersion());
|
29: | $this->_addPostParam('IPCLanguage', $this->getCnf()->getLang());
|
30: | $this->_addPostParam('SID', $this->getCnf()->getSid());
|
31: | $this->_addPostParam('WalletNumber', $this->getCnf()->getWallet());
|
32: | $this->_addPostParam('KeyIndex', $this->getCnf()->getKeyIndex());
|
33: | $this->_addPostParam('Source', $this->getCnf()->getSource());
|
34: |
|
35: | $this->_addPostParam('OrderID', $this->getOrderID());
|
36: | $this->_addPostParam('OutputFormat', $this->getOutputFormat());
|
37: |
|
38: | return $this->_processPost();
|
39: | }
|
40: |
|
41: | |
42: | |
43: | |
44: | |
45: | |
46: |
|
47: | public function validate()
|
48: | {
|
49: | try {
|
50: | $this->getCnf()->validate();
|
51: | } catch (\Exception $ex) {
|
52: | throw new IPC_Exception('Invalid Config details: '.$ex->getMessage());
|
53: | }
|
54: |
|
55: | if ($this->getOrderID() == null || !Helper::isValidOrderId($this->getOrderID())) {
|
56: | throw new IPC_Exception('Invalid OrderId');
|
57: | }
|
58: |
|
59: | if ($this->getOutputFormat() == null || !Helper::isValidOutputFormat($this->getOutputFormat())) {
|
60: | throw new IPC_Exception('Invalid Output format');
|
61: | }
|
62: |
|
63: | return true;
|
64: | }
|
65: |
|
66: | |
67: | |
68: | |
69: | |
70: |
|
71: | public function getOrderID()
|
72: | {
|
73: | return $this->orderID;
|
74: | }
|
75: |
|
76: | |
77: | |
78: | |
79: | |
80: | |
81: | |
82: |
|
83: | public function setOrderID($orderID)
|
84: | {
|
85: | $this->orderID = $orderID;
|
86: |
|
87: | return $this;
|
88: | }
|
89: | }
|
90: | |