-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the BAI2 grammar from forked package #1
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
BTR3 { | ||
BTRSfile = FileHeader Bank* FileTrailer | ||
BTRSfile = FileHeader Bank* FileTrailer | ||
|
||
Bank = BankHeader Account* BankTrailer | ||
|
||
Account = AccountHeader TransactionDetail* AccountTrailer | ||
|
||
|
||
FileHeader = "01" delim senderIdentification delim receiverIdentification delim fileCreationDate delim fileCreationTime delim fileIdentificationNumber delim physicalRecordLength delim blockSize delim versionNumber eor | ||
senderIdentification = alnum + | ||
receiverIdentification = alnum + | ||
senderIdentification = alphaNumeric+ | ||
receiverIdentification = alphaNumeric+ | ||
fileCreationDate = date | ||
fileCreationTime = time | ||
fileIdentificationNumber = alnum + | ||
physicalRecordLength = digit * | ||
blockSize = digit * | ||
fileIdentificationNumber = alphaNumeric+ | ||
physicalRecordLength = digit* | ||
blockSize = digit* | ||
versionNumber = bai1 | bai2 | bai3 | ||
|
||
FileTrailer = "99" delim fileControlTotal delim numberofBanks delim numberofRecords eor | ||
|
@@ -26,8 +26,8 @@ BTR3 { | |
|
||
|
||
BankHeader = "02" delim ultimateReceiverIdentification delim bankIdentification delim groupStatus delim asofDate delim asofTime delim currencyCodeBank delim asofDateModifier eor | ||
ultimateReceiverIdentification = alnum * | ||
bankIdentification = alnum + | ||
ultimateReceiverIdentification = alphaNumeric* | ||
bankIdentification = alphaNumeric+ | ||
groupStatus = "1" | ||
asofDate = date | ||
asofTime = time? | ||
|
@@ -47,7 +47,7 @@ BTR3 { | |
AccountHeader = "03" delim customerAccountNumber delim currencyCodeAccount delim statusOrSummaryCodeFormatOptRepeat eor | ||
statusOrSummaryCodeFormatOptRepeat = statusOrSummaryCodeFormat (delim statusOrSummaryCodeFormat)* | ||
statusOrSummaryCodeFormat = statusCodeFormat | summaryCodeFormat | ||
customerAccountNumber = alnum * | ||
customerAccountNumber = alphaNumeric* | ||
currencyCodeAccount (Currency Code is mandatory in BTR3 but not in BAI2) | ||
= letter* | ||
|
||
|
@@ -74,7 +74,7 @@ BTR3 { | |
|
||
amountOpt = optSign digit* | ||
itemCount = digit* | ||
fundsType = alnum? | ||
fundsType = ("0".."2" | "S" | "V" | "D" | "Z") ? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, hardening the definition, there is a specific set of values for this [pg. 29] |
||
|
||
AccountTrailer = "49" delim accountControlTotal delim numberofRecords eor | ||
accountControlTotal = optSignedN | ||
|
@@ -102,8 +102,10 @@ BTR3 { | |
bankReferenceNumber = alphaNumeric* | ||
customerReferenceNumber = alphaNumeric* | ||
detailText (Text relaxed for CBA BAI2 format does not contain , / Optionally followed by /) | ||
= (~ eor any) * | ||
= & "/" // null text field | ||
| text * // normal text field | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here, we need to do a lookahead for a |
||
|
||
beginningOfNonContinuationRecord = "" | ||
optPos = "+"? | ||
optSign = ("-" | "+")? | ||
|
||
|
@@ -120,10 +122,17 @@ BTR3 { | |
hh = ("0".."1" digit) | ("2" "0" .. "3") | ||
mm = "0".."5" digit | ||
|
||
delim = "," | ||
newLine = ("\r\n" | "\n" | "\r") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should accept all kinds of newlines |
||
delim = | ||
| "," -- comma_delimiter | ||
| "/" newLine "88," -- continuation_record_delimiter | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is big. I have added support for 88 - Continuation Record [pg. 20]. It is simplest to treat \n88, as a delimiter rather than a new record. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
eor = "/" | ||
|
||
alphaNumeric (BTR3 Alphanumeric - string not containing comma or slash) | ||
= ~(delim | eor) any | ||
alphaNumeric (BTR3 Alphanumeric - string not containing comma or slash) | ||
= ~("," | "/") any | ||
|
||
continuationWithinTextField = newLine "88," | ||
|
||
} | ||
text = (continuationWithinTextField | ~newLine any) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,7 +90,7 @@ | |
"detailFundsType": "", | ||
"bankReferenceNumber": "AGN", | ||
"customerReferenceNumber": "935892", | ||
"detailText": "POINT OF SALE" | ||
"detailText": "POINT OF SALE/" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I make a few changes to the test cases, because I believe the grammar was implemented incorrectly. The specification states that
|
||
} | ||
} | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These alterations are hardening the definition, these values cannot include , or /