Code Monkey home page Code Monkey logo

wire's Introduction

Moov Banner Logo

Project Documentation · API Endpoints · API Guide · Community · Blog

GoDoc Build Status Coverage Status Go Report Card Repo Size Apache 2 License Slack Channel Docker Pulls GitHub Stars Twitter

moov-io/wire

Moov's mission is to give developers an easy way to create and integrate bank processing into their own software products. Our open source projects are each focused on solving a single responsibility in financial services and designed around performance, scalability, and ease of use.

Wire implements a reader, writer, and validator for FED Wire Messages (FEDWire) in an HTTP server and Go library. The HTTP server is available in a Docker image and the Go package github.com/moov-io/wire is available.

Table of contents

Project status

Moov Wire is actively used in multiple production environments. Please star the project if you are interested in its progress. If you have layers above Wire to simplify tasks, perform business operations, or found bugs we would appreciate an issue or pull request. Thanks!

Usage

The Wire project implements an HTTP server and Go library for creating and modifying Wire files. We also have some examples of the reader and writer.

Docker

We publish a public Docker image moov/wire on Docker Hub with every tagged release of Wire. No configuration is required to serve on :8088 and metrics at :9098/metrics in Prometheus format. We also have Docker images for OpenShift published as quay.io/moov/wire.

Pull & start the Docker image:

docker pull moov/wire:latest
docker run -p 8088:8088 -p 9098:9098 moov/wire:latest

List files stored in-memory:

curl localhost:8088/files
null

Create a file on the HTTP server:

