Skip to content

Commit

Permalink
Added postForespoerg types
Browse files Browse the repository at this point in the history
  • Loading branch information
rimi-itk committed Sep 24, 2024
1 parent fe4a2d0 commit 50af358
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ '8.1' ]
php: [ '8.1', '8.3' ]
name: Validate composer (${{ matrix.php}})
steps:
- name: Checkout
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ '8.1' ]
php: [ '8.1', '8.3' ]
name: PHP coding Standards (${{ matrix.php }})
steps:
- name: Checkout
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ '8.1' ]
php: [ '8.1', '8.3' ]
name: PHP code analysis (${{ matrix.php }})
steps:
- name: Checkout
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- [PR-37](https://github.com/itk-dev/serviceplatformen/pull/37)
Added postForespoerg types

## [1.5.2] - 2024-08-06

- [PR-31](https://github.com/itk-dev/serviceplatformen/pull/31)
Expand Down
12 changes: 12 additions & 0 deletions src/Service/SF1601/SF1601.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use DOMElement;
use DOMText;
use ItkDev\Serviceplatformen\Service\AbstractRESTService;
use ItkDev\Serviceplatformen\Service\Exception\InvalidArgumentException;
use ItkDev\Serviceplatformen\Service\Exception\ServiceException;
use ItkDev\Serviceplatformen\Service\SF1601\Exception\InvalidMemoException;
use Oio\Fjernprint\ForsendelseI;
Expand All @@ -38,6 +39,14 @@ class SF1601 extends AbstractRESTService
self::TYPE_NEM_SMS,
];

public const FORESPOERG_TYPE_DIGITAL_POST = 'digitalpost';
public const FORESPOERG_TYPE_NEM_SMS = 'nemsms';

public const FORESPOERG_TYPES = [
self::FORESPOERG_TYPE_DIGITAL_POST,
self::FORESPOERG_TYPE_NEM_SMS,
];

// Where the hell are these documented?!
public const MESSAGE_TYPE_DIGITAL_POST = 'DIGITALPOST';
public const MESSAGE_TYPE_NEM_SMS = 'NEMSMS';
Expand Down Expand Up @@ -94,6 +103,9 @@ protected function configureOptions(OptionsResolver $resolver)

public function postForespoerg(string $transactionId, string $type, string $identifier, DateTimeInterface $transactionTid = null): array
{
if (!in_array($type, self::FORESPOERG_TYPES)) {
throw new InvalidArgumentException(sprintf('Invalid type: %s', $type));
}
$entityId = $this->getOption('post_forespoerg_svc_entity_id');
$url = $this->getOption('post_forespoerg_svc_endpoint') . '/' . $type;
$response = $this->call($entityId, 'GET', $url, [
Expand Down

0 comments on commit 50af358

Please sign in to comment.