-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
An invoice in its simplest form. Debtor and creditor account does only support bic-account number. An invoicePayment complements an invoice with more information regarding the payment of the invoice. Out with google guava for tests.
- Loading branch information
Showing
13 changed files
with
334 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/main/java/no/digipost/api/datatypes/types/invoice/Bank.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package no.digipost.api.datatypes.types.invoice; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Value; | ||
import lombok.With; | ||
import no.digipost.api.datatypes.documentation.Description; | ||
|
||
import javax.xml.bind.annotation.XmlElement; | ||
import javax.xml.bind.annotation.XmlType; | ||
|
||
@XmlType | ||
@Value | ||
@AllArgsConstructor | ||
@NoArgsConstructor(force = true, access = AccessLevel.PRIVATE) | ||
@With | ||
public class Bank { | ||
|
||
@XmlElement(name = "id") | ||
@Description("Unique id of the bank to reference the payment with third party") | ||
String id; | ||
|
||
@XmlElement(name = "name") | ||
@Description("Display name of the bank") | ||
String name; | ||
|
||
public static final Bank EXAMPLE = new Bank("ce7ad8ba63d0ea5cd212580192a00156", "Acme Bank inc"); | ||
} |
58 changes: 58 additions & 0 deletions
58
src/main/java/no/digipost/api/datatypes/types/invoice/Invoice.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package no.digipost.api.datatypes.types.invoice; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Value; | ||
import lombok.With; | ||
import no.digipost.api.datatypes.ComplementedBy; | ||
import no.digipost.api.datatypes.DataType; | ||
import no.digipost.api.datatypes.documentation.Description; | ||
import no.digipost.api.datatypes.types.ExternalLink; | ||
|
||
import javax.validation.constraints.Size; | ||
import javax.xml.bind.annotation.XmlElement; | ||
import javax.xml.bind.annotation.XmlRootElement; | ||
import java.math.BigDecimal; | ||
import java.time.ZoneId; | ||
import java.time.ZonedDateTime; | ||
|
||
@XmlRootElement(name = "invoice") | ||
@Value | ||
@AllArgsConstructor | ||
@NoArgsConstructor(force = true, access = AccessLevel.PRIVATE) | ||
@With | ||
@Description("An invoice") | ||
@ComplementedBy({InvoicePayment.class}) | ||
public class Invoice implements DataType { | ||
|
||
@XmlElement | ||
@Description("A link to more information, or further actions that can be taken") | ||
ExternalLink link; | ||
|
||
@XmlElement(required = true, name = "due-date") | ||
@Description("When the payment falls due") | ||
ZonedDateTime dueDate; | ||
|
||
@XmlElement(required = true, name = "sum") | ||
@Description("The sum to be paid") | ||
BigDecimal sum; | ||
|
||
@XmlElement(required = true, name = "creditor-account") | ||
@Description("The creditor account for the payment. Exactly 11 digits") | ||
@Size(min = 11, max = 11) | ||
String creditorAccount; | ||
|
||
@XmlElement | ||
@Description("The customer identification number. Max length 25 chars") | ||
@Size(max = 25) | ||
String kid; | ||
|
||
public static final Invoice EXAMPLE = new Invoice( | ||
ExternalLink.EXAMPLE_NO_DEADLINE | ||
, ZonedDateTime.of(2020, 9, 10, 0, 0, 0, 0, ZoneId.of("+01:00")) | ||
, BigDecimal.valueOf(42) | ||
, "01235424320" | ||
, "1435025439583420243982723" | ||
); | ||
} |
Oops, something went wrong.