Skip to content

Commit

Permalink
Add support for pain.001.001.09 and pain.008.01.08.
Browse files Browse the repository at this point in the history
  • Loading branch information
AbcAeffchen committed Jan 20, 2025
1 parent ff6cf22 commit 4541f55
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 29 deletions.
16 changes: 14 additions & 2 deletions CHANGE_LOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
Sephpa - Change Log
SepaUtilities - Change Log
===============

## 2.0.0 - Jan 20, 24
- Minimal required PHP version is now 8.1 as it is the currently oldest supported version.
- **Add support for pain.001.001.09 and pain.008.001.08.**
- `check()` supports new fields: `reqdexctndttm`, subfields of `pstladr` (`bldgnm`,`bldgnb`, `twnnm`, `twnlctnnm`, `dstrctnm`,
`ctrysubdvsn`, `pstbx`, `pstcd`, `dept`, `subdept`, `strtnm`, `flr`, `room`). All fields are case-insensitive.
- Add missing parameter and return types.
- `getDate()`, `getDateWithOffset()` do not throw anymore to simplify checking for errors.
- `checkAndSanitizeAll()` now returns an array instead of a string in case of an error.

# 1.3.4 - Sep 8, 21
- Add key `orgid_sm` to the check and sanitize functions.

## 1.3.3 - Mar 4, 21
- Fixed typo in `ultmtCdtr` (was `ultmtCdrt` before). The old version still works for backward compatibility.

Expand Down Expand Up @@ -84,7 +96,7 @@ and was never officially supported anyway.

## 1.0.7 - Dec 18, '14
- added `checkInput()`,`sanitizeInput()` and `checkAndSanitizeInput()` to validate user inputs.
With this functions it is not required to check first, if an array index like `$_POST['key1']['key2']`
With these functions it is not required to check first, if an array index like `$_POST['key1']['key2']`
exists, before validating the values.

## 1.0.6 - Oct 24, '14
Expand Down
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ SepaUtilities is a PHP class to check and sanitize inputs used in SEPA files
such as IBAN numbers, creditor identifiers, names and other text.

## PHP Versions
SepaUtilities supports PHP >= 7.2 including PHP 8.
SepaUtilities supports PHP >= 8.1.

## Installation

Expand All @@ -22,7 +22,7 @@ You can get SepaUtilities via Composer. Just add
```json
{
"require": {
"abcaeffchen/sepa-utilities": "^1.3"
"abcaeffchen/sepa-utilities": "^2.0"
}
}
```
Expand All @@ -43,7 +43,7 @@ and changes all letters to upper case.
- `isNationalTransaction($iban1,$iban2)`: Checks if both IBANs are belong to the same country.
- `checkCharset($str)`: Checks if the string contains only allowed characters.
- `check($field, $input, $options, $version)`: Checks if the input fits the field. This function also does little
format changes, e.g. correcting letter case. Possible field values are:
format changes, e.g. correcting letter case. Possible field values are (case-insensitive):
- `initgpty`: Initiating Party
- `initgptyid`: Initiating Party ID
- `msgid`: Message ID
Expand All @@ -64,7 +64,21 @@ format changes, e.g. correcting letter case. Possible field values are:
- `seqtp`: Sequence Type
- `lclinstrm`: Local Instrument
- `ctry`: Two-letter country code, used in postal address
- `adrline`: An address line, or an array of at most two address lines
- Subfield of `pstlAdr`
- `adrline`: An address line, or an array of at most two address lines
- `bldgnm`: Building name
- `bldgnb`: Building number
- `twnnm`: Town name
- `twnlctnnm`: Town location name (within a town)
- `dstrctnm`: District name
- `ctrysubdvsn`: country subdivision, e.g. state, region, county
- `pstbx`: Postbox
- `pstcd`: Postal code
- `dept`: Department
- `subdept`: Subdepartment
- `strtnm`: Street name
- `flr`: Floor
- `room`: Room

The `$options` take an array
### Sanitizing
Expand Down
112 changes: 89 additions & 23 deletions src/SepaUtilities.php

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions tests/SepaUtilitiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,12 @@ public function testCheckDateFormat()
static::assertFalse(SepaUtilities::checkCreateDateTime('19.10.2014'));
}

public function testCheckDateTimeFormat()
{
static::assertSame('2014-10-19', SepaUtilities::check('dtofsgntr', '2014-10-19'));
static::assertFalse(SepaUtilities::checkCreateDateTime('19.10.2014'));
}

public function testCrossIbanBicCheck()
{
// IBAN and BIC is not validated. It is only checked if the country codes belong together.
Expand Down

0 comments on commit 4541f55

Please sign in to comment.