Skip to content

Commit

Permalink
Send optional request when converting order to invoice
Browse files Browse the repository at this point in the history
  • Loading branch information
kg-bot committed Feb 18, 2020
1 parent a502625 commit 946a932
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Models/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,13 @@ public function shipments()
* @throws \Rackbeat\Exceptions\RackbeatClientException
* @throws \Rackbeat\Exceptions\RackbeatRequestException
*/
public function convertToInvoice($book = false)
public function convertToInvoice($book = false, $request = [])
{
return $this->request->handleWithExceptions(function () use ($book) {
return $this->request->handleWithExceptions(function () use ($book, $request) {

$response = json_decode((string)$this->request->client->post("{$this->entity}/{$this->url_friendly_id}/convert-to-invoice?book=" . (($book === true) ? 'true' : 'false'))
->getBody());
$response = json_decode((string)$this->request->client->post("{$this->entity}/{$this->url_friendly_id}/convert-to-invoice?book=" . (($book === true) ? 'true' : 'false'), [
'json' => $request,
])->getBody(), false);

$invoice = (new CustomerInvoiceBuilder($this->request))->find($response->invoice_id);

Expand Down

0 comments on commit 946a932

Please sign in to comment.