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