Your IP : 216.73.216.224


Current Path : /var/www/html/libraries/omnipay/vendor/omnipay/mollie/src/Message/
Upload File :
Current File : /var/www/html/libraries/omnipay/vendor/omnipay/mollie/src/Message/AbstractRequest.php

<?php

namespace Omnipay\Mollie\Message;

use Guzzle\Common\Event;

abstract class AbstractRequest extends \Omnipay\Common\Message\AbstractRequest
{
    protected $endpoint = 'https://api.mollie.nl/v1';

    public function getApiKey()
    {
        return $this->getParameter('apiKey');
    }

    public function setApiKey($value)
    {
        return $this->setParameter('apiKey', $value);
    }
    
    public function getLocale()
    {
    	return $this->getParameter('localeCode');
    }
    
    public function setLocale($value)
    {
    	return $this->setParameter('localeCode', $value);
    }

    protected function sendRequest($method, $endpoint, $data = null)
    {
        $this->httpClient->getEventDispatcher()->addListener('request.error', function (Event $event) {
            /**
             * @var \Guzzle\Http\Message\Response $response
             */
            $response = $event['response'];

            if ($response->isError()) {
                $event->stopPropagation();
            }
        });

        $httpRequest = $this->httpClient->createRequest(
            $method,
            $this->endpoint . $endpoint,
            array(
                'Authorization' => 'Bearer ' . $this->getApiKey()
            ),
            $data
        );

        return $httpRequest->send();
    }
}