diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 97853aa..84de629 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -6,12 +6,12 @@ jobs:
build:
strategy:
matrix:
- java: [ '8', '11', '17' ]
+ java: [ '8']
name: Build on Java ${{ matrix.java }}
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
- - uses: actions/setup-java@v3
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
+ - uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
with:
distribution: temurin
java-version: ${{ matrix.java }}
@@ -20,36 +20,41 @@ jobs:
run: mvn -B verify --no-transfer-progress --show-version
- publishing_parameters:
+ publish:
needs: build
- name: Publishing parameters
+ name: Publish ${{ github.ref_name }}
runs-on: ubuntu-latest
- outputs:
- is_release: ${{ steps.version.outputs.is_release }}
- version: ${{ steps.version.outputs.version }}
steps:
- - name: Determine version
- id: version
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
+ - name: Set up Java
+ uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
+ with:
+ distribution: temurin
+ java-version: '8'
+ cache: "maven"
+ gpg-private-key: ${{ secrets.MAVEN_CENTRAL_SIGNING_KEY_PRIVATE }}
+ server-id: central
+ server-username: MAVEN_CENTRAL_TOKEN_USERNAME
+ server-password: MAVEN_CENTRAL_TOKEN_PASSWORD
+ gpg-passphrase: MAVEN_GPG_PASSPHRASE
+ - name: Activate Artifact Signing and Version Suffix
run: |
- if [[ $GITHUB_REF == *"tags"* ]]; then
- is_release=true
- version=${GITHUB_REF#refs/tags/}
+ profiles="build-sources-and-javadoc,deploy-to-maven-central"
+ if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
+ profiles="$profiles,sign-artifacts"
+ version_suffix=""
else
- is_release=false
- version=${GITHUB_REF#refs/heads/}-SNAPSHOT
+ version_suffix="-SNAPSHOT"
fi
- echo "is_release=${is_release//\//-}" >> $GITHUB_OUTPUT
- echo "version=${version//\//-}" >> $GITHUB_OUTPUT
-
-
- publish:
- needs: publishing_parameters
- name: Publish ${{ needs.publishing_parameters.outputs.version }}
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
- - uses: digipost/action-maven-publish@v1
- with:
- sonatype_secrets: ${{ secrets.sonatype_secrets }}
- release_version: ${{ needs.publishing_parameters.outputs.version }}
- perform_release: ${{ needs.publishing_parameters.outputs.is_release }}
+ echo "MAVEN_PROFILES=$profiles" >> $GITHUB_ENV
+ version="${GITHUB_REF_NAME}${version_suffix}"
+ echo "VERSION=$version" >> $GITHUB_ENV
+ - name: Set Maven version
+ run: mvn --batch-mode --no-transfer-progress versions:set -DnewVersion=${VERSION}
+ - name: Build and deploy to Maven Central
+ run: |
+ mvn --batch-mode --no-transfer-progress --activate-profiles ${MAVEN_PROFILES} deploy
+ env:
+ MAVEN_CENTRAL_TOKEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_TOKEN_USERNAME }}
+ MAVEN_CENTRAL_TOKEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN_PASSWORD }}
+ MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_CENTRAL_SIGNING_KEY_PASSPHRASE }}
diff --git a/datatypes-examples.xml b/datatypes-examples.xml
index 60dae2b..9c93d16 100644
--- a/datatypes-examples.xml
+++ b/datatypes-examples.xml
@@ -150,7 +150,10 @@
-
+
+ 2020-09-21
+ 5000
+
KB432788293NO
diff --git a/datatypes.xsd b/datatypes.xsd
index 27a5089..18327e8 100644
--- a/datatypes.xsd
+++ b/datatypes.xsd
@@ -206,7 +206,10 @@
-
+
+
+
+
diff --git a/pom.xml b/pom.xml
index c8a3856..21e3408 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
no.digipost
digipost-open-super-pom
- 13
+ 14
digipost-data-types
@@ -174,7 +174,7 @@
maven-clean-plugin
- 3.2.0
+ 3.5.0
maven-resources-plugin
@@ -182,14 +182,14 @@
maven-compiler-plugin
- 3.11.0
+ 3.14.0
true
maven-enforcer-plugin
- 3.3.0
+ 3.6.1
@@ -205,33 +205,33 @@
maven-surefire-plugin
- 3.0.0
+ 3.5.3
maven-dependency-plugin
- 3.5.0
+ 3.8.1
maven-jar-plugin
- 3.3.0
+ 3.4.2
maven-install-plugin
- 3.1.1
+ 3.1.4
maven-deploy-plugin
- 3.1.1
+ 3.1.4
org.codehaus.mojo
versions-maven-plugin
- 2.15.0
+ 2.18.0
org.codehaus.mojo
exec-maven-plugin
- 3.1.0
+ 3.5.1
com.github.siom79.japicmp
@@ -260,7 +260,7 @@
- ${project.build.sourceDirectory}
+ ${project.build.sourceDirectory}/no/digipost/api/datatypes/types/
${project.build.directory}/schemagen-work/lombok
false
diff --git a/readme.md b/readme.md
index df70766..3140517 100644
--- a/readme.md
+++ b/readme.md
@@ -458,14 +458,19 @@ For treating documents as Payslips.
### Fields
-|Name|Type|Required|Description|
-|----|----|--------|-----------|
+| Name | Type | Required | Description |
+|-------------|------------|----------|----------------------------------------|
+| paymentDate | LocalDate | no | The date when the salary is paid out |
+| netAmount | BigDecimal | no | Net salary, the actual amount paid out |
### XML
```xml
-
+
+ 2020-09-21
+ 5000
+
```
## PickupNotice
diff --git a/src/main/java/no/digipost/api/datatypes/marshalling/LocalDateXmlAdapter.java b/src/main/java/no/digipost/api/datatypes/marshalling/LocalDateXmlAdapter.java
new file mode 100644
index 0000000..6c7cb29
--- /dev/null
+++ b/src/main/java/no/digipost/api/datatypes/marshalling/LocalDateXmlAdapter.java
@@ -0,0 +1,24 @@
+package no.digipost.api.datatypes.marshalling;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+
+public class LocalDateXmlAdapter extends XmlAdapter {
+ @Override
+ public LocalDate unmarshal(String s) {
+ if (s == null) {
+ return null;
+ }
+ return LocalDate.from(DateTimeFormatter.ISO_LOCAL_DATE.parse(s));
+ }
+ @Override
+ public String marshal(LocalDate v) {
+ if (v == null) {
+ return null;
+ }
+ return v.format(DateTimeFormatter.ISO_LOCAL_DATE);
+ }
+}
+
diff --git a/src/main/java/no/digipost/api/datatypes/types/Payslip.java b/src/main/java/no/digipost/api/datatypes/types/Payslip.java
index 9e78fde..0ac3f0f 100644
--- a/src/main/java/no/digipost/api/datatypes/types/Payslip.java
+++ b/src/main/java/no/digipost/api/datatypes/types/Payslip.java
@@ -1,16 +1,38 @@
package no.digipost.api.datatypes.types;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
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 no.digipost.api.datatypes.marshalling.LocalDateXmlAdapter;
-import javax.xml.bind.annotation.XmlRootElement;
+import java.math.BigDecimal;
+import java.time.LocalDate;
@XmlRootElement
@Value
@AllArgsConstructor
+@NoArgsConstructor(force = true)
+@With
@Description("For treating documents as Payslips.")
public class Payslip implements DataType {
- public static Payslip EXAMPLE = new Payslip();
+
+ @XmlElement(name = "payment-date")
+ @XmlJavaTypeAdapter(LocalDateXmlAdapter.class)
+ @Description("The date when the salary is paid out")
+ LocalDate paymentDate;
+
+ @XmlElement(name = "net-amount")
+ @Description("Net salary, the actual amount received")
+ BigDecimal netAmount;
+
+
+ public static Payslip EXAMPLE = new Payslip(
+ LocalDate.parse("2025-01-01"),
+ new BigDecimal("42000.00"));
}