Skip to content

Commit

Permalink
Merge branch 'develop' into feature/audit-log-digital-post
Browse files Browse the repository at this point in the history
  • Loading branch information
jekuaitk authored Dec 6, 2024
2 parents 8ccdb91 + f4f574f commit dbdec2a
Show file tree
Hide file tree
Showing 22 changed files with 1,579 additions and 1 deletion.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ before starting to add changes. Use example [placed in the end of the page](#exa
- Adds audit logging to `os2forms_digital_post`
- Adds audit logging to `os2forms_nemid`

## [3.18.0] 2024-12-05

- Added `os2forms_fasit` module.

## [3.17.0] 2024-11-21

- Updated `os2web/os2web_audit` version
Expand Down Expand Up @@ -302,7 +306,8 @@ before starting to add changes. Use example [placed in the end of the page](#exa
- Security in case of vulnerabilities.
```

[Unreleased]: https://github.com/OS2Forms/os2forms/compare/3.17.0...HEAD
[Unreleased]: https://github.com/OS2Forms/os2forms/compare/3.18.0...HEAD
[3.18.0]: https://github.com/OS2Forms/os2forms/compare/3.17.0...3.18.0
[3.17.0]: https://github.com/OS2Forms/os2forms/compare/3.16.2...3.17.0
[3.16.2]: https://github.com/OS2Forms/os2forms/compare/3.16.1...3.16.2
[3.16.1]: https://github.com/OS2Forms/os2forms/compare/3.16.0-beta1...3.16.1
Expand Down
64 changes: 64 additions & 0 deletions modules/os2forms_fasit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# OS2Forms Fasit

Adds [Fasit Schultz](https://schultz.dk/loesninger/schultz-fasit/)
handler for archiving purposes.

For usage in danish, see [BENYTTELSE](docs/BENYTTELSE.md).

## Installation

```sh
drush pm:enable os2forms_fasit
```

## Settings

Configure Fasit API `base url` and a way of getting
certificate on `/admin/os2forms_fasit/settings`.

### Certificate

The certificate must be in `pem` or `cer` format and
must be whitelisted by Fasit Schultz.
For this the certificate thumbprint,
in lowercase and without colons, is needed.
To get the thumbprint in the correct format from the command line run

```sh
openssl x509 -in SOME_CERTIFICATE.pem -noout -fingerprint | cut -d= -f2 | sed 's/://g' | tr '[:upper:]' '[:lower:]'
```

Example output

```sh
6acb261f393172d87fa3997cec86569759a8528a
```

## Queue

Archiving is done via an
[Advanced Queue](https://www.drupal.org/project/advancedqueue)
called `fasit_queue`.

The queue should be processed with `drush`:

```sh
drush advancedqueue:queue:process fasit_queue
```

List the queue (and all other queues) with

```sh
drush advancedqueue:queue:list
```

or go to `/admin/config/system/queues/jobs/fasit_queue`
for a graphical overview of jobs in the queue.

### Cronjob

Consider running the queue via a cronjob.

```cron
*/5 * * * * /path/to/drush advancedqueue:queue:process fasit_queue
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
langcode: da
status: true
dependencies: { }
id: fasit_queue
label: 'Fasit Queue'
backend: database
backend_configuration:
lease_time: 300
processor: daemon
processing_time: 280
locked: false
threshold:
type: 0
limit: 0
state: all
62 changes: 62 additions & 0 deletions modules/os2forms_fasit/docs/BENYTTELSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# OS2Forms Fasit

Modulet OS2Forms Fasit giver muligheden for at videresende et genereret
indsendelsesbilag til en borger i fagsystemet Fasit Schultz.

## Krav

For at kunne snakke sammen med Fasit skal kommunen og Fasit først indbyrdes
aftale hvilke certifikater der anvendes. Disse certifikater skal være OCES-3,
f.eks. FOCES-3, og skal bruges i pem- eller cer-format.

Dernæst oplyses det anvendte certifikats thumbprint eller public-key til Fasit,
som derefter aktiverer snitfladen. Se evt.
[README#certificate](../README.md#certificate)
for hvordan et certifikats thumbprint kan findes gennem kommandolinjen.

## Konfiguration

Integrationen konfigureres under
**Indstillinger** > **OS2Forms Fasit** (/admin/os2forms_fasit/settings).
Her skal følgende sættes op:

* Fasit API base url
* Basis url’en til Fasit. Denne specificeres af Fasit.
* Eksempel: https://webservices.fasit.dk/
* Fasit API tenant
* Fasit tenant. Denne specificeres af Fasit.
* Eksempel: aarhus
* Fasit API version
* Hvilken version af af API’et der skal bruges. Her er mulighederne ’v1’ eller ’v2’. Der bør altid bruges ’v2’.
* Eksempel: v2
* Certificate
* Her kan angives detaljer til et azure key vault hvori certifikatet ligges (Azure key vault) eller en sti direkte til certifikatet (Filsystem)
* Passphrase
* Passphrase til certifikatet, hvis sådan et eksisterer.


Se evt. Fasit Scultz dokumentationen for flere detaljer på opbygningen af endpoint url’er.

Det er desuden muligt at teste om os2forms kan få fat i certifikatet på samme konfigurations-side.

## Handler

For at videresende noget til Fasit skal der på formular niveau opsættes en ’Fasit’-handler.
Dette gøres på en formular under Indstillinger > Emails/Handlers > Add handler.
På denne konfigureres følgende:

* Document title
* Dokumentets titel i Fasit
* Document description
* Dokumentets beskrivelse i Fasit
* CPR element
* Elementet der indeholdender det CPR-nummer der skal videresendes til i Fasit.
* Her kan benyttes enten ’textfield’, ’os2forms_nemid_cpr’ eller ’os2forms_person_lookup’.
* Attachment element
* Elementet der står for at oprette et OS2Forms attachment, altså et ’os2forms_attachment’-element.

Alle felter er obligatoriske.

Når der indsendes en formular bliver et ‘job’ sat i en kø.
Videresendelsen til Fasit sker først når dette job køres.
Se [README#queue](../README.md#queue) for flere detaljer.
10 changes: 10 additions & 0 deletions modules/os2forms_fasit/os2forms_fasit.info.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: 'OS2Forms Fasit'
type: module
description: 'Fasit integration'
package: OS2Forms
core_version_requirement: ^9 || ^10
dependencies:
- drupal:webform
- drupal:advancedqueue
- os2forms:os2forms_attachment
configure: os2forms_fasit.admin.settings
5 changes: 5 additions & 0 deletions modules/os2forms_fasit/os2forms_fasit.links.menu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
os2forms_fasit.admin.settings:
title: OS2Forms Fasit
description: Configure the OS2Forms Fasit module
parent: system.admin_config_system
route_name: os2forms_fasit.admin.settings
7 changes: 7 additions & 0 deletions modules/os2forms_fasit/os2forms_fasit.routing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
os2forms_fasit.admin.settings:
path: '/admin/os2forms_fasit/settings'
defaults:
_form: '\Drupal\os2forms_fasit\Form\SettingsForm'
_title: 'Fasit settings'
requirements:
_permission: 'administer site configuration'
15 changes: 15 additions & 0 deletions modules/os2forms_fasit/os2forms_fasit.services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
services:
Drupal\os2forms_fasit\Helper\Settings:
arguments:
- "@keyvalue"

Drupal\os2forms_fasit\Helper\CertificateLocatorHelper:
arguments:
- "@Drupal\\os2forms_fasit\\Helper\\Settings"

Drupal\os2forms_fasit\Helper\FasitHelper:
arguments:
- '@http_client'
- '@entity_type.manager'
- "@Drupal\\os2forms_fasit\\Helper\\Settings"
- "@Drupal\\os2forms_fasit\\Helper\\CertificateLocatorHelper"
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Drupal\os2forms_fasit\Exception;

/**
* Certificate locator exception.
*/
class CertificateLocatorException extends Exception {

}
10 changes: 10 additions & 0 deletions modules/os2forms_fasit/src/Exception/Exception.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Drupal\os2forms_fasit\Exception;

/**
* Certificate locator exception.
*/
class Exception extends \Exception {

}
10 changes: 10 additions & 0 deletions modules/os2forms_fasit/src/Exception/FasitResponseException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Drupal\os2forms_fasit\Exception;

/**
* Fasit response exception.
*/
class FasitResponseException extends Exception {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Drupal\os2forms_fasit\Exception;

/**
* Fasit XML generation exception.
*/
class FasitXMLGenerationException extends Exception {

}
10 changes: 10 additions & 0 deletions modules/os2forms_fasit/src/Exception/FileTypeException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Drupal\os2forms_fasit\Exception;

/**
* File type exception.
*/
class FileTypeException extends Exception {

}
10 changes: 10 additions & 0 deletions modules/os2forms_fasit/src/Exception/InvalidSettingException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Drupal\os2forms_fasit\Exception;

/**
* Invalid setting exception.
*/
class InvalidSettingException extends Exception {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Drupal\os2forms_fasit\Exception;

/**
* Invalid submission exception.
*/
class InvalidSubmissionException extends Exception {

}
Loading

0 comments on commit dbdec2a

Please sign in to comment.