curl -X POST --data-binary "@./test/testdata/fedWireMessage-CustomerTransfer.txt" http://localhost:8088/files/create
{"id":"<YOUR-UNIQUE-FILE-ID>","fedWireMessage":{"id":"","senderSupplied":{"formatVersion":"30", .....

Get the file in its original format:

curl http://localhost:8088/files/<YOUR-UNIQUE-FILE-ID>/contents
{1500}30User ReqT
{1510}1000
{1520}20190410Source08000001
...

Google Cloud Run

To get started in a hosted environment you can deploy this project to the Google Cloud Platform.

From your Google Cloud dashboard create a new project and call it:

moov-wire-demo

Enable the Container Registry API for your project and associate a billing account if needed. Then, open the Cloud Shell terminal and run the following Docker commands, substituting your unique project ID:

docker pull moov/wire
docker tag moov/wire gcr.io/<PROJECT-ID>/wire
docker push gcr.io/<PROJECT-ID>/wire

Deploy the container to Cloud Run:

gcloud run deploy --image gcr.io/<PROJECT-ID>/wire --port 8088

Select your target platform to 1, service name to wire, and region to the one closest to you (enable Google API service if a prompt appears). Upon a successful build you will be given a URL where the API has been deployed:

https://YOUR-WIRE-APP-URL.a.run.app

Now you can list files stored in-memory:

curl https://YOUR-WIRE-APP-URL.a.run.app/files

You should get this response:

null

Configuration settings

The following environmental variables can be set to configure behavior in Wire.

Environmental Variable Description Default
HTTPS_CERT_FILE Filepath containing a certificate (or intermediate chain) to be served by the HTTP server. Requires all traffic be over secure HTTP. Empty
HTTPS_KEY_FILE Filepath of a private key matching the leaf certificate from HTTPS_CERT_FILE. Empty
WIRE_FILE_TTL Time to live (TTL) for *wire.File objects stored in the in-memory repository. 0 = No TTL / Never delete files (Example: 240m)

Data persistence

By design, Wire does not persist (save) any data about the files or entry details created. The only storage occurs in memory of the process and upon restart Wire will have no files or data saved. Also, no in-memory encryption of the data is performed.

Go library

This project uses Go Modules and Go v1.18 or newer. See Golang's install instructions for help setting up Go. You can download the source code and we offer tagged and released versions as well. We highly recommend you use a tagged release for production.

$ [email protected]:moov-io/wire.git

$ go get -u github.com/moov-io/wire

$ go doc github.com/moov-io/wire fedWireMessage

The package github.com/moov-io/wire offers a Go-based Wire file reader and writer. To get started, check out a specific example:

Supported Business Function Codes
Business Function Code Name Example Read Write
DRB BankDrawDownRequest Link Link Link
BTR BankTransfer Link Link Link
CKS CheckSameDaySettlement Link Link Link
DRC CustomerCorporateDrawDownRequest Link Link Link
CTR CustomerTransfer Link Link Link
CTP CustomerTransferPlus Link Link Link
CTP CustomerTransferPlusCOVS Link Link Link
DEP DepositSendersAccount Link Link Link
FFR FEDFundsReturned Link Link Link
FFS FEDFundsSold Link Link Link
SVC ServiceMessage Link Link Link

In-browser Wire file parser

Using our in-browser utility, you can instantly convert Wire files into JSON. Either paste in Wire file content directly or choose a file from your local machine. This tool is particulary useful if you're handling sensitive PII or want perform some quick tests, as operations are fully client-side with nothing stored in memory. We plan to support bidirectional conversion in the future.

Learn about Fedwire

FAQ

Is there an in-browser tool for converting Wire files into JSON? Yes! You can find our browser utility at http://oss.moov.io/wire/.
Is my data being saved somewhere? No, we do not save any data related to files or message details. All processing is done in-memory.
What Fedwire message types are supported? We support generating and parsing all Business Function codes.

Getting help

channel info
Project Documentation Our project documentation available online.
Twitter @moov You can follow Moov.io's Twitter feed to get updates on our project(s). You can also tweet us questions or just share blogs or stories.
GitHub Issue If you are able to reproduce a problem please open a GitHub Issue under the specific project that caused the error.
moov-io slack Join our slack channel to have an interactive discussion about the development of the project.

Supported and tested platforms

  • 64-bit Linux (Ubuntu, Debian), macOS, and Windows

Note: 32-bit platforms have known issues and are not supported.

Contributing

Yes please! Please review our Contributing guide and Code of Conduct to get started!

This project uses Go Modules and Go v1.18 or newer. See Golang's install instructions for help setting up Go. You can download the source code and we offer tagged and released versions as well. We highly recommend you use a tagged release for production.

Releasing

To make a release of wire simply open a pull request with CHANGELOG.md and version.go updated with the next version number and details. You'll also need to push the tag (i.e. git push origin v1.0.0) to origin in order for CI to make the release.

Testing

We maintain a comprehensive suite of unit tests and recommend table-driven testing when a particular function warrants several very similar test cases. To run all test files in the current directory, use go test. Current overall coverage can be found on Codecov.

Fuzzing

We currently run fuzzing over Wire in the form of a Github Action. Please report crashes examples to [email protected]. Thanks!

Related projects

As part of Moov's initiative to offer open source fintech infrastructure, we have a large collection of active projects you may find useful:

  • Moov Watchman offers search functions over numerous trade sanction lists from the United States and European Union.

  • Moov Fed implements utility services for searching the United States Federal Reserve System such as ABA routing numbers, financial institution name lookup, and FedACH and Fedwire routing information.

  • Moov Image Cash Letter implements Image Cash Letter (ICL) files used for Check21, X.9 or check truncation files for exchange and remote deposit in the U.S.

  • Moov ACH provides ACH file generation and parsing, supporting all Standard Entry Codes for the primary method of money movement throughout the United States.

  • Moov Metro 2 provides a way to easily read, create, and validate Metro 2 format, which is used for consumer credit history reporting by the United States credit bureaus.

License

Apache License 2.0 - See LICENSE for details.

wire's People

Contributors

adamdecaf avatar andrewheavin avatar anujtewari avatar atonks2 avatar bhedge avatar bikramjagdev avatar bkmoovio avatar dependabot[bot] avatar dmtrinh avatar infernojj avatar jasonbornsteinmoov avatar mfdeveloper508 avatar nlakritz avatar renovate-bot avatar renovate[bot] avatar snyk-bot avatar wrightd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wire's Issues

Fix validation of AccountCreditedDrawdown ABA number

What were you trying to do?
Validate an AccountCreditedDrawdown (tag {5400})

What did you expect to see?
DrawdownCreditAccountNumber shouldn't allow any characters other than 0-9. This field is for 9 digit ABA routing numbers:
image

What did you see?
DrawdownCreditAccountNumber allows both numbers and letters.

How can we reproduce the problem?
See the unit test TestParseAccountCreditedDrawdownReaderParseError

Validation Error on CTP Messages containing tag {6000} and not tag {5010}

Wire Version: v0.9.0-rc1

What were you trying to do?
Parse a valid wire file in the format

{1100}30P N{1110}06071654XXXX{1120}20220607XXXXXXXXXXXXXXXXXXXXXXXXXX{1510}1000{1520}20220607XXXXXXXX000002{2000}000000009000{3100}021004543Test Bank*{3320}158545637*{3400}123456789Test XXXXXXXXXXXXX*{3600}CTP{3620}3*752E9D0D-99B8-4DF4-87F2-XXXXXXXXXXXX*{3700}BUSD0,00*USD10,00*{3710}USD100,00*{4200}DXXXXXXXXXXXXXXXX*Test Bank*line1*line2*line3*{4320}WW22060755582563*{5000}DXXXXXXXXXXX*line1*line2*line3*{5100}BXXXXXXXXXXX*Test Bank*line1*line2*{6000}FFC: XXXXX*XXXXXXXXXXX*

What did you expect to see?
I would expect this file to be successfully parsed

What did you see?
A validation error is thrown indicating that tag {5010} is mandatory.

How can we reproduce the problem?
Using the wire example posted above or any wire which is

  • of Business Function code CTP
  • Has tag {6000}
  • Does not have tag {5010}

The crux of the issue seems to be around the following note on tag {6000} in the Fedwire Funds Service
Format Reference Guide doc, March 18, 2019. The note says

Screen Shot 2022-07-01 at 10 16 23 PM

The wire library seems to interpret this note to indicate that if tag {6000} is present and the wire is a CTP, then tag {5010} is mandatory and validates accordingly.

Based on live wires we have been seeing as well as the rest of the format reference guide which requires either tag {5000} or {5010} to provide originator details for CTP, I believe this note on the reference guide is effectively trying to say

If tag {6000} is present and the business function code is not CTP, {4200} and {5000} are mandatory.
If tag {6000} is present and the business function code Is CTP, {4200} and ( either of {5000} or {5010} ) are mandatory.

SUGGESTION: Rename amount to amountInCents

Wire Version: Release v0.9.0-rc1

What were you trying to do?

Send a wire for $1200

What did you expect to see?

a wire for $1200

What did you see?

a wire for $12

How can we reproduce the problem?

with the name of the field not being clear it would be easy for someone to submit the wrong amount, I realize this is a nitpick so I added it to its own issue, its mostly just that consistency in naming would help here and this would be much more explicit

URC field should allow for spaces

Wire Version: ``

What were you trying to do?

Make this file via the API

{1500}30        T {1510}1000{1520}20220128DOVTAL3C000001{2000}000000010000{3100}123456789DOVETAIL BANK US F*{3320}XX22012800000051*{3400}021000089CITIBANK NYC*{3600}CTP{3620}3*3AC4C307-0FFB-4028-BD8E-53D55BDB90E1*{3700}SUSD0,*{4200}D000100002*{5000}T000100011*DRESDEFFXXX*

What did you expect to see?

A properly formatted file that allows spaces in {1500}

What did you see?

{"error":"error reading file: line:1 record:SenderSupplied *wire.FieldError UserRequestCorrelation is a required field"}

How can we reproduce the problem?

Use the file above and try to create a file through the API

## Create Wire File From FAIM
# Creates a Wire File with the Moov Wire API
curl -X "POST" "https://MOOV_WIRE_URL/files/create" \
     -H 'Content-Type: text/plain' \
     -d "{1500}30        T {1510}1000{1520}20220128DOVTAL3C000001{2000}000000010000{3100}123456789DOVETAIL BANK US F*{3320}XX22012800000051*{3400}021000089CITIBANK NYC*{3600}CTP{3620}3*3AC4C307-0FFB-4028-BD8E-53D55BDB90E1*{3700}SUSD0,*{4200}D000100002*{5000}T000100011*DRESDEFFXXX*"

UnstructuredAddenda.Addenda validation based on Local Instrument Code

If {3610} is ANSI or S820, only the X12 Character Set* is permitted in Addenda Information element.

If {3610} is GXML, IXML, NARR, SWIF or UEDI, only the SWIFT MX ISO 20022 Character Set* is permitted in Addenda Information element.

  • See latest version of the FAIM manual for specific characters included in character set.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • chore(deps): update actions/cache action to v4
  • chore(deps): update actions/checkout action to v4
  • chore(deps): update actions/setup-go action to v5
  • chore(deps): update github artifact actions to v4 (major) (actions/download-artifact, actions/upload-artifact)
  • chore(deps): update github/codeql-action action to v3

Detected dependencies

bundler
docs/Gemfile
  • bulma-clean-theme undefined
  • github-pages undefined
  • jekyll-feed "~> 0.12"
  • tzinfo "~> 1.0"
  • wdm "~> 0.1.1"
docker-compose
docker-compose.yml
dockerfile
Dockerfile
  • golang 1.22-alpine
Dockerfile.openshift
Dockerfile.webui
  • golang 1.22
github-actions
.github/workflows/codeql.yaml
  • actions/checkout v2
  • github/codeql-action v2
  • github/codeql-action v2
.github/workflows/fuzz.yml
  • actions/setup-go v5
  • actions/checkout v3
  • actions/cache v3
  • actions/setup-go v3
  • actions/checkout v3
  • actions/cache v3
.github/workflows/go.yml
  • actions/setup-go v5
  • actions/checkout v3
.github/workflows/release.yml
  • actions/setup-go v5
  • actions/checkout v3
  • actions/create-release v1
  • actions/upload-artifact v1
  • actions/setup-go v5
  • actions/checkout v2
  • actions/download-artifact v1
  • actions/upload-release-asset v1
  • actions/upload-release-asset v1
  • actions/upload-release-asset v1
  • actions/setup-go v5
  • actions/checkout v2
gomod
go.mod
  • go 1.20
  • github.com/antihax/optional v1.0.0
  • github.com/go-kit/kit v0.13.0
  • github.com/gorilla/mux v1.8.1
  • github.com/moov-io/base v0.48.5
  • github.com/prometheus/client_golang v1.19.0
  • github.com/stretchr/testify v1.9.0
  • golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f@fe59bbe5cc7f
  • golang.org/x/oauth2 v0.19.0
  • golang.org/x/text v0.14.0

  • Check this box to trigger a request for Renovate to run again on this repository

Add FedWireMessage Validations

Add validations for the FEDWIRE Message.

  1. Mandatory tags
  • Sender Supplied Information
  • Type/Subtype
  • Input Message Accountability Data (IMAD)
  • Amount
  • Sender DI
  • Receiver DI
  • Business Function Code
  1. Business Function Codes

Business Function Code (3 characters)
BTR, CKS, CTP, CTR, DEP, DRB, DRC, DRW, FFR, FFS, SVC

Business Function Code Notes:
Each Fedwire Funds Service message originated must be assigned a valid business function code.
the business function code must be valid for the associated type/subtype code.

Some business function codes have specific information requirements and restrictions. Some field tags are only permitted for certain business function codes.

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

Getting Started with Wire

I am new to GoLang. The following are the steps I had completed. I have set the Go in my environment and verified the same working fine.

image

Now when I change into the wire-master directory (cloned from GIT) and trying to build gives the following output. I would like to know if there is an instruction to build this wire project locally on windows and run it.

image

BUG: When executing FileFromJSON, the resulting wire file format does not have tags populated and passes validation

Wire Version: v0.6.2-dev

What were you trying to do?
So I am round trip testing a example wire file that I got out of the examples directory and when I receive them in the wire format I convert to json and store these in our database (not the wire server DB). I them grab the json representation of the wire and sent back through our wire processor and convert to fedwire format and all the tags are missing when using the FileFromJSON method

What did you expect to see?

{1500}30User ReqT ...

What did you see?

30User ReqT 
1600
20190410Source08000001
000001234567
121042882Wells Fargo NA    
231380104Citadel           
CKS   
Sender Reference
Previous Message Ident
D123456789                         FI Name                            Address One                        Address Two                        Address Three                      
D123456789                         FI Name                            Address One                        Address Two                        Address Three                      
31234                              Name                               Address One                        Address Two                        Address Three                      
Reference       
11234                              Name                               Address One                                                           Address Three                      
D123456789                         FI Name                            Address One                        Address Two                        Address Three                      
D123456789                         FI Name                            Address One                        Address Two                        Address Three                      
LineOne                            LineTwo                            LineThree                          LineFour                           
Line Six                                                                                                                                                                                           
Line Six                                                                                                                                                                                           
LTRLine One                  Line Two                         Line Three                       Line Four                        Line Five                        Line Six                         
Line One                      Line Two                         Line Three                       Line Four                        Line Five                        Line Six                         
TLXLine One                  Line Two                         Line Three                       Line Four                        Line Five                        Line Six                         
Line One                      Line Two                         Line Three                       Line Four                        Line Five                        Line Six                         
LTRLine One                  Line Two                         Line Three                       Line Four                        Line Five                        Line Six                         
CHECKAdditional Information        
Line One                           Line Two                           Line Three                         Line Four                          Line Five                          Line Six      

How can we reproduce the problem?

Call the /files/:fileID/contents end point with a valid json representation of a wire and you should get back:

30User ReqT 
1000
20190410Source08000001
000001234567
121042882Wells Fargo NA    
231380104Citadel           
BTR   
Sender Reference
Previous Message Ident
D123456789                         FI Name                            Address One                        Address Two                        Address Three                      
D123456789                         FI Name                            Address One                        Address Two                        Address Three                      
31234                              Name                               Address One                        Address Two                        Address Three                      
Reference       
11234                              Name                               Address One                                                           Address Three                      
D123456789                         FI Name                            Address One                        Address Two                        Address Three                      
D123456789                         FI Name                            Address One                        Address Two                        Address Three                      
LineOne                            LineTwo                            LineThree                          LineFour                           
Line Six                                                                                                                                                                                           
Line Six                                                                                                                                                                                           
LTRLine One                  Line Two                         Line Three                       Line Four                        Line Five                        Line Six                         
Line One                      Line Two                         Line Three                       Line Four                        Line Five                        Line Six                         
TLXLine One                  Line Two                         Line Three                       Line Four                        Line Five                        Line Six                         
Line One                      Line Two                         Line Three                       Line Four                        Line Five                        Line Six                         
LTRLine One                  Line Two                         Line Three                       Line Four                        Line Five                        Line Six                         
CHECKAdditional Information        
Line One                           Line Two                           Line Three                         Line Four                          Line Five                          Line Six                           

IMAD (1520} should be optional if sender is a FedLine Advantage Customer

Wire Version: v0.8.0

What were you trying to do?
I was attempting to create a CustomerTransfer (CTR) without the InputMessageAccountabilityData (IMAD) field

What did you expect to see?
I expected to see the fedwire file contents without the IMAD field

What did you see?
An error is produced indicating the IMAD is a required field

How can we reproduce the problem?
Try to create a wire file without setting the InputMessageAccountabilityData field

Docker Server sending empty responses

I have installed the latest docker and then downloaded the docker image as below. Docker terminal shows the following output. However a curl or Google Chrome complains an empty response

Let me know what is going wrong....

image

Interface Data fields for Wire files

Wire Version: Release v0.9.0-rc1

What were you trying to do?

Process a wire file with Interface data at the beginning

What did you expect to see?

A successful processing of the wire file

What did you see?

{"error":"error reading file: line:1 record:SenderSupplied *wire.FieldError UserRequestCorrelation  is a required field"}

How can we reproduce the problem?

Use this to create a new wire file

FTI0811 XFT811  {1500}30        T {1510}1000{1520}20220128DOVTAL3C000001{2000}000000010000{3100}123456789DOVETAIL BANK US F*{3320}XX22012800000051*{3400}021000089CITIBANK NYC*{3600}CTP{3620}3*3AC4C307-0FFB-4028-BD8E-53D55BDB90E1*{3700}SUSD0,*{4200}D000100002*{5000}T000100011*DRESDEFFXXX*
## Create Wire File From FAIM
# Creates a Wire File with the Moov Wire API
curl -X "POST" "https://MOOV_WIRE_URL/files/create" \
     -H 'Content-Type: text/plain' \
     -d "FTI0811 XFT811  {1500}30        T {1510}1000{1520}20220128DOVTAL3C000001{2000}000000010000{3100}123456789DOVETAIL BANK US F*{3320}XX22012800000051*{3400}021000089CITIBANK NYC*{3600}CTP{3620}3*3AC4C307-0FFB-4028-BD8E-53D55BDB90E1*{3700}SUSD0,*{4200}D000100002*{5000}T000100011*DRESDEFFXXX*"

I think the best solution is to just strip out any characters before the first { because the Interface data is not useful for anything in 99.99% of use cases and this would also solve for other errors that sprung up for strange characters that ODFIs somehow magically add to wire files

Create HTTP Server for WIRE Files

We need to support a basic HTTP server for Wire files. To upload one (in JSON form), get its contents and validate. The OpenAPI docs exist, so let's copy from those and write the endpoints.

Enhancement : Support for "variable-length" file generation via HTTP API

Wire Version: v0.9.0

What were you trying to do?
Generate a "variable-length" file via HTTP API.

What did you expect to see?
Support for "variable-length" file via HTTP API.

What did you see?
No support right now via HTTP API.
As per slack discussion the proposal is expose to a feature to generate "variable-length" file using /files/{fileId}/contents.

One proposal - have a query param type to choose between fixed and variable(can use better names).
Based on this value, appropriate writer can be used. i.e.

for fixed -> use what we have wire.NewWriter(w)
for variable -> use

wire.NewWriter(w, wire.VariableLengthFields(true), wire.NewlineCharacter(""))

** One other thing to take care is how the writer currently handles
{3600}BusinessFunctionCode - TransactionTypeCode. This field is optional as per spec and when not set in payload while creating(/files/create) the file, the decoder still adds the field with "". This happens because a string in Go cannot be nil. Any string field where the JSON key isn't present will end up as an empty string in Go.
This ends up adding * to this tag element for when we request file content i.e CTR* but should be just CTR here.
@atonks2 will investigate and address this after understanding its impact.

OriginatorOptionF PartyIdentifier, Name, and Line1-3 Validation

Party Identifier (35 characters)
Must be one of the following two formats:

  1. /Account Number (slash followed by at least one valid non-space character: e.g., /123456)

  2. Unique Identifier/ (4 character code followed by a slash and at least one valid non-space character: e.g., SOSE/123-456-789)
    ARNU/ Alien Registration Number
    CCPT/ Passport Number
    CUST/ Customer Identification Number DRLC/ Driver’s License Number EMPL/ Employer Number
    NIDN/ National Identify Number SOSE/ Social Security Number
    TXID/ Tax Identification Number
    Name (35 characters)
    Format: Must begin with Line Code 1 followed by a slash and at least one valid non-space character: e.g., 1/SMITH JOHN.
    Line 1 to 3 (35 characters each)
    Format: Each line, if present, must begin with one of the following Line Codes followed by a slash and at least one valid non-space character.
    1 Name
    2 Address
    3 Country and Town
    4 Date of Birth
    5 Place of Birth
    6 Customer Identification Number
    7 National Identity Number
    8 Additional Information For example:
    2/123 MAIN STREET
    3/US/NEW YORK, NY 10000
    7/111-22-3456

Enhancement : Support for "Fedwire extended format"

Wire Version: v0.8.0

What were you trying to do?
Generate a wire file in the "Fedwire extended format" (not sure of the terminology) for sharing with a banker's bank.

What do you expect to see?

A file generated by Moov looks similar to

{1500}30User ReqT {1510}1000 {1520}20220324WebBanki000001 {2000}000100000000 {3100}125109048Bank Name XXXXXXXX {3400}062000019An Souphorn {3600}CTR {4200}D000000219 An Souphorn {5000}D1001295 Christiane YWalker Address 1

Unlike a bank with a direct connection to the fed, which can use the file generated by the Moov wire library as is, for sharing the file with a banker's bank, a few changes are required with respect to delimiters. Each message starts with “YFT811 “, instead of fixed width, they are using variable width with asterisk (*) as the delimiter, and no new line characters are used in between and tags are present in the order of increasing numerical order.

A file that can be accepted by the Banker's Bank looks similar to

YFT811 {1500}303O004HE8P {1510}1000{1520}2022032400000000000001{2000}000000022200{3100}123456780Xxxxx Corresponden*{3400}021000021JPMCHASE*{3600}CTR{4100}F021000021*JPMC*123 Test st*Test*Test*{4200}D123455*Test Name*123 Test St*Town*MO*{5000}D123456*John Doe*123 Anywhere St*Anywhere*MO*{5100}D998877*Xxxx First Bank*158 Anywhere St*Anywhere*MO*{5200}F404123787*Xxxxxxx Bank*144 Anywhere St*Anywhere*MO*{6000}Test*{6500}Test*

Key differences:

  1. ”YTF811 ” Static data; Marks the beginning of each wire

  2. No new line character in the entire message structure (single line message)

  3. A field delimiter (*) is used to terminate mandatory or optional variable length elements or optional fixed length elements. Mandatory fixed length elements do not require a delimiter. Mandatory elements always precede optional elements in a field tag. If an element is not present we must include asterisk. For e.g.

  • {4200} is the beneficiary of the wire. The tag is broken up into 5 elements: (1) Account (2) Name (3) Address Line 1 (4) Address Line 2 (5) Address Line 3
  • Each element is delimited by an asterisk. If the element is not present, you must include an asterisk. For example: {4200}D123456789*BeneficiaryName*AddressLine1*AddressLine2*AddressLine3* {4200}D123456789*BeneficiaryName*AddressLine1**AddressLine3 *{4200}D123456789*BeneficiaryName*AddressLine1*AddressLine2**
  1. Three characters are defined as restricted special characters. They are: Asterisk (*), Left brace ({), and Right brace (}) The asterisk is used only as a delimiter, to terminate a mandatory or optional variable-length element or an optional fixed length element. The braces are used only as tag delimiters.

What did you want to see?

An optional field in the Moov wire library, say "useExtendedFormat" (not sure if I am using the right terminology) that allows toggling between the default format to the format described above

Amount field allows decimal places in wire file creation

Wire Version: Release v0.9.0-rc1

What were you trying to do?

Send a wire

What did you expect to see?

No decimals in completed wire file

What did you see?

{2000}000000012.05

How can we reproduce the problem?

"amount": {
      "amount": "12.05"
    }

I'd recommend adding something like this to make sure it strips out anything that is not a digit

regexp.Compile("[\d]+")

Increase code coverage

Add tests for each fedWireMessage type to increase code coverage. With the new validation code coverage is currently at 56.5%. We should target 92% or > code coverage.

Charges

Charges  Details of Charges (‘B’ beneficiary or ‘S’ shared)   Senders Charges  (up to 4 occurrences of 15 characters each)   Format:  The first three characters must contain an alpha currency code (e.g., USD).  The remaining characters for the amount must begin with at least one numeric character (0-9) and only one decimal comma marker (e.g., $1,234.56 should be entered as USD1234,56 and $0.99 should be entered as USD0,99).

cmd/server: support TLS in HTTP server

We need to support TLS in our HTTP server. This protects requests from inspection along the various network paths and routing. It's also required as part of several guidelines and audit requirements.

api: empty response when file ID not found for FEDWireMessage endpoint

Wire Version: 0.7.2

What were you trying to do?
Replace a file's existing message using /FEDWireMessage, where the file ID does not exist.

What did you expect to see?
A 404 error response.

What did you see?
Empty reply from server.

How can we reproduce the problem?
curl -X POST -d "@fedWireMessage-FEDFundsSold.json" localhost:8088/files/invalid-id/FEDWireMessage -i

api: generate fails with Could not process model 'MessageDisposition'

I was looking at #36 but was unable to generate the client locally.

adam@Adams-MacBook-Pro:~/code/src/github.com/moov-io/wire
$ OPENAPI_GENERATOR_VERSION=4.0.1 ./openapi-generator generate -i openapi.yaml -g go -o ./client 
[main] WARN  o.o.c.ignore.CodegenIgnoreProcessor - Output directory does not exist, or is inaccessible. No file (.openapi-generator-ignore) will be evaluated.
[main] INFO  o.o.codegen.DefaultGenerator - OpenAPI Generator: go (client)
[main] INFO  o.o.codegen.DefaultGenerator - Generator 'go' is considered stable.
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] INFO  o.o.c.languages.AbstractGoCodegen - Environment variable GO_POST_PROCESS_FILE not defined so Go code may not be properly formatted. To define it, try `export GO_POST_PROCESS_FILE="/usr/local/bin/gofmt -w"` (Linux/Mac)
[main] INFO  o.o.c.languages.AbstractGoCodegen - NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).
[main] INFO  o.o.codegen.DefaultGenerator - Model Files not generated since it's an alias to array (without property) and `generateAliasAsModel` is set to false (default)
Exception in thread "main" java.lang.RuntimeException: Could not process model 'MessageDisposition'.Please make sure that your schema is correct!
	at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:470)
	at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:919)
	at org.openapitools.codegen.cmd.Generate.run(Generate.java:396)
	at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:60)
