Added base plugin, in preperation for the API
This commit is contained in:
40
src/Message/PurchaseRequest.php
Normal file
40
src/Message/PurchaseRequest.php
Normal 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());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user