Skip to content

Commit

Permalink
Feat/assert name (#5)
Browse files Browse the repository at this point in the history
* add: assert_name() method
* fix: use InvalidSupplierError
* 1.9.0
  • Loading branch information
bj0rge authored Jun 25, 2019
1 parent f6b199c commit 158773e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions lib/sepa.js
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,13 @@
invalidFields.push(pullFrom + 'Name');
}

try {
assert_name(name, pullFrom);
} catch (error) {
message = pullFrom + ' has invalid name: "' + name + '"';
invalidFields.push(pullFrom + 'Name');
}

try {
assert_iban(iban, pullFrom + 'IBAN');
assert_fixed(bic.length, [0, 8, 11], pullFrom + 'BIC');
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Create SEPA XML for business transactions, fork of https://github.com/kewisch/sepa.js",
"license": "MPL-2.0",
"main": "lib/sepa.js",
"version": "1.8.0",
"version": "1.9.0",
"author": "Spendesk",
"repository": {
"url": "https://github.com/Spendesk/sepa.js"
Expand Down

0 comments on commit 158773e

Please sign in to comment.