Skip to content

Commit 52e5f1e

Browse files
committed
Added Schultz Fasit handler
1 parent b958990 commit 52e5f1e

21 files changed

+1504
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ before starting to add changes. Use example [placed in the end of the page](#exa
1212
## [Unreleased]
1313

1414
- [OS-119] Keeping value of CPR clean, not adding address protection text
15+
- Added Schultz Fasit handler.
1516

1617
## [3.16.0] 2024-08-27
1718

modules/os2forms_fasit/README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# OS2Forms Fasit
2+
3+
Adds [Fasit Schultz](https://schultz.dk/loesninger/schultz-fasit/)
4+
handler for archiving purposes.
5+
6+
## Installation
7+
8+
```sh
9+
drush pm:enable os2forms_fasit
10+
```
11+
12+
## Settings
13+
14+
Configure Fasit API `base url` and a way of getting
15+
certificate on `/admin/os2forms_fasit/settings`.
16+
17+
### Certificate
18+
19+
The certificate must be in `pem` or `cer` format and
20+
must be whitelisted by Fasit Schultz.
21+
For this the certificate thumbprint,
22+
in lowercase and without colons, is needed.
23+
To get the thumbprint in the correct format from the command line run
24+
25+
```sh
26+
openssl x509 -in SOME_CERTIFICATE.pem -noout -fingerprint | cut -d= -f2 | sed 's/://g' | tr '[:upper:]' '[:lower:]'
27+
```
28+
29+
Example output
30+
31+
```sh
32+
6acb261f393172d87fa3997cec86569759a8528a
33+
```
34+
35+
## Queue
36+
37+
Archiving is done via an
38+
[Advanced Queue](https://www.drupal.org/project/advancedqueue)
39+
called `fasit_queue`.
40+
41+
The queue should be processed with `drush`:
42+
43+
```sh
44+
drush advancedqueue:queue:process fasit_queue
45+
```
46+
47+
List the queue (and all other queues) with
48+
49+
```sh
50+
drush advancedqueue:queue:list
51+
```
52+
53+
or go to `/admin/config/system/queues/jobs/fasit_queue`
54+
for a graphical overview of jobs in the queue.
55+
56+
### Cronjob
57+
58+
Consider running the queue via a cronjob.
59+
60+
```cron
61+
*/5 * * * * /path/to/drush advancedqueue:queue:process fasit_queue
62+
```
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
langcode: da
2+
status: true
3+
dependencies: { }
4+
id: fasit_queue
5+
label: 'Fasit Queue'
6+
backend: database
7+
backend_configuration:
8+
lease_time: 300
9+
processor: daemon
10+
processing_time: 280
11+
locked: false
12+
threshold:
13+
type: 0
14+
limit: 0
15+
state: all
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: 'OS2Forms Fasit'
2+
type: module
3+
description: 'Fasit integration'
4+
package: OS2Forms
5+
core_version_requirement: ^9 || ^10
6+
dependencies:
7+
- drupal:webform
8+
- drupal:advancedqueue
9+
- os2forms:os2forms_attachment
10+
configure: os2forms_fasit.admin.settings
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
os2forms_fasit.admin.settings:
2+
title: OS2Forms Fasit
3+
description: Configure the OS2Forms Fasit module
4+
parent: system.admin_config_system
5+
route_name: os2forms_fasit.admin.settings
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
os2forms_fasit.admin.settings:
2+
path: '/admin/os2forms_fasit/settings'
3+
defaults:
4+
_form: '\Drupal\os2forms_fasit\Form\SettingsForm'
5+
_title: 'Fasit settings'
6+
requirements:
7+
_permission: 'administer site configuration'
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
services:
2+
Drupal\os2forms_fasit\Helper\Settings:
3+
arguments:
4+
- "@keyvalue"
5+
6+
Drupal\os2forms_fasit\Helper\CertificateLocatorHelper:
7+
arguments:
8+
- "@Drupal\\os2forms_fasit\\Helper\\Settings"
9+
10+
Drupal\os2forms_fasit\Helper\FasitHelper:
11+
arguments:
12+
- '@http_client'
13+
- '@entity_type.manager'
14+
- "@Drupal\\os2forms_fasit\\Helper\\Settings"
15+
- "@Drupal\\os2forms_fasit\\Helper\\CertificateLocatorHelper"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace Drupal\os2forms_fasit\Exception;
4+
5+
/**
6+
* Certificate locator exception.
7+
*/
8+
class CertificateLocatorException extends Exception {
9+
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace Drupal\os2forms_fasit\Exception;
4+
5+
/**
6+
* Certificate locator exception.
7+
*/
8+
class Exception extends \Exception {
9+
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace Drupal\os2forms_fasit\Exception;
4+
5+
/**
6+
* Fasit response exception.
7+
*/
8+
class FasitResponseException extends Exception {
9+
10+
}

0 commit comments

Comments
 (0)