moov-io / bai2

BAI2 file format is a cash management balance reporting standard
Apache License 2.0
15 stars 9 forks source link

feat: suport btrs (bai v3) files #118

Open omerlh opened 3 months ago

omerlh commented 3 months ago

fix #117

adamdecaf commented 3 months ago

Can we add a test verifying the fields of the version 3 file. Are there really no differences between v2 and v3?

omerlh commented 3 months ago

From a quick look at the BTRS file I have I think it's the same, it's also mentioned in the spec that in general the file format is the same, there are some difference in BTRS files requires changes to the parser. Maybe this can be merged with a warning of "btrs is experimental"?

adamdecaf commented 3 months ago

I'm trying to decide if we need a new package with the differences, or if we can just change behavior based off the version number.

Screenshot 2024-05-16 at 09 17 12

adamdecaf commented 3 months ago

I've started on a BTRS test to verify we're parsing as expected. I'm using their examples and want to get all of that copied over in a test before we merge.

Can you help out @omerlh ? I'll get chunks of the test added over today/tomorrow.

omerlh commented 3 months ago

Yeah sure I am taking a look now, let me see what I can do in the next hour or so

omerlh commented 3 months ago

Well I was mistaken, the files I have has version 3 in the header:

01,redacted,redacted,redacted,redacted,redacted,,,3/

But it's actually BAI

Take a look at the next line, in BAI2 it's group header and in BTRS it called "bank header". This BTRS line cannot be parsed correctly:

02,,122099999,1,150622,,,2/ 

This is from the official example...

So.. what I need is BAI2 parser that can eat fake BTRS files 😂 Do you want this repository to support BTRS parsing? Or have BTRS parser in a different repository?

adamdecaf commented 3 months ago

I'm thinking a moov-io/btrs repository would be better then. I could get behind a move towards pkg/bai2 and pkg/btrs subfolders of this repository too.

omerlh commented 3 months ago

Yeah that makes sense, just need something for weird banks that sends BTRS3 files that are actually bai2 🤷

adamdecaf commented 3 months ago

I don't understand how you're getting BTRS3 files that are actually bai2. Are the files a mix of bai2 and BTRS records?

omerlh commented 3 months ago

I think it's just wrong version, so for my use case a flag like ignoreVersion will be better, WDYT?

adamdecaf commented 3 months ago

Does the current bai2 parser work with an invalid version? If not we can add an override to skip invalid version headers.

BTR3 looks to need a new parser/project/package.

omerlh commented 3 months ago

Yes I agree about BTRS3 and the flag, if that's ok with you I can open a PR that will solve my issue :)

adamdecaf commented 3 months ago

Yea go ahead and open a PR for your issue. I'm back and will look over this PR.

adamdecaf commented 2 months ago

can we refresh this PR?