File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
src/Picqer/Financials/Moneybird/Entities Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,10 @@ var_dump($salesInvoice); // SalesInvoice object
8484// *** Officially unsupported in the Moneybird API ***
8585$pdfContents = $salesInvoice->download();
8686
87+ // Example: Create credit invoice based on existing invoice
88+ $creditInvoice = $salesInvoice->duplicateToCreditInvoice();
89+ var_dump($creditInvoice); // SalesInvoice object
90+
8791// Example: Create a new contact
8892$contact = $moneybird->contact();
8993
Original file line number Diff line number Diff line change @@ -162,4 +162,18 @@ public function addNote(Note $note)
162162 $ note ->jsonWithNamespace ()
163163 );
164164 }
165+
166+ /**
167+ * Create a credit invoice based on the current invoice.
168+ *
169+ * @return \Picqer\Financials\Moneybird\Entities\SalesInvoice
170+ */
171+ public function duplicateToCreditInvoice ()
172+ {
173+ $ response = $ this ->connection ()->patch ($ this ->getEndpoint () . '/ ' . $ this ->id . '/duplicate_creditinvoice ' ,
174+ json_encode ([]) // No body needed for this call. The patch method however needs one.
175+ );
176+
177+ return $ this ->makeFromResponse ($ response );
178+ }
165179}
You can’t perform that action at this time.
0 commit comments