Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ are additionally validated for:
The `transaction.structuredDetails` attribute can be used to access structured
data from statement transaction details (SWIFT "86" tag). The following
structured detail formats are supported:
- `'<sep>DD'`, where `<sep>` can be `'>'` or `'?'` and `DD` is two digits
- `'<sep>DD'`, where `<sep>` can be `'>'`, `'<'` or `'?'` and `DD` is two digits
- `'/TAG/value'`, where `TAG` is 2 to 4 uppercase chars.

**Example**
Expand Down
9 changes: 5 additions & 4 deletions lib/field86structure.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Field86StructureParser {
return;
} else if (prefix === '/') { // assume /XXX/ fields
tagRe = '\\/[0-9A-Z]{2,4}\\/';
} else if ('>?'.includes(prefix)) { // assume >DD fields
} else if ('?><'.includes(prefix)) { // assume >DD fields
tagRe = `\\${prefix}\\d{2}`;
} else {
return; // known separator not found
Expand All @@ -47,9 +47,10 @@ class Field86StructureParser {

const parsedStruc = {};

if (details.match(/^\d\d\d[?>]/)) {
parsedStruc.gvc = details.substr(0,3);
details = details.substr(3);
const gvc = details.match(/^(\d\d\d+)[?><]/);
if (gvc) {
parsedStruc.gvc = gvc[1];
details = details.substr(gvc[1].length);
}

const rule = Field86StructureParser.buildTagRe(details);
Expand Down