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/CompletePurchaseRequest.php

38 lines
938 B
PHP

<?php
namespace Omnipay\Inforbank\Message;
class CompletePurchaseRequest extends AbstractRequest
{
protected $endpoint = "http://localhost:8080/api/statusRequest";
protected function generateSignature()
{
return sha1(
$this->getTransactionReference() . $this->getClientSecret()
);
}
public function getTransactionReference()
{
return $this->httpRequest->query->get('trxid');
}
public function getData()
{
$data = array(
"clientId" => $this->getClientId(),
"transactionId" => $this->getTransactionReference(),
"sha1" => $this->generateSignature()
);
return $data;
}
public function sendData($data)
{
$httpResponse = $this->httpClient->post($this->endpoint, null, $data)->send();
return $this->response = new CompletePurchaseResponse($this, $httpResponse->json());
}
}