for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Omnipay\CapitaPay360\Message;
use Omnipay\Common\Message\AbstractResponse;
/**
* CapitaPay360 Complete Purchase Response
*/
class CompletePurchaseResponse extends AbstractResponse
{
* Is the response successful?
*
* @return boolean
public function isSuccessful()
return $this->data->transactionState == 'COMPLETE' && $this->data->paymentResult->status == 'SUCCESS';
}
* Get the authorisation code if available.
* @return null|string
public function getTransactionReference()
return $this->isSuccessful() ? $this->data->paymentResult->paymentDetails->authDetails->authCode : null;
* Get the merchant response message if available.
public function getMessage()
if ($this->isSuccessful())
return null;
if (isset($this->data->paymentResult->errorDetails->errorMessage))
return $this->data->paymentResult->errorDetails->errorMessage;
return $this->data->transactionState;
* Get the card brand if available e.g. Visa
public function getCardBrand()
return $this->isSuccessful() ? $this->data->paymentResult->paymentDetails->authDetails->cardDescription : null;
* Get the card expiry if available e.g. Visa
public function getCardExpiry()
return $this->isSuccessful() ? $this->data->paymentResult->paymentDetails->authDetails->expiryDate : null;
* Get the card masked number if available e.g. Visa
public function getCardNumber()
return $this->isSuccessful() ? $this->data->paymentResult->paymentDetails->authDetails->maskedCardNumber : null;