moov-io / paygate

A RESTful API enabling electronic payments to be submitted and received without a deep understanding payment file specification
http://moov.io
Apache License 2.0
129 stars 31 forks source link

achx,transfers: support sending pre-notification entries #601

Open adamdecaf opened 3 years ago

adamdecaf commented 3 years ago

We are looking to support sending pre-notes (prenotifications) for account validations. Pre-notes are zero-balance entries used to affirm an account exists at the RDFI.

Similar to initiating micro-deposits there would be an endpoint like POST /pre-notifications (no hyphen?) https://moov-io.github.io/paygate/api/#post-/micro-deposits

Per NACHA guidelines a pre-note is determined by an entry having a zero-balance and appropriate TransactionCode: https://github.com/moov-io/paygate/blob/v0.9.0-dev1/pkg/transfers/inbound/prenotes.go#L59-L74

In order to create a pre-note entry (with the appropriate SEC code) we could follow a similar pattern from achx.ConstructFile that is for pre-notifications. The logic is a bit different and we don't require a client.Transfer so the exposed Go API is going to be different.

Inside ./pkg/achx I think it makes sense to store this inside a prenote.go file that has the logic. That'll allow us to adopt batch/entry creation where possible but set pre-note specific files. The achx package can assume a contributors have knowledge of moov-io/ach and the requirements to building a file. This package contains lots of business logic specific to NACHA guidelines.

Note: We are going to support more SEC codes (CCD, WEB, etc) so assume there will be a ccd.go file that has helpers similar to PPD and is used in files.go and similar. https://github.com/moov-io/paygate/blob/v0.9.0-dev1/pkg/achx/ppd.go

For the Customers issue see https://github.com/moov-io/customers/issues/252