itk-dev/os2forms_cpr_lookup

Provides integration to CPR service provided by Serviceplatformen.

Installs: 1 972

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 3

Forks: 0

Open Issues: 4

Type:drupal-module

1.8.0 2023-05-09 09:00 UTC

README

Query the Danish for CPR register for Drupal Webforms. This module uses the service SF1520 from Serviceplatformen. Information and documentation can be obtained by following the link.

Installation

Require it with composer:

composer require "itk-dev/os2forms_cpr_lookup"

Enable it with drush:

drush pm:enable os2forms_cpr_lookup

Add the following configuration:

$config['os2forms_cpr_lookup'] = [
  'azure_tenant_id' => '',
  'azure_application_id' => '',
  'azure_client_secret' => '',

  'azure_key_vault_name' => '',
  'azure_key_vault_secret' => '',
  'azure_key_vault_secret_version' => '',

  'service_agreement_uuid' => '',
  'user_system_uuid' => '',
  'user_uuid' => '',

  'service_uuid' => '',
  'service_endpoint' => '',
  'service_contract' => dirname(DRUPAL_ROOT) . '/vendor/itk-dev/serviceplatformen/resources/person-base-data-extended-service-contract/wsdl/context/PersonBaseDataExtendedService.wsdl',
];

Usage

This module provides functionality for querying the danish CPR register and showing the result in webforms.

This can be done in two ways:

  1. By adding a query element which when changed performs a query and populates other elements with the result.
  2. By requiring personal NemLog-in login on the form (set Edit form > Settings > Third party settings > OS2Forms > OS2Forms NemID settings > Webform type to “Personal”) and having elements pre-filled based on data fetched from the CPR service.

Note: You cannot use both methods on the same form, i.e. you cannot have some elements filled by a dynamic lookup based on an “CPR Element” and have other elements filled based on an authenticated users’ data.

The elements provided:

  • CPR Element - Element which queries the Danish CPR register when changed.
  • CPR Name Element - This is populated with the name from the above mentioned query result.
  • CPR Address Element - This is populated with the address from the result.
  • CPR Street Element - This is filled with the name of the street from the result.
  • CPR House Number Element - This is filled with the house number from the result.
  • CPR Side Element - This is filled with the side from the result.
  • CPR Floor Element - This is filled with the floor from the result.
  • CPR Postal Code Element - This is filled with the postal code from the result.
  • CPR City Element - This is filled with the city from the result.

Coding standards

Check coding standards (run composer install to install the required tools):

composer coding-standards-check

Apply coding standards:

composer coding-standards-apply