Caused by: java.lang.NullPointerException
	at org.openapitools.codegen.DefaultCodegen.updateCodegenPropertyEnum(DefaultCodegen.java:4137)
	at org.openapitools.codegen.DefaultCodegen.postProcessModelsEnum(DefaultCodegen.java:332)
	at org.openapitools.codegen.languages.AbstractGoCodegen.postProcessModels(AbstractGoCodegen.java:509)
	at org.openapitools.codegen.DefaultGenerator.processModels(DefaultGenerator.java:1195)
	at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:465)
	... 3 more

Refactor unit tests

Most (all?) of the unit tests in Wire put their assertions inside conditional blocks. These tests trigger errors by deliberately crafting invalid tags and/or messages, but they pass if no error is returned. For example:

	if err := pn.Validate(); err != nil {
		if !base.Match(err, ErrValidTagForType) {
			t.Errorf("%T: %s", err, err)
		}
	}

The tests should be refactored to fail if no error is returned. The test above should be

	err := pn.Validate()

	if err == nil {
		t.Fatalf("an error was expected - wanted %T, %s", ErrValidTagForType, ErrValidTagForType)
	}
	if !base.Match(err, ErrValidTagForType) {
		t.Errorf("%T: %s", err, err)
	}

Better yet, the tests could be improved by using the testify package to assert or require test results:

	err := pn.Validate()
	
	require.NotNil(t, err)
	require.Contains(t, err.Error(), ErrValidTagForType.Error())

