File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
src/Picqer/Financials/Moneybird/Entities Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -231,4 +231,48 @@ public function addAttachment($filename, $contents)
231231
232232 return $ this ;
233233 }
234+
235+ /**
236+ * Pauses the sales invoice. The automatic workflow steps will not be executed while the sales invoice is paused.
237+ *
238+ * @return bool
239+ *
240+ * @throws \Picqer\Financials\Moneybird\Exceptions\ApiException
241+ */
242+ public function pauseWorkflow ()
243+ {
244+ try {
245+ $ this ->connection ()->post ($ this ->endpoint . '/ ' . $ this ->id . '/pause ' , json_encode ([]));
246+ } catch (ApiException $ exception ) {
247+ if (strpos ($ exception ->getMessage (), "The sales_invoice is already paused " ) !== false ) {
248+ return true ; // Everything is fine since the sales invoice was already paused we don't need an error.
249+ }
250+
251+ throw $ exception ;
252+ }
253+
254+ return true ;
255+ }
256+
257+ /**
258+ * Resumes the sales invoice. The automatic workflow steps will execute again after resuming.
259+ *
260+ * @return bool
261+ *
262+ * @throws \Picqer\Financials\Moneybird\Exceptions\ApiException
263+ */
264+ public function resumeWorkflow ()
265+ {
266+ try {
267+ $ this ->connection ()->post ($ this ->endpoint . '/ ' . $ this ->id . '/resume ' , json_encode ([]));
268+ } catch (ApiException $ exception ) {
269+ if (strpos ($ exception ->getMessage (), "The sales_invoice isn't paused " ) !== false ) {
270+ return true ; // Everything is fine since the sales invoice wasn't paused we don't need an error.
271+ }
272+
273+ throw $ exception ;
274+ }
275+
276+ return true ;
277+ }
234278}
You can’t perform that action at this time.
0 commit comments