Skip to content

Commit

Permalink
Merge pull request #289 from MultiSuperFreek/patch-1
Browse files Browse the repository at this point in the history
Support changing estimate state
  • Loading branch information
stephangroen authored Nov 2, 2023
2 parents 91871e0 + 1766a61 commit b2ffa6c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/Picqer/Financials/Moneybird/Entities/Estimate.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,27 @@ public function sendEstimate($deliveryMethodOrOptions = SendInvoiceOptions::METH

return $this;
}

/**
* Change the state of the estimate.
*
* @see https://developer.moneybird.com/api/estimates/#patch_estimates_id_change_state
*
* @param string $state
* @return $this
*
* @throws ApiException
*/
public function changeState(string $state)
{
$response = $this->connection()->patch($this->getEndpoint() . '/' . urlencode($this->id) . '/change_state', json_encode([
'state' => $state,
]));

if (is_array($response)) {
$this->selfFromResponse($response);
}

return $this;
}
}

0 comments on commit b2ffa6c

Please sign in to comment.