setLocation($url); } /** * Creates the resource. * * @param array $data Creation data * * @throws ConnectorException When the API replies with an error response * @throws RequestException When an error is encountered * @throws \RuntimeException If the location header is missing * @throws \RuntimeException If the API replies with an unexpected response * @throws \LogicException When Guzzle cannot populate the response * * @return self */ public function create(array $data) { $url = $this->post($this->getLocation(), $data) ->status('201') ->getLocation(); $this->setLocation($url); return $this; } /** * Appends shipping information to the capture. * * @param array $data Shipping info data * * @throws ConnectorException When the API replies with an error response * @throws RequestException When an error is encountered * @throws \RuntimeException If the API replies with an unexpected response * @throws \LogicException When Guzzle cannot populate the response * * @return self */ public function addShippingInfo(array $data) { $this->post($this->getLocation() . '/shipping-info', $data) ->status('204'); return $this; } /** * Updates the customers details. * * @param array $data Customer details data * * @throws ConnectorException When the API replies with an error response * @throws RequestException When an error is encountered * @throws \RuntimeException If the API replies with an unexpected response * @throws \LogicException When Guzzle cannot populate the response * * @return self */ public function updateCustomerDetails(array $data) { $this->patch($this->getLocation() . '/customer-details', $data) ->status('204'); return $this; } /** * Trigger send outs for this capture. * * @throws ConnectorException When the API replies with an error response * @throws RequestException When an error is encountered * @throws \RuntimeException If the API replies with an unexpected response * @throws \LogicException When Guzzle cannot populate the response * * @return self */ public function triggerSendout() { $this->post($this->getLocation() . '/trigger-send-out') ->status('204'); return $this; } }