Overview
  • Namespace
  • Class

Namespaces

  • Mypos
    • IPC

Classes

  • Mypos\IPC\Authorization
  • Mypos\IPC\AuthorizationCapture
  • Mypos\IPC\AuthorizationList
  • Mypos\IPC\AuthorizationReverse
  • Mypos\IPC\Base
  • Mypos\IPC\Card
  • Mypos\IPC\CardStore
  • Mypos\IPC\Cart
  • Mypos\IPC\Config
  • Mypos\IPC\Customer
  • Mypos\IPC\Defines
  • Mypos\IPC\GetPaymentStatus
  • Mypos\IPC\GetTxnStatus
  • Mypos\IPC\Helper
  • Mypos\IPC\IAPreAuthorization
  • Mypos\IPC\IAPurchase
  • Mypos\IPC\IAStoreCard
  • Mypos\IPC\IAStoredCardUpdate
  • Mypos\IPC\IPCGetTxnLog
  • Mypos\IPC\Loader
  • Mypos\IPC\MandateManagement
  • Mypos\IPC\PreAuthorization
  • Mypos\IPC\PreAuthorizationCancellation
  • Mypos\IPC\PreAuthorizationCompletion
  • Mypos\IPC\PreAuthorizationStatus
  • Mypos\IPC\Purchase
  • Mypos\IPC\PurchaseByIcard
  • 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      *
 19      * @param Config $cnf
 20      */
 21     public function __construct(Config $cnf)
 22     {
 23         $this->setCnf($cnf);
 24     }
 25 
 26     /**
 27      * Initiate API request
 28      *
 29      * @return Response
 30      */
 31     public function process()
 32     {
 33         $this->validate();
 34 
 35         $this->_addPostParam('IPCmethod', 'IPCIAStoredCardUpdate');
 36         $this->_addPostParam('IPCVersion', $this->getCnf()->getVersion());
 37         $this->_addPostParam('IPCLanguage', $this->getCnf()->getLang());
 38         $this->_addPostParam('SID', $this->getCnf()->getSid());
 39         $this->_addPostParam('WalletNumber', $this->getCnf()->getWallet());
 40         $this->_addPostParam('KeyIndex', $this->getCnf()->getKeyIndex());
 41         $this->_addPostParam('Source', $this->getCnf()->getSource());
 42 
 43         $this->_addPostParam('CardVerification', $this->getCardVerification());
 44         if ($this->getCardVerification() == self::CARD_VERIFICATION_YES) {
 45             $this->_addPostParam('Amount', $this->getAmount());
 46             $this->_addPostParam('Currency', $this->getCurrency());
 47         }
 48 
 49         $this->_addPostParam('CardType', $this->getCard()->getCardType());
 50         $this->_addPostParam('CardToken', $this->getCard()->getCardToken());
 51         $this->_addPostParam('CardholderName', $this->getCard()->getCardHolder());
 52         $this->_addPostParam('ExpDate', $this->getCard()->getExpDate(), true);
 53         $this->_addPostParam('CVC', $this->getCard()->getCvc(), true);
 54         $this->_addPostParam('ECI', $this->getCard()->getEci());
 55         $this->_addPostParam('AVV', $this->getCard()->getAvv());
 56         $this->_addPostParam('XID', $this->getCard()->getXid());
 57 
 58         $this->_addPostParam('OutputFormat', $this->getOutputFormat());
 59 
 60         return $this->_processPost();
 61     }
 62 
 63     /**
 64      * Validate all set purchase details
 65      *
 66      * @return boolean
 67      * @throws IPC_Exception
 68      */
 69     public function validate()
 70     {
 71         parent::validate();
 72 
 73         try {
 74             $this->getCnf()->validate();
 75         } catch (\Exception $ex) {
 76             throw new IPC_Exception('Invalid Config details: '.$ex->getMessage());
 77         }
 78 
 79         if ($this->getCard() === null) {
 80             throw new IPC_Exception('Missing card details');
 81         }
 82 
 83         try {
 84             $this->getCard()->validate();
 85         } catch (\Exception $ex) {
 86             throw new IPC_Exception('Invalid Card details: '.$ex->getMessage());
 87         }
 88 
 89         return true;
 90     }
 91 
 92     /**
 93      * Card object
 94      *
 95      * @return Card
 96      */
 97     public function getCard()
 98     {
 99         return $this->card;
100     }
101 
102     /**
103      * Card object
104      *
105      * @param Card $card
106      */
107     public function setCard($card)
108     {
109         $this->card = $card;
110     }
111 }
112 
API documentation generated by ApiGen