moov-io / iso8583

A golang implementation to marshal and unmarshal iso8583 message.
https://moov.io
Apache License 2.0
304 stars 100 forks source link

Use int64 for field.Numeric #292

Closed alovak closed 8 months ago

alovak commented 9 months ago

In most of the iso8583 specs, amount fields are 12 digits. Currently, field.Numerc is storing value as int, which is max 2147483647 (and it's 10 digits). We should use int64 instead of int.

There are some options for fixing this:

  1. change type for field.Numeric from int to int64 - a breaking change
  2. add new field.BigNumeric 😂 which will accept int64 - looks like an extra complexity

I believe that option 1 is the right one as currently using int for amount fields is a bug and should be fixed. While it's not a backward-compatible change, it fixes the issue and requires a simple upgrade.

P.S. this change should also support int64 (and *int64) in Marshal/Unmarshal in the field.String and field.Numeric.

GalihFajar commented 9 months ago

Hi @alovak kindly assign this one to me, much appreciated!

wadearnold commented 9 months ago

What is "Option 3" @alovak? Do you mean option 1? Thanks for the help @GalihFajar!

alovak commented 9 months ago

@GalihFajar, please join Moov's community Slack here: https://slack.moov.io/ and we can discuss any questions you have in #iso8583 channel as well.

alovak commented 8 months ago

closed by @GalihFajar in #294