1
0

Added base plugin, in preperation for the API

This commit is contained in:
2017-02-19 11:19:42 +01:00
parent 64d7fa13d7
commit 3e0d67caca
8 changed files with 181 additions and 7 deletions

View File

@ -0,0 +1,40 @@
<?php
namespace Omnipay\Inforbank\Message;
class PurchaseRequest extends AbstractRequest
{
protected $endpoint = "https://inforbank.nl/api/transactionRequest";
protected function generateSignature()
{
return sha1(
$this->getTransactionId() . $this->getAmountInteger() . $this->getClientId() . $this->getClientSecret()
);
}
public function getData()
{
$this->validate(
'amount',
'transactionId',
'returnUrl'
);
$data = array(
"clientId" => $this->getClientId(),
"clientSecret" => $this->getClientSecret(),
"transactionId" => $this->getTransactionId(),
"amount" => $this->getAmountInteger(),
"description" => $this->getDescription(),
"returnUrl" => $this->getReturnUrl(),
"sha1" => $this->generateSignature()
);
}
public function sendData($data)
{
$httpResponse = $this->httpClient->post($this->endpoint, null, $data)->send();
return $this->response = new PurchaseResponse($this, $httpResponse->json());
}
}