banking-swift-messages-java icon indicating copy to clipboard operation
banking-swift-messages-java copied to clipboard

Fix statement line entry date year based on the statement date

Open nieldw opened this issue 3 years ago • 1 comments

After a bit more than a year I finally managed to re-implement this according to our discussion on PR https://github.com/qoomon/banking-swift-messages-java/pull/83.

This implementation infers the correct year for the entry date of a statement line based on the shortest interval between the entry date's month-day and the statement date. For MT940 the statement date is taken to be the date of the closing balance (:62F: or :62M); for MT942 the statement date is the date-time indicator (:13D:).

After reading the whole statement page, the statement lines are post-processed to adjust the entry dates, because in the case of MT940 the statement date is only available after reading all the statement lines.

Caveat: The entry date is an optional field, but if it is absent the StatementLine constructor assumes it to be the same as the value date. In this case the post-processor may choose an incorrect year.

Closes https://github.com/qoomon/banking-swift-messages-java/pull/83

nieldw avatar Jan 08 '22 15:01 nieldw

@qoomon , please advise if this PR corresponds with the conventions, package structure, etc. that you wish to maintain in this project. Thanks

nieldw avatar Jan 08 '22 15:01 nieldw