Skip to content

Commit 9275e02

Browse files
committed
Fixed typo in ultmtdebtr.
1 parent e42b280 commit 9275e02

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

CHANGE_LOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ Sephpa - Change Log
1515
- Add sanitize function for `adrline` (it is just a 70-character text).
1616
- Add support for Swiss LSV+ DirectDebit pain.008.001.02.ch.03 (merged from [hairacless/SepaUtilities](https://github.com/hairacless/SepaUtilities))
1717
- Add support for Swiss Credit Transfer pain.001.001.03.ch.02 (merged from [tobi76/SepaUtilities](https://github.com/tobi76/SepaUtilities))
18-
18+
- **Fixed**: Changed the keyword `ultmtdebtr` to `ultmtdebtr` in sanitize and check function.
19+
This was a misspelling and only partially supported.
1920

2021
## 1.2.5 - Feb 21, '18
2122
- added support for `OrgId` fields `ID` and `BicOrBei`. They can be used in check and sanitize

examples/utilitiesExample.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
foreach($_POST as $field => $input)
1414
{
1515
if(!in_array($field, array('pmtinfid', 'dbtr', 'iban', 'bic', 'ccy', 'btchbookg',
16-
'ultmtdebtr', 'pmtid', 'instdamt', 'cdtr', 'ultmtcdrt',
16+
'ultmtdbtr', 'pmtid', 'instdamt', 'cdtr', 'ultmtcdrt',
1717
'rmtinf', 'ci')))
1818
continue;
1919
$results[$field] = SepaUtilities::check($field, $input);
@@ -22,7 +22,7 @@
2222
if(isset($_POST['sanitize']))
2323
foreach($_POST as $field => $input)
2424
{
25-
if(!in_array($field, array('cdtr', 'dbtr', 'rmtinf', 'ultmtcdrt', 'ultmtdebtr')))
25+
if(!in_array($field, array('cdtr', 'dbtr', 'rmtinf', 'ultmtcdrt', 'ultmtdbtr')))
2626
continue;
2727
$results[$field] = SepaUtilities::sanitize($field, $input);
2828
}
@@ -58,8 +58,8 @@
5858
<?php if(isset($results['ccy'])){ echo ($results['ccy'] === false ? 'invalid' : 'valid -> ' . $results['ccy']); } ?><br>
5959
<input type="text" name="btchbookg" placeholder="Batch Booking" value="<?php if(isset($_POST['btchbookg'])) echo $_POST['btchbookg']; ?>">
6060
<?php if(isset($results['btchbookg'])){ echo ($results['btchbookg'] === false ? 'invalid' : 'valid -> ' . $results['btchbookg']); } ?><br>
61-
<input type="text" name="ultmtdebtr" placeholder="Ultimate Debtor" value="<?php if(isset($_POST['ultmtdebtr'])) echo $_POST['ultmtdebtr']; ?>">
62-
<?php if(isset($results['ultmtdebtr'])){ echo ($results['ultmtdebtr'] === false ? 'invalid' : 'valid -> ' . $results['ultmtdebtr']); } ?><br>
61+
<input type="text" name="ultmtdbtr" placeholder="Ultimate Debtor" value="<?php if(isset($_POST['ultmtdbtr'])) echo $_POST['ultmtdbtr']; ?>">
62+
<?php if(isset($results['ultmtdbtr'])){ echo ($results['ultmtdbtr'] === false ? 'invalid' : 'valid -> ' . $results['ultmtdbtr']); } ?><br>
6363
<input type="text" name="pmtid" placeholder="Payment ID" value="<?php if(isset($_POST['pmtid'])) echo $_POST['pmtid']; ?>">
6464
<?php if(isset($results['pmtid'])){ echo ($results['pmtid'] === false ? 'invalid' : 'valid -> ' . $results['pmtid']); } ?><br>
6565
<input type="text" name="instdamt" placeholder="Instructed Amount" value="<?php if(isset($_POST['instdamt'])) echo $_POST['instdamt']; ?>">

src/SepaUtilities.php

+6-5
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ private static function getValFromMultiDimInput(array &$input, $keys)
640640
*
641641
* @param string $field Valid fields are: 'orgnlcdtrschmeid_id','ci','msgid','pmtid','pmtinfid',
642642
* 'orgnlmndtid','mndtid','initgpty','cdtr','dbtr','orgnlcdtrschmeid_nm',
643-
* 'ultmtcdrt','ultmtdebtr','rmtinf','orgnldbtracct_iban','iban','bic',
643+
* 'ultmtcdrt','ultmtdbtr','rmtinf','orgnldbtracct_iban','iban','bic',
644644
* 'ccy','amendment', 'btchbookg','instdamt','seqtp','lclinstrm',
645645
* 'elctrncsgntr','reqdexctndt','purp','ctgypurp','orgnldbtragt', 'adrline'
646646
* 'ctry', 'dbtrpstladr'
@@ -863,7 +863,7 @@ public static function sanitizeText(int $length, string $input, bool $allowEmpty
863863
/**
864864
* Tries to sanitize the the input so it fits in the field.
865865
*
866-
* @param string $field Valid fields are: 'ultmtcdrt', 'ultmtdebtr',
866+
* @param string $field Valid fields are: 'ultmtcdrt', 'ultmtdbtr',
867867
* 'orgnlcdtrschmeid_nm', 'initgpty', 'cdtr', 'dbtr', 'rmtinf', 'adrline'
868868
* @param mixed $input
869869
* @param int $flags Flags used in replaceSpecialChars()
@@ -879,7 +879,8 @@ public static function sanitize(string $field, $input, int $flags = 0)
879879
return self::sanitizeText(self::TEXT_LENGTH_VERY_SHORT, $input, true, $flags);
880880
case 'adrline':
881881
case 'ultmtcdrt':
882-
case 'ultmtdebtr':
882+
case 'ultmtdbtr':
883+
case 'ultmtdebtr': // deprecated, just here for backwards compatibility
883884
return self::sanitizeText(self::TEXT_LENGTH_SHORT, $input, true, $flags);
884885
case 'orgnlcdtrschmeid_nm':
885886
case 'initgpty':
@@ -902,7 +903,7 @@ public static function checkRequiredCollectionKeys(array $inputs, int $version)
902903
break;
903904
case self::SEPA_PAIN_001_001_03:
904905
case self::SEPA_PAIN_001_001_03_GBIC:
905-
case self::SEPA_PAIN_001_001_03_CH_02:
906+
case self::SEPA_PAIN_001_001_03_CH_02:
906907
case self::SEPA_PAIN_001_003_03:
907908
$requiredKeys = ['pmtInfId', 'dbtr', 'iban'];
908909
break;
@@ -933,7 +934,7 @@ public static function checkRequiredPaymentKeys(array $inputs, int $version)
933934
break;
934935
case self::SEPA_PAIN_001_001_03:
935936
case self::SEPA_PAIN_001_001_03_GBIC:
936-
case self::SEPA_PAIN_001_001_03_CH_02:
937+
case self::SEPA_PAIN_001_001_03_CH_02:
937938
case self::SEPA_PAIN_001_003_03:
938939
$requiredKeys = ['pmtId', 'instdAmt', 'iban', 'cdtr'];
939940
break;

tests/SepaUtilitiesTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ public function testCheckAndSanitizeAll()
308308
'btchBookg' => 'true', // BatchBooking, only 'true' or 'false'
309309
//'ctgyPurp' => , // Do not use this if you do not know how. For further information read the SEPA documentation
310310
'reqdExctnDt' => '2013-11-25', // Date: YYYY-MM-DD
311-
'ultmtDebtr' => 'Ultimate Debtor Name' // just an information, this do not affect the payment (max 70 characters)
311+
'ultmtDbtr' => 'Ultimate Debtor Name' // just an information, this do not affect the payment (max 70 characters)
312312
];
313313

314314
$validDirectDebitPaymentInformation = [
@@ -345,7 +345,7 @@ public function testCheckAndSanitizeAll()
345345
'btchBookg' => 'true', // BatchBooking, only 'true' or 'false'
346346
//'ctgyPurp' => , // Do not use this if you do not know how. For further information read the SEPA documentation
347347
'reqdExctnDt' => '2013-11-25', // Date: YYYY-MM-DD
348-
'ultmtDebtr' => 'Ultimate Debtor Name' // just an information, this do not affect the payment (max 70 characters)
348+
'ultmtDbtr' => 'Ultimate Debtor Name' // just an information, this do not affect the payment (max 70 characters)
349349
];
350350

351351
static::assertTrue(SepaUtilities::checkAndSanitizeAll($validCollectionInfo));

0 commit comments

Comments
 (0)