1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62:
<?php
namespace Omnipay\VivaPayments\Message;
use Omnipay\Common\Message\RedirectResponseInterface;
use Omnipay\Common\Message\RequestInterface;
class RedirectResponse extends RestResponse implements RedirectResponseInterface
{
protected $baseEndpoint;
public function __construct(
RequestInterface $request,
$data,
$statusCode = 200,
$baseEndpoint = "http://demo.vivapayments.com"
) {
parent::__construct($request, $data, $statusCode);
$this->baseEndpoint = $baseEndpoint;
}
public function isRedirect()
{
if ($this->getCode() >= 400) {
return false;
}
if (! empty($this->data['ErrorCode'])) {
return false;
}
return true;
}
public function getRedirectUrl()
{
return $this->baseEndpoint . '/web/checkout?ref=' . $this->getTransactionReference();
}
public function getRedirectMethod()
{
return 'GET';
}
public function getRedirectData()
{
return null;
}
}