@@ -48,16 +48,72 @@ The following api methods have been implemented:
4848
4949- ` customers ` Customers
5050- ` sales ` Sales invoices
51+ - ` purchases ` Purchase invoices
5152
5253### Getter examples
5354
5455Each resource type has ` getAll() ` and ` getById(1234) ` getters (below examples with customers):
5556
5657``` javascript
5758const customers = await fennoa .customers .getAll (); // array of customers
58- const customer = await fennoa .customers .getById (1234 ); // single customer
59+ const customer = await fennoa .customers .getById (1234 ); // single customer by id
5960```
6061
62+ ### Customer examples
63+
64+ Get customer by customer number:
65+
66+ ``` javascript
67+ const customer = await fennoa .customers .getByCustomerNo (' 1234' ); // single customer by customer number
68+ ```
69+
70+ <br >
71+ Create a new customer
72+
73+ ``` javascript
74+ const newCustomer: INewCustomer = {
75+ customer_no: ' 1234' ,
76+ name: ' Test Customer 2 Oy' ,
77+ name2: ' Nimi 2' ,
78+ address: ' Test Address 1' ,
79+ postalcode: ' 00100' ,
80+ city: ' Helsinki' ,
81+ country_id: ' FI' ,
82+ description: ' Test Description' ,
83+ email: ' test@example.com' ,
84+ phone: ' 0123456789' ,
85+ fax: ' 0123456789' ,
86+ website: ' https://www.example.com' ,
87+ business_id: ' 1837795-7' ,
88+ vat_number: ' FI18377957' ,
89+ identity_number: ' 123456-7890' ,
90+ account_type_id: 1 ,
91+ contact_person: ' John Doe' ,
92+ einvoice_address: ' einvoice@example.com' ,
93+ einvoice_operator_id: ' OKOYFIHH' ,
94+ sales_invoice_delivery_method: ' email' ,
95+ customer_group_ids: [1 , 2 ],
96+ locale_id: 1 ,
97+ locale_code: ' FI'
98+ };
99+
100+ const createdCustomer = await fennoa .customers .createCustomer (newCustomer);
101+ ```
102+
103+ <br >
104+ Update a customer
105+
106+ ``` javascript
107+ const updateCustomer: IUpdateCustomer = {
108+ name: ' Updated Customer Oy'
109+ customer_group_ids: [3 ],
110+ };
111+
112+ const updatedCustomer = await fennoa .customers .updateCustomer (' 1234' , updateCustomer);
113+ ```
114+
115+ <br >
116+
61117### Sales examples
62118
63119Here is an example of creating, approving and sending a new sales invoice to a customer:
0 commit comments