Code Monkey home page Code Monkey logo

metro2'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/metro2

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.

Metro2 implements a reader, writer, and validator for consumer credit history reports in an HTTP server and Go library. The HTTP server is available in a Docker image and the Go package github.com/moov-io/metro2 is available.

Table of contents

Project status

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

Usage

The Metro2 project implements an HTTP server and Go library for creating and modifying files in Metro 2 format, which is used for consumer credit history reporting by U.S. credit bureaus.

Docker

We publish a public Docker image moov/metro2 on Docker Hub with each tagged release of Metro2. No configuration is required to serve on :8080. We also have Docker images for OpenShift published as quay.io/moov/metro2.

Pull & start the Docker image:

docker pull moov/metro2:latest
docker run -p 8080:8080 moov/metro2:latest

Upload a file and validate it:

curl -X POST --form "file=@./test/testdata/packed_file.json" http://localhost:8080/validator
valid file

Convert a file from JSON to raw Metro format:

curl -X POST --form "file=@./test/testdata/packed_file.json" --form "format=metro" http://localhost:8080/convert
0480HEADER                           555555555508202002051019990510199905101999YOUR BUSINESS NAME HERE                 LINE ONE OF YOUR ADDRESS LINE TWO OF YOUR ADDRESS LINE THERE OF YOUR ADDRESS                    1234567890
...

Convert a file from raw Metro format to JSON:

