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: IPCIAStoreCard.
  7  * Collect, validate and send API params
  8  */
  9 class IAStoredCardUpdate extends CardStore
 10 {
 11     /**
 12      * @var Card
 13      */
 14     private $card;
 15 
 16     /**
 17      * Return purchase object
 18      * @param Config $cnf
 19      */
 20     public function __construct(Config $cnf)
 21     {
 22         $this->setCnf($cnf);
 23     }
 24 
 25     /**
 26      * Card object
 27      * @return Card
 28      */
 29     public function getCard()
 30     {
 31         return $this->card;
 32     }
 33 
 34     /**
 35      * Card object
 36      * @param Card $card
 37      */
 38     public function setCard($card)
 39     {
 40         $this->card = $card;
 41     }
 42 
 43 
 44     /**
 45      * Initiate API request
 46      * @return Response
 47      */
 48     public function process()
 49     {
 50         $this->validate();
 51 
 52         $this->_addPostParam('IPCmethod', 'IPCIAStoredCardUpdate');
 53         $this->_addPostParam('IPCVersion', $this->getCnf()->getVersion());
 54         $this->_addPostParam('IPCLanguage', $this->getCnf()->getLang());
 55         $this->_addPostParam('SID', $this->getCnf()->getSid());
 56         $this->_addPostParam('WalletNumber', $this->getCnf()->getWallet());
 57         $this->_addPostParam('KeyIndex', $this->getCnf()->getKeyIndex());
 58         $this->_addPostParam('Source', Defines::SOURCE_PARAM);
 59 
 60         $this->_addPostParam('CardVerification', $this->getCardVerification());
 61         if ($this->getCardVerification() == self::CARD_VERIFICATION_YES) {
 62             $this->_addPostParam('Amount', $this->getAmount());
 63             $this->_addPostParam('Currency', $this->getCurrency());
 64         }
 65 
 66         $this->_addPostParam('CardType', $this->getCard()->getCardType());
 67         $this->_addPostParam('CardToken', $this->getCard()->getCardToken());
 68         $this->_addPostParam('CardholderName', $this->getCard()->getCardHolder());
 69         $this->_addPostParam('ExpDate', $this->getCard()->getExpDate(), true);
 70         $this->_addPostParam('CVC', $this->getCard()->getCvc(), true);
 71         $this->_addPostParam('ECI', $this->getCard()->getEci());
 72         $this->_addPostParam('AVV', $this->getCard()->getAvv());
 73         $this->_addPostParam('XID', $this->getCard()->getXid());
 74 
 75         $this->_addPostParam('OutputFormat', $this->getOutputFormat());
 76         return $this->_processPost();
 77     }
 78 
 79     /**
 80      * Validate all set purchase details
 81      * @return boolean
 82      * @throws IPC_Exception
 83      */
 84     public function validate()
 85     {
 86         parent::validate();
 87 
 88         try {
 89             $this->getCnf()->validate();
 90         } catch (Exception $ex) {
 91             throw new IPC_Exception('Invalid Config details: ' . $ex->getMessage());
 92         }
 93 
 94         try {
 95             $this->getCard()->validate();
 96         } catch (Exception $ex) {
 97             throw new IPC_Exception('Invalid Card details: ' . $ex->getMessage());
 98         }
 99         return true;
100     }
101 
102 }
103 
API documentation generated by ApiGen