Simple API Types

Simple types for use in implementing financial APIs

License

License

Categories

Categories

Data
GroupId

GroupId

dk.bankdata.api
ArtifactId

ArtifactId

types
Last Version

Last Version

1.0.19
Release Date

Release Date

Type

Type

pom
Description

Description

Simple API Types
Simple types for use in implementing financial APIs

Download types

How to add to project

<!-- https://jarcasting.com/artifacts/dk.bankdata.api/types/ -->
<dependency>
    <groupId>dk.bankdata.api</groupId>
    <artifactId>types</artifactId>
    <version>1.0.19</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/dk.bankdata.api/types/
implementation 'dk.bankdata.api:types:1.0.19'
// https://jarcasting.com/artifacts/dk.bankdata.api/types/
implementation ("dk.bankdata.api:types:1.0.19")
'dk.bankdata.api:types:pom:1.0.19'
<dependency org="dk.bankdata.api" name="types" rev="1.0.19">
  <artifact name="types" type="pom" />
</dependency>
@Grapes(
@Grab(group='dk.bankdata.api', module='types', version='1.0.19')
)
libraryDependencies += "dk.bankdata.api" % "types" % "1.0.19"
[dk.bankdata.api/types "1.0.19"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

Overview

This project contains a number of simple types used by Bankdata financial APIs. The project is intended to aid the implementation of Java POJO models for JSON serialization.

Maven Central Javadoc Build Status License: MIT Known Vulnerabilities

Usage

The library is deployed to Maven Central dk.bankdata.api:types and may be used from both Gradle or Maven.

AccountNumber

AccountNumber represents a danish account along with an encryption and decryption option.

AccountNumber number = new AccountNumber.Builder()
    .regNo("some-regno")
    .accountNo("some-accountno")
    .shadowAccountId("some-shadowAccountId")
    .cipherKey("ThisIsPossiblyTheWorstCreatedKey")
    .build();

Which will be serialized as

{
  "regNo": "some-regno", 
  "accountNo": "some-accountno",
  "shadowAccountId": "some-shadowAccountId",
  "publicId": "gSM4IML5DaaCi3ctaFlP1jrTbpByjMGH9iD28Z96i4gOti8cx0tiaBNwJyDV-YHQj9GYU_OCMwvmh4t0gIv38PlXvMqlUbY7A4Zwan9EBhW_xOxtkZ3Zqneey0DXknf6qV8V-wBFGg5wT-GzHrRn7A=='
}

NOTE: a publicId will only be generated if a cipherKey has been supplied

To decrypt a publicId use the following method

AccountNumber decrypted = AccountNumber
    .decrypt("ThisIsPossiblyTheWorstCreatedKey", 
              number.getPublicId()
);

Error Details

Error details can be used in responses of type application/error+json as follows.

ErrorDetails error = new ErrorDetails.Builder()
    .messageId("app.area.sub")
    .status(500)
    .detail("An unrecoverable error occurred")
    .extension("balance", 23)
    .build();

Which will be serialized as:

{
  "messageID": "app.area.sub",
  "status": 500,
  "detail": "An unrecoverable error occurred",
  "balance": 23
}

Note the use of extension members relies on Jackson serialization features.

Amount with Currency

The library contains a simple type for representing an amount with associated currencyCode. Simply use dk.bankdata.api.types.CurrencyAmount which will be serialized to json as:

{
  "amount": 12345.12,
  "currencyCode": "DKK"
}

Date and Time Serialization

The library contains simple support for always serializing date and time into and JSON object with milliseconds from unix epoch as well as a more human-readable ISO formatted date. Note this requires Jackson to be used for serialization.

The date and time will be serialized as follows.

{
  "epochMilli": 3600000,
  "utc": "1970-01-01T01:00:00Z"
}

This may be achieved either by using dk.bankdata.api.types.DateTime or by using a standard Java java.time.Instant adding a Jackson serializer like so.

class POJO {
    @JsonSerialize(using = DateTimeSerializer.class)
    Instant dateTime;
}
dk.bankdata.api

Bankdata

Bankdata is one of the largest financial technology companies in Denmark with 650 employees.

Versions

Version
1.0.19
1.0.18
1.0.17
1.0.16
1.0.15
1.0.14
1.0.13
1.0.12
1.0.11
1.0.10
1.0.9
1.0.8
1.0.7
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0