spike: Fedwire Format Validation Logic

What were you trying to do?
I was trying to show file contents of a CTR transaction

What did you expect to see?
I expected to see my file contents

What did you see?
I saw an error requiring the the BeneficiaryIntermediaryFI field

How can we reproduce the problem?
Create a fedwire file with the following JSON:

{
    "id": "704943",
    "fedWireMessage": {
        "id": "704943",
        "messageDisposition": {
            "formatVersion": "30",
            "testProductionCode": "T"
        },
        "senderSupplied": {
            "formatVersion": "30",
            "userRequestCorrelation": "TESTDATA",
            "testProductionCode": "T",
            "messageDuplicationCode": " "
        },
        "typeSubType": {
            "typeCode": "10",
            "subTypeCode": "00"
        },
        "inputMessageAccountabilityData": {
            "inputCycleDate": "20180922",
            "inputSource": "XYZ ABC ",
            "inputSequenceNumber": "000001"
        },
        "amount": {
            "amount": "000000000250"
        },
        "senderDepositoryInstitution": {
            "senderABANumber": "000714895",
            "senderShortName": "Fake Institution"
        },
        "receiverDepositoryInstitution": {
            "receiverABANumber": "000738119",
            "receiverShortName": "Fake Institution"
        },
        "businessFunctionCode": {
            "businessFunctionCode": "CTR",
            "transactionTypeCode": "   "
        },
        "charges": {
            "chargeDetails": "B",
            "sendersChargesOne": "USD0",
            "sendersChargesTwo": "USD0",
            "sendersChargesThree": "USD0",
            "sendersChargesFour": "USD0"
        },
        "instructedAmount": {
            "currencyCode": "USD",
            "amount": "000000000250"
        },
        "exchangeRate": {
            "exchangeRate": "1.3624055125"
        },
        "beneficiary": {
            "personal": {
                "identificationCode": "T",
                "identifier": "755756",
                "name": "string",
                "address": {
                    "addressLineOne": "string",
                    "addressLineTwo": "string",
                    "addressLineThree": "string"
                }
            }
        },
        "originator": {
            "personal": {
                "identificationCode": "T",
                "identifier": "798260",
                "name": "string",
                "address": {
                    "addressLineOne": "string",
                    "addressLineTwo": "string",
                    "addressLineThree": "string"
                }
            }
        }
    }
}

