Skip to content
A RESTful API enabling electronic payments to be submitted and received without a deep understanding payment file specification
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode Initial development with Go-Kit May 7, 2018
docs docs/ach: file transfers don't have HTTP config endpoints yet Jun 12, 2019
internal all: cleanup from staticcheck May 23, 2019
pkg/achclient transfers: ignore error if a Transfer had no file_id on deletion Jun 13, 2019
testdata files: add tests and a mocked fileTransferAgent Apr 11, 2019
.appveyor.yml build: add appveyor.yml Oct 1, 2018
.gitignore build: 'skip_cleanup: true' May 21, 2019
.travis.yml build: run docker-compose and apitest -local in TravisCI (Linux only) Jun 11, 2019
AUTHORS all: switch copyright header to "The Moov Authors" Oct 1, 2018
CHANGELOG.md docs: changelog++ Jun 13, 2019
CONTRIBUTING.md docs: add "Overview of Go Tooling" to contributing Apr 16, 2019
Dockerfile build: switch to vendor-less build and docker image May 9, 2019
LICENSE Initial commit Feb 14, 2018
README.md docs/ach: mention file transfer config tables Jun 12, 2019
accounts.go accounts: implement ReverseTransaction from Accounts generated client May 24, 2019
accounts_test.go accounts: close dockertest deployment after success Jun 13, 2019
common.go all: cleanup from staticcheck May 23, 2019
common_test.go common: don't expose Amount int -> internal impl details May 9, 2019
depositories.go all: update to test with mysql and sqlite May 14, 2019
depositories_test.go all: update to test with mysql and sqlite May 14, 2019
docker-compose.yml build: include a docker-compose setup Jun 10, 2019
events.go all: return database/sql Rows.Err where applicable, fix cust -> recei… Apr 29, 2019
events_test.go all: update to test with mysql and sqlite May 14, 2019
fed.go fed: add LookupRoutingNumber for network call to verify ABA routing n… Mar 20, 2019
fed_test.go fed: add LookupRoutingNumber for network call to verify ABA routing n… Mar 20, 2019
file_transfer.go build: update moov/fsftp to v0.2.0 Jun 12, 2019
file_transfer_async.go file-transfers: add (admin) HTTP endpoints for modifying configs Jun 12, 2019
file_transfer_async_test.go file-transfers: add (admin) HTTP endpoints for modifying configs Jun 12, 2019
file_transfer_configs.go file-transfers: add (admin) HTTP endpoints for modifying configs Jun 12, 2019
file_transfer_configs_test.go file-transfers: add (admin) HTTP endpoints for modifying configs Jun 12, 2019
file_transfer_test.go files: test ftpFileTransferAgent.delete() Apr 15, 2019
gateways.go gateways, receivers: support mysql along with sqlite May 15, 2019
gateways_test.go all: update to test with mysql and sqlite May 14, 2019
go.mod file-transfers: add (admin) HTTP endpoints for modifying configs Jun 12, 2019
go.sum file-transfers: add (admin) HTTP endpoints for modifying configs Jun 12, 2019
http.go http: remove moov/base.ID() values from Prometheus metric labels May 1, 2019
http_test.go http: remove moov/base.ID() values from Prometheus metric labels May 1, 2019
main.go file-transfers: add (admin) HTTP endpoints for modifying configs Jun 12, 2019
makefile build: update moov/fsftp to v0.2.0 Jun 12, 2019
microDeposits.go all: s/nextID()/base.ID()/g May 10, 2019
microDeposits_test.go all: update to test with mysql and sqlite May 14, 2019
ofac.go ofac: search: set match percent on SDN if an AltName overrides it May 1, 2019
ofac_test.go
openapi.yaml api: fix minor typos Jun 4, 2019
originators.go all: cleanup from staticcheck May 23, 2019
originators_test.go originators: ignore Accounts lookup if we've disabled the Accounts in… May 22, 2019
receivers.go receivers: pass emails through net/mail.ParseAddress Jun 4, 2019
receivers_test.go receivers: pass emails through net/mail.ParseAddress Jun 4, 2019
renovate.json renovate: only run on monday Feb 28, 2019
transfers.go transfers: ignore error if a Transfer had no file_id on deletion Jun 13, 2019
transfers_ccd.go transfers: support CCD and the required Addenda05 on them Jun 3, 2019
transfers_ccd_test.go transfers: support CCD and the required Addenda05 on them Jun 3, 2019
transfers_iat.go all: cleanup old TODO's Apr 19, 2019
transfers_iat_test.go all: rename customer to receiver Apr 18, 2019
transfers_ppd.go transfers: support TEL ACH transfers May 21, 2019
transfers_tel.go transfers: reject reoccurring TEL and WEB transfers May 22, 2019
transfers_tel_test.go transfers: reject reoccurring TEL and WEB transfers May 22, 2019
transfers_test.go transfers: ignore error if a Transfer had no file_id on deletion Jun 13, 2019
transfers_web.go transfers: reject reoccurring TEL and WEB transfers May 22, 2019
transfers_web_test.go transfers: reject reoccurring TEL and WEB transfers May 22, 2019

