This repository has been archived by the owner on Aug 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Example.java
61 lines (50 loc) · 2.2 KB
/
Example.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
* Copyright 2012 Oliver Siegmar
*
* This file is part of Billomat4J.
*
* Billomat4J is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Billomat4J is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Billomat4J. If not, see <https://www.gnu.org/licenses/>.
*/
package integrationtest;
import java.time.LocalDate;
import de.siegmar.billomat4j.domain.invoice.Invoice;
import de.siegmar.billomat4j.domain.invoice.InvoiceFilter;
import de.siegmar.billomat4j.domain.invoice.InvoiceStatus;
import de.siegmar.billomat4j.service.BillomatConfiguration;
import de.siegmar.billomat4j.service.InvoiceService;
@SuppressWarnings({
"checkstyle:hideutilityclassconstructor",
"checkstyle:uncommentedmain",
"checkstyle:magicnumber",
"checkstyle:regexpmultiline"
})
public class Example {
public static void main(final String[] args) {
final BillomatConfiguration billomatConfiguration = new BillomatConfiguration();
billomatConfiguration.setBillomatId("<billomatId>");
billomatConfiguration.setApiKey("<apiKey>");
// Optional Settings for registered Apps
billomatConfiguration.setAppId("<appId>");
billomatConfiguration.setAppSecret("<appSecret>");
final InvoiceService invoiceService = new InvoiceService(billomatConfiguration);
System.out.println("Paid invoices for the last 30 days:");
final InvoiceFilter invoiceFilter = new InvoiceFilter()
.byFrom(LocalDate.now().minusDays(30))
.byTo(LocalDate.now())
.byStatus(InvoiceStatus.PAID);
for (final Invoice invoice : invoiceService.findInvoices(invoiceFilter)) {
System.out.println("Invoice " + invoice.getInvoiceNumber() + ": " + invoice.getTotalNet());
}
}
}