Skip to content

Commit b3f16ad

Browse files
Sales Invoices
1 parent 82977b6 commit b3f16ad

23 files changed

+768
-21
lines changed

docs/endpoints.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -194,32 +194,32 @@ This document tracks the implementation progress of all Moneybird API endpoints
194194

195195
## Sales Invoices
196196
147. [x] GET /sales_invoices - List all sales invoices (paginate)
197-
148. [ ] GET /sales_invoices/synchronization - List all ids and versions
198-
149. [ ] POST /sales_invoices/synchronization - Fetch sales invoices with given ids
197+
148. [x] GET /sales_invoices/synchronization - List all ids and versions
198+
149. [x] POST /sales_invoices/synchronization - Fetch sales invoices with given ids
199199
150. [x] GET /sales_invoices/{id} - Get sales invoice
200200
151. [x] GET /sales_invoices/find_by_invoice_id/{invoice_id} - Find sales invoice by invoice id
201201
152. [x] GET /sales_invoices/find_by_reference/{reference} - Find sales invoice by reference
202202
153. [x] POST /sales_invoices - Create sales invoice
203-
154. [ ] PATCH /sales_invoices/{id} - Update sales invoice
204-
155. [ ] DELETE /sales_invoices/{id} - Delete sales invoice
203+
154. [x] PATCH /sales_invoices/{id} - Update sales invoice
204+
155. [x] DELETE /sales_invoices/{id} - Delete sales invoice
205205
156. [x] POST /sales_invoices/{id}/payments - Create payment for sales invoice
206-
157. [ ] DELETE /sales_invoices/{id}/payments/{payment_id} - Delete payment for sales invoice
207-
158. [ ] POST /sales_invoices/{id}/send_email - Send sales invoice by email
208-
159. [ ] GET /sales_invoices/{id}/send_email_template - Get send sales invoice email template
209-
160. [ ] POST /sales_invoices/{id}/send_reminder - Send sales invoice reminder by email
210-
161. [ ] GET /sales_invoices/{id}/send_reminder_template - Get send sales invoice reminder email template
211-
162. [ ] POST /sales_invoices/{id}/send_invoice_reminder - Send invoice reminder by email
212-
163. [ ] GET /sales_invoices/{id}/send_invoice_reminder_template - Get send invoice reminder email template
213-
164. [ ] POST /sales_invoices/{id}/send_payment_reminder - Send payment reminder by email
214-
165. [ ] GET /sales_invoices/{id}/send_payment_reminder_template - Get send payment reminder email template
215-
166. [ ] POST /sales_invoices/{id}/send_post - Send sales invoice by post
216-
167. [ ] POST /sales_invoices/{id}/mark_as_sent - Mark sales invoice as sent
217-
168. [ ] POST /sales_invoices/{id}/mark_as_accepted - Mark sales invoice as accepted
218-
169. [ ] POST /sales_invoices/{id}/mark_as_paid - Mark sales invoice as paid
219-
170. [ ] POST /sales_invoices/{id}/mark_as_uncollectible - Mark sales invoice as uncollectible
220-
171. [ ] POST /sales_invoices/{id}/mark_as_published - Mark sales invoice as published
221-
172. [ ] POST /sales_invoices/{id}/mark_as_unpublished - Mark sales invoice as unpublished
222-
173. [ ] POST /sales_invoices/{id}/duplicate - Duplicate sales invoice
206+
157. [x] DELETE /sales_invoices/{id}/payments/{payment_id} - Delete payment for sales invoice
207+
158. [x] POST /sales_invoices/{id}/send_email - Send sales invoice by email
208+
159. [x] GET /sales_invoices/{id}/send_email_template - Get send sales invoice email template
209+
160. [x] POST /sales_invoices/{id}/send_reminder - Send sales invoice reminder by email
210+
161. [x] GET /sales_invoices/{id}/send_reminder_template - Get send sales invoice reminder email template
211+
162. [x] POST /sales_invoices/{id}/send_invoice_reminder - Send invoice reminder by email
212+
163. [x] GET /sales_invoices/{id}/send_invoice_reminder_template - Get send invoice reminder email template
213+
164. [x] POST /sales_invoices/{id}/send_payment_reminder - Send payment reminder by email
214+
165. [x] GET /sales_invoices/{id}/send_payment_reminder_template - Get send payment reminder email template
215+
166. [x] POST /sales_invoices/{id}/send_post - Send sales invoice by post
216+
167. [x] POST /sales_invoices/{id}/mark_as_sent - Mark sales invoice as sent
217+
168. [x] POST /sales_invoices/{id}/mark_as_accepted - Mark sales invoice as accepted
218+
169. [x] POST /sales_invoices/{id}/mark_as_paid - Mark sales invoice as paid
219+
170. [x] POST /sales_invoices/{id}/mark_as_uncollectible - Mark sales invoice as uncollectible
220+
171. [x] POST /sales_invoices/{id}/mark_as_published - Mark sales invoice as published
221+
172. [x] POST /sales_invoices/{id}/mark_as_unpublished - Mark sales invoice as unpublished
222+
173. [x] POST /sales_invoices/{id}/duplicate - Duplicate sales invoice
223223
174. [x] POST /sales_invoices/{id}/duplicate_to_credit_invoice - Duplicate sales invoice to credit invoice
224224

225225
## Subscription Templates
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Sandorian\Moneybird\Api\SalesInvoices;
6+
7+
use Sandorian\Moneybird\Api\Support\BaseJsonDeleteRequest;
8+
9+
class DeleteSalesInvoiceRequest extends BaseJsonDeleteRequest
10+
{
11+
public function __construct(
12+
protected readonly string $salesInvoiceId,
13+
) {
14+
//
15+
}
16+
17+
public function resolveEndpoint(): string
18+
{
19+
return "sales_invoices/{$this->salesInvoiceId}";
20+
}
21+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Sandorian\Moneybird\Api\SalesInvoices;
6+
7+
use Saloon\Http\Response;
8+
use Sandorian\Moneybird\Api\Support\BaseJsonPostRequest;
9+
10+
class DuplicateSalesInvoiceRequest extends BaseJsonPostRequest
11+
{
12+
public function __construct(
13+
protected readonly string $salesInvoiceId,
14+
) {
15+
//
16+
}
17+
18+
public function resolveEndpoint(): string
19+
{
20+
return "sales_invoices/{$this->salesInvoiceId}/duplicate";
21+
}
22+
23+
public function createDtoFromResponse(Response $response): SalesInvoice
24+
{
25+
return SalesInvoice::createFromResponseData($response->json());
26+
}
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Sandorian\Moneybird\Api\SalesInvoices;
6+
7+
use Saloon\Http\Response;
8+
use Sandorian\Moneybird\Api\Support\BaseJsonGetRequest;
9+
10+
class GetInvoiceReminderTemplateRequest extends BaseJsonGetRequest
11+
{
12+
public function __construct(
13+
protected readonly string $salesInvoiceId,
14+
) {
15+
//
16+
}
17+
18+
public function resolveEndpoint(): string
19+
{
20+
return "sales_invoices/{$this->salesInvoiceId}/send_invoice_reminder_template";
21+
}
22+
23+
public function createDtoFromResponse(Response $response): array
24+
{
25+
return $response->json();
26+
}
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Sandorian\Moneybird\Api\SalesInvoices;
6+
7+
use Saloon\Http\Response;
8+
use Sandorian\Moneybird\Api\Support\BaseJsonGetRequest;
9+
10+
class GetPaymentReminderTemplateRequest extends BaseJsonGetRequest
11+
{
12+
public function __construct(
13+
protected readonly string $salesInvoiceId,
14+
) {
15+
//
16+
}
17+
18+
public function resolveEndpoint(): string
19+
{
20+
return "sales_invoices/{$this->salesInvoiceId}/send_payment_reminder_template";
21+
}
22+
23+
public function createDtoFromResponse(Response $response): array
24+
{
25+
return $response->json();
26+
}
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Sandorian\Moneybird\Api\SalesInvoices;
6+
7+
use Saloon\Http\Response;
8+
use Sandorian\Moneybird\Api\Support\BaseJsonGetRequest;
9+
10+
class GetSalesInvoiceEmailTemplateRequest extends BaseJsonGetRequest
11+
{
12+
public function __construct(
13+
protected readonly string $salesInvoiceId,
14+
) {
15+
//
16+
}
17+
18+
public function resolveEndpoint(): string
19+
{
20+
return "sales_invoices/{$this->salesInvoiceId}/send_email_template";
21+
}
22+
23+
public function createDtoFromResponse(Response $response): array
24+
{
25+
return $response->json();
26+
}
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Sandorian\Moneybird\Api\SalesInvoices;
6+
7+
use Saloon\Http\Response;
8+
use Sandorian\Moneybird\Api\Support\BaseJsonGetRequest;
9+
10+
class GetSalesInvoiceReminderTemplateRequest extends BaseJsonGetRequest
11+
{
12+
public function __construct(
13+
protected readonly string $salesInvoiceId,
14+
) {
15+
//
16+
}
17+
18+
public function resolveEndpoint(): string
19+
{
20+
return "sales_invoices/{$this->salesInvoiceId}/send_reminder_template";
21+
}
22+
23+
public function createDtoFromResponse(Response $response): array
24+
{
25+
return $response->json();
26+
}
27+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Sandorian\Moneybird\Api\SalesInvoices;
6+
7+
use Saloon\Http\Response;
8+
use Sandorian\Moneybird\Api\Support\BaseJsonGetRequest;
9+
use Sandorian\Moneybird\Api\Support\IdVersion;
10+
11+
class GetSalesInvoicesSynchronizationRequest extends BaseJsonGetRequest
12+
{
13+
public function resolveEndpoint(): string
14+
{
15+
return 'sales_invoices/synchronization';
16+
}
17+
18+
/**
19+
* @return array<IdVersion>
20+
*/
21+
public function createDtoFromResponse(Response $response): array
22+
{
23+
return array_map(
24+
fn (array $data) => IdVersion::createFromResponseData($data),
25+
$response->json()
26+
);
27+
}
28+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Sandorian\Moneybird\Api\SalesInvoices;
6+
7+
use Saloon\Http\Response;
8+
use Sandorian\Moneybird\Api\Support\BaseJsonPostRequest;
9+
10+
class MarkSalesInvoiceAsAcceptedRequest extends BaseJsonPostRequest
11+
{
12+
public function __construct(
13+
protected readonly string $salesInvoiceId,
14+
) {
15+
//
16+
}
17+
18+
public function resolveEndpoint(): string
19+
{
20+
return "sales_invoices/{$this->salesInvoiceId}/mark_as_accepted";
21+
}
22+
23+
public function createDtoFromResponse(Response $response): SalesInvoice
24+
{
25+
return SalesInvoice::createFromResponseData($response->json());
26+
}
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Sandorian\Moneybird\Api\SalesInvoices;
6+
7+
use Saloon\Http\Response;
8+
use Sandorian\Moneybird\Api\Support\BaseJsonPostRequest;
9+
10+
class MarkSalesInvoiceAsPaidRequest extends BaseJsonPostRequest
11+
{
12+
public function __construct(
13+
protected readonly string $salesInvoiceId,
14+
) {
15+
//
16+
}
17+
18+
public function resolveEndpoint(): string
19+
{
20+
return "sales_invoices/{$this->salesInvoiceId}/mark_as_paid";
21+
}
22+
23+
public function createDtoFromResponse(Response $response): SalesInvoice
24+
{
25+
return SalesInvoice::createFromResponseData($response->json());
26+
}
27+
}

0 commit comments

Comments
 (0)