diff --git a/datatypes-examples.xml b/datatypes-examples.xml index 9800245..1cb9740 100644 --- a/datatypes-examples.xml +++ b/datatypes-examples.xml @@ -398,6 +398,20 @@ 984661185 + + 2024-09-16T10:00:00+02:00 + Whoever Accessed + + 2024-09-16T10:00:00+02:00 + Subject + PDF + 1 + + + + + + 123 diff --git a/datatypes.xsd b/datatypes.xsd index 0b9f932..349a030 100644 --- a/datatypes.xsd +++ b/datatypes.xsd @@ -15,6 +15,7 @@ + @@ -434,13 +435,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + @@ -465,4 +500,10 @@ + + + + + + diff --git a/readme.md b/readme.md index e272bc5..e5f0d85 100644 --- a/readme.md +++ b/readme.md @@ -16,6 +16,7 @@ |[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| |[ShareDocumentsRequest](#sharedocumentsrequest)|A request for a user to share one or more documents| +|[ShareDocumentsRequestDocumentAccessed](#sharedocumentsrequestdocumentaccessed)|Documents have been accessed for ShareDocumentsRequest by the receiver.| |[ShareDocumentsRequestDocumentsShared](#sharedocumentsrequestdocumentsshared)|Documents have been shared for ShareDocumentsRequest| |[ShareDocumentsRequestSharingStopped](#sharedocumentsrequestsharingstopped)|Stop sharing of documents for ShareDocumentsRequest| |[SignedDocument](#signeddocument)|Details about a signed document| @@ -1110,6 +1111,66 @@ A request for a user to share one or more documents ``` +## ShareDocumentsRequestDocumentAccessed + +Documents have been accessed for ShareDocumentsRequest by the receiver. + +### Fields + +|Name|Type|Required|Description| +|----|----|--------|-----------| +|accessedTime|ZonedDateTime|yes|The point of time the document was accessed,| +|accessedBy|String|yes|Name of the person or organisation who accessed the shared document.| +|sharedDocumentData|[SharedDocumentData](#sharedocumentsrequestdocumentaccessedshareddocumentdata)|yes|| + +### ShareDocumentsRequestDocumentAccessed.SharedDocumentData + +|Name|Type|Required|Description| +|----|----|--------|-----------| +|deliveryTime|ZonedDateTime|yes|| +|subject|String|yes|| +|fileType|String|yes|| +|fileSizeBytes|BigInteger|yes|| +|origin|[SharedDocumentOrigin](#sharedocumentsrequestdocumentaccessedshareddocumentorigin)|yes|| + +### ShareDocumentsRequestDocumentAccessed.SharedDocumentOrigin + +|Name|Type|Required|Description| +|----|----|--------|-----------| +|privatePerson|[SharedDocumentOriginPrivatePerson](#sharedocumentsrequestdocumentaccessedshareddocumentoriginprivateperson)|no|| +|organisation|[SharedDocumentOriginOrganisation](#sharedocumentsrequestdocumentaccessedshareddocumentoriginorganisation)|no|| + +### ShareDocumentsRequestDocumentAccessed.SharedDocumentOriginPrivatePerson + +|Name|Type|Required|Description| +|----|----|--------|-----------| +|name|String|no|| + +### ShareDocumentsRequestDocumentAccessed.SharedDocumentOriginOrganisation + +|Name|Type|Required|Description| +|----|----|--------|-----------| +|organisationNumber|String|no|| +|name|String|no|| + +### XML + +```xml + + 2024-09-16T10:00:00+02:00 + Whoever Accessed + + 2024-09-16T10:00:00+02:00 + Subject + PDF + 1 + + + + + +``` + ## ShareDocumentsRequestDocumentsShared Documents have been shared for ShareDocumentsRequest @@ -1136,7 +1197,15 @@ Stop sharing of documents for ShareDocumentsRequest |Name|Type|Required|Description| |----|----|--------|-----------| +|messagingParty|[MessagingParty](#sharedocumentsrequestsharingstoppedmessagingparty)|no|Whether the sharing was stopped by the sender or receiver.| +|name|String|no|Name of the person or administrator who stopped the sharing.| + +### ShareDocumentsRequestSharingStopped.MessagingParty + +Valid values: +* SENDER +* RECEIVER ### XML diff --git a/src/main/java/no/digipost/api/datatypes/DataType.java b/src/main/java/no/digipost/api/datatypes/DataType.java index da4916b..6140b29 100644 --- a/src/main/java/no/digipost/api/datatypes/DataType.java +++ b/src/main/java/no/digipost/api/datatypes/DataType.java @@ -19,6 +19,7 @@ import no.digipost.api.datatypes.types.proof.Proof; import no.digipost.api.datatypes.types.receipt.Receipt; import no.digipost.api.datatypes.types.share.ShareDocumentsRequest; +import no.digipost.api.datatypes.types.share.ShareDocumentsRequestDocumentAccessed; import no.digipost.api.datatypes.types.share.ShareDocumentsRequestDocumentsShared; import no.digipost.api.datatypes.types.share.ShareDocumentsRequestSharingStopped; @@ -41,6 +42,7 @@ , @JsonSubTypes.Type(ShareDocumentsRequest.class) , @JsonSubTypes.Type(ShareDocumentsRequestSharingStopped.class) , @JsonSubTypes.Type(ShareDocumentsRequestDocumentsShared.class) + , @JsonSubTypes.Type(ShareDocumentsRequestDocumentAccessed.class) }) public interface DataType { diff --git a/src/main/java/no/digipost/api/datatypes/DataTypeIdentifier.java b/src/main/java/no/digipost/api/datatypes/DataTypeIdentifier.java index 9a89a25..110c30f 100644 --- a/src/main/java/no/digipost/api/datatypes/DataTypeIdentifier.java +++ b/src/main/java/no/digipost/api/datatypes/DataTypeIdentifier.java @@ -15,6 +15,7 @@ import no.digipost.api.datatypes.types.proof.Proof; import no.digipost.api.datatypes.types.receipt.Receipt; import no.digipost.api.datatypes.types.share.ShareDocumentsRequest; +import no.digipost.api.datatypes.types.share.ShareDocumentsRequestDocumentAccessed; import no.digipost.api.datatypes.types.share.ShareDocumentsRequestDocumentsShared; import no.digipost.api.datatypes.types.share.ShareDocumentsRequestSharingStopped; @@ -56,6 +57,7 @@ public enum DataTypeIdentifier { , SHARE_DOCUMENT_REQUEST(ShareDocumentsRequest.class, "SHAR", ShareDocumentsRequest.EXAMPLE) , SHARE_DOCUMENT_REQUEST_SHARING_STOPPED(ShareDocumentsRequestSharingStopped.class, "SHSS", ShareDocumentsRequestSharingStopped.EXAMPLE) , SHARE_DOCUMENT_REQUEST_DOCUMENTS_SHARED(ShareDocumentsRequestDocumentsShared.class, "SHDS", ShareDocumentsRequestDocumentsShared.EXAMPLE) + , SHARE_DOCUMENT_REQUEST_DOCUMENT_ACCESSED(ShareDocumentsRequestDocumentAccessed.class, "SHDA", ShareDocumentsRequestDocumentAccessed.EXAMPLE) ; private final Class dataType; diff --git a/src/main/java/no/digipost/api/datatypes/types/share/MessagingParty.java b/src/main/java/no/digipost/api/datatypes/types/share/MessagingParty.java new file mode 100644 index 0000000..76ae567 --- /dev/null +++ b/src/main/java/no/digipost/api/datatypes/types/share/MessagingParty.java @@ -0,0 +1,6 @@ +package no.digipost.api.datatypes.types.share; + +public enum MessagingParty { + SENDER, + RECEIVER +} diff --git a/src/main/java/no/digipost/api/datatypes/types/share/ShareDocumentsRequestDocumentAccessed.java b/src/main/java/no/digipost/api/datatypes/types/share/ShareDocumentsRequestDocumentAccessed.java new file mode 100644 index 0000000..fe81cc8 --- /dev/null +++ b/src/main/java/no/digipost/api/datatypes/types/share/ShareDocumentsRequestDocumentAccessed.java @@ -0,0 +1,43 @@ +package no.digipost.api.datatypes.types.share; + +import jakarta.validation.constraints.NotNull; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Value; +import lombok.With; +import no.digipost.api.datatypes.DataType; +import no.digipost.api.datatypes.documentation.Description; + +import java.time.ZoneId; +import java.time.ZonedDateTime; + +@XmlRootElement(name = "share-documents-request-document-accessed") +@Value +@AllArgsConstructor +@NoArgsConstructor(force = true, access = AccessLevel.PRIVATE) +@With +@Description("Documents have been accessed for ShareDocumentsRequest by the receiver.") +public class ShareDocumentsRequestDocumentAccessed implements DataType { + + @XmlElement(name = "accessed-time", required = true) + @Description("The point of time the document was accessed,") + ZonedDateTime accessedTime; + + @XmlElement(name="accessed-by", required = true) + @NotNull + @Description("Name of the person or organisation who accessed the shared document.") + String accessedBy; + + @XmlElement(required = true) + SharedDocumentData sharedDocumentData; + + public static final ShareDocumentsRequestDocumentAccessed EXAMPLE = new ShareDocumentsRequestDocumentAccessed( + ZonedDateTime.of(2024, 9, 16, 10, 0, 0, 0, ZoneId.of("+02:00")), + "Whoever Accessed", + SharedDocumentData.EXAMPLE + ); + +} diff --git a/src/main/java/no/digipost/api/datatypes/types/share/ShareDocumentsRequestSharingStopped.java b/src/main/java/no/digipost/api/datatypes/types/share/ShareDocumentsRequestSharingStopped.java index f96b780..598caf4 100644 --- a/src/main/java/no/digipost/api/datatypes/types/share/ShareDocumentsRequestSharingStopped.java +++ b/src/main/java/no/digipost/api/datatypes/types/share/ShareDocumentsRequestSharingStopped.java @@ -1,7 +1,9 @@ package no.digipost.api.datatypes.types.share; +import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlRootElement; import lombok.AccessLevel; +import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; import lombok.Value; import lombok.With; @@ -10,11 +12,20 @@ @XmlRootElement(name = "share-documents-request-sharing-stopped") @Value +@AllArgsConstructor @NoArgsConstructor(force = true, access = AccessLevel.PUBLIC) @With @Description("Stop sharing of documents for ShareDocumentsRequest") public class ShareDocumentsRequestSharingStopped implements DataType { + @XmlElement(name="messaging-party", required = false) + @Description("Whether the sharing was stopped by the sender or receiver.") + MessagingParty messagingParty; + + @XmlElement(name="name", required = false) + @Description("Name of the person or administrator who stopped the sharing.") + String name; + public static final ShareDocumentsRequestSharingStopped EXAMPLE = new ShareDocumentsRequestSharingStopped(); } diff --git a/src/main/java/no/digipost/api/datatypes/types/share/SharedDocumentData.java b/src/main/java/no/digipost/api/datatypes/types/share/SharedDocumentData.java new file mode 100644 index 0000000..94e796e --- /dev/null +++ b/src/main/java/no/digipost/api/datatypes/types/share/SharedDocumentData.java @@ -0,0 +1,47 @@ +package no.digipost.api.datatypes.types.share; + +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlType; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Value; +import lombok.With; +import no.digipost.api.datatypes.documentation.Description; + +import java.math.BigInteger; +import java.time.ZoneId; +import java.time.ZonedDateTime; + +@XmlType +@Value +@AllArgsConstructor +@NoArgsConstructor(force = true, access = AccessLevel.PRIVATE) +@With +@Description("Contains details about a shared document") +public class SharedDocumentData { + + @XmlElement(name = "delivery-time", required = true) + ZonedDateTime deliveryTime; + + @XmlElement(required = true) + String subject; + + @XmlElement(name = "file-type", required = true) + String fileType; + + @XmlElement(name = "file-size-bytes", required = true) + BigInteger fileSizeBytes; + + @XmlElement(required = true) + SharedDocumentOrigin origin; + + public static final SharedDocumentData EXAMPLE = new SharedDocumentData( + ZonedDateTime.of(2024, 9, 16, 10, 0, 0, 0, ZoneId.of("+02:00")), + "Subject", + "PDF", + BigInteger.ONE, + new SharedDocumentOrigin().withOrganisation(SharedDocumentOriginOrganisation.EXAMPLE) + ); + +} diff --git a/src/main/java/no/digipost/api/datatypes/types/share/SharedDocumentOrigin.java b/src/main/java/no/digipost/api/datatypes/types/share/SharedDocumentOrigin.java new file mode 100644 index 0000000..89308f7 --- /dev/null +++ b/src/main/java/no/digipost/api/datatypes/types/share/SharedDocumentOrigin.java @@ -0,0 +1,25 @@ +package no.digipost.api.datatypes.types.share; + +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlType; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Value; +import lombok.With; +import no.digipost.api.datatypes.documentation.Description; + +@XmlType +@Value +@AllArgsConstructor +@NoArgsConstructor(force = true, access = AccessLevel.PUBLIC) +@With +@Description("Contains details about a single item (line) on the receipt") +public class SharedDocumentOrigin { + + @XmlElement(name = "private-person", required = false) + SharedDocumentOriginPrivatePerson privatePerson; + @XmlElement(name = "organisation", required = false) + SharedDocumentOriginOrganisation organisation; + +} diff --git a/src/main/java/no/digipost/api/datatypes/types/share/SharedDocumentOriginOrganisation.java b/src/main/java/no/digipost/api/datatypes/types/share/SharedDocumentOriginOrganisation.java new file mode 100644 index 0000000..13f547f --- /dev/null +++ b/src/main/java/no/digipost/api/datatypes/types/share/SharedDocumentOriginOrganisation.java @@ -0,0 +1,30 @@ +package no.digipost.api.datatypes.types.share; + +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlType; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Value; +import lombok.With; +import no.digipost.api.datatypes.documentation.Description; + +@XmlType +@Value +@AllArgsConstructor +@NoArgsConstructor(force = true, access = AccessLevel.PRIVATE) +@With +@Description("Origin of shared document is an organisation") +public class SharedDocumentOriginOrganisation { + + @XmlAttribute(name = "organisation-number", required = true) + String organisationNumber; + @XmlAttribute(name = "name", required = true) + String name; + + public static final SharedDocumentOriginOrganisation EXAMPLE = new SharedDocumentOriginOrganisation( + "984661185", + "Posten Bring AS" + ); + +} diff --git a/src/main/java/no/digipost/api/datatypes/types/share/SharedDocumentOriginPrivatePerson.java b/src/main/java/no/digipost/api/datatypes/types/share/SharedDocumentOriginPrivatePerson.java new file mode 100644 index 0000000..3ee723a --- /dev/null +++ b/src/main/java/no/digipost/api/datatypes/types/share/SharedDocumentOriginPrivatePerson.java @@ -0,0 +1,27 @@ +package no.digipost.api.datatypes.types.share; + +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlType; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Value; +import lombok.With; +import no.digipost.api.datatypes.documentation.Description; + +@XmlType +@Value +@AllArgsConstructor +@NoArgsConstructor(force = true, access = AccessLevel.PRIVATE) +@With +@Description("Origin of shared document is a private person") +public class SharedDocumentOriginPrivatePerson { + + @XmlAttribute(name = "name", required = true) + String name; + + public static final SharedDocumentOriginPrivatePerson EXAMPLE = new SharedDocumentOriginPrivatePerson( + "Test Testesen" + ); + +} 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 e338896..f6c3dce 100644 --- a/src/main/resources/no/digipost/api/datatypes/types/jaxb.index +++ b/src/main/resources/no/digipost/api/datatypes/types/jaxb.index @@ -15,3 +15,4 @@ Inkasso share.ShareDocumentsRequest share.ShareDocumentsRequestSharingStopped share.ShareDocumentsRequestDocumentsShared +share.ShareDocumentsRequestDocumentAccessed