public function getCardData($data = array())
    {
        // Validate the card details (number, date, cardholder name).
        $this->getCard()->validate();

        if ($this->getCardholderName()) {
            $data['CardHolder'] = $this->getCardholderName();
        } else {
            $data['CardHolder'] = $this->getCard()->getName();
        }

        // Card number should not be provided if token is being provided instead
        if (! $this->getToken()) {
            $data['CardNumber'] = $this->getCard()->getNumber();
        }

        $data['ExpiryDate'] = $this->getCard()->getExpiryDate('my');
        $data['CardType'] = $this->getCardBrand();

        if ($this->getCard()->getStartMonth() and $this->getCard()->getStartYear()) {
            $data['StartDate'] = $this->getCard()->getStartDate('my');
        }

        if ($this->getCard()->getIssueNumber()) {
            $data['IssueNumber'] = $this->getCard()->getIssueNumber();
        }

        // If we want the card details to be saved on the gateway as a
        // token or card reference, then request for that to be done.

        $createCard = $this->getCreateToken() ?: $this->getCreateCard();

        if ($createCard !== null) {
            $data['CreateToken'] = $createCard ? static::CREATE_TOKEN_YES : static::CREATE_TOKEN_NO;
        }

        if ($this->getCard()->getCvv() !== null) {
            $data['CV2'] = $this->getCard()->getCvv();
        }

        return $data;
    }
public function getCardData($data = array())
    {
        // Validate the card details (number, date, cardholder name).
        $this->getCard()->validate();

        if ($this->getCardholderName()) {
            $data['CardHolder'] = $this->getCardholderName();
        } else {
            $data['CardHolder'] = $this->getCard()->getName();
        }

        // Card number should not be provided if token is being provided instead
        if (! $this->getToken()) {
            $data['CardNumber'] = $this->getCard()->getNumber();
        }

        $data['ExpiryDate'] = $this->getCard()->getExpiryDate('my');
        $data['CardType'] = $this->getCardBrand();

        if ($this->getCard()->getStartMonth() and $this->getCard()->getStartYear()) {
            $data['StartDate'] = $this->getCard()->getStartDate('my');
        }

        if ($this->getCard()->getIssueNumber()) {
            $data['IssueNumber'] = $this->getCard()->getIssueNumber();
        }

        // If we want the card details to be saved on the gateway as a
        // token or card reference, then request for that to be done.

        $createCard = $this->getCreateToken() ?: $this->getCreateCard();

        if ($createCard !== null) {
            $data['CreateToken'] = $createCard ? static::CREATE_TOKEN_YES : static::CREATE_TOKEN_NO;
        }

        if ($this->getCard()->getCvv() !== null) {
            $data['CV2'] = $this->getCard()->getCvv();
        }

        return $data;
    }
public function getCardData ( $ data = array ( ) ) { // Validate the card details (number, date, cardholder name). $ this -> getCard ( ) -> validate ( ) ; if ( $ this -> getCardholderName ( ) ) { $ data [ 'CardHolder' ] = $ this -> getCardholderName ( ) ; } else { $ data [ 'CardHolder' ] = $ this -> getCard ( ) -> getName ( ) ; } // Card number should not be provided if token is being provided instead if ( ! $ this -> getToken ( ) ) { $ data [ 'CardNumber' ] = $ this -> getCard ( ) -> getNumber ( ) ; } $ data [ 'ExpiryDate' ] = $ this -> getCard ( ) -> getExpiryDate ( 'my' ) ; $ data [ 'CardType' ] = $ this -> getCardBrand ( ) ; if ( $ this -> getCard ( ) -> getStartMonth ( ) and $ this -> getCard ( ) -> getStartYear ( ) ) { $ data [ 'StartDate' ] = $ this -> getCard ( ) -> getStartDate ( 'my' ) ; } if ( $ this -> getCard ( ) -> getIssueNumber ( ) ) { $ data [ 'IssueNumber' ] = $ this -> getCard ( ) -> getIssueNumber ( ) ; } // If we want the card details to be saved on the gateway as a // token or card reference, then request for that to be done. $ createCard = $ this -> getCreateToken ( ) ? : $ this -> getCreateCard ( ) ; if ( $ createCard !== null ) { $ data [ 'CreateToken' ] = $ createCard ? static :: CREATE_TOKEN_YES : static :: CREATE_TOKEN_NO ; } if ( $ this -> getCard ( ) -> getCvv ( ) !== null ) { $ data [ 'CV2' ] = $ this -> getCard ( ) -> getCvv ( ) ; } return $ data ; }
If a credit card is being used, then include the details
of the card in the data.

@param array $data The data collected so far (to be added to).
@return array
If a credit card is being used then include the details of the card in the data .