public function getTransactionReference($serialize = true)
    {
        // The transactionResponse is only returned if succesful or declined
        // for some reason, so don't assume it will always be there.

        if (isset($this->data->transactionResponse)) {
            $body = $this->data->transactionResponse;
            $transactionRef = new TransactionReference();
            $transactionRef->setApprovalCode((string)$body->authCode);
            $transactionRef->setTransId((string)$body->transId);

            try {
                // Need to store card details in the transaction reference since it is required when doing a refund
                if ($card = $this->request->getCard()) {
                    $transactionRef->setCard(array(
                        'number' => $card->getNumberLastFour(),
                        'expiry' => $card->getExpiryDate('mY')
                    ));
                } elseif ($cardReference = $this->request->getCardReference()) {
                    $transactionRef->setCardReference(new CardReference($cardReference));
                }
            } catch (\Exception $e) {
            }

            return $serialize ? (string)$transactionRef : $transactionRef;
        }

        return '';
    }
public function getTransactionReference($serialize = true)
    {
        // The transactionResponse is only returned if succesful or declined
        // for some reason, so don't assume it will always be there.

        if (isset($this->data->transactionResponse)) {
            $body = $this->data->transactionResponse;
            $transactionRef = new TransactionReference();
            $transactionRef->setApprovalCode((string)$body->authCode);
            $transactionRef->setTransId((string)$body->transId);

            try {
                // Need to store card details in the transaction reference since it is required when doing a refund
                if ($card = $this->request->getCard()) {
                    $transactionRef->setCard(array(
                        'number' => $card->getNumberLastFour(),
                        'expiry' => $card->getExpiryDate('mY')
                    ));
                } elseif ($cardReference = $this->request->getCardReference()) {
                    $transactionRef->setCardReference(new CardReference($cardReference));
                }
            } catch (\Exception $e) {
            }

            return $serialize ? (string)$transactionRef : $transactionRef;
        }

        return '';
    }
public function getTransactionReference ( $ serialize = true ) { // The transactionResponse is only returned if succesful or declined // for some reason, so don't assume it will always be there. if ( isset ( $ this -> data -> transactionResponse ) ) { $ body = $ this -> data -> transactionResponse ; $ transactionRef = new TransactionReference ( ) ; $ transactionRef -> setApprovalCode ( ( string ) $ body -> authCode ) ; $ transactionRef -> setTransId ( ( string ) $ body -> transId ) ; try { // Need to store card details in the transaction reference since it is required when doing a refund if ( $ card = $ this -> request -> getCard ( ) ) { $ transactionRef -> setCard ( array ( 'number' => $ card -> getNumberLastFour ( ) , 'expiry' => $ card -> getExpiryDate ( 'mY' ) ) ) ; } elseif ( $ cardReference = $ this -> request -> getCardReference ( ) ) { $ transactionRef -> setCardReference ( new CardReference ( $ cardReference ) ) ; } } catch ( \ Exception $ e ) { } return $ serialize ? ( string ) $ transactionRef : $ transactionRef ; } return '' ; }
A composite key containing the gateway provided transaction reference as
well as other data points that may be required for subsequent transactions
that may need to modify this one.

@param bool $serialize Determines whether a string or object is returned
@return TransactionReference|string
A composite key containing the gateway provided transaction reference as well as other data points that may be required for subsequent transactions that may need to modify this one .