moov-io / wire

FedWire funds service file parser and writer. The HTTP server is available in a Docker image and the Go package is available.
https://moov-io.github.io/wire/
Apache License 2.0
82 stars 38 forks source link

Moov library fails to parse Valid Wire Message #404

Open nitu-luna opened 1 month ago

nitu-luna commented 1 month ago

Wire Version: v0.15.5

What were you trying to do? Parse an incoming message

What Wire specification are you referencing? Fedwire Application interface Manual

What did you expect to see? Message parsed successfully

What did you see? unable to parse wire file - line:15 record:InstructingFI *wire.FieldError IdentificationCode is an invalid identification code line:18 record:UnstructuredAddenda wire.TagWrongLengthErr must be 10 characters and found 93

How can we reproduce the problem? {1100}30P N{1110}06070806FT03{1120}20240607MFP0003000000906070806FT03{1510}1000{1520}20240607MM12MP2K008465{2000}000000052200{3100}024567821TEST BK{3400}101014578TEST BK{3600}CTP{3610}IXML{4200}D241/ABC2/ADDR{4320}SW{5010}/12341/PLTD2/STREET3/GB/XYZ{5100}BfdfLTDTHENGFLLON{5200} XXX{6000}1{6500}/XXX*{8200}<<>>

NitheeshKumar-k commented 2 weeks ago

I am facing the same issue and I am unable to parse a valid wire file due to the absence of Addenda length in the tag {8200} Unstructured Addenda.

As per the below document faim 3.0.7 8200 tag modifications, the addenda length is no longer a valid field and the Addenda Information length has been updated to 9000 characters

https://www.frbservices.org/binaries/content/assets/crsocms/financial-services/wires/faim-3-0-7-tag-8200-changes-faq-july-2022.pdf

func (ua *UnstructuredAddenda) Validate() error {
    if err := ua.fieldInclusion(); err != nil {
        return err
    }
    if ua.tag != TagUnstructuredAddenda {
        return fieldError("tag", ErrValidTagForType, ua.tag)
    }
    if err := ua.isNumeric(ua.AddendaLength); err != nil {
        return fieldError("AddendaLength", err, ua.AddendaLength)
    }
    if err := ua.isAlphanumeric(ua.Addenda); err != nil {
        return fieldError("Addenda", err, ua.Addenda)
    }

    return nil
}

As per the logic, we still validating the addenda length.

bulhi commented 1 week ago

Can confirm, we started receiving wires with the new tag 8200 format which is:

  1. a multi-line XML
  2. without the addenda length part.

e.g. something like

{8200}<!--<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pacs.008.001.08">
    <FIToFICstmrCdtTrf>
        <GrpHdr>
            <MsgId>CHASEMCBPR2024070500000012345678HV0</MsgId>
            <CreDtTm>2024-07-05T08:01:40.800+00:00</CreDtTm>
            <NbOfTxs>1</NbOfTxs>
            <SttlmInf>
                <SttlmMtd>INDA</SttlmMtd>
            </SttlmInf>
        </GrpHdr>
        ... 
    </FIToFICstmrCdtTrf>
</Document>--><<>>