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: IPCMandateManagement.
  7  * Collect, validate and send API params
  8  */
  9 class MandateManagement extends Base
 10 {
 11 
 12     const MANDATE_MANAGEMENT_ACTION_REGISTER = 1;
 13     const MANDATE_MANAGEMENT_ACTION_CANCEL = 2;
 14 
 15 
 16     private $mandateReferece, $customerWalletNumber, $action, $mandateText;
 17 
 18     /**
 19      * Return Refund object
 20      * @param Config $cnf
 21      */
 22     public function __construct(Config $cnf)
 23     {
 24         $this->setCnf($cnf);
 25     }
 26 
 27     /**
 28      * Unique identifier of the agreement (mandate) between the merchant and the client (debtor). Up to 127 characters.
 29      * @return string
 30      */
 31     public function getMandateReferece()
 32     {
 33         return $this->mandateReferece;
 34     }
 35 
 36     /**
 37      * Unique identifier of the agreement (mandate) between the merchant and the client (debtor). Up to 127 characters.
 38      * @param string $mandateReferece
 39      */
 40     public function setMandateReferece($mandateReferece)
 41     {
 42         $this->mandateReferece = $mandateReferece;
 43     }
 44 
 45     /**
 46      * Identifier of the client’s (debtor’s) myPOS account
 47      * @return string
 48      */
 49     public function getCustomerWalletNumber()
 50     {
 51         return $this->customerWalletNumber;
 52     }
 53 
 54     /**
 55      * Identifier of the client’s (debtor’s) myPOS account
 56      * @param string $customerWalletNumber
 57      */
 58     public function setCustomerWalletNumber($customerWalletNumber)
 59     {
 60         $this->customerWalletNumber = $customerWalletNumber;
 61     }
 62 
 63     /**
 64      * Registration / Cancellation of a MandateReference
 65      *
 66      * @return int
 67      */
 68     public function getAction()
 69     {
 70         return $this->action;
 71     }
 72 
 73     /**
 74      * Registration / Cancellation of a MandateReference
 75      * @param int $action
 76      */
 77     public function setAction($action)
 78     {
 79         $this->action = $action;
 80     }
 81 
 82     /**
 83      * Text supplied from the merchant, so the client can easily identify the Mandate.
 84      * @return string
 85      */
 86     public function getMandateText()
 87     {
 88         return $this->mandateText;
 89     }
 90 
 91     /**
 92      * Text supplied from the merchant, so the client can easily identify the Mandate.
 93      * @param string $mandateText
 94      */
 95     public function setMandateText($mandateText)
 96     {
 97         $this->mandateText = $mandateText;
 98     }
 99 
100     /**
101      * Initiate API request
102      * @return Response
103      */
104     public function process()
105     {
106         $this->validate();
107         $this->_addPostParam('IPCmethod', 'IPCMandateManagement');
108         $this->_addPostParam('IPCVersion', $this->getCnf()->getVersion());
109         $this->_addPostParam('IPCLanguage', $this->getCnf()->getLang());
110         $this->_addPostParam('SID', $this->getCnf()->getSid());
111         $this->_addPostParam('WalletNumber', $this->getCnf()->getWallet());
112         $this->_addPostParam('KeyIndex', $this->getCnf()->getKeyIndex());
113         $this->_addPostParam('Source', Defines::SOURCE_PARAM);
114         $this->_addPostParam('MandateReference', $this->getMandateReferece());
115         $this->_addPostParam('CustomerWalletNumber', $this->getCustomerWalletNumber());
116         $this->_addPostParam('Action', $this->getAction());
117         $this->_addPostParam('MandateText', $this->getMandateText());
118         $this->_addPostParam('OutputFormat', $this->getOutputFormat());
119         return $this->_processPost();
120     }
121 
122     /**
123      * Validate all set refund details
124      * @return boolean
125      * @throws IPC_Exception
126      */
127     public function validate()
128     {
129         try {
130             $this->getCnf()->validate();
131         } catch (\Exception $ex) {
132             throw new IPC_Exception('Invalid Config details: ' . $ex->getMessage());
133         }
134 
135         if ($this->getOutputFormat() == null || !Helper::isValidOutputFormat($this->getOutputFormat())) {
136             throw new IPC_Exception('Invalid Output format');
137         }
138 
139         return true;
140     }
141 }
API documentation generated by ApiGen