Overview
  • Namespace
  • Class

Namespaces

  • Mypos
    • IPC

Classes

  • Mypos\IPC\Base
  • Mypos\IPC\Card
  • Mypos\IPC\CardStore
  • Mypos\IPC\Cart
  • Mypos\IPC\Config
  • Mypos\IPC\Customer
  • Mypos\IPC\Defines
  • Mypos\IPC\GetTxnStatus
  • Mypos\IPC\Helper
  • Mypos\IPC\IAPurchase
  • Mypos\IPC\IAStoreCard
  • Mypos\IPC\IAStoredCardUpdate
  • Mypos\IPC\IPCGetTxnLog
  • Mypos\IPC\Loader
  • Mypos\IPC\MandateManagement
  • Mypos\IPC\Purchase
  • Mypos\IPC\Refund
  • Mypos\IPC\RequestMoney
  • Mypos\IPC\Response
  • Mypos\IPC\Reversal

Exceptions

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