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