1
0
Fork 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.
informaticaD4P-2017-omnipay.../src/Message/PurchaseRequest.php

42 lines
1.1 KiB
PHP
Raw Normal View History

<?php
namespace Omnipay\Inforbank\Message;
class PurchaseRequest extends AbstractRequest
{
2017-02-19 11:24:32 +00:00
protected $endpoint = "http://localhost:8080/api/transactionRequest";
protected function generateSignature()
{
return sha1(
$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(),
"sha1" => $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());
}
}