Skip to content
8 changes: 8 additions & 0 deletions src/Omnipay/Realex/Message/AuthRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ public function getData()
{
$this->validate('amount', 'currency', 'transactionId');

// Set the endpoint to be used during the connection
$this->setEndpoint($this->getEndpoint());

// Create the hash
$timestamp = strftime("%Y%m%d%H%M%S");
$merchantId = $this->getMerchantId();
Expand Down Expand Up @@ -163,4 +166,9 @@ public function getEndpoint()
{
return $this->endpoint;
}

public function setEndpoint($value)
{
$this->endpoint = $value;
}
}
8 changes: 8 additions & 0 deletions src/Omnipay/Realex/Message/AuthResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,12 @@ public function getRedirectUrl()
{
return '';
}

/**
* Returns the full xml response
*/
public function getXML()
{
return $this->xml->asXML();
}
}
9 changes: 9 additions & 0 deletions src/Omnipay/Realex/Message/EnrolmentRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ protected function createResponse($data)
$request = new AuthRequest($this->httpClient, $this->httpRequest);
$request->initialize($this->getParameters());

if (method_exists($request, 'setEndpoint')) {
$request->setEndpoint($this->getEndpoint());
}

$response = $request->send();
}

Expand All @@ -124,4 +128,9 @@ public function getEndpoint()
{
return $this->endpoint;
}

public function setEndpoint($endpoint)
{
$this->endpoint = $endpoint;
}
}
8 changes: 8 additions & 0 deletions src/Omnipay/Realex/Message/EnrolmentResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,12 @@ public function getRedirectData()
'MD' => $this->getMerchantData()
);
}

/**
* Returns the full xml response
*/
public function getXML()
{
return $this->xml->asXML();
}
}
6 changes: 6 additions & 0 deletions src/Omnipay/Realex/Message/VerifySigRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ public function getEndpoint()
return $this->endpoint;
}

public function setEndpoint($endpoint)
{
$this->endpoint = $endpoint;
}

/**
* @param mixed $parameters
*
Expand Down Expand Up @@ -156,6 +161,7 @@ public function sendData($parameters)
* @var AuthResponse $response
*/
$request = new AuthRequest($this->httpClient, $this->httpRequest);
$request->setEndpoint($this->getEndpoint());
$request->initialize($parameters);

$response = $request->send();
Expand Down
8 changes: 8 additions & 0 deletions src/Omnipay/Realex/Message/VerifySigResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,12 @@ public function getRedirectUrl()
{
return '';
}

/**
* Returns the full xml response
*/
public function getXML()
{
return $this->xml->asXML();
}
}
27 changes: 27 additions & 0 deletions src/Omnipay/Realex/RemoteGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ public function set3dSecure($value)
{
return $this->setParameter('3dSecure', $value);
}
protected function createRequest($class, array $parameters)
{
$obj = new $class($this->httpClient, $this->httpRequest);
// Set the endpoint on the subject class if available
if (method_exists($obj, 'setEndpoint')) {
$obj->setEndpoint($this->getEndpoint());
}

return $obj->initialize(array_replace($this->getParameters(), $parameters));
}

public function purchase(array $parameters = array())
{
Expand Down Expand Up @@ -150,4 +160,21 @@ public function updateCustomer(array $parameters = array())
{
return $this->createRequest('\Omnipay\Realex\Message\UpdateCustomerRequest', $parameters);
}

/**
* Allow the user to set the endpoint
*/
public function setEndpoint($value)
{
return $this->setParameter('endpoint', $value);
}

public function getEndpoint()
{
if (null !== $this->getParameter('endpoint')) {
return $this->getParameter('endpoint');
} else {
return 'https://epage.payandshop.com/epage-remote.cgi';
}
}
}