diff --git a/readme.md b/readme.md index 226c196c..44000e0f 100644 --- a/readme.md +++ b/readme.md @@ -7,6 +7,7 @@ |[Category](#category)|Category is a way to specify which category the data of a document is related to.| |[ExternalLink](#externallink)|An external URL, along with an optional description and deadline for resources such as a survey.| |[Payslip](#payslip)|For treating documents as Payslips.| +|[PickupNotice](#pickupnotice)|Details about a signed document| |[Receipt](#receipt)|Receipt represents a document containing details about a purchase| |[Residence](#residence)|Residence is a way of linking separate data for the same residence| |[SignedDocument](#signeddocument)|Details about a signed document| @@ -213,6 +214,89 @@ For treating documents as Payslips. ``` +## PickupNotice + +Details about a signed document + +### Fields + +|Name|Type|Required|Description| +|----|----|--------|-----------| +|parcelId|String|yes|The id of the parcel in posten| +|parcelUUID|String|yes|The uuid of the parcel| +|barcode|Barcode|yes|Bar code| +|recipient|[Recipient](#recipient)|yes|The recipient of the parcel| +|sender|[Sender](#sender)|yes|The sender of the parcel| +|pickupPlace|[PickupPlace](#pickupplace)|yes|where the parcel can be fetched| + +### Recipient + +|Name|Type|Required|Description| +|----|----|--------|-----------| +|digipostAddress|String|yes|The digipost address for the recipient| +|address|Address|no|| +|emailAdress|String|no|| + +### Sender + +|Name|Type|Required|Description| +|----|----|--------|-----------| +|reference|String|yes|The senders reference| +|address|Address|no|| + +### PickupPlace + +|Name|Type|Required|Description| +|----|----|--------|-----------| +|name|String|yes|The pickup place name| +|id|String|yes|The pickup place id| +|instruction|String|yes|instructions for fetching the parcel| +|address|Address|no|| + +### XML + +```xml + + + KB432788293NO + 70300492517312675 + + 1234567890 + EAN-128 + + + test.testesen#0000 +
+ Storgata 23 + 0011 + Oslo + Norge +
+ test.testesen@example.com +
+ + 13372500 +
+ Storgata 23 + 0011 + Oslo + Norge +
+
+ + 0132 + Coop Mega + Må hentes innen 010180 +
+ Storgata 23 + 0011 + Oslo + Norge +
+
+
+``` + ## Receipt Receipt represents a document containing details about a purchase diff --git a/src/main/java/no/digipost/api/datatypes/DataTypeIdentifier.java b/src/main/java/no/digipost/api/datatypes/DataTypeIdentifier.java index 589a81ed..d7d93a00 100644 --- a/src/main/java/no/digipost/api/datatypes/DataTypeIdentifier.java +++ b/src/main/java/no/digipost/api/datatypes/DataTypeIdentifier.java @@ -1,6 +1,7 @@ package no.digipost.api.datatypes; import no.digipost.api.datatypes.types.*; +import no.digipost.api.datatypes.types.pickup.PickupNotice; import no.digipost.api.datatypes.types.receipt.Receipt; import java.util.Map; @@ -29,6 +30,7 @@ public enum DataTypeIdentifier { RECEIPT(Receipt.class, "RCPT", Receipt.EXAMPLE), PAYSLIP(Payslip.class, "PAY", Payslip.EXAMPLE), SIGNED_DOCUMENT(SignedDocument.class, "SIGN", SignedDocument.EXAMPLE), + PICKUP_NOTICE(PickupNotice.class, "PKUP", PickupNotice.EXAMPLE), ; private final Class dataType; 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 new file mode 100644 index 00000000..07f52ec7 --- /dev/null +++ b/src/main/java/no/digipost/api/datatypes/types/pickup/PickupNotice.java @@ -0,0 +1,62 @@ +package no.digipost.api.datatypes.types.pickup; + +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Value; +import lombok.experimental.Wither; +import no.digipost.api.datatypes.DataType; +import no.digipost.api.datatypes.documentation.Description; +import no.digipost.api.datatypes.types.Address; +import no.digipost.api.datatypes.types.Info; +import no.digipost.api.datatypes.types.receipt.Barcode; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +@XmlRootElement +@Value +@AllArgsConstructor +@NoArgsConstructor(force = true, access = AccessLevel.PRIVATE) +@Wither +@Description("Details about a signed document") +public class PickupNotice implements DataType { + + @XmlElement(name = "parcel-id", required = true) + @Description("The id of the parcel in posten") + String parcelId; + + @XmlElement(name = "parcel-uuid", required = true) + @Description("The uuid of the parcel") + String parcelUUID; + + @XmlElement(name = "bar-code", required = true) + @Description("Bar code") + Barcode barcode; + + @XmlElement(name = "recipient", required = true) + @Description("The recipient of the parcel") + Recipient recipient; + + @XmlElement(name = "sender", required = true) + @Description("The sender of the parcel") + Sender sender; + + @XmlElement(name = "pickup-place", required = true) + @Description("where the parcel can be fetched") + PickupPlace pickupPlace; + + public static PickupNotice EXAMPLE = new PickupNotice( + "KB432788293NO" + , "70300492517312675" + , Barcode.EXAMPLE.withBarcodeType("EAN-128") + , Recipient.EXAMPLE + , Sender.EXAMPLE + , PickupPlace.EXAMPLE + ); +} + + 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 new file mode 100644 index 00000000..e9bc7c8d --- /dev/null +++ b/src/main/java/no/digipost/api/datatypes/types/pickup/PickupPlace.java @@ -0,0 +1,39 @@ +package no.digipost.api.datatypes.types.pickup; + +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Value; +import lombok.experimental.Wither; +import no.digipost.api.datatypes.documentation.Description; +import no.digipost.api.datatypes.types.Address; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +@XmlType +@Value +@AllArgsConstructor +@NoArgsConstructor(force = true, access = AccessLevel.PRIVATE) +@Wither +public class PickupPlace { + + @XmlElement(name = "name", required = true) + @Description("The pickup place name") + String name; + + @XmlElement(name = "id", required = true) + @Description("The pickup place id") + String id; + + @XmlElement(name = "instruction", required = true) + @Description("instructions for fetching the parcel") + String instruction; + + @XmlElement + Address address; + + public static final PickupPlace EXAMPLE = new PickupPlace("0132", "Coop Mega", "Må hentes innen 010180", Address.EXAMPLE); + + +} 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 new file mode 100644 index 00000000..d81e3e62 --- /dev/null +++ b/src/main/java/no/digipost/api/datatypes/types/pickup/Recipient.java @@ -0,0 +1,33 @@ +package no.digipost.api.datatypes.types.pickup; + +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Value; +import lombok.experimental.Wither; +import no.digipost.api.datatypes.documentation.Description; +import no.digipost.api.datatypes.types.Address; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +@XmlType +@Value +@AllArgsConstructor +@NoArgsConstructor(force = true, access = AccessLevel.PRIVATE) +@Wither +public class Recipient { + + @XmlElement(name = "digipost-address", required = true) + @Description("The digipost address for the recipient") + String digipostAddress; + + @XmlElement + Address address; + + @XmlElement(name = "email-address") + String emailAdress; + + public static final Recipient EXAMPLE = new Recipient("test.testesen#0000", Address.EXAMPLE, "test.testesen@example.com"); + +} 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 new file mode 100644 index 00000000..4b7a9200 --- /dev/null +++ b/src/main/java/no/digipost/api/datatypes/types/pickup/Sender.java @@ -0,0 +1,30 @@ +package no.digipost.api.datatypes.types.pickup; + +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Value; +import lombok.experimental.Wither; +import no.digipost.api.datatypes.documentation.Description; +import no.digipost.api.datatypes.types.Address; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +@XmlType +@Value +@AllArgsConstructor +@NoArgsConstructor(force = true, access = AccessLevel.PRIVATE) +@Wither +public class Sender { + + @XmlElement(name = "reference", required = true) + @Description("The senders reference") + String reference; + + @XmlElement + Address address; + + public static final Sender EXAMPLE = new Sender("13372500", Address.EXAMPLE); + +} diff --git a/src/main/java/no/digipost/api/datatypes/types/pickup/package-info.java b/src/main/java/no/digipost/api/datatypes/types/pickup/package-info.java new file mode 100644 index 00000000..4fb237aa --- /dev/null +++ b/src/main/java/no/digipost/api/datatypes/types/pickup/package-info.java @@ -0,0 +1,13 @@ +@XmlSchema(namespace = DIGIPOST_DATATYPES_NAMESPACE, elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +@XmlAccessorType(XmlAccessType.FIELD) +@XmlJavaTypeAdapter(ZonedDateTimeXmlAdapter.class) +package no.digipost.api.datatypes.types.pickup; + +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/resources/no/digipost/api/datatypes/types/jaxb.index b/src/main/resources/no/digipost/api/datatypes/types/jaxb.index index 03283e0c..ee36fc3f 100644 --- a/src/main/resources/no/digipost/api/datatypes/types/jaxb.index +++ b/src/main/resources/no/digipost/api/datatypes/types/jaxb.index @@ -6,3 +6,4 @@ Boligdetaljer receipt.Receipt Payslip SignedDocument +pickup.PickupNotice