Skip to content

Commit

Permalink
Merge pull request #62 from digipost/invoice
Browse files Browse the repository at this point in the history
Invoice datatype
  • Loading branch information
eivinhb authored Oct 16, 2020
2 parents 2c3a299 + d468ca0 commit 7ceb76e
Show file tree
Hide file tree
Showing 43 changed files with 344 additions and 57 deletions.
24 changes: 24 additions & 0 deletions datatypes-examples.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,30 @@
<kid>1435025439583420243982723</kid>
</inkasso>

<invoice xmlns="http://api.digipost.no/schema/datatypes">
<link>
<url>https://www.example.com</url>
<description>Gå til avsenders side for å gjøre en handling</description>
<button-text>Ta meg til handling!</button-text>
</link>
<due-date>2020-09-10T00:00:00+01:00</due-date>
<sum>42</sum>
<creditor-account>01235424320</creditor-account>
<kid>1435025439583420243982723</kid>
</invoice>

<invoice-payment xmlns="http://api.digipost.no/schema/datatypes">
<payment-id>33aa4572ac1c61d807345c5968ab1fbd</payment-id>
<payment-status>PDNG</payment-status>
<payment-time>2020-09-21T00:00:00+01:00</payment-time>
<debtor-account>01235424320</debtor-account>
<payment-channel>My pay app</payment-channel>
<payment-bank>
<id>ce7ad8ba63d0ea5cd212580192a00156</id>
<name>Acme Bank inc</name>
</payment-bank>
</invoice-payment>

<payslip xmlns="http://api.digipost.no/schema/datatypes"/>

<pickup-notice xmlns="http://api.digipost.no/schema/datatypes">
Expand Down
45 changes: 39 additions & 6 deletions datatypes.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

<xs:element name="inkasso" type="tns:inkasso"/>

<xs:element name="invoice" type="tns:invoice"/>

<xs:element name="invoice-payment" type="tns:invoicePayment"/>

<xs:element name="payslip" type="tns:payslip"/>

<xs:element name="pickup-notice" type="tns:pickupNotice"/>
Expand Down Expand Up @@ -206,6 +210,35 @@
</xs:sequence>
</xs:complexType>

<xs:complexType final="extension restriction" name="bank">
<xs:sequence>
<xs:element minOccurs="0" name="id" type="xs:string"/>
<xs:element minOccurs="0" name="name" type="xs:string"/>
</xs:sequence>
</xs:complexType>

<xs:complexType final="extension restriction" name="invoice">
<xs:sequence>
<xs:element minOccurs="0" name="link" type="tns:externalLink"/>
<xs:element name="due-date" type="xs:string"/>
<xs:element name="sum" type="xs:decimal"/>
<xs:element name="creditor-account" type="xs:string"/>
<xs:element minOccurs="0" name="kid" type="xs:string"/>
</xs:sequence>
</xs:complexType>

<xs:complexType final="extension restriction" name="invoicePayment">
<xs:sequence>
<xs:element name="payment-id" type="xs:string"/>
<xs:element name="payment-status" type="xs:string"/>
<xs:element name="payment-time" type="xs:string"/>
<xs:element name="debtor-account" type="xs:string"/>
<xs:element minOccurs="0" name="debtor-account-name" type="xs:string"/>
<xs:element name="payment-channel" type="xs:string"/>
<xs:element name="payment-bank" type="tns:bank"/>
</xs:sequence>
</xs:complexType>

<xs:complexType final="extension restriction" name="cost">
<xs:sequence>
<xs:element name="value-to-be-payed" type="xs:decimal"/>
Expand Down Expand Up @@ -447,27 +480,27 @@

<xs:simpleType name="language">
<xs:restriction base="xs:string">
<xs:enumeration value="NN"/>
<xs:enumeration value="NB"/>
<xs:enumeration value="EN"/>
<xs:enumeration value="NB"/>
<xs:enumeration value="NN"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="status">
<xs:restriction base="xs:string">
<xs:enumeration value="PICKED_UP"/>
<xs:enumeration value="RETURNED"/>
<xs:enumeration value="READY_FOR_PICKUP"/>
<xs:enumeration value="UNKNOWN"/>
<xs:enumeration value="DEVIATION"/>
<xs:enumeration value="RETURNED"/>
<xs:enumeration value="UNKNOWN"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="tag">
<xs:restriction base="xs:string">
<xs:enumeration value="POSTEN"/>
<xs:enumeration value="VARSEL1"/>
<xs:enumeration value="VARSEL2"/>
<xs:enumeration value="VARSEL1"/>
<xs:enumeration value="POSTEN"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
6 changes: 0 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,6 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>28.1-jre</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<resources>
Expand Down
86 changes: 86 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down Expand Up @@ -344,6 +346,90 @@ A debt collection payment
</inkasso>
```

## 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
<invoice xmlns="http://api.digipost.no/schema/datatypes">
<link>
<url>https://www.example.com</url>
<description>Gå til avsenders side for å gjøre en handling</description>
<button-text>Ta meg til handling!</button-text>
</link>
<due-date>2020-09-10T00:00:00+01:00</due-date>
<sum>42</sum>
<creditor-account>01235424320</creditor-account>
<kid>1435025439583420243982723</kid>
</invoice>
```

## 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
<invoice-payment xmlns="http://api.digipost.no/schema/datatypes">
<payment-id>33aa4572ac1c61d807345c5968ab1fbd</payment-id>
<payment-status>PDNG</payment-status>
<payment-time>2020-09-21T00:00:00+01:00</payment-time>
<debtor-account>01235424320</debtor-account>
<payment-channel>My pay app</payment-channel>
<payment-bank>
<id>ce7ad8ba63d0ea5cd212580192a00156</id>
<name>Acme Bank inc</name>
</payment-bank>
</invoice-payment>
```

## Payslip

For treating documents as Payslips.
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/no/digipost/api/datatypes/ComplementedBy.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<? extends DataType> dataType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 0 additions & 1 deletion src/main/java/no/digipost/api/datatypes/types/Address.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/no/digipost/api/datatypes/types/Barcode.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/no/digipost/api/datatypes/types/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/no/digipost/api/datatypes/types/Link.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Loading

0 comments on commit 7ceb76e

Please sign in to comment.