1: <?php
2:
3: namespace Mypos\IPC;
4:
5: /**
6: * Process IPC method: IPCAuthorizationList.
7: * Collect, validate and send API params
8: */
9: class AuthorizationList extends Base
10: {
11: /**
12: * Return purchase object
13: *
14: * @param Config $cnf
15: */
16: public function __construct(Config $cnf)
17: {
18: $this->setCnf($cnf);
19: }
20:
21: /**
22: * Initiate API request
23: *
24: * @return Response
25: * @throws IPC_Exception
26: */
27: public function process()
28: {
29: $this->validate();
30:
31: $this->_addPostParam('IPCmethod', 'IPCAuthorizationList');
32: $this->_addPostParam('IPCVersion', $this->getCnf()->getVersion());
33: $this->_addPostParam('IPCLanguage', $this->getCnf()->getLang());
34: $this->_addPostParam('SID', $this->getCnf()->getSid());
35: $this->_addPostParam('WalletNumber', $this->getCnf()->getWallet());
36: $this->_addPostParam('KeyIndex', $this->getCnf()->getKeyIndex());
37: $this->_addPostParam('Source', $this->getCnf()->getSource());
38:
39: $this->_addPostParam('OutputFormat', $this->getOutputFormat());
40:
41: return $this->_processPost();
42: }
43:
44: /**
45: * Validate all set purchase details
46: *
47: * @return boolean
48: * @throws IPC_Exception
49: */
50: public function validate()
51: {
52: try {
53: $this->getCnf()->validate();
54: } catch (\Exception $ex) {
55: throw new IPC_Exception('Invalid Config details: ' . $ex->getMessage());
56: }
57:
58: if (!Helper::versionCheck($this->getCnf()->getVersion(), '1.4')) {
59: throw new IPC_Exception('IPCVersion ' . $this->getCnf()->getVersion() . ' does not support IPCAuthorizationList method. Please use 1.4 or above.');
60: }
61:
62: return true;
63: }
64: }
65: