for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Omnipay\WindcaveHpp\Message;
use Omnipay\Common\Exception\InvalidRequestException;
use Omnipay\Common\Message\AbstractRequest;
use Omnipay\Common\Message\NotificationInterface;
class AcceptNotification extends PurchaseRequest {
public function getData()
{
return [
'sessionId' => $this->httpRequest->query->get('sessionId') ?? $this->httpRequest->request->get('sessionId') ?? '',
'username' => $this->httpRequest->query->get('username') ?? $this->httpRequest->request->get('username') ?? '',
];
}
public function sendData($data)
if ( empty($data['sessionId']) ) {
throw new InvalidRequestException('Session id is required');
$sessionId = $data['sessionId'];
$headers = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
'Authorization' => 'Basic ' . $this->getAuthorization()
try {
$httpResponse = $this->httpClient->request('GET', $this->getEndpoint('sessions/' . $sessionId), $headers);
} catch (\Exception $exception) {
throw new InvalidRequestException($exception->getMessage());
$transactionData = json_decode($httpResponse->getBody()->getContents(), true);
return $this->response = new CompletePurchaseResponse($this, $transactionData);