-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fjerner alt som har med faktura og oppslag på bankkontonummer å gjøre.
Både STNB 2.0 (faktura) og kvitteringstjenesten (oppslag på kontonummer) er avsluttet, så disse APIene skal ikke lenger være i bruk.
- Loading branch information
1 parent
16ac832
commit 3ecce70
Showing
21 changed files
with
172 additions
and
474 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
--- | ||
title: Introduction | ||
identifier: introduction | ||
layout: default | ||
--- | ||
|
||
This API makes it possible to access agreements between Digipost users and third parties, and followingly perform certain operations which the user has granted the third party. | ||
For instance, the user may permit that certain information may be provided to a third party in order to receive a service. The user may also grant the sender access to documents | ||
through an agreement. The agreement governs which documents the sender can access and what operations it can perform. | ||
|
||
|
||
### Download | ||
|
||
The library can be acquired from Maven Central Repository, using the dependency management tool of your choice. | ||
For Maven you can use the following dependency: | ||
|
||
```xml | ||
<dependency> | ||
<groupId>no.digipost</groupId> | ||
<artifactId>digipost-useragreements-api-client-java</artifactId> | ||
<version>2.0-delta</version> | ||
</dependency> | ||
``` | ||
|
||
### Prerequisites | ||
|
||
The library requires *Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files for JDK/JRE* to be installed: | ||
[www.oracle.com/technetwork/java/javase/downloads/index.html](http://www.oracle.com/technetwork/java/javase/downloads/index.html) | ||
|
||
Starting from *Java 8 build 152* the unlimited strength cryptography policy files are bundled with the JDK/JRE, and may be enabled by setting | ||
the security property `security.policy` to `"unlimited"`. How this is set depends on how you deploy your application, but if done early enough, | ||
i.e. *before* the JCE framework is initialized, it can be set programatically like this: | ||
|
||
```java | ||
Security.setProperty("crypto.policy", "unlimited"); // only effective on Java 8 b152 or newer | ||
``` | ||
|
||
More details are available in the [Java 8u152 Release Notes](http://www.oracle.com/technetwork/java/javase/8u152-relnotes-3850503.html#JDK-8157561). | ||
|
||
|
||
### Instantiate and configure client | ||
|
||
```java | ||
InputStream key = getClass().getResourceAsStream("certificate.p12"); | ||
|
||
HttpHost proxy = new HttpHost("proxy.example.com", 8080, "http"); | ||
|
||
BrokerId brokerId = BrokerId.of(1234L); | ||
|
||
DigipostUserAgreementsClient client = new DigipostUserAgreementsClient | ||
.Builder(brokerId, key, "password") | ||
.useProxy(proxy) //optional | ||
.setHttpClientBuilder(HttpClientBuilder.create()) //optional | ||
.serviceEndpoint(URI.create("https://api.digipost.no")) //optional | ||
.build(); | ||
``` | ||
|
||
### Identify Digipost user | ||
|
||
```java | ||
final SenderId senderId = SenderId.of(1234L); | ||
final UserId userId = UserId.of("01017012345"); | ||
|
||
final IdentificationResult identificationResult = client.identifyUser(senderId, userId); | ||
boolean isDigipost = identificationResult.getResult() == IdentificationResultCode.DIGIPOST; | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
--- | ||
title: Messages sent to user | ||
identifier: fetch_messages | ||
layout: default | ||
--- | ||
|
||
The agreement type `FETCH_MESSAGES` allows a sender to retrieve metadata for | ||
documents that sender has previously sent to the user, that e.g. can be used to | ||
present a synthetic inbox to the user. The metadata includes a deep-link the | ||
user can use to access the document in Digipost. | ||
|
||
|
||
### Create, read, update and delete agreement | ||
|
||
```java | ||
final SenderId senderId = SenderId.of(1234L); | ||
final UserId userId = UserId.of("01017012345"); | ||
|
||
//CreateAgreement | ||
client.createOrReplaceAgreement(senderId, Agreement.createAgreement(userId, AgreementType.FETCH_MESSAGES)); | ||
|
||
//GetAgreement | ||
final GetAgreementResult agreement = client.getAgreement(senderId, AgreementType.FETCH_MESSAGES, userId); | ||
|
||
//UpdateAgreement | ||
client.createOrReplaceAgreement(senderId, Agreement.createAgreement(userId, AgreementType.FETCH_MESSAGES)); | ||
|
||
//DeleteAgreement | ||
client.deleteAgreement(senderId, AgreementType.FETCH_MESSAGES, userId); | ||
``` | ||
|
||
### Get and verify agreement | ||
|
||
```java | ||
final SenderId senderId = SenderId.of(1234L); | ||
final UserId userId = UserId.of("01017012345"); | ||
|
||
final GetAgreementResult agreementResult = client.getAgreement(senderId, AgreementType.FETCH_MESSAGES, userId); | ||
if (agreementResult.isSuccess()) { | ||
final Agreement agreement = agreementResult.getAgreement(); | ||
} else { | ||
switch (agreementResult.getFailedReason()) { | ||
case UNKNOWN_USER: //User does not have a Digipost account | ||
case NO_AGREEMENT: //No agreement exists for user | ||
} | ||
} | ||
``` | ||
|
||
### Get documents | ||
|
||
```java | ||
final SenderId senderId = SenderId.of(1234L); | ||
final UserId userId = UserId.of("01017012345"); | ||
|
||
final List<Document> previouslyDeliveredDocs = client.getDocuments(senderId, AgreementType.FETCH_MESSAGES, | ||
userId, GetDocumentsQuery.empty()); | ||
|
||
final ZoneId OSLO_ZONE = ZoneId.of("Europe/Oslo"); | ||
final List<Document> withinTimeWindow = client.getDocuments(senderId, AgreementType.FETCH_MESSAGES, userId, | ||
GetDocumentsQuery.builder() | ||
.deliveryTimeFrom(ZonedDateTime.of(2020, 1, 1, 0, 0, 0, 0, OSLO_ZONE)) | ||
.deliveryTimeTo(ZonedDateTime.now(OSLO_ZONE)) | ||
.build()); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
identifier: index | ||
layout: default | ||
redirect_from: / | ||
--- | ||
|
||
<!-- Documentation --> | ||
{% for dok in site.v3_x %} | ||
{% if dok.identifier != 'index' %} | ||
<section class="bs-docs-section"> | ||
<h1 id="{{ dok.identifier }}" class="page-header">{{ dok.title}}</h1> | ||
{{dok.content}} | ||
</section> | ||
{% endif%} | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.