curl -X POST --form "file=@./test/testdata/packed_file.dat" --form "format=json" http://localhost:8080/convert
{"header": {"blockDescriptorWord": 370,"recordDescriptorWord": 366,"recordIdentifier": "HEADER","transUnionProgramIdentifier": "5555555555","activityDate": "2002-08-20T00:00:00Z", ...

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-metro2-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/metro2
docker tag moov/metro2 gcr.io/<PROJECT-ID>/metro2
docker push gcr.io/<PROJECT-ID>/metro2

Deploy the container to Cloud Run:

gcloud run deploy --image gcr.io/<PROJECT-ID>/metro2 --port 8080

Select your target platform to 1, service name to metro2, 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-METRO2-APP-URL.a.run.app

Now you can complete a health check:

curl https://YOUR-METRO2-APP-URL.a.run.app/health

You should get this response:

{"status":"alive"}

Data persistence

By design, Metro2 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 Metro2 will have no files or data saved. Also, no in-memory encryption of the data is performed.

Command line

Metro2 has a command line interface to manage Metro 2 files and launch a web service.

metro2 --help

Usage:
   [command]

Available Commands:
  convert     Convert metro file format
  help        Help about any command
  print       Print metro file
  validator   Validate metro file
  web         Launches web server

Flags:
  -h, --help           help for this command
      --input string   input file (default is $PWD/metro.json)

Use " [command] --help" for more information about a command.

Each interaction that the library supports is exposed in a command-line option:

Command Info
convert The convert command allows users to convert a metro file to a specified file format (json, metro). The result will create a new file.
print The print command allows users to print a metro file in a specified file format (json, metro).
validator The validator command allows users to validate a metro file.
web The web command will launch a web server with endpoints to manage metro files.

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.

Package Installation

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

# Pull down into the Go Module cache
$ go get -u github.com/moov-io/metro2

$ go doc github.com/moov-io/metro2

Package Overview

Package file defines main interfaces to a metro file.

func NewFile(format string) (File, error)

func NewFileFromReader(r io.Reader) (File, error)

type File
	GetType() string
	SetType(string) error
	SetRecord(lib.Record) error
	AddDataRecord(lib.Record) error
	GetRecord(string) (lib.Record, error)
	GetDataRecords() []lib.Record
	GeneratorTrailer() (lib.Record, error)
	Parse(record string) error
	String(newline bool) string
	Validate() error

File has some records for header, body, trailer

Records have distinguished by file type

type Record
	Name() string
	Parse(string) (int, error)
	String() string
	Validate() error
	Length() int
	BlockSize() int
	AddApplicableSegment(Segment) error
	GetSegments(string) []Segment

type BaseSegment        // for character file format

type PackedBaseSegment  // for packed file format

type HeaderRecord       // for character file format

type PackedHeaderRecord // for packed file format

type TrailerRecord      // for character file format

type PackedTrailerRecord // for packed file format

Record has some segments to describe special form

Base Record can use correctly the features of appendable segments

type Record
	Name() string
	Parse(string) (int, error)
	String() string
	Validate() error
	Length() int
	BlockSize() int
	AddApplicableSegment(Segment) error
	GetSegments(string) []Segment

type J1Segment

type J2Segment

type K1Segment

type K2Segment

type K3Segment

type K4Segment

type L1Segment

type N1Segment

Package Examples

File object has type for metro packed file and metro character file, should specify file type when creating new file

f, err := file.NewFile(utils.PackedFileFormat)
err = json.Unmarshal([]byte(buf), f)

File object will create from metro file buffer directly, CreateFile function will create new file and will set file type based on metro file body

r, _ = os.Open(filepath.Join("...))
f, err := file.NewFileFromReader(r)

File object will manage records using member functions

Please use exact record object that has same type (header, base, trailer)

f, err := file.NewFile(utils.CharacterFileFormat)
newHeader := lib.HeaderRecord{}
err = f.SetRecord(&newSegment)
exsitedHeader, err := f.GetRecord(utils.HeaderRecordName)
newBase := lib.HeaderRecord{}
...

Similarly, Record can manage the appendable segments

Learn about Metro 2

Getting help

channel info
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

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 metro2 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 ACH 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 Wire implements an interface to write files for the Fedwire Funds Service, a real-time gross settlement funds transfer system operated by the United States Federal Reserve Banks.

  • 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 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.

License

Apache License 2.0 - See LICENSE for details.

metro2's People

Contributors

adamdecaf avatar atonks2 avatar codesnik avatar docadam avatar dylanallen avatar ebisrat avatar g0ddish avatar infernojj avatar jamierajewski avatar joshsadler avatar leodpena avatar loukotal avatar mdross95 avatar mfdeveloper508 avatar nlakritz avatar reilg avatar renovate-bot avatar renovate[bot] avatar snyk-bot avatar wadearnold avatar zmccoy 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  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

metro2's Issues

Example validation file doesn't pass validation

Metro2 Version: moov/metro2:latest docker image as of this writing (apparently v0.4.1)

What were you trying to do?

Validate the example file using the same commands in the README

What did you expect to see?

valid file

What did you see?

total_social_numbers_all_segments in trailer record has an invalid value

How can we reproduce the problem?

By following the steps in the README:

docker pull moov/metro2:latest
docker run -p 8080:8080 moov/metro2:latest

...then, from the root of this repo (on commit 53a5e86, the tip of master as of this writing):

curl -X POST --form "file=@./test/testdata/packed_file.json" http://localhost:8080/validator

JSON conversion for not available date fields is “0001-01-01T00:00:00Z"

Metro2 Version: latest|0.9.0

What were you trying to do?
Convert a METRO2 file to JSON with zero-filled dates for some non-required date fields.

What did you expect to see?
From the CDIA's METRO2 2020 Credit Reporting Resource Guide, we see that the Header Record (Char format) Field 10 is Program Date, is not required, and is Recording Technique of "numeric".

From the "Programing standards" section in the same guide it mentions:
"If a numeric field is not available, it should be zero filled."

I would expect the converted JSON data for a zero-filled date field to be blank (e.g. "")

What did you see?
Zero-filled dates are being converted to JSON with a value of “0001-01-01T00:00:00Z" -- which is the IsZero() value.

How can we reproduce the problem?
Convert any non-required data field (like Base Record Field 10 "dateClosed") to all zeros and convert to JSON.

improper encoding

Metro2 Version: moov/metro2:latest

What were you trying to do?
Convert Json to Metro2 using API call

What did you expect to see?
Converted response text in metro 2 format

What did you see?
Got the converted response but the encoding seems to be wrong. please find the attached screenshot for reference.

How can we reproduce the problem?
Run docker container using docker for windows.
Execute /convert API passing sample data.
Read the response and save in a file.
check file encoding.
image

Conversion doesn't work properly

Metro2 Version: 0.3.3

What were you trying to do?
I am trying to generate a json and convert it into metro.
This is the json
{ "header": { "recordDescriptorWord": 426, "recordIdentifier": "HEADER", "equifaxProgramIdentifier": "5555555555", "transUnionProgramIdentifier": "6666666666", "activityDate": "2022-01-20T18:35:42.648+03:00", "dateCreated": "2022-01-20T18:35:42.648+03:00", "programDate": "2022-01-20T18:35:42.648+03:00", "programRevisionDate": "2022-01-20T18:35:42.648+03:00", "reporterName": "name", "reporterAddress": "Reporter address", "reporterTelephoneNumber": 19999999999 }, "data": [ { "base": { "recordDescriptorWord": 730, "processingIndicator": 1, "timeStamp": "2022-01-20T18:35:42.648+03:00", "identificationNumber": "unknown", "consumerAccountNumber": "L21350000010", "portfolioType": "I", "accountType": "01", "dateOpened": "2021-12-16T11:35:24.854+03:00", "highestCredit": 100, "termsDuration": "3", "termsFrequency": "M", "scheduledMonthlyPaymentAmount": 34, "actualPaymentAmount": 0, "accountStatus": "11", "paymentRating": "0", "paymentHistoryProfile": "0", "currentBalance": 104, "amountPastDue": 0, "dateAccountInformation": "2022-01-20T15:35:39.051+03:00", "surname": "surname", "firstName": "name", "socialSecurityNumber": 1111, "dateBirth": "1963-03-28T00:00:00+03:00", "ecoaCode": "1", "countryCode": "US", "firstLineAddress": "add", "secondLineAddress": "", "city": "cc", "state": "TX", "zipCode": "78249", "addressIndicator": "Y" }, "j1": [], "j2": [] } ], "trailer": { "recordDescriptorWord": 426, "recordIdentifier": "TRAILER", "totalBaseRecords": 0, "totalStatusCodeDF": 0, "totalConsumerSegmentsJ1": 0, "totalConsumerSegmentsJ2": 0, "blockCount": 0, "totalStatusCodeDA": 0, "totalStatusCode05": 0, "totalStatusCode11": 0, "totalStatusCode13": 0, "totalStatusCode61": 0, "totalStatusCode62": 0, "totalStatusCode63": 0, "totalStatusCode64": 0, "totalStatusCode65": 0, "totalStatusCode71": 0, "totalStatusCode78": 0, "totalStatusCode80": 0, "totalStatusCode82": 0, "totalStatusCode83": 0, "totalStatusCode84": 0, "totalStatusCode88": 0, "totalStatusCode89": 0, "totalStatusCode93": 0, "totalStatusCode94": 0, "totalStatusCode95": 0, "totalStatusCode96": 0, "totalStatusCode97": 0, "totalECOACodeZ": 0, "totalEmploymentSegments": 0, "totalOriginalCreditorSegments": 0, "totalPurchasedToSegments": 0, "totalMortgageInformationSegments": 0, "totalPaymentInformationSegments": 0, "totalChangeSegments": 0, "totalSocialNumbersAllSegments": 0, "totalSocialNumbersBaseSegments": 0, "totalSocialNumbersJ1Segments": 0, "totalSocialNumbersJ2Segments": 0, "totalDatesBirthAllSegments": 0, "totalDatesBirthBaseSegments": 0, "totalDatesBirthJ1Segments": 0, "totalDatesBirthJ2Segments": 0, "totalTelephoneNumbersAllSegments": 0 } }

What did you expect to see?
I expect to get a valid metro2 file

What did you see?

  1. I see errors like that (may vary depending on the json I pass there, but still errors)
    ./metro2 convert --format metro -g --input ./b.json b.metro2
    Error: total_base_records in trailer record has a required field
  2. However, the provided json converts into metro file. But the resulting metro file doesn't convert back into json.

How can we reproduce the problem?

  1. Convert the json into metro, Now convert the result back to json.

Incorrect TotalSocialNumbers[All/Base]Segments calculation

Metro2 Version: v0.4.1

What were you trying to do?

Validate test file test/testdata/unpacked_fixed_file.json.

What did you expect to see?

In the trailer record, totalSocialNumbersAllSegments should have value 3, and totalSocialNumbersBaseSegments should have value 1.

What did you see?

The current values are incorrect because they don't include the social security number of the base record.

"totalSocialNumbersAllSegments": 2,

"totalSocialNumbersBaseSegments": 0,

Similar to how dates of birth are counted, this method should increase the counter for social security numbers:

func (f *fileInstance) generatorTrailer() (*lib.TrailerInformation, error) {

I believe the following lines are missing right above line 412:

trailer.TotalSocialNumbersAllSegments++
trailer.TotalSocialNumbersBaseSegments++

How can we reproduce the problem?

Validator returns "the file is valid", but test/testdata/unpacked_fixed_file.json is not a valid file. Set the following two values in the test file:

"totalSocialNumbersAllSegments": 3,
"totalSocialNumbersBaseSegments": 1,

and then validate:

go run cmd/metro2/main.go validator --input test/testdata/unpacked_fixed_file.json

test data question

Metro2 Version: v0.3.3

What were you trying to do?
trying to play with API and understand metro2 format

What did you expect to see?
https://github.com/moov-io/metro2/blob/master/test/testdata/unpacked_variable_file.json
I tested validator with above test data from your repo, noticed totalConsumerSegmentsJ1 is 2
and validator returns error if I change it to 1
I'm a bit confused as I also don't find much explanation on this value in the guide provided by CDIA
I was expecting it to be 1 since there is only one j1 item found, or is the base record also considered?

What did you see?
see above

How can we reproduce the problem?
N/A

Thank you

useless replace directive in go.mod

It seems that moov-io/metro2 does not depend on github.com/gogo/protobuf any more, both directly and indirectly.
So, replace directive left in go.mod makes no sense. Should it be dropped?

$ go mod why github.com/gogo/protobuf
# github.com/gogo/protobuf
(main module does not need package github.com/gogo/protobuf)

https://github.com/moov-io/metro2/blob/master/go.mod#L5

replace github.com/gogo/protobuf => github.com/gogo/protobuf v1.3.2

Highest Credit "required" validator fails for 0 value(s)

HighestCredit int `json:"highestCredit" validate:"required"`

The highest credit field in the base_segment.go struct has the required json flag, which doesn't allow for 0 int values:

https://pkg.go.dev/gopkg.in/go-playground/validator.v8#hdr-Required

This validates that the value is not the data types default zero value. For numbers ensures value is not zero. For strings ensures value is not "". For slices, maps, pointers, interfaces, channels and functions ensures the value is not nil.

don't support large file

Metro2 Version: ``

What were you trying to do?

Used http service with large file

What did you expect to see?

want to use large metro file

What did you see?

How can we reproduce the problem?

http server returns error response when trying to validate a large ( 63MB / ~140k lines) txt based metro2 file.

Balance "required" validator fails for 0 value(s)

Metro2 Version: v0.5.1

What were you trying to do?

Generate a metro2 using the metro2 tool. I inputted a 0 value for the CurrentBalance on one of the base segments.

What did you expect to see?

A metro2 with a base segment and 0 current balance.

What did you see?

An error stating "current_balance in base segment is a required field"

How can we reproduce the problem?
Input a 0 current balance on one of the base segments and try to generate a metro2.

Note I created a similar ticket a couple of weeks ago here. I believe the issue this time is coming from this: https://github.com/moov-io/metro2/blob/master/pkg/client/model_base_segment.go#L40, when it converts the lib model into the client model and expects a non-zero value.

A guide on how to use the metro2 library would be very helpful

Metro2 Version: 0.3.1

What were you trying to do?

I wanted to use the library.

What did you expect to see?

I expected some reference explaining that the main library usage starts at "github.com/moov-io/metro2/pkg/file"
with file.CreateFile.

What did you see?

Instead, I had to dig into the CLI and API packages to learn how the metro2 lib was actually used.

How can we reproduce the problem?

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 all (go, golang)
  • chore(deps): update all (major) (actions/cache, actions/checkout, actions/setup-go, bulma-clean-theme, catchpoint/workflow-telemetry-action, github/codeql-action)

Detected dependencies

bundler
docs/Gemfile
  • bulma-clean-theme undefined
  • github-pages undefined
  • jekyll-feed "~> 0.12"
  • tzinfo "~> 2.0"
  • wdm "~> 0.2.0"
dockerfile
Dockerfile
  • golang 1.22-alpine
Dockerfile-openshift
github-actions
.github/workflows/codeql.yaml
  • actions/checkout v2
  • github/codeql-action v2
  • github/codeql-action v2
.github/workflows/fuzz.yml
  • catchpoint/workflow-telemetry-action v1
  • actions/setup-go v4
  • actions/checkout v3
  • actions/cache v3
.github/workflows/go.yml
  • actions/setup-go v4
  • actions/checkout v2
  • actions/setup-go v4
  • actions/checkout v2
.github/workflows/release.yml
  • actions/setup-go v5
  • actions/checkout v3
  • actions/create-release v1
  • actions/upload-artifact v4
  • actions/setup-go v5
  • actions/checkout v3
  • actions/download-artifact v4
  • actions/upload-release-asset v1
  • actions/upload-release-asset v1
  • actions/upload-release-asset v1
  • actions/setup-go v5
  • actions/checkout v3
gomod
go.mod
  • go 1.21
  • go 1.22.6
  • github.com/KimMachineGun/automemlimit v0.6.1
  • github.com/gorilla/mux v1.8.1
  • github.com/moov-io/base v0.51.1
  • github.com/spf13/cobra v1.8.1
  • github.com/stretchr/testify v1.9.0
  • golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa@0cdaa3abc0fa
  • gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c@10cb98267c6c

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

Server errors when using large JSON payloads

Metro2 Version: latest

What were you trying to do?
We were trying to validate and convert large JSON files to the Metro2 format using the HTTP Docker server.

What did you expect to see?
We ran tests with JSON files consisting of 10k, 25k, 50k, and ~250k records. We expected to see each file validate and, if valid, have the server return a Metro2 file.

What did you see?
The JSON payload holding 10k records validated and was converted with no issues.

The 25k record payload validated, but when hitting the /convert endpoint we received a 502 Bad Gateway response. Our cloud architects don't think this is an issue with server resources or how we've set up the server. At times we have also seen a 504 Gateway Time-out response and an SSL "end of file" error.

On the two larger files, we received a 400 status code on validation with the message "is not a metro file". We are unsure if this is from the server not receiving the whole file or otherwise having trouble parsing it, or if we're just sending bad payloads.

Here's an example of how we've used curl to test these payloads:

curl --form "file=@./25k_record.json" <URL>/validator
curl --form "file=@./25k_record.json" --form "format=metro" <URL>/convert

How can we reproduce the problem?
I've attached the payloads we've been testing with. The problem can be reproduced by sending these payloads to the /validator and /convert endpoints of the HTTP server. If you'd like to use our instance, feel free to test with this url:

https://workato-container-service.ou23u2ki0eaiq.us-west-2.cs.amazonlightsail.com

Payloads:
10k_20k_50k.zip

Phone numbers with length greater than 10 do not fit inside an int32

Metro2 Version: 0.3.1

What were you trying to do?

I was trying to create a metro2 file with a phone number of digits greater than 10.

Are we supposed to ignore the US +1 code in phone numbers when reporting to the bureaus? Does the metro2 standard only accept 10-digit phone numbers?

Our API system includes the US +1 code with phone numbers. Example: 1-XXX-XXX-XXXX. The metro2 lib uses an int32 and assumes that all phone numbers are at most 10 digits. int32 doesn't support a number greater than 10 digits. The easiest solution is to truncate our phone numbers down to just 10 digits.

What did you expect to see?

I guess I expected that we support phone numbers with the country extension, so an int64 is required.

What did you see?

A runtime error.

How can we reproduce the problem?

Try 15103334444 in place of any of the required phone number fields like the reporter or primary customer phone.

bureaus are asking for one record per line

Metro2 Version: moov/metro2:latest image id 1fd1f2e9b67e

What were you trying to do?
Generate any super-basic metro2 file with more than one user and furnish it to Experian

What did you expect to see?
Since all the validations passed I was expecting Experian to accept it for processing.

What did you see?
The feedback from Experian was:
There was an issue with the file you sent to us and it couldn’t be processed. There is no Line Feed Characters (CRLF) to break the file into “clean” records. We cannot process files like this. We need you to fix and resend this file.

A similar issue was also reported twice by other Moov metro2 users in the Slack channel in the last few months:
https://moov-io.slack.com/archives/C014L9CAW77/p1637747898029500
https://moov-io.slack.com/archives/C014L9CAW77/p1648746025803759

How can we reproduce the problem?
Generate any valid metro2 file with more than one base record and observe the lack of Line Feed Characters

Verbose Error Flag Request

Metro2 Version: v0.2.6

What were you trying to do?
Print more verbose errors on what field / location in the input file is causing the error.

What did you expect to see?
A specific part of the file which caused the program to error so I could resolve it.

What did you see?
Generic error

image

How can we reproduce the problem?

Run the print command on unpacked_fixed_file.dat for instance.

Unpacked Metro2 File Print Error

Metro2 Version: v0.2.6

What were you trying to do?
go run ./cmd/metro2/ print an unpacked file.

image

What did you expect to see?
A printed out version of an unpacked file.

What did you see?
Error, without verbose explanation of the issue.

How can we reproduce the problem?
Attempt to Go Run Metro2 Print an unpacked file using:

go run ./cmd/metro2/ print on the unpacked_fixed_file.dat in testdata folder with format output as JSON.

Should handle a bad date-string (non-ISO8601) as an error

Metro2 Version: 0.3.1

What were you trying to do?

I am trying to create a metro2 file via file.CreateFile(json)

What did you expect to see?

I expect an error to be returned if I pass an invalid date-string for data[0].base.dateBirth.


func badMetro2JSON() string {
	return `{
        "header": {
          ....
        },
        "data": [
          {
            "base": {
              // .. truncated data for easy viewing  
              "dateLastPayment": "2002-08-02T00:00:00Z", 
           
              "dateBirth": "1972-03-18", // <--- Note the lack of timezone
              ....
            }
          }
        ]
    }
    `
}

What did you see?

I see a partially complete metro2 file that has all the header fields but no customer data in the output file.

How can we reproduce the problem?

Use the test case from https://github.com/moov-io/metro2/blob/master/test/testdata/unpacked_fixed_file.json and remove the timezone from data[0].base.dateBirth

Help with deploying docker image to ECR

Metro2 Version: 0.7.1

What were you trying to do?
I am trying to deploy your docker image to AWS ECR but I don't know docker very well. Is there anyone that has an example Docker file that can be used?

What did you expect to see?
moov metro 2 running via AWS API gateway

What did you see?
When I deploy your docker image directly to ECR I get a Runtime unknown error which I assume means that the Go runtime environment is missing.

How can we reproduce the problem?
follow this tutorial to deploy docker repo to ECR and see the errors
https://medium.com/@tud7/aws-deploy-lambda-function-with-docker-image-and-invoke-over-https-ae27b137fffc

Add fuzzer for parsing / reading

Fuzzing is a technique for sending arbitrary input into functions to see what happens. Typically this is done to weed out crashes/panics from software, or to detect bugs. In some cases all possible inputs are ran into the program (i.e. if a function accepts 16-bit integers it's trivial to try them all).

We should support fuzzing and ship a docker image that can be ran which will help automate fuzzing. There are examples we can use from moov-io/ach:

Readme should document CLI

Readme should document using the CLI for taking an input file and converting to an output type. Should also show validation of the file.

Missing Validate Functions on Base Segment Type

Metro2 Version: 0.8.2

What were you trying to do?
Looking through base segment code in pkg/lib/base_segment.go.

What did you expect to see?
Expected to see Validate* functions that check provided values against a list of constants for all applicable base segment fields, similar to the existing ValidatePortfolioType().

What did you see?
Noticed absence of Validate* functions for quite a few applicable base segment fields in pkg/lib/base_segment.go. Examples I would have expected to see are ValidateAccountStatus(), ValidateAccountType(), ValidateSpecialComment(), and possibly more.

How can we reproduce the problem?
Constructing a base segment with, for example, AccountType of FF (an invalid CRRG value) and adding the segment via AddDataRecord allows the segment to be added, when I would expect a NewErrInvalidValueOfField error.

Mentioned this in the slack channel, happy to help with PR(s) to get some of these added if we decide it's appropriate!

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.

Does not allow a value of 0 for current balance and highest credit on v0.3.1

Zero balances for both current balances and highest credit responds with a validation error that reads, "current_balance in base segment has a required field". However things do work appropriately when using v0.2.7

Metro2 Version: v0.3.1

What were you trying to do?

Validate a json with current balance set at 0.

What did you expect to see?

Values of 0 should be accepted

What did you see?

Validation error stating "current_balance in base segment has a required field"

How can we reproduce the problem?

Using version 0.3.1, try to validate a json using 0 for current balance or highest credit.

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.