README.md

moov-io/paygate

GoDoc Build Status Coverage Status Go Report Card Apache 2 licensed

project is under active development and is not production ready

Moov Paygate is a RESTful API enabling Automated Clearing House (ACH) transactions to be submitted and received without a deep understanding of a full NACHA file specification.

Docs: docs.moov.io | api docs

Project Status

This project is currently pre-production and could change without much notice, however we are looking for community feedback so please try out our code or give us feedback!

Deployment

Paygate currently requires the following services to be deployed and available:

  • ACH (HTTP Server) via ACH_ENDPOINT
  • FED (HTTP Server) via FED_ENDPOINT
  • OFAC (HTTP Server) via OFAC_ENDPOINT
  • The X-User-Id (case insensntive) HTTP header is also required and we recommend using an auth proxy to set this. Paygate only expects this value to be unique and consistent to a user.

The following services are required by default, but can be disabled:

  • Accounts (HTTP server) via ACCOUNTS_ENDPOINT and disabled with ACCOUNTS_CALLS_DISABLED=yes

Docker image

You can download our docker image moov/paygate from Docker Hub or use this repository. No configuration is required to serve on :8082 and metrics at :9092/metrics in Prometheus format.

$ docker run -p 8082:8082 moov/paygate:v0.4.0-rc4
ts=2018-12-13T19:18:11.970293Z caller=main.go:55 startup="Starting paygate server version v0.4.0-rc4"
ts=2018-12-13T19:18:11.970391Z caller=main.go:59 main="sqlite version 3.25.2"
ts=2018-12-13T19:18:11.971777Z caller=database.go:88 sqlite="starting database migrations"
ts=2018-12-13T19:18:11.971886Z caller=database.go:97 sqlite="migration #0 [create table if not exists receivers(cus...] changed 0 rows"
... (more database migration log lines)
ts=2018-12-13T19:18:11.97221Z caller=database.go:100 sqlite="finished migrations"
ts=2018-12-13T19:18:11.974316Z caller=main.go:96 ach="Pong successful to ACH service"
ts=2018-12-13T19:18:11.975093Z caller=main.go:155 transport=HTTP addr=:8082
ts=2018-12-13T19:18:11.975177Z caller=main.go:124 admin="listening on :9092"

$ curl -XPOST -H "x-user-id: test" localhost:8082/originators --data '{...}'

Local development

We support a Docker Compose environment in paygate that can be used to launch the entire Moov stack. After setup launching the stack is the following steps and we offer a testing utility apitest from the moov-io/api repository.

$ docker-compose up -d
paygate_ach_1 is up-to-date
paygate_ofac_1 is up-to-date
Recreating paygate_accounts_1 ...
paygate_fed_1 is up-to-date
Recreating paygate_accounts_1 ... done
Recreating paygate_paygate_1  ... done

# Run Moov's testing utility
$ apitest -local
2019/06/10 21:18:06.117261 main.go:61: Starting apitest v0.9.5
2019/06/10 21:18:06.117293 main.go:133: Using http://localhost as base API address
...
2019/06/10 21:18:06.276443 main.go:218: SUCCESS: Created user b1f2671bbed52ed6da88f16ce467cadecb0ee1b6 (email: festive.curran27@example.com)
...
2019/06/10 21:18:06.607817 main.go:218: SUCCESS: Created USD 204.71 transfer (id=b7ecb109574187ff726ba48275dcf88956c26841) for user

Build from source

PayGate orchestrates several services that depend on Docker and additional GoLang libraries to run. Paygate leverages Go Modules to manage dependencies. Ensure that your build environment is running Go 1.11 or greater and the environment variable export GO111MODULE=on is set. PayGate depends on other Docker containers that will be downloaded for testing and running the service. Ensure Docker is installed and running.

$ cd moov/paygate # wherever this project lives

$ go run .
ts=2018-12-13T19:18:11.970293Z caller=main.go:55 startup="Starting paygate server version v0.4.0-rc4"
ts=2018-12-13T19:18:11.970391Z caller=main.go:59 main="sqlite version 3.25.2"
ts=2018-12-13T19:18:11.971777Z caller=database.go:88 sqlite="starting database migrations"
ts=2018-12-13T19:18:11.971886Z caller=database.go:97 sqlite="migration #0 [create table if not exists receivers(cus...] changed 0 rows"
... (more database migration log lines)
ts=2018-12-13T19:18:11.97221Z caller=database.go:100 sqlite="finished migrations"
ts=2018-12-13T19:18:11.974316Z caller=main.go:96 ach="Pong successful to ACH service"
ts=2018-12-13T19:18:11.975093Z caller=main.go:155 transport=HTTP addr=:8082
ts=2018-12-13T19:18:11.975177Z caller=main.go:124 admin="listening on :9092"

Configuration

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

  • ACH_ENDPOINT: DNS record responsible for routing us to an ACH instance. If running as part of our local development setup (or in a Kubernetes cluster we setup) you won't need to set this.
  • ACCOUNTS_ENDPOINT: A DNS record responsible for routing us to an Accounts instance. (Example: http://accounts.apps.svc.cluster.local:8080)
    • Set ACCOUNTS_CALLS_DISABLED=yes to completely disable all calls to an Accounts service. This is used when paygate doesn't need to integrate with a general ledger solution.
  • FED_ENDPOINT: HTTP address for FED interaction to lookup ABA routing numbers
  • OFAC_ENDPOINT: HTTP address for OFAC interaction, defaults to Kubernetes inside clusters and local dev otherwise.
  • OFAC_MATCH_THRESHOLD: Percent match against OFAC data that's required for paygate to block a transaction.
  • DATABASE_TYPE: Which database option to use (options: sqlite [Default], mysql)
    • See Storage header below for per-database configuration

ACH file uploading / transfers

  • ACH_FILE_BATCH_SIZE: Number of Transfers to retrieve from the database in each batch for mergin before upload to Fed.
  • ACH_FILE_TRANSFER_INTERVAL: Go duration for how often to check and sync ACH files on their SFTP destinations.
  • ACH_FILE_STORAGE_DIR: Filepath for temporary storage of ACH files. This is used as a scratch directory to manage outbound and incoming/returned ACH files.
  • FORCED_CUTOFF_UPLOAD_DELTA: When the current time is within the routing number's cutoff time by duration force that file to be uploaded.

See our detailed documentation for SFTP configurations.

Micro Deposits

In order to validate Depositories and transfer money paygate must submit small deposits and credits and have someone confirm the amounts manually. This is only required once per Depository. The configuration options for paygate are below and are all required:

  • ODFI_ACCOUNT_NUMBER: Account Number of Financial Institution which is originating micro deposits.
  • ODFI_BANK_NAME: Legal name of Financial Institution which is originating micro deposits.
  • ODFI_HOLDER: Legal name of Financial Institution which is originating micro deposits.
  • ODFI_IDENTIFICATION: Number by which the customer is known to the Financial Institution originating micro deposits.
  • ODFI_ROUTING_NUMBER: ABA routing number of Financial Institution which is originating micro deposits.

Storage

Based on DATABASE_TYPE the following environment variables will be read to configure connections for a specific database.

MySQL
  • MYSQL_ADDRESS: TCP address for connecting to the mysql server. (example: localhost:3306)
  • MYSQL_DATABASE: Name of database to connect into.
  • MYSQL_PASSWORD: Password of user account for authentication.
  • MYSQL_USER: Username used for authentication,
SQLite
  • SQLITE_DB_PATH: Local filepath location for the paygate SQLite database.

Getting Help

channel info
Project Documentation Our project documentation available online.
Google Group moov-users The Moov users Google group is for contributors other people contributing to the Moov project. You can join them without a google account by sending an email to moov-users+subscribe@googlegroups.com. After receiving the join-request message, you can simply reply to that to confirm the subscription.
Twitter @moov_io 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 an 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. Request an invite to the slack channel

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!

Note: This project uses Go Modules, which requires Go 1.11 or higher, but we ship the vendor directory in our repository.

Test Coverage

Improving test coverage is a good candidate for new contributors while also allowing the project to move more quickly by reducing regressions issues that might not be caught before a release is pushed out to our users. One great way to improve coverage is by adding edge cases and different inputs to functions (or contributing and running fuzzers).

Tests can run processes (like sqlite databases), but should only do so locally.

Each PR should increase the overall coverage, if possible. You can run make cover-test to save a coverage profile and make cover-web to open the HTML view in your default browser.

License

Apache License 2.0 See LICENSE for details.

You can’t perform that action at this time.