moov-io / rtp20022

ISO20022 messages in Go for Real Time Payments (RTP)
Apache License 2.0
38 stars 9 forks source link

rtp.ISODateTime marshal with RFC3339 layout #47

Open jerome-laforge opened 7 months ago

jerome-laforge commented 7 months ago

Hello, When I marshal rtp.ISODateTime type, I have something like 2006-01-02T15:04:05 . But it seems that we need to export with RFC3339 layout.

Do you think that it is possible do to define somewhere the time format that we want to use for marshaling?

Thx in adv for you support.

adamdecaf commented 7 months ago

Your XML specs require RFC3339? We found with TCH that they don't support RFC3339.

jerome-laforge commented 7 months ago

Yes, all dates in the provided examples are in RFC3339Milli layout : 2006-01-02T15:04:05.000Z07:00

adamdecaf commented 7 months ago

When we've gone through testing for RTP with TCH we found the sub-second precision and timezone format was not accepted. We had to format timestamps as ISO 8601 in order to be accepted.

jerome-laforge commented 7 months ago

Ok, that makes sens, but I don't want to change the default timestamp format. Is it possible for you that define a global public variable with default format as ISO8601? With this variable, I will be able to define the format (RFC3339 or something else) in order to marshall/unmarshall the ISODateTime.

jerome-laforge commented 7 months ago

For now, I just fork and add the global variable (https://github.com/jerome-laforge/rtp20022/commit/ac6fa8700c64570bc8c2e0866f2fc66affd78e50).

It is enough for me for now at this stage. I will be back later in order to known if he format in example are OK or not (need to manage it more properly with the upstream driver).

Is it suitable for you?

adamdecaf commented 7 months ago

Sounds good. Are you using this for RTP or FedNow? We're planning a separate fednow20022 repo with generated code since the two protocols use different ISO 20022 messages.

I'm fine adding that variable if it's needed.

jerome-laforge commented 7 months ago

I use it for BCEAO zone (https://en.wikipedia.org/wiki/Central_Bank_of_West_African_States)

jerome-laforge commented 7 months ago

FYI, I regenerate the model/validate with specific xsd and modified template.

jerome-laforge commented 7 months ago

I'm fine adding that variable if it's needed.

Thx a lot :pray:

adamdecaf commented 7 months ago

Okay, I understand better now. I found some information to help understand how ISO 20022 is being used for BCEAO.

https://gfrid.org/wp-content/uploads/2023/08/Senegal-CoP-September-2023_ISO-20022_EN__final.pdf https://www.bceao.int/sites/default/files/2023-07/BCEAO%20-%20Rapport%20sur%20les%20IMF%2C%20Moyens%20et%20Services%20de%20Paiement_2020-2021.pdf

ISO 20022 is a very large set of XML specifications and different usages (countries, businesses, etc) adopt different parts of it. I would recommend you fork rtp20022 and adapt the templates/generators to your needs for BCEAO. I'm not sure how far we can stretch this repository to support both RTP and BCEAO. I will help you fork and setup the repo for your needs.

Do you have more details on the exact ISO 20022 messages used and how they're to be formatted?

jerome-laforge commented 7 months ago

Currently, I have just some example & xsd. Nothing official yet. When, I have the official data, forward you all xsd.

For now, I 've just :

adamdecaf commented 6 months ago

Did you figure out if you needed more changes? Or if a fork of rtp20022 would be your solution?

jerome-laforge commented 6 months ago

Thank again for your support :pray: For now based on the provided examples, the fork works fine with the modifications on:

I would have preferred that those 2 modifications were merged in the upstream (with the default values that allow keep current behavior for TCH). If those 2 modifications have been merged then I will be able to remove replace github.com/moov-io/rtp20022 v0.9.4 => github.com/jerome-laforge/rtp20022 v0.0.0-20231208075226-8e7a6baf36f9 directive from our go.mod.

adamdecaf commented 6 months ago

I'm not sure we want to maintain extensible support for ISO 20022 and all of its various implementations. TCH makes a lot of changes to the ISO 20022 spec which are not compatible with BCEAO. We will help you stay updated with the generated code.