1
0
This repository has been archived on 2017-06-06. You can view files and clone it, but cannot push or open issues or pull requests.
Files
informaticaD4P-2017-omnipay…/src/Message/PurchaseRequest.php
2017-04-02 11:54:34 +02:00

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());
}
}