diff --git a/datatypes-examples.xml b/datatypes-examples.xml index 23013311..77ffe793 100644 --- a/datatypes-examples.xml +++ b/datatypes-examples.xml @@ -120,6 +120,30 @@ 1435025439583420243982723 + + + https://www.example.com + Gå til avsenders side for å gjøre en handling + Ta meg til handling! + + 2020-09-10T00:00:00+01:00 + 42 + 01235424320 + 1435025439583420243982723 + + + + 33aa4572ac1c61d807345c5968ab1fbd + PDNG + 2020-09-21T00:00:00+01:00 + 01235424320 + My pay app + + ce7ad8ba63d0ea5cd212580192a00156 + Acme Bank inc + + + diff --git a/datatypes.xsd b/datatypes.xsd index 9915a509..39285723 100644 --- a/datatypes.xsd +++ b/datatypes.xsd @@ -11,6 +11,10 @@ + + + + @@ -206,6 +210,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -447,27 +480,27 @@ - - + + - - + + - - + + diff --git a/pom.xml b/pom.xml index cf056a5c..c942c046 100644 --- a/pom.xml +++ b/pom.xml @@ -128,12 +128,6 @@ - - com.google.guava - guava - 28.1-jre - test - diff --git a/readme.md b/readme.md index b47fdefb..d144a3c1 100644 --- a/readme.md +++ b/readme.md @@ -7,6 +7,8 @@ |[Event](#event)|Event represents an event that occurs over a time period or several days. Eg. a conference or an election| |[ExternalLink](#externallink)|An external URL, along with an optional description and deadline for resources such as a survey.| |[Inkasso](#inkasso)|A debt collection payment| +|[Invoice](#invoice)|An invoice| +|[InvoicePayment](#invoicepayment)|Payment information for an invoice| |[Payslip](#payslip)|For treating documents as Payslips.| |[PickupNotice](#pickupnotice)|Details about a pickup notice| |[PickupNoticeStatus](#pickupnoticestatus)|Updates to status for PickupNotice| @@ -344,6 +346,90 @@ A debt collection payment ``` +## Invoice + +An invoice + +### Complemented by: +[InvoicePayment](#invoicepayment) + +### Fields + +|Name|Type|Required|Description| +|----|----|--------|-----------| +|link|[ExternalLink](#invoiceexternallink)|no|A link to more information, or further actions that can be taken| +|dueDate|ZonedDateTime|yes|When the payment falls due| +|sum|BigDecimal|yes|The sum to be paid| +|creditorAccount|String|yes|The creditor account for the payment. Exactly 11 digits| +|kid|String|no|The customer identification number. Max length 25 chars| + +### Invoice.ExternalLink + +|Name|Type|Required|Description| +|----|----|--------|-----------| +|url|URI|yes|Target URL of this link. Must be http or https.| +|deadline|ZonedDateTime|no|Optional deadline for the user to respond. ISO8601 full DateTime.| +|description|String|no|A short, optional text-field, describing the external link.| +|buttonText|String|no|Optional text which will be displayed on the button.| + +### XML + +```xml + + + https://www.example.com + Gå til avsenders side for å gjøre en handling + Ta meg til handling! + + 2020-09-10T00:00:00+01:00 + 42 + 01235424320 + 1435025439583420243982723 + +``` + +## InvoicePayment + +Payment information for an invoice + +### Complemented by: +[InvoicePayment](#invoicepayment) + +### Fields + +|Name|Type|Required|Description| +|----|----|--------|-----------| +|paymentId|String|yes|Unique id to reference the payment with third party| +|paymentStatus|String|yes|A status a given payment is in. ISO20022 payment statuses can be used| +|paymentTime|ZonedDateTime|yes|When the payment is done| +|debtorAccount|String|yes|The debtor account for the payment. Exactly 11 digits| +|debtorAccountName|String|no|Optional name of the account| +|paymentChannel|String|yes|Name the third party performing the payment| +|paymentBank|[Bank](#invoicepaymentbank)|yes|The bank payment is registered with| + +### InvoicePayment.Bank + +|Name|Type|Required|Description| +|----|----|--------|-----------| +|id|String|no|Unique id of the bank to reference the payment with third party| +|name|String|no|Display name of the bank| + +### XML + +```xml + + 33aa4572ac1c61d807345c5968ab1fbd + PDNG + 2020-09-21T00:00:00+01:00 + 01235424320 + My pay app + + ce7ad8ba63d0ea5cd212580192a00156 + Acme Bank inc + + +``` + ## Payslip For treating documents as Payslips. diff --git a/src/main/java/no/digipost/api/datatypes/ComplementedBy.java b/src/main/java/no/digipost/api/datatypes/ComplementedBy.java index f2412c44..7117b2ef 100644 --- a/src/main/java/no/digipost/api/datatypes/ComplementedBy.java +++ b/src/main/java/no/digipost/api/datatypes/ComplementedBy.java @@ -1,7 +1,5 @@ package no.digipost.api.datatypes; -import no.digipost.api.datatypes.DataType; - import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; diff --git a/src/main/java/no/digipost/api/datatypes/DataTypeIdentifier.java b/src/main/java/no/digipost/api/datatypes/DataTypeIdentifier.java index 801613e3..ef6cfee0 100644 --- a/src/main/java/no/digipost/api/datatypes/DataTypeIdentifier.java +++ b/src/main/java/no/digipost/api/datatypes/DataTypeIdentifier.java @@ -8,6 +8,8 @@ import no.digipost.api.datatypes.types.Payslip; import no.digipost.api.datatypes.types.Residence; import no.digipost.api.datatypes.types.SignedDocument; +import no.digipost.api.datatypes.types.invoice.Invoice; +import no.digipost.api.datatypes.types.invoice.InvoicePayment; import no.digipost.api.datatypes.types.pickup.PickupNotice; import no.digipost.api.datatypes.types.pickup.PickupNoticeStatus; import no.digipost.api.datatypes.types.proof.Proof; @@ -46,6 +48,8 @@ public enum DataTypeIdentifier { , EVENT(Event.class, "EVNT", Event.EXAMPLE) , PROOF(Proof.class, "PRF", Proof.EXAMPLE) , INKASSO(Inkasso.class, "INKA", Inkasso.EXAMPLE) + , INVOICE(Invoice.class, "INVO", Invoice.EXAMPLE) + , INVOICE_PAYMENT(InvoicePayment.class, "INVP", InvoicePayment.EXAMPLE) ; private final Class dataType; diff --git a/src/main/java/no/digipost/api/datatypes/documentation/DocumentationGenerator.java b/src/main/java/no/digipost/api/datatypes/documentation/DocumentationGenerator.java index ef30a107..107a43b5 100644 --- a/src/main/java/no/digipost/api/datatypes/documentation/DocumentationGenerator.java +++ b/src/main/java/no/digipost/api/datatypes/documentation/DocumentationGenerator.java @@ -7,7 +7,10 @@ import javax.xml.bind.JAXBException; import java.io.IOException; import java.nio.charset.StandardCharsets; -import java.nio.file.*; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardOpenOption; import java.util.Set; import java.util.function.Function; import java.util.stream.Stream; diff --git a/src/main/java/no/digipost/api/datatypes/marshalling/DataTypesJsonMapper.java b/src/main/java/no/digipost/api/datatypes/marshalling/DataTypesJsonMapper.java index e219bd7e..b2925220 100644 --- a/src/main/java/no/digipost/api/datatypes/marshalling/DataTypesJsonMapper.java +++ b/src/main/java/no/digipost/api/datatypes/marshalling/DataTypesJsonMapper.java @@ -6,8 +6,6 @@ import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -import java.util.TimeZone; - public class DataTypesJsonMapper { private static final ObjectMapper mapper = initMapper(); diff --git a/src/main/java/no/digipost/api/datatypes/types/Address.java b/src/main/java/no/digipost/api/datatypes/types/Address.java index c41ed6e3..2a7bd631 100644 --- a/src/main/java/no/digipost/api/datatypes/types/Address.java +++ b/src/main/java/no/digipost/api/datatypes/types/Address.java @@ -5,7 +5,6 @@ import lombok.NoArgsConstructor; import lombok.Value; import lombok.With; -import lombok.experimental.Wither; import no.digipost.api.datatypes.documentation.Description; import javax.validation.constraints.Size; diff --git a/src/main/java/no/digipost/api/datatypes/types/Barcode.java b/src/main/java/no/digipost/api/datatypes/types/Barcode.java index b6908a9f..cccc1b06 100644 --- a/src/main/java/no/digipost/api/datatypes/types/Barcode.java +++ b/src/main/java/no/digipost/api/datatypes/types/Barcode.java @@ -5,7 +5,6 @@ import lombok.NoArgsConstructor; import lombok.Value; import lombok.With; -import lombok.experimental.Wither; import no.digipost.api.datatypes.documentation.Description; import javax.validation.constraints.Size; diff --git a/src/main/java/no/digipost/api/datatypes/types/Event.java b/src/main/java/no/digipost/api/datatypes/types/Event.java index 6ba753cd..d57210bd 100644 --- a/src/main/java/no/digipost/api/datatypes/types/Event.java +++ b/src/main/java/no/digipost/api/datatypes/types/Event.java @@ -5,7 +5,6 @@ import lombok.NoArgsConstructor; import lombok.Value; import lombok.With; -import lombok.experimental.Wither; import no.digipost.api.datatypes.DataType; import no.digipost.api.datatypes.documentation.Description; diff --git a/src/main/java/no/digipost/api/datatypes/types/ExternalLink.java b/src/main/java/no/digipost/api/datatypes/types/ExternalLink.java index ce4c0f6e..1c68fbe4 100644 --- a/src/main/java/no/digipost/api/datatypes/types/ExternalLink.java +++ b/src/main/java/no/digipost/api/datatypes/types/ExternalLink.java @@ -5,7 +5,6 @@ import lombok.NoArgsConstructor; import lombok.Value; import lombok.With; -import lombok.experimental.Wither; import no.digipost.api.datatypes.DataType; import no.digipost.api.datatypes.documentation.Description; import no.digipost.api.datatypes.validation.WebUrl; diff --git a/src/main/java/no/digipost/api/datatypes/types/ForeignCurrencyPayment.java b/src/main/java/no/digipost/api/datatypes/types/ForeignCurrencyPayment.java index 72298b4e..4d5aa842 100644 --- a/src/main/java/no/digipost/api/datatypes/types/ForeignCurrencyPayment.java +++ b/src/main/java/no/digipost/api/datatypes/types/ForeignCurrencyPayment.java @@ -5,7 +5,6 @@ import lombok.NoArgsConstructor; import lombok.Value; import lombok.With; -import lombok.experimental.Wither; import no.digipost.api.datatypes.documentation.Description; import javax.validation.constraints.Size; diff --git a/src/main/java/no/digipost/api/datatypes/types/Heftelse.java b/src/main/java/no/digipost/api/datatypes/types/Heftelse.java index 6a80e3f8..4ae4e2d7 100644 --- a/src/main/java/no/digipost/api/datatypes/types/Heftelse.java +++ b/src/main/java/no/digipost/api/datatypes/types/Heftelse.java @@ -5,7 +5,6 @@ import lombok.NoArgsConstructor; import lombok.Value; import lombok.With; -import lombok.experimental.Wither; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; diff --git a/src/main/java/no/digipost/api/datatypes/types/Link.java b/src/main/java/no/digipost/api/datatypes/types/Link.java index f274d6f6..3c12421d 100644 --- a/src/main/java/no/digipost/api/datatypes/types/Link.java +++ b/src/main/java/no/digipost/api/datatypes/types/Link.java @@ -5,7 +5,6 @@ import lombok.NoArgsConstructor; import lombok.Value; import lombok.With; -import lombok.experimental.Wither; import no.digipost.api.datatypes.documentation.Description; import no.digipost.api.datatypes.validation.WebUrl; diff --git a/src/main/java/no/digipost/api/datatypes/types/Matrikkel.java b/src/main/java/no/digipost/api/datatypes/types/Matrikkel.java index 00a59676..edd9f706 100644 --- a/src/main/java/no/digipost/api/datatypes/types/Matrikkel.java +++ b/src/main/java/no/digipost/api/datatypes/types/Matrikkel.java @@ -5,7 +5,6 @@ import lombok.NoArgsConstructor; import lombok.Value; import lombok.With; -import lombok.experimental.Wither; import javax.validation.Valid; import javax.validation.constraints.NotNull; diff --git a/src/main/java/no/digipost/api/datatypes/types/Omsetningshistorikk.java b/src/main/java/no/digipost/api/datatypes/types/Omsetningshistorikk.java index 1bcca9a9..cf652c1c 100644 --- a/src/main/java/no/digipost/api/datatypes/types/Omsetningshistorikk.java +++ b/src/main/java/no/digipost/api/datatypes/types/Omsetningshistorikk.java @@ -5,14 +5,12 @@ import lombok.NoArgsConstructor; import lombok.Value; import lombok.With; -import lombok.experimental.Wither; import no.digipost.api.datatypes.documentation.Description; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; - import java.time.ZonedDateTime; @XmlType diff --git a/src/main/java/no/digipost/api/datatypes/types/Residence.java b/src/main/java/no/digipost/api/datatypes/types/Residence.java index de669669..0ff9c967 100644 --- a/src/main/java/no/digipost/api/datatypes/types/Residence.java +++ b/src/main/java/no/digipost/api/datatypes/types/Residence.java @@ -5,7 +5,6 @@ import lombok.NoArgsConstructor; import lombok.Value; import lombok.With; -import lombok.experimental.Wither; import no.digipost.api.datatypes.DataType; import no.digipost.api.datatypes.documentation.Description; diff --git a/src/main/java/no/digipost/api/datatypes/types/ResidenceAddress.java b/src/main/java/no/digipost/api/datatypes/types/ResidenceAddress.java index a687ab60..c231cef0 100644 --- a/src/main/java/no/digipost/api/datatypes/types/ResidenceAddress.java +++ b/src/main/java/no/digipost/api/datatypes/types/ResidenceAddress.java @@ -5,10 +5,8 @@ import lombok.NoArgsConstructor; import lombok.Value; import lombok.With; -import lombok.experimental.Wither; import no.digipost.api.datatypes.documentation.Description; -import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; import javax.xml.bind.annotation.XmlElement; diff --git a/src/main/java/no/digipost/api/datatypes/types/SignedDocument.java b/src/main/java/no/digipost/api/datatypes/types/SignedDocument.java index 1a89fbe6..71b942bd 100644 --- a/src/main/java/no/digipost/api/datatypes/types/SignedDocument.java +++ b/src/main/java/no/digipost/api/datatypes/types/SignedDocument.java @@ -5,7 +5,6 @@ import lombok.NoArgsConstructor; import lombok.Value; import lombok.With; -import lombok.experimental.Wither; import no.digipost.api.datatypes.DataType; import no.digipost.api.datatypes.documentation.Description; diff --git a/src/main/java/no/digipost/api/datatypes/types/invoice/Bank.java b/src/main/java/no/digipost/api/datatypes/types/invoice/Bank.java new file mode 100644 index 00000000..4a018996 --- /dev/null +++ b/src/main/java/no/digipost/api/datatypes/types/invoice/Bank.java @@ -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"); +} diff --git a/src/main/java/no/digipost/api/datatypes/types/invoice/Invoice.java b/src/main/java/no/digipost/api/datatypes/types/invoice/Invoice.java new file mode 100644 index 00000000..9f857266 --- /dev/null +++ b/src/main/java/no/digipost/api/datatypes/types/invoice/Invoice.java @@ -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" + ); +} diff --git a/src/main/java/no/digipost/api/datatypes/types/invoice/InvoicePayment.java b/src/main/java/no/digipost/api/datatypes/types/invoice/InvoicePayment.java new file mode 100644 index 00000000..2cd20803 --- /dev/null +++ b/src/main/java/no/digipost/api/datatypes/types/invoice/InvoicePayment.java @@ -0,0 +1,67 @@ +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 javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import java.time.ZoneId; +import java.time.ZonedDateTime; + +@XmlRootElement(name = "invoice-payment") +@Value +@AllArgsConstructor +@NoArgsConstructor(force = true, access = AccessLevel.PRIVATE) +@With +@Description("Payment information for an invoice") +@ComplementedBy({InvoicePayment.class}) +public class InvoicePayment implements DataType { + + @XmlElement(required = true, name = "payment-id") + @Description("Unique id to reference the payment with third party") + String paymentId; + + @XmlElement(required = true, name = "payment-status") + @Description("A status a given payment is in. ISO20022 payment statuses can be used") + String paymentStatus; + + @XmlElement(required = true, name = "payment-time") + @Description("When the payment is done") + ZonedDateTime paymentTime; + + @XmlElement(required = true, name = "debtor-account") + @Description("The debtor account for the payment. Exactly 11 digits") + @Size(min = 11, max = 11) + String debtorAccount; + + @XmlElement(name = "debtor-account-name") + @Description("Optional name of the account") + String debtorAccountName; + + @XmlElement(required = true, name = "payment-channel") + @Description("Name the third party performing the payment") + String paymentChannel; + + @XmlElement(required = true, name = "payment-bank") + @Description("The bank payment is registered with") + @NotNull + Bank paymentBank; + + public static final InvoicePayment EXAMPLE = new InvoicePayment( + "33aa4572ac1c61d807345c5968ab1fbd" + , "PDNG" + , ZonedDateTime.of(2020, 9, 21, 0, 0, 0, 0, ZoneId.of("+01:00")) + , "01235424320" + , null + , "My pay app" + , Bank.EXAMPLE + ); +} diff --git a/src/main/java/no/digipost/api/datatypes/types/invoice/package-info.java b/src/main/java/no/digipost/api/datatypes/types/invoice/package-info.java new file mode 100644 index 00000000..2b501b67 --- /dev/null +++ b/src/main/java/no/digipost/api/datatypes/types/invoice/package-info.java @@ -0,0 +1,15 @@ +@XmlSchema(namespace = DIGIPOST_DATATYPES_NAMESPACE, elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +@XmlAccessorType(XmlAccessType.FIELD) +@XmlJavaTypeAdapter(ZonedDateTimeXmlAdapter.class) +@DataTypePackage +package no.digipost.api.datatypes.types.invoice; + +import no.digipost.api.datatypes.documentation.DataTypePackage; +import no.digipost.api.datatypes.marshalling.ZonedDateTimeXmlAdapter; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlSchema; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + +import static no.digipost.api.datatypes.marshalling.DataTypesJAXBContext.DIGIPOST_DATATYPES_NAMESPACE; diff --git a/src/main/java/no/digipost/api/datatypes/types/pickup/Cost.java b/src/main/java/no/digipost/api/datatypes/types/pickup/Cost.java index 47aac708..b40903b0 100644 --- a/src/main/java/no/digipost/api/datatypes/types/pickup/Cost.java +++ b/src/main/java/no/digipost/api/datatypes/types/pickup/Cost.java @@ -5,7 +5,6 @@ import lombok.NoArgsConstructor; import lombok.Value; import lombok.With; -import lombok.experimental.Wither; import no.digipost.api.datatypes.documentation.Description; import javax.xml.bind.annotation.XmlElement; diff --git a/src/main/java/no/digipost/api/datatypes/types/pickup/Package.java b/src/main/java/no/digipost/api/datatypes/types/pickup/Package.java index 5c98ffff..cedcaec7 100644 --- a/src/main/java/no/digipost/api/datatypes/types/pickup/Package.java +++ b/src/main/java/no/digipost/api/datatypes/types/pickup/Package.java @@ -5,7 +5,6 @@ import lombok.NoArgsConstructor; import lombok.Value; import lombok.With; -import lombok.experimental.Wither; import no.digipost.api.datatypes.documentation.Description; import javax.xml.bind.annotation.XmlElement; diff --git a/src/main/java/no/digipost/api/datatypes/types/pickup/PickupNotice.java b/src/main/java/no/digipost/api/datatypes/types/pickup/PickupNotice.java index 1d9d5b55..7e4bedeb 100644 --- a/src/main/java/no/digipost/api/datatypes/types/pickup/PickupNotice.java +++ b/src/main/java/no/digipost/api/datatypes/types/pickup/PickupNotice.java @@ -5,13 +5,12 @@ import lombok.NoArgsConstructor; import lombok.Value; import lombok.With; -import lombok.experimental.Wither; 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.Barcode; import no.digipost.api.datatypes.types.Language; import no.digipost.api.datatypes.types.Tag; -import no.digipost.api.datatypes.types.Barcode; import javax.validation.Valid; import javax.validation.constraints.NotNull; diff --git a/src/main/java/no/digipost/api/datatypes/types/pickup/PickupNoticeStatus.java b/src/main/java/no/digipost/api/datatypes/types/pickup/PickupNoticeStatus.java index 029ae05c..f0c9fc74 100644 --- a/src/main/java/no/digipost/api/datatypes/types/pickup/PickupNoticeStatus.java +++ b/src/main/java/no/digipost/api/datatypes/types/pickup/PickupNoticeStatus.java @@ -5,12 +5,10 @@ import lombok.NoArgsConstructor; import lombok.Value; import lombok.With; -import lombok.experimental.Wither; import no.digipost.api.datatypes.DataType; import no.digipost.api.datatypes.documentation.Description; import javax.validation.Valid; -import javax.validation.constraints.Max; import javax.validation.constraints.NotNull; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; diff --git a/src/main/java/no/digipost/api/datatypes/types/pickup/PickupPlace.java b/src/main/java/no/digipost/api/datatypes/types/pickup/PickupPlace.java index 7cffc3ad..6cfe1b2b 100644 --- a/src/main/java/no/digipost/api/datatypes/types/pickup/PickupPlace.java +++ b/src/main/java/no/digipost/api/datatypes/types/pickup/PickupPlace.java @@ -5,7 +5,6 @@ import lombok.NoArgsConstructor; import lombok.Value; import lombok.With; -import lombok.experimental.Wither; import no.digipost.api.datatypes.documentation.Description; import no.digipost.api.datatypes.types.Address; diff --git a/src/main/java/no/digipost/api/datatypes/types/pickup/Recipient.java b/src/main/java/no/digipost/api/datatypes/types/pickup/Recipient.java index cde6d999..504e230c 100644 --- a/src/main/java/no/digipost/api/datatypes/types/pickup/Recipient.java +++ b/src/main/java/no/digipost/api/datatypes/types/pickup/Recipient.java @@ -5,7 +5,6 @@ import lombok.NoArgsConstructor; import lombok.Value; import lombok.With; -import lombok.experimental.Wither; import no.digipost.api.datatypes.documentation.Description; import no.digipost.api.datatypes.types.Address; diff --git a/src/main/java/no/digipost/api/datatypes/types/pickup/Sender.java b/src/main/java/no/digipost/api/datatypes/types/pickup/Sender.java index 1046b996..af579481 100644 --- a/src/main/java/no/digipost/api/datatypes/types/pickup/Sender.java +++ b/src/main/java/no/digipost/api/datatypes/types/pickup/Sender.java @@ -5,7 +5,6 @@ import lombok.NoArgsConstructor; import lombok.Value; import lombok.With; -import lombok.experimental.Wither; import no.digipost.api.datatypes.documentation.Description; import no.digipost.api.datatypes.types.Address; diff --git a/src/main/java/no/digipost/api/datatypes/types/proof/ValidPeriod.java b/src/main/java/no/digipost/api/datatypes/types/proof/ValidPeriod.java index 78d61f18..6063b45b 100644 --- a/src/main/java/no/digipost/api/datatypes/types/proof/ValidPeriod.java +++ b/src/main/java/no/digipost/api/datatypes/types/proof/ValidPeriod.java @@ -1,7 +1,6 @@ package no.digipost.api.datatypes.types.proof; import lombok.AccessLevel; -import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; import lombok.Value; import lombok.With; @@ -10,7 +9,6 @@ import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElements; import javax.xml.bind.annotation.XmlType; @XmlType diff --git a/src/main/java/no/digipost/api/datatypes/types/receipt/Customer.java b/src/main/java/no/digipost/api/datatypes/types/receipt/Customer.java index 6684ae97..38dc7b72 100644 --- a/src/main/java/no/digipost/api/datatypes/types/receipt/Customer.java +++ b/src/main/java/no/digipost/api/datatypes/types/receipt/Customer.java @@ -5,7 +5,6 @@ import lombok.NoArgsConstructor; import lombok.Value; import lombok.With; -import lombok.experimental.Wither; import no.digipost.api.datatypes.types.Address; import javax.xml.bind.annotation.XmlElement; diff --git a/src/main/java/no/digipost/api/datatypes/types/receipt/Delivery.java b/src/main/java/no/digipost/api/datatypes/types/receipt/Delivery.java index 8b7c9aff..d6b1742c 100644 --- a/src/main/java/no/digipost/api/datatypes/types/receipt/Delivery.java +++ b/src/main/java/no/digipost/api/datatypes/types/receipt/Delivery.java @@ -5,7 +5,6 @@ import lombok.NoArgsConstructor; import lombok.Value; import lombok.With; -import lombok.experimental.Wither; import no.digipost.api.datatypes.types.Address; import javax.xml.bind.annotation.XmlElement; diff --git a/src/main/java/no/digipost/api/datatypes/types/receipt/Payment.java b/src/main/java/no/digipost/api/datatypes/types/receipt/Payment.java index d4d30b6d..2b628c9b 100644 --- a/src/main/java/no/digipost/api/datatypes/types/receipt/Payment.java +++ b/src/main/java/no/digipost/api/datatypes/types/receipt/Payment.java @@ -5,7 +5,6 @@ import lombok.NoArgsConstructor; import lombok.Value; import lombok.With; -import lombok.experimental.Wither; import no.digipost.api.datatypes.documentation.Description; import no.digipost.api.datatypes.types.ForeignCurrencyPayment; diff --git a/src/main/java/no/digipost/api/datatypes/types/receipt/Receipt.java b/src/main/java/no/digipost/api/datatypes/types/receipt/Receipt.java index 5bfced80..e3be2bdf 100644 --- a/src/main/java/no/digipost/api/datatypes/types/receipt/Receipt.java +++ b/src/main/java/no/digipost/api/datatypes/types/receipt/Receipt.java @@ -5,7 +5,6 @@ import lombok.NoArgsConstructor; import lombok.Value; import lombok.With; -import lombok.experimental.Wither; import no.digipost.api.datatypes.DataType; import no.digipost.api.datatypes.documentation.Description; import no.digipost.api.datatypes.types.Address; diff --git a/src/main/java/no/digipost/api/datatypes/types/receipt/ReceiptLine.java b/src/main/java/no/digipost/api/datatypes/types/receipt/ReceiptLine.java index 1e2639b8..87ec2d5e 100644 --- a/src/main/java/no/digipost/api/datatypes/types/receipt/ReceiptLine.java +++ b/src/main/java/no/digipost/api/datatypes/types/receipt/ReceiptLine.java @@ -5,7 +5,6 @@ import lombok.NoArgsConstructor; import lombok.Value; import lombok.With; -import lombok.experimental.Wither; import no.digipost.api.datatypes.documentation.Description; import javax.xml.bind.annotation.XmlElement; diff --git a/src/main/java/no/digipost/api/datatypes/types/receipt/TaxiDetails.java b/src/main/java/no/digipost/api/datatypes/types/receipt/TaxiDetails.java index 2aebc0da..b25baca6 100644 --- a/src/main/java/no/digipost/api/datatypes/types/receipt/TaxiDetails.java +++ b/src/main/java/no/digipost/api/datatypes/types/receipt/TaxiDetails.java @@ -5,7 +5,6 @@ import lombok.NoArgsConstructor; import lombok.Value; import lombok.With; -import lombok.experimental.Wither; import no.digipost.api.datatypes.documentation.Description; import javax.validation.Valid; diff --git a/src/main/java/no/digipost/api/datatypes/types/receipt/VatDetails.java b/src/main/java/no/digipost/api/datatypes/types/receipt/VatDetails.java index d10144e2..d553625f 100644 --- a/src/main/java/no/digipost/api/datatypes/types/receipt/VatDetails.java +++ b/src/main/java/no/digipost/api/datatypes/types/receipt/VatDetails.java @@ -5,7 +5,6 @@ import lombok.NoArgsConstructor; import lombok.Value; import lombok.With; -import lombok.experimental.Wither; import javax.validation.Valid; import javax.xml.bind.annotation.XmlElement; diff --git a/src/main/java/no/digipost/api/datatypes/validation/ValidPeriode.java b/src/main/java/no/digipost/api/datatypes/validation/ValidPeriode.java index a52e12bb..58ce4e3d 100644 --- a/src/main/java/no/digipost/api/datatypes/validation/ValidPeriode.java +++ b/src/main/java/no/digipost/api/datatypes/validation/ValidPeriode.java @@ -2,7 +2,11 @@ import javax.validation.Constraint; import javax.validation.Payload; -import java.lang.annotation.*; +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; @Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE}) @Retention(RetentionPolicy.RUNTIME) diff --git a/src/main/resources/no/digipost/api/datatypes/types/jaxb.index b/src/main/resources/no/digipost/api/datatypes/types/jaxb.index index 1c3ac000..4c438149 100644 --- a/src/main/resources/no/digipost/api/datatypes/types/jaxb.index +++ b/src/main/resources/no/digipost/api/datatypes/types/jaxb.index @@ -9,4 +9,6 @@ Payslip SignedDocument pickup.PickupNotice pickup.PickupNoticeStatus +invoice.Invoice +invoice.InvoicePayment Inkasso diff --git a/src/test/java/no/digipost/api/datatypes/documentation/DocumentationTest.java b/src/test/java/no/digipost/api/datatypes/documentation/DocumentationTest.java index ae0545f9..e84b6197 100644 --- a/src/test/java/no/digipost/api/datatypes/documentation/DocumentationTest.java +++ b/src/test/java/no/digipost/api/datatypes/documentation/DocumentationTest.java @@ -7,13 +7,14 @@ import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; - import java.io.IOException; +import java.net.URISyntaxException; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.Arrays; import java.util.Collections; import java.util.stream.Stream; -import static com.google.common.io.Resources.toByteArray; import static java.nio.charset.StandardCharsets.UTF_8; import static java.util.Collections.singleton; import static java.util.Collections.singletonList; @@ -45,12 +46,12 @@ void should_build_type_structure_for_test_data_type() { } @Test - void should_print_docs_for_test_data_type() throws IOException, JAXBException { + void should_print_docs_for_test_data_type() throws IOException, JAXBException, URISyntaxException { String docs = new MarkdownPrinter(JAXBContext.newInstance(ShortTextMessage.class), true) .print(DocumentationStructureBuilder .buildTypeStructure(singleton(ShortTextMessage.class), t -> ShortTextMessage.EXAMPLE) .collect(toList())); - assertThat(docs, is(new String(toByteArray(getClass().getResource("testdoc.md")), UTF_8))); + assertThat(docs, is(new String(Files.readAllBytes(Paths.get(getClass().getResource("testdoc.md").toURI())), UTF_8))); } } diff --git a/src/test/java/no/digipost/api/datatypes/types/JAXBIndexTest.java b/src/test/java/no/digipost/api/datatypes/types/JAXBIndexTest.java index d5c3f893..5679ebdc 100644 --- a/src/test/java/no/digipost/api/datatypes/types/JAXBIndexTest.java +++ b/src/test/java/no/digipost/api/datatypes/types/JAXBIndexTest.java @@ -4,10 +4,12 @@ import org.junit.jupiter.api.Test; import java.io.IOException; +import java.net.URISyntaxException; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.List; import java.util.stream.Stream; -import static com.google.common.io.Resources.readLines; import static java.nio.charset.StandardCharsets.UTF_8; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsInAnyOrder; @@ -15,8 +17,8 @@ class JAXBIndexTest { @Test - void check_all_metatdata_in_jaxb_index() throws IOException { - final List classNames = readLines(getClass().getResource("jaxb.index"), UTF_8); + void check_all_metatdata_in_jaxb_index() throws IOException, URISyntaxException { + final List classNames = Files.readAllLines(Paths.get(getClass().getResource("jaxb.index").toURI()), UTF_8); assertThat("Alle datatyper må ligge i jaxb.index for at de skal fungere med JAXB", classNames, containsInAnyOrder(Stream.of(DataTypeIdentifier.values()) .map(DataTypeIdentifier::getDataType) .map(Class::getName)