/**
  * Request to Adyen with query string used for Directory Lookup
  *
  * @param \Adyen\Service $service
  * @param $requestUrl
  * @param $params
  * @return mixed
  * @throws \Adyen\AdyenException
  */
 public function requestPost(\Adyen\Service $service, $requestUrl, $params)
 {
     $client = $service->getClient();
     $config = $client->getConfig();
     $logger = $client->getLogger();
     $username = $config->getUsername();
     $password = $config->getPassword();
     // log the requestUr, params and json request
     $logger->info("Request url to Adyen: " . $requestUrl);
     $logger->info('Params in request to Adyen:' . print_r($params, 1));
     //Initiate cURL.
     $ch = curl_init($requestUrl);
     //Tell cURL that we want to send a POST request.
     curl_setopt($ch, CURLOPT_POST, 1);
     // set authorisation
     curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
     curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);
     curl_setopt($ch, CURLOPT_POST, count($params));
     curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
     // set a custom User-Agent
     $userAgent = $config->get('applicationName') . " " . \Adyen\Client::USER_AGENT_SUFFIX . $client->getLibraryVersion();
     //Set the content type to application/json and use the defined userAgent
     $headers = array('Content-Type: application/json', 'User-Agent: ' . $userAgent);
     // return the result
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     //Execute the request
     $result = curl_exec($ch);
     $httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);
     // log the raw response
     $logger->info("JSON Response is: " . $result);
     if ($httpStatus != 200 && $result) {
         $this->handleResultError($result, $logger);
     } elseif (!$result) {
         $errno = curl_errno($ch);
         $message = curl_error($ch);
         $httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);
         curl_close($ch);
         $this->handleCurlError($requestUrl, $errno, $message, $logger);
     }
     curl_close($ch);
     // result in array or json
     if ($config->getOutputType() == 'array') {
         // transform to PHP Array
         $result = json_decode($result, true);
         if (!$result) {
             $msg = "The result is empty, looks like your request is invalid";
             $logger->error($msg);
             throw new \Adyen\AdyenException($msg);
         }
         // log the array result
         $logger->info('Params in response from Adyen:' . print_r($result, 1));
     }
     return $result;
 }
 public function __construct(\Adyen\Client $client)
 {
     parent::__construct($client);
     $this->_cancel = new \Adyen\Service\ResourceModel\Modification\Cancel($this);
     $this->_cancelOrRefund = new \Adyen\Service\ResourceModel\Modification\CancelOrRefund($this);
     $this->_capture = new \Adyen\Service\ResourceModel\Modification\Capture($this);
     $this->_refund = new \Adyen\Service\ResourceModel\Modification\Refund($this);
 }
Beispiel #3
0
 public function __construct(\Adyen\Client $client)
 {
     parent::__construct($client);
     $this->_confirm = new \Adyen\Service\ResourceModel\Payout\Confirm($this);
     $this->_decline = new \Adyen\Service\ResourceModel\Payout\Decline($this);
     $this->_storeDetailsAndSubmit = new \Adyen\Service\ResourceModel\Payout\StoreDetailsAndSubmit($this);
     $this->_submit = new \Adyen\Service\ResourceModel\Payout\Submit($this);
     $this->_confirmThirdParty = new \Adyen\Service\ResourceModel\Payout\ThirdParty\ConfirmThirdParty($this);
     $this->_declineThirdParty = new \Adyen\Service\ResourceModel\Payout\ThirdParty\DeclineThirdParty($this);
     $this->_storeDetailsAndSubmitThirdParty = new \Adyen\Service\ResourceModel\Payout\ThirdParty\StoreDetailsAndSubmitThirdParty($this);
     $this->_submitThirdParty = new \Adyen\Service\ResourceModel\Payout\ThirdParty\SubmitThirdParty($this);
 }
 public function __construct(\Adyen\Client $client)
 {
     parent::__construct($client);
     $this->_directoryLookup = new \Adyen\Service\ResourceModel\DirectoryLookup\Directory($this);
 }
 public function __construct(\Adyen\Client $client)
 {
     parent::__construct($client);
     $this->_listRecurringDetails = new \Adyen\Service\ResourceModel\Recurring\ListRecurringDetails($this);
     $this->_disable = new \Adyen\Service\ResourceModel\Recurring\Disable($this, $this->getClient()->getConfig()->get('endpoint') . '/disable', array('merchantAccount', 'shopperReference'));
 }
 public function __construct(\Adyen\Client $client)
 {
     parent::__construct($client);
     $this->_authorise = new \Adyen\Service\ResourceModel\Payment\Authorise($this);
     $this->_authorise3D = new \Adyen\Service\ResourceModel\Payment\Authorise3D($this);
 }