So realistically - following the flow of this 2011 Fedwire Doc: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.445.7645&rep=rep1&type=pdf
Field {4000} (Beneficiary Intermediary FI) is not required in any case. If you look at page 15 of the doc, you'll see a flow of Business function codes, which fields are mandatory, and which fields are optional in a fedwire implementation.

Unless if you know of a better standard to be following: this is the implementation of Fedwire I'm using as a gold standard.

Business Function Code is CTR

        If {3600} is CTR, an optional Transaction Type Code element is permitted;
        however, the Transaction Type Code 'COV' is not permitted.

Reduce gocyclo to -over 45

C:\Users\Owner\go\src\github.com\fzipp\gocyclo>gocyclo -over 45 C:\Users\Owner\go\src\github.com\moov-io\wire
114 wire (*Reader).parseLine C:\Users\Owner\go\src\github.com\moov-io\wire\reader.go:88:1
60 wire (*FedWireMessage).verify C:\Users\Owner\go\src\github.com\moov-io\wire\fedWireMessage.go:146:1

webui: validate files

What were you trying to do?
Within the webui we can parse Wire files over to their JSON representation. We should expose file validation as well as a button.

Validation issues around missing tag {1500} in incoming wires formatted with Fedwire extended format

Wire Version: v0.9.0

