File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
src/Picqer/Financials/Moneybird/Entities Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -99,4 +99,38 @@ public function sendInvoice($deliveryMethod = 'Email')
9999 ]
100100 ]));
101101 }
102+
103+ /**
104+ * Find SalesInvoice by invoice_id
105+ *
106+ * @param $invoiceId
107+ * @return static
108+ */
109+ public function findByInvoiceId ($ invoiceId )
110+ {
111+ $ result = $ this ->connection ()->get ($ this ->getUrl () . '/find_by_invoice_id/ ' . urlencode ($ invoiceId ));
112+
113+ return $ this ->makeFromResponse ($ result );
114+ }
115+
116+ /**
117+ * Register a payment for the current invoice
118+ *
119+ * @param array $data required keys are payment_date and price
120+ * @throws ApiException
121+ */
122+ public function registerPayment (array $ data )
123+ {
124+ if (! isset ($ data ['payment_date ' ])) {
125+ throw new ApiException ('Required [payment_date] is missing ' );
126+ }
127+
128+ if (! isset ($ data ['price ' ])) {
129+ throw new ApiException ('Required [price] is missing ' );
130+ }
131+
132+ $ this ->connection ()->patch ($ this ->url . '/ ' . $ this ->id . '/register_payment ' , json_encode ([
133+ 'payment ' => $ data
134+ ]));
135+ }
102136}
You can’t perform that action at this time.
0 commit comments