Skip to content

Commit 2ee1614

Browse files
committed
added support for pain.008.001.02.austria.003
1 parent e32f46c commit 2ee1614

File tree

3 files changed

+23
-13
lines changed

3 files changed

+23
-13
lines changed

CHANGE_LOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
Sephpa - Change Log
22
===============
33

4+
##1.2.3 - Nov 21, '16##
5+
- added support for pain.008.001.02.austria.003
6+
47
##1.2.2 - Oct 18, '16##
58
- little bug fixes
69

src/SepaUtilities.php

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
*
55
* @license GNU LGPL v3.0 - For details have a look at the LICENSE file
66
* @copyright ©2015 Alexander Schickedanz
7-
* @link https://github.com/AbcAeffchen/Sephpa
7+
* @link https://github.com/AbcAeffchen/SepaUtilities
88
*
9-
* @author Alexander Schickedanz <[email protected]>
9+
* @author Alexander Schickedanz <[email protected]>
1010
*/
11+
1112
namespace AbcAeffchen\SepaUtilities;
1213

1314
/**
@@ -40,10 +41,11 @@ class SepaUtilities
4041
const SEPA_PAIN_001_001_03 = 100103;
4142
const SEPA_PAIN_001_001_03_GBIC = 1001031;
4243
// direct debit versions
43-
const SEPA_PAIN_008_002_02 = 800202;
44-
const SEPA_PAIN_008_003_02 = 800302;
45-
const SEPA_PAIN_008_001_02 = 800102;
46-
const SEPA_PAIN_008_001_02_GBIC = 8001021;
44+
const SEPA_PAIN_008_002_02 = 800202;
45+
const SEPA_PAIN_008_003_02 = 800302;
46+
const SEPA_PAIN_008_001_02 = 800102;
47+
const SEPA_PAIN_008_001_02_GBIC = 8001021;
48+
const SEPA_PAIN_008_001_02_AUSTRIAN_003 = 8001022;
4749

4850
const HTML_PATTERN_IBAN = '([a-zA-Z]\s*){2}([0-9]\s?){2}\s*([a-zA-Z0-9]\s*){1,30}';
4951
const HTML_PATTERN_BIC = '([a-zA-Z]\s*){6}[a-zA-Z2-9]\s*[a-nA-Np-zP-Z0-9]\s*(([A-Z0-9]\s*){3}){0,1}';
@@ -222,6 +224,11 @@ class SepaUtilities
222224
'PF', 'TF', 'YT', 'NC',
223225
'BL', 'MF', 'PM', 'WF'),
224226
'GB' => array('IM', 'GG', 'JE'));
227+
228+
private static $exceptionalBics = array(
229+
'NOTAVAIL' // used in Austria to mark that no BIC is provided
230+
);
231+
225232
/*
226233
* Checks if an creditor identifier (ci) is valid. Note that also if the ci is valid it does
227234
* not have to exist
@@ -398,6 +405,10 @@ public static function isEEATransaction($iban1, $iban2)
398405
*/
399406
public static function crossCheckIbanBic($iban, $bic)
400407
{
408+
// check for special cases
409+
if(in_array(strtoupper($bic), self::$exceptionalBics))
410+
return true;
411+
401412
// remove whitespaces
402413
$iban = preg_replace('#\s+#','',$iban);
403414
$bic = preg_replace('#\s+#','',$bic);

tests/SepaUtilitiesTest.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,6 @@
44

55
use AbcAeffchen\SepaUtilities\SepaUtilities;
66

7-
8-
/**
9-
* Project: SepaUtilities
10-
* User: AbcAeffchen
11-
* Date: 14.10.2014
12-
*/
13-
147
class SepaUtilitiesTest extends PHPUnit_Framework_TestCase
158
{
169

@@ -383,6 +376,9 @@ public function testCrossIbanBicCheck()
383376
static::assertTrue(SepaUtilities::crossCheckIbanBic('FR', '1234TF12XXX'));
384377
static::assertTrue(SepaUtilities::crossCheckIbanBic('GB', '1234GG12XXX'));
385378

379+
// valid due to special case
380+
static::assertTrue(SepaUtilities::crossCheckIbanBic('AT', 'NOTAVAIL'));
381+
386382
// invalid
387383
static::assertFalse(SepaUtilities::crossCheckIbanBic('DE', '1234ED12XXX'));
388384
static::assertFalse(SepaUtilities::crossCheckIbanBic('FR', '1234AD12XXX'));

0 commit comments

Comments
 (0)