What were you trying to do?
Parse incoming wires in the Fedwire extended format

What did you expect to see?
Wires parsed successfully

What did you see?
Validation error message since tag {1500} is not present in incoming Fedwire extended format files

How can we reproduce the problem?
Parse a wire file with tag {1500}, ex

{1100}30P N{1110}06071654XXXX{1120}20220607XXXXXXXXXXXXXXXXXXXXXXXXXX{1510}1000{1520}20220607XXXXXXXX000002{2000}000000009000{3100}021004543Test Bank*{3320}158545637*{3400}123456789Test XXXXXXXXXXXXX*{3600}CTP{3620}3*752E9D0D-99B8-4DF4-87F2-XXXXXXXXXXXX*{3700}BUSD0,00*USD10,00*{3710}USD100,00*{4200}DXXXXXXXXXXXXXXXX*Test Bank*line1*line2*line3*{4320}WW22060755582563*{5000}DXXXXXXXXXXX*line1*line2*line3*{5100}BXXXXXXXXXXX*Test Bank*line1*line2*{6000}FFC: XXXXX*XXXXXXXXXXX*

reader: parse additional tags appended by the Fed

Wire Version: v0.6.3-dev

This issue was reported by one of our Slack community members. Here's the thread for context: https://moov-io.slack.com/archives/CJV1WSCKF/p1605886718010000

What were you trying to do?
Parse a Fedwire file by calling the create file endpoint

What did you expect to see?
A successful API request/response

What did you see?
{"error":"error reading file: {1100} is an invalid tag"}

How can we reproduce the problem?
Call the create file endpoint with a file containing tags that fall under the "12. Information Appended by the Fedwire Funds Service" section of the format guide.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.