Releases: moov-io/iso8583
v0.12.1
Release v0.12.0
Changelog
- Introduce a
SafeError
type which is used to wrap around external errors, preventing the returned error message from displaying sensitive information, while still allowing errors to be matched (#185) - Use
SafeError
type to wrap external errors in the field and encoding packages, as these operate on the potentially sensitive data. Errors fromprefix
andnetwork
packages were not changed since these only operate on the length part of the data, exposing their details should be okay. (#185)
Kudos to @cheukwing for the contributions!
Release v0.11.2
Changelog
- Return error when packing fields with zero length (#180)
Release v0.11.1
Changelog
index
tag of the field has priority over the field name when (un)marshal message data using go structs #168
Release v0.11.0
Changelog
- move
describe.Message(out, mesage)
intoiso8583.Describe(message, out)
- accept value (not only pointer) in
message.Marshal(data)
- it will make it easier to migrate fromSetData
as similar behavior was supported in it.
Release v0.10.0
Changelog
- added
message.Marshal(data)
which sets values of message fields using values provided in thedata
struct. - added support of
index
tag for bothmessage.Marshal()
andmessage.Unmarshal()
. Now you can name your fields as you want and useindex
tag to specify the field index matching the ISO8583 specification. Examples are here and here. - removed
iso8583.Unmarshal
. Please, usemessage.Unmarshal
instead. - removed message.Data()
- deprecated
message.SetData(data)
. Usemessage.Marshal()
instead. - deprecated
field.SetData(data)
. Usefield.Marshal(data)
instead. - changed current behavior of
message.SetData(data)
. Before it could be used to get values into a struct after callingmessage.Unpack()
like this:
data := &ISOMessage{}
mesage.SetData(data)
message.Unpack(rawMessage)
data.F1.Value // in previous versions, values were populated during unpacking, but now they are not
Now message.SetData(data)
only sets field values and you can't get values back to the struct using it. In order to get values into the struct you have to use message.Unmarshal(data)
like this:
message.Unpack(rawMessage)
data := &ISOMessage{}
mesage.Unmarshall(data)
data.F1.Value // now you can get the value
Migration Guide
Two main changes that you may need to do in your code:
- Replace
message.SetData(data)
withmessage.Marshal(data)
. Latter simply sets field values with values provided in thedata
struct. Without any side effects. - Replace
message.Data()(*YouMessageTypehere)
withmessage.Unmarshal(data)
. It setsdata
struct values with message field values. No side-effects. - If you used
SetData()
withUnpack
to get access to message field values, then you have to replace it with justmessage.Unmarshal(data)
.
You have to change your code from this
type ISO87Data struct {
F0 *field.String
F2 *field.String
F4 *field.String
}
message := NewMessage(spec)
data := &ISO87Data{}
err := message.SetData(data) // you "link" data internally
err = message.Unpack(rawMsg) // here values are populated into linked data struct. it will not work anymore.
// access field values
data.F0.Value
data.F2.Value
data.F4.Value
to this:
type ISO87Data struct {
F0 *field.String
F2 *field.String
F4 *field.String
}
message := NewMessage(spec)
err := message.Unpack(rawMsg)
data := &ISO87Data{}
err = message.Unmarshal(data)
// access field values
data.F0.Value
data.F2.Value
data.F4.Value
If you have any questions, please, submit an issue or ask in our community Slack channel.
Release v0.10.0-beta
Changes in this PR are not backward compatible! Few things have changed. Hopefully, migration will not be painful for you. If you have any questions, please, let us know here or in our community Slack channel.
Changes:
- added
message.Marshal(data)
which sets values of message fields using values provided indata
struct. - added support of
index
tag for bothmessage.Marshal()
andmessage.Unmarshal()
. Now you can name your fields as you want and usedindex
tag to specify field index in the ISO8583 specification. Examples are here and here. - removed
iso8583.Unmarshal
. Please, usemessage.Unmarshal
instead. - removed message.Data()
- deprecated
message.SetData(data)
. Usemessage.Marshal()
instead. - deprecated
field.SetData(data)
. Usefield.Marshal(data)
instead. - changed current behavior of
message.SetData(data)
. Before it could be used to get values into a struct after callingmessage.Unpack()
like this:
data := &ISOMessage{}
mesage.SetData(data)
message.Unpack(rawMessage)
data.F1.Value // if previous versions values were populated during unpacking, but now they are not
Now message.SetData(data)
only sets field values. No way to get values back to the struct. In order to get values into struct you have to use message.Unmarshal(data)
like this:
message.Unpack(rawMessage)
data := &ISOMessage{}
mesage.Unmarshall(data)
data.F1.Value // now you can get the value
Migration Guide
Two main changes that you may need to do in your code:
- Replace
message.SetData(data)
withmessage.Marshal(data)
. Latter, simply sets field values with values provided in thedata
struct. Without any side-effects. - Replce
message.Data()(*YouMessageTypehere) with
message.Unmarshal(data). It sets
data` struct values with message field values. No side-effects. - If you used
SetData()
and callUnpack
to get access to message field values, replace it withmessage.Unmarshal(data)
.
You have to change your code from this
type ISO87Data struct {
F0 *field.String
F2 *field.String
F4 *field.String
}
message := NewMessage(spec)
data := &ISO87Data{}
err := message.SetData(data) // you "link" data internally
err = message.Unpack(rawMsg) // here values are populated into linked data struct. no more.
// now you access you
data.F0.Value
data.F2.Value
data.F4.Value
to this:
type ISO87Data struct {
F0 *field.String
F2 *field.String
F4 *field.String
}
message := NewMessage(spec)
err := message.Unpack(rawMsg)
data := &ISO87Data{}
err = message.Unmarshal(data)
// now you access fields in data
data.F0.Value
data.F2.Value
data.F4.Value
Release v0.9.0
Changelog
- Fix panic on
message.Unpack(nil)
or empty/smaller than expected input slice length (#161) - Implement
iso8583.Unmarshal
method to populate data struct with message field values (#157) - Deprecated:
message.Data()
will be removed in the next release. Please, useiso8583.Unmarshal
instead (see the example here).
Release v0.8.4
What's Changed
- added a missing
rightPadder
to JSON spec builder by @adamdecaf in #156
Full Changelog: v0.8.2...v0.8.4
Release v0.8.3
Extend MTI enum (#153) * Add Reversal Request Response to MTI enum * Add 0180 and 0190 * Add administrative messages * specify that 0180 is positive * fix whitespace Co-authored-by: louis <[email protected]>