public function __construct($options = []) { $config = (include __DIR__ . '/../../../config/braspag.config.php'); try { if (is_array($options)) { $config = \array_merge($config, $options); } } catch (\Exception $e) { echo $e->getFile(); } Hydrator::hydrate($this, $config); }
public function __construct($options = []) { Hydrator::hydrate($this, $options); }
/** * Void a payment * @param string $paymentId * @param int $amount * @return mixed */ public function void($paymentId, $amount) { $uri = $this->config['apiUri'] . \sprintf('/sales/%s/void', $paymentId); if ($amount) { $uri .= sprintf('?amount=%f', (double) $amount); } $voidResponse = new VoidResponse(); try { $response = $this->http()->request('PUT', $uri, ['headers' => $this->headers]); $result = \json_decode($response->getBody()->getContents(), 1); Hydrator::hydrate($voidResponse, $result); } catch (RequestException $e) { $voidResponse->setMessages(\json_decode($e->getResponse()->getBody()->getContents(), true)); } return $voidResponse; }