You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Omnipay\Inforbank\Message;
|
|
|
|
class PurchaseRequest extends AbstractRequest
|
|
{
|
|
protected $endpoint = "http://sgni.nl/~113004/index.php/api/transactionRequest";
|
|
|
|
protected function generateSignature()
|
|
{
|
|
return hash("sha256",
|
|
$this->getTransactionId() . $this->getAmountInteger() . $this->getClientSecret()
|
|
);
|
|
}
|
|
|
|
public function getData()
|
|
{
|
|
$this->validate(
|
|
'amount',
|
|
'transactionId',
|
|
'returnUrl'
|
|
);
|
|
|
|
$data = array(
|
|
"clientId" => $this->getClientId(),
|
|
"transactionId" => $this->getTransactionId(),
|
|
"amount" => $this->getAmountInteger(),
|
|
"description" => $this->getDescription(),
|
|
"returnUrl" => $this->getReturnUrl(),
|
|
"hash" => $this->generateSignature()
|
|
);
|
|
|
|
return $data;
|
|
}
|
|
|
|
public function sendData($data)
|
|
{
|
|
$httpResponse = $this->httpClient->post($this->endpoint, null, $data)->send();
|
|
return $this->response = new PurchaseResponse($this, $httpResponse->json());
|
|
}
|
|
}
|