Skip to content

Commit

Permalink
Merge pull request #2 from SimonsThijs/main
Browse files Browse the repository at this point in the history
send endpoint
  • Loading branch information
UnderKoen committed Oct 12, 2023
2 parents b71b1ee + 412b5af commit c74dba0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/common.ts
Expand Up @@ -255,6 +255,16 @@ export interface ISalesInvoiceCreate {
from_checkout?: boolean;
}

export interface ISalesInvoiceSending {
delivery_method?: "Email" | "Simplerinvoicing" | "Manual";
sending_scheduled?: boolean;
deliver_ubl?: boolean;
mergeable?: boolean;
email_address?: string;
email_message?: string;
invoice_date?: string;
}

export interface IPayment {
id: string;
administration_id: string;
Expand Down
17 changes: 16 additions & 1 deletion src/salesInvoice.ts
@@ -1,7 +1,12 @@
import { HttpHandler } from "./httpHandler";
import { Moneybird } from "./moneybird";
import { Administration } from "./administration";
import { IAttachment, IPayment, IPaymentCreate, ISalesInvoice } from "./common";
import {
IAttachment, IPayment,
IPaymentCreate,
ISalesInvoice,
ISalesInvoiceSending,
} from "./common";

export class SalesInvoice {
private readonly moneybird: Moneybird;
Expand All @@ -25,6 +30,16 @@ export class SalesInvoice {
);
}

/**
* Send the sales invoice
* @returns A sales invoice
*/
public async send(data: ISalesInvoiceSending = {}): Promise<SalesInvoice> {
return this.HTTP.PATCH<SalesInvoice>("send_invoice", {
sales_invoice_sending: data,
});
}

/**
* Download the PDF of the sales invoice
* @returns The content of the PDF
Expand Down

0 comments on commit c74dba0

Please sign in to comment.