internal

package
v0.7.0-rc2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2019 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrDifferentCurrencies is returned when an operation on an Amount instance is attempted with another Amount of a different currency (symbol).
	ErrDifferentCurrencies = errors.New("different currencies")
)

Functions

func AddEventRoutes

func AddEventRoutes(logger log.Logger, r *mux.Router, eventRepo EventRepository)

func AddGatewayRoutes

func AddGatewayRoutes(logger log.Logger, r *mux.Router, gatewayRepo gatewayRepository)

func AddOriginatorRoutes

func AddOriginatorRoutes(logger log.Logger, r *mux.Router, accountsCallsDisabled bool, accountsClient AccountsClient, ofacClient ofac.Client, depositoryRepo DepositoryRepository, originatorRepo originatorRepository)

func AddPingRoute

func AddPingRoute(logger log.Logger, r *mux.Router)

func AddReceiverRoutes

func AddReceiverRoutes(logger log.Logger, r *mux.Router, ofacClient ofac.Client, receiverRepo receiverRepository, depositoryRepo DepositoryRepository)

func ReadMergedFilename

func ReadMergedFilename(repo *SQLDepositoryRepo, amount *Amount, id DepositoryID) (string, error)

func TLSHttpClient

func TLSHttpClient(path string) (*http.Client, error)

Types

type AccountType

type AccountType string
const (
	Checking AccountType = "checking"
	Savings  AccountType = "savings"
)

func (*AccountType) UnmarshalJSON

func (t *AccountType) UnmarshalJSON(b []byte) error

func (AccountType) Validate

func (t AccountType) Validate() error

type AccountsClient

type AccountsClient interface {
	Ping() error

	PostTransaction(requestID, userID string, lines []transactionLine) (*accounts.Transaction, error)
	SearchAccounts(requestID, userID string, dep *Depository) (*accounts.Account, error)
	ReverseTransaction(requestID, userID string, transactionID string) error
}

func CreateAccountsClient

func CreateAccountsClient(logger log.Logger, endpoint string, httpClient *http.Client) AccountsClient

CreateAccountsClient returns an AccountsClient used to make HTTP calls over to a Account instance. By default moov's localhost bind address will be used or the Kubernetes DNS name when called from inside a Kubernetes cluster.

endpoint is a DNS record responsible for routing us to an Account instance. Example: http://accounts.apps.svc.cluster.local:8080

type Amount

type Amount struct {
	// contains filtered or unexported fields
}

Amount represents units of a particular currency.

func NewAmount

func NewAmount(symbol string, number string) (*Amount, error)

NewAmount returns an Amount object after validating the ISO 4217 currency symbol.

func NewAmountFromInt

func NewAmountFromInt(symbol string, number int) (*Amount, error)

NewAmountFromInt returns an Amount object after converting an integer amount (in cents) and validating the ISO 4217 currency symbol.

func (Amount) Equal

func (a Amount) Equal(other Amount) bool

func (*Amount) FromString

func (a *Amount) FromString(str string) error

FromString attempts to parse str as a valid currency symbol and the quantity. Examples:

USD 12.53
GBP 4.02

func (*Amount) Int

func (a *Amount) Int() int

Int returns the currency amount as an integer. Example: "USD 1.11" returns 111

func (Amount) MarshalJSON

func (a Amount) MarshalJSON() ([]byte, error)

func (Amount) Plus

func (a Amount) Plus(other Amount) (Amount, error)

Plus returns an Amount of adding both Amount instances together. Currency symbols must match for Plus to return without errors.

func (*Amount) String

func (a *Amount) String() string

String returns an amount formatted with the currency. Examples:

USD 12.53
GBP 4.02

The symbol returned corresponds to the ISO 4217 standard. Only one period used to signify decimal value will be included.

func (*Amount) UnmarshalJSON

func (a *Amount) UnmarshalJSON(b []byte) error

func (*Amount) Validate

func (a *Amount) Validate() error

type CCDDetail

type CCDDetail struct {
	PaymentInformation string `json:"paymentInformation,omitempty"`
}

type Depository

type Depository struct {
	// ID is a unique string representing this Depository.
	ID DepositoryID `json:"id"`

	// BankName is the legal name of the financial institution.
	BankName string `json:"bankName"`

	// Holder is the legal holder name on the account
	Holder string `json:"holder"`

	// HolderType defines the type of entity of the account holder as an individual or company
	HolderType HolderType `json:"holderType"`

	// Type defines the account as checking or savings
	Type AccountType `json:"type"`

	// RoutingNumber is the ABA routing transit number for the depository account.
	RoutingNumber string `json:"routingNumber"`

	// AccountNumber is the account number for the depository account
	AccountNumber string `json:"accountNumber"`

	// Status defines the current state of the Depository
	Status DepositoryStatus `json:"status"`

	// Metadata provides additional data to be used for display and search only
	Metadata string `json:"metadata"`

	// Created a timestamp representing the initial creation date of the object in ISO 8601
	Created base.Time `json:"created"`

	// Updated is a timestamp when the object was last modified in ISO8601 format
	Updated base.Time `json:"updated"`

	// ReturnCodes holds the optional set of return codes for why this Depository was rejected
	ReturnCodes []*ach.ReturnCode `json:"returnCodes"`
	// contains filtered or unexported fields
}

func (*Depository) UserID

func (d *Depository) UserID() string

type DepositoryID

type DepositoryID string

func GetDepositoryID

func GetDepositoryID(r *http.Request) DepositoryID

GetDepositoryID extracts the DepositoryID from the incoming request.

type DepositoryRepository

type DepositoryRepository interface {
	GetUserDepositories(userID string) ([]*Depository, error)
	GetUserDepository(id DepositoryID, userID string) (*Depository, error)

	UpsertUserDepository(userID string, dep *Depository) error
	UpdateDepositoryStatus(id DepositoryID, status DepositoryStatus) error

	GetMicroDeposits(id DepositoryID) ([]*MicroDeposit, error) // admin endpoint

	LookupDepositoryFromReturn(routingNumber string, accountNumber string) (*Depository, error)
	LookupMicroDepositFromReturn(id DepositoryID, amount *Amount) (*MicroDeposit, error)
	SetReturnCode(id DepositoryID, amount Amount, returnCode string) error

	InitiateMicroDeposits(id DepositoryID, userID string, microDeposit []*MicroDeposit) error

	GetMicroDepositCursor(batchSize int) *MicroDepositCursor
	// contains filtered or unexported methods
}

type DepositoryRouter

type DepositoryRouter struct {
	// contains filtered or unexported fields
}

func NewDepositoryRouter

func NewDepositoryRouter(
	logger log.Logger,
	odfiAccount *ODFIAccount,
	accountsClient AccountsClient,
	achClient *achclient.ACH,
	fedClient fed.Client,
	ofacClient ofac.Client,
	depositoryRepo DepositoryRepository,
	eventRepo EventRepository,
) *DepositoryRouter

func (*DepositoryRouter) RegisterRoutes

func (r *DepositoryRouter) RegisterRoutes(router *mux.Router, accountsCallsDisabled bool)

type DepositoryStatus

type DepositoryStatus string
const (
	DepositoryUnverified DepositoryStatus = "unverified"
	DepositoryVerified   DepositoryStatus = "verified"
	DepositoryRejected   DepositoryStatus = "rejected"
)

func (*DepositoryStatus) UnmarshalJSON

func (ds *DepositoryStatus) UnmarshalJSON(b []byte) error

type Event

type Event struct {
	ID      EventID   `json:"id"`
	Topic   string    `json:"topic"`
	Message string    `json:"message"`
	Type    EventType `json:"type"`
}

type EventID

type EventID string

type EventRepository

type EventRepository interface {
	// contains filtered or unexported methods
}

type EventType

type EventType string
const (
	// TODO(adam): more EventType values?
	// ReceiverEvent   EventType = "Receiver"
	// DepositoryEvent EventType = "Depository"
	// OriginatorEvent EventType = "Originator"
	TransferEvent EventType = "Transfer"
)

type Gateway

type Gateway struct {
	// ID is a unique string representing this Gateway.
	ID GatewayID `json:"id"`

	// Origin is an ABA routing number
	Origin string `json:"origin"`

	// OriginName is the legal name associated with the origin routing number.
	OriginName string `json:"originName"`

	// Destination is an ABA routing number
	Destination string `json:"destination"`

	// DestinationName is the legal name associated with the destination routing number.
	DestinationName string `json:"destinationName"`

	// Created a timestamp representing the initial creation date of the object in ISO 8601
	Created base.Time `json:"created"`
}

type GatewayID

type GatewayID string

type GroupableTransfer

type GroupableTransfer struct {
	*Transfer

	// Origin is the ABA routing number of the Originating FI (ODFI)
	// This comes from the Transfer's OriginatorDepository.RoutingNumber
	Origin string
	// contains filtered or unexported fields
}

GroupableTransfer holds metadata of a Transfer used in grouping for generating and merging ACH files to be uploaded into the Fed.

func (GroupableTransfer) UserID

func (t GroupableTransfer) UserID() string

type HolderType

type HolderType string
const (
	Individual HolderType = "individual"
	Business   HolderType = "business"
)

func (*HolderType) UnmarshalJSON

func (t *HolderType) UnmarshalJSON(b []byte) error

type IATDetail

type IATDetail struct {
	// Originator information
	OriginatorName        string `json:"originatorName"`
	OriginatorAddress     string `json:"originatorAddress"`
	OriginatorCity        string `json:"originatorCity"`
	OriginatorState       string `json:"originatorState"`
	OriginatorPostalCode  string `json:"originatorPostalCode"`
	OriginatorCountryCode string `json:"originatorCountryCode"`

	// ODFI information
	ODFIName               string `json:"ODFIName"`
	ODFIIDNumberQualifier  string `json:"ODFIIDNumberQualifier"` // 01 = National Clearing System, 02 = BIC Code, 03 = IBAN Code
	ODFIIdentification     string `json:"ODFIIdentification"`
	ODFIBranchCurrencyCode string `json:"ODFIBranchCurrencyCode"` // two-letter ISO code

	// Receiver information
	ReceiverName        string `json:"receiverName"`
	ReceiverAddress     string `json:"receiverAddress"`
	ReceiverCity        string `json:"receiverCity"`
	ReceiverState       string `json:"receiverState"`
	ReceiverPostalCode  string `json:"receiverPostalCode"`
	ReceiverCountryCode string `json:"receiverCountryCode"`

	// RDFI information
	RDFIName               string `json:"RDFIName"`
	RDFIIDNumberQualifier  string `json:"RDFIIDNumberQualifier"`
	RDFIIdentification     string `json:"RDFIIdentification"`
	RDFIBranchCurrencyCode string `json:"RDFIBranchCurrencyCode"`

	// Foreign Correspondent Bank information
	ForeignCorrespondentBankName              string `json:"foreignCorrespondentBankName"`
	ForeignCorrespondentBankIDNumberQualifier string `json:"foreignCorrespondentBankIDNumberQualifier"` // 01 = National Clearing System, “02” = BIC Code, “03” = IBAN Code
	ForeignCorrespondentBankIDNumber          string `json:"foreignCorrespondentBankIDNumber"`
	ForeignCorrespondentBankBranchCountryCode string `json:"foreignCorrespondentBankBranchCountryCode"` // two-letter ISO code

}

type MicroDeposit

type MicroDeposit struct {
	Amount        Amount
	FileID        string
	TransactionID string
}

func (MicroDeposit) MarshalJSON

func (m MicroDeposit) MarshalJSON() ([]byte, error)

type MicroDepositCursor

type MicroDepositCursor struct {
	BatchSize int

	DepRepo *SQLDepositoryRepo
	// contains filtered or unexported fields
}

MicroDepositCursor allows for iterating through micro-deposits in ascending order (by CreatedAt) to merge into files uploaded to an ODFI.

func (*MicroDepositCursor) Next

Next returns a slice of micro-deposit objects from the current day. Next should be called to process all objects for a given day in batches.

type MockDepositoryRepository

type MockDepositoryRepository struct {
	Depositories  []*Depository
	MicroDeposits []*MicroDeposit
	Err           error

	DepID string

	Cur *MicroDepositCursor

	// Updated fields
	Status     DepositoryStatus
	ReturnCode string
}

func (*MockDepositoryRepository) GetMicroDepositCursor

func (r *MockDepositoryRepository) GetMicroDepositCursor(batchSize int) *MicroDepositCursor

func (*MockDepositoryRepository) GetMicroDeposits

func (r *MockDepositoryRepository) GetMicroDeposits(id DepositoryID) ([]*MicroDeposit, error)

func (*MockDepositoryRepository) GetUserDepositories

func (r *MockDepositoryRepository) GetUserDepositories(userID string) ([]*Depository, error)

func (*MockDepositoryRepository) GetUserDepository

func (r *MockDepositoryRepository) GetUserDepository(id DepositoryID, userID string) (*Depository, error)

func (*MockDepositoryRepository) InitiateMicroDeposits

func (r *MockDepositoryRepository) InitiateMicroDeposits(id DepositoryID, userID string, microDeposit []*MicroDeposit) error

func (*MockDepositoryRepository) LookupDepositoryFromReturn

func (r *MockDepositoryRepository) LookupDepositoryFromReturn(routingNumber string, accountNumber string) (*Depository, error)

func (*MockDepositoryRepository) LookupMicroDepositFromReturn

func (r *MockDepositoryRepository) LookupMicroDepositFromReturn(id DepositoryID, amount *Amount) (*MicroDeposit, error)

func (*MockDepositoryRepository) SetReturnCode

func (r *MockDepositoryRepository) SetReturnCode(id DepositoryID, amount Amount, returnCode string) error

func (*MockDepositoryRepository) UpdateDepositoryStatus

func (r *MockDepositoryRepository) UpdateDepositoryStatus(id DepositoryID, status DepositoryStatus) error

func (*MockDepositoryRepository) UpsertUserDepository

func (r *MockDepositoryRepository) UpsertUserDepository(userID string, dep *Depository) error

type MockTransferRepository

type MockTransferRepository struct {
	Xfer   *Transfer
	FileID string

	Cur *TransferCursor

	Err error

	// Updated fields
	ReturnCode string
	Status     TransferStatus
}

func (*MockTransferRepository) GetFileIDForTransfer

func (r *MockTransferRepository) GetFileIDForTransfer(id TransferID, userID string) (string, error)

func (*MockTransferRepository) GetTransferCursor

func (r *MockTransferRepository) GetTransferCursor(batchSize int, depRepo DepositoryRepository) *TransferCursor

func (*MockTransferRepository) LookupTransferFromReturn

func (r *MockTransferRepository) LookupTransferFromReturn(sec string, amount *Amount, traceNumber string, effectiveEntryDate time.Time) (*Transfer, error)

func (*MockTransferRepository) MarkTransferAsMerged

func (r *MockTransferRepository) MarkTransferAsMerged(id TransferID, filename string, traceNumber string) error

func (*MockTransferRepository) SetReturnCode

func (r *MockTransferRepository) SetReturnCode(id TransferID, returnCode string) error

func (*MockTransferRepository) UpdateTransferStatus

func (r *MockTransferRepository) UpdateTransferStatus(id TransferID, status TransferStatus) error

type ODFIAccount

type ODFIAccount struct {
	// contains filtered or unexported fields
}

ODFIAccount represents the depository account micro-deposts are debited from

func NewODFIAccount

func NewODFIAccount(accountsClient AccountsClient, accountNumber string, routingNumber string, accountType AccountType) *ODFIAccount

type Originator

type Originator struct {
	// ID is a unique string representing this Originator.
	ID OriginatorID `json:"id"`

	// DefaultDepository the depository account to be used by default per transaction.
	DefaultDepository DepositoryID `json:"defaultDepository"`

	// Identification is a number by which the receiver is known to the originator
	// This should be the 9 digit FEIN number for a company or Social Security Number for an Individual
	Identification string `json:"identification"`

	// Metadata provides additional data to be used for display and search only
	Metadata string `json:"metadata"`

	// Created a timestamp representing the initial creation date of the object in ISO 8601
	Created base.Time `json:"created"`

	// Updated is a timestamp when the object was last modified in ISO8601 format
	Updated base.Time `json:"updated"`
}

Originator objects are an organization or person that initiates an ACH Transfer to a Receiver account either as a debit or credit. The API allows you to create, delete, and update your originators. You can retrieve individual originators as well as a list of all your originators. (Batch Header)

type OriginatorID

type OriginatorID string

type Receiver

type Receiver struct {
	// ID is a unique string representing this Receiver.
	ID ReceiverID `json:"id"`

	// Email address associated to Receiver
	Email string `json:"email"`

	// DefaultDepository is the Depository associated to this Receiver.
	DefaultDepository DepositoryID `json:"defaultDepository"`

	// Status defines the current state of the Receiver
	Status ReceiverStatus `json:"status"`

	// Metadata provides additional data to be used for display and search only
	Metadata string `json:"metadata"`

	// Created a timestamp representing the initial creation date of the object in ISO 8601
	Created base.Time `json:"created"`

	// Updated is a timestamp when the object was last modified in ISO8601 format
	Updated base.Time `json:"updated"`
}

Receiver objects are organizations or people who receive an ACH Transfer from an Originator account.

The API allows you to create, delete, and update your originators. You can retrieve individual originators as well as a list of all your originators. (Batch Header)

type ReceiverID

type ReceiverID string

type ReceiverStatus

type ReceiverStatus string
const (
	ReceiverUnverified  ReceiverStatus = "unverified"
	ReceiverVerified    ReceiverStatus = "verified"
	ReceiverSuspended   ReceiverStatus = "suspended"
	ReceiverDeactivated ReceiverStatus = "deactivated"
)

func (*ReceiverStatus) UnmarshalJSON

func (cs *ReceiverStatus) UnmarshalJSON(b []byte) error

type SQLDepositoryRepo

type SQLDepositoryRepo struct {
	// contains filtered or unexported fields
}

func NewDepositoryRepo

func NewDepositoryRepo(logger log.Logger, db *sql.DB) *SQLDepositoryRepo

func (*SQLDepositoryRepo) Close

func (r *SQLDepositoryRepo) Close() error

func (*SQLDepositoryRepo) GetMicroDepositCursor

func (r *SQLDepositoryRepo) GetMicroDepositCursor(batchSize int) *MicroDepositCursor

GetMicroDepositCursor returns a microDepositCursor for iterating through micro-deposits in ascending order (by CreatedAt) beginning at the start of the current day.

func (*SQLDepositoryRepo) GetMicroDeposits

func (r *SQLDepositoryRepo) GetMicroDeposits(id DepositoryID) ([]*MicroDeposit, error)

GetMicroDeposits will retrieve the micro deposits for a given depository. This endpoint is designed for paygate's admin endpoints. If an amount does not parse it will be discardded silently.

func (*SQLDepositoryRepo) GetUserDepositories

func (r *SQLDepositoryRepo) GetUserDepositories(userID string) ([]*Depository, error)

func (*SQLDepositoryRepo) GetUserDepository

func (r *SQLDepositoryRepo) GetUserDepository(id DepositoryID, userID string) (*Depository, error)

func (*SQLDepositoryRepo) InitiateMicroDeposits

func (r *SQLDepositoryRepo) InitiateMicroDeposits(id DepositoryID, userID string, microDeposits []*MicroDeposit) error

InitiateMicroDeposits will save the provided []Amount into our database. If amounts have already been saved then no new amounts will be added.

func (*SQLDepositoryRepo) LookupDepositoryFromReturn

func (r *SQLDepositoryRepo) LookupDepositoryFromReturn(routingNumber string, accountNumber string) (*Depository, error)

func (*SQLDepositoryRepo) LookupMicroDepositFromReturn

func (r *SQLDepositoryRepo) LookupMicroDepositFromReturn(id DepositoryID, amount *Amount) (*MicroDeposit, error)

func (*SQLDepositoryRepo) MarkMicroDepositAsMerged

func (r *SQLDepositoryRepo) MarkMicroDepositAsMerged(filename string, mc UploadableMicroDeposit) error

MarkMicroDepositAsMerged will set the merged_filename on micro-deposits so they aren't merged into multiple files and the file uploaded to the Federal Reserve can be tracked.

func (*SQLDepositoryRepo) SetReturnCode

func (r *SQLDepositoryRepo) SetReturnCode(id DepositoryID, amount Amount, returnCode string) error

SetReturnCode will write the given returnCode (e.g. "R14") onto the row for one of a Depository's micro-deposit

func (*SQLDepositoryRepo) UpdateDepositoryStatus

func (r *SQLDepositoryRepo) UpdateDepositoryStatus(id DepositoryID, status DepositoryStatus) error

func (*SQLDepositoryRepo) UpsertUserDepository

func (r *SQLDepositoryRepo) UpsertUserDepository(userID string, dep *Depository) error

type SQLEventRepo

type SQLEventRepo struct {
	// contains filtered or unexported fields
}

func NewEventRepo

func NewEventRepo(logger log.Logger, db *sql.DB) *SQLEventRepo

func (*SQLEventRepo) Close

func (r *SQLEventRepo) Close() error

type SQLGatewayRepo

type SQLGatewayRepo struct {
	// contains filtered or unexported fields
}

func NewGatewayRepo

func NewGatewayRepo(logger log.Logger, db *sql.DB) *SQLGatewayRepo

func (*SQLGatewayRepo) Close

func (r *SQLGatewayRepo) Close() error

type SQLOriginatorRepo

type SQLOriginatorRepo struct {
	// contains filtered or unexported fields
}

func NewOriginatorRepo

func NewOriginatorRepo(logger log.Logger, db *sql.DB) *SQLOriginatorRepo

func (*SQLOriginatorRepo) Close

func (r *SQLOriginatorRepo) Close() error

type SQLReceiverRepo

type SQLReceiverRepo struct {
	// contains filtered or unexported fields
}

func NewReceiverRepo

func NewReceiverRepo(logger log.Logger, db *sql.DB) *SQLReceiverRepo

func (*SQLReceiverRepo) Close

func (r *SQLReceiverRepo) Close() error

type SQLTransferRepo

type SQLTransferRepo struct {
	// contains filtered or unexported fields
}

func NewTransferRepo

func NewTransferRepo(logger log.Logger, db *sql.DB) *SQLTransferRepo

func (*SQLTransferRepo) Close

func (r *SQLTransferRepo) Close() error

func (*SQLTransferRepo) GetFileIDForTransfer

func (r *SQLTransferRepo) GetFileIDForTransfer(id TransferID, userID string) (string, error)

func (*SQLTransferRepo) GetTransferCursor

func (r *SQLTransferRepo) GetTransferCursor(batchSize int, depRepo DepositoryRepository) *TransferCursor

GetTransferCursor returns a TransferCursor for iterating through Transfers in ascending order (by CreatedAt) beginning at the start of the current day.

func (*SQLTransferRepo) LookupTransferFromReturn

func (r *SQLTransferRepo) LookupTransferFromReturn(sec string, amount *Amount, traceNumber string, effectiveEntryDate time.Time) (*Transfer, error)

func (*SQLTransferRepo) MarkTransferAsMerged

func (r *SQLTransferRepo) MarkTransferAsMerged(id TransferID, filename string, traceNumber string) error

MarkTransferAsMerged will set the merged_filename on Pending transfers so they aren't merged into multiple files and the file uploaded to the FED can be tracked.

func (*SQLTransferRepo) SetReturnCode

func (r *SQLTransferRepo) SetReturnCode(id TransferID, returnCode string) error

func (*SQLTransferRepo) UpdateTransferStatus

func (r *SQLTransferRepo) UpdateTransferStatus(id TransferID, status TransferStatus) error

type TELDetail

type TELDetail struct {
	PhoneNumber string         `json:"phoneNumber"`
	PaymentType TELPaymentType `json:"paymentType,omitempty"`
}

type TELPaymentType

type TELPaymentType string
const (
	TELSingle      TELPaymentType = "single"
	TELReoccurring TELPaymentType = "reoccurring"
)

func (*TELPaymentType) UnmarshalJSON

func (t *TELPaymentType) UnmarshalJSON(b []byte) error

type Transfer

type Transfer struct {
	// ID is a unique string representing this Transfer.
	ID TransferID `json:"id"`

	// Type determines if this is a Push or Pull transfer
	Type TransferType `json:"transferType"`

	// Amount is the country currency and quantity
	Amount Amount `json:"amount"`

	// Originator object associated with this transaction
	Originator OriginatorID `json:"originator"`

	// OriginatorDepository is the Depository associated with this transaction
	OriginatorDepository DepositoryID `json:"originatorDepository"`

	// Receiver is the Receiver associated with this transaction
	Receiver ReceiverID `json:"receiver"`

	// ReceiverDepository is the DepositoryID associated with this transaction
	ReceiverDepository DepositoryID `json:"receiverDepository"`

	// Description is a brief summary of the transaction that may appear on the receiving entity’s financial statement
	Description string `json:"description"`

	// StandardEntryClassCode code will be generated based on Receiver type
	StandardEntryClassCode string `json:"standardEntryClassCode"`

	// Status defines the current state of the Transfer
	Status TransferStatus `json:"status"`

	// SameDay indicates that the transfer should be processed the same day if possible.
	SameDay bool `json:"sameDay"`

	// Created a timestamp representing the initial creation date of the object in ISO 8601
	Created base.Time `json:"created"`

	// CCDDetail is an optional struct which enables sending CCD ACH transfers.
	CCDDetail *CCDDetail `json:"CCDDetail,omitempty"`

	// IATDetail is an optional struct which enables sending IAT ACH transfers.
	IATDetail *IATDetail `json:"IATDetail,omitempty"`

	// TELDetail is an optional struct which enables sending TEL ACH transfers.
	TELDetail *TELDetail `json:"TELDetail,omitempty"`

	// WEBDetail is an optional struct which enables sending WEB ACH transfers.
	WEBDetail *WEBDetail `json:"WEBDetail,omitempty"`

	// ReturnCode is an optional struct representing why this Transfer was returned by the RDFI
	ReturnCode *ach.ReturnCode `json:"returnCode"`

	// Hidden fields (populated in LookupTransferFromReturn) which aren't marshaled
	TransactionID string `json:"-"`
	UserID        string `json:"-"`
}

type TransferCursor

type TransferCursor struct {
	BatchSize int

	DepRepo      DepositoryRepository
	TransferRepo *SQLTransferRepo
	// contains filtered or unexported fields
}

TransferCursor allows for iterating through Transfers in ascending order (by CreatedAt) to merge into files uploaded to an ODFI.

func (*TransferCursor) Next

func (cur *TransferCursor) Next() ([]*GroupableTransfer, error)

Next returns a slice of Transfer objects from the current day. Next should be called to process all objects for a given day in batches.

TODO(adam): should we have a field on transfers for marking when the ACH file is uploaded? "after the file is uploaded we mark the items in the DB with the batch number and upload time and update the status" -- Wade

type TransferID

type TransferID string

func (TransferID) Equal

func (id TransferID) Equal(s string) bool

type TransferRepository

type TransferRepository interface {
	UpdateTransferStatus(id TransferID, status TransferStatus) error

	GetFileIDForTransfer(id TransferID, userID string) (string, error)

	LookupTransferFromReturn(sec string, amount *Amount, traceNumber string, effectiveEntryDate time.Time) (*Transfer, error)
	SetReturnCode(id TransferID, returnCode string) error

	// GetTransferCursor returns a database cursor for Transfer objects that need to be
	// posted today.
	//
	// We currently default EffectiveEntryDate to tomorrow for any transfer and thus a
	// transfer created today needs to be posted.
	GetTransferCursor(batchSize int, depRepo DepositoryRepository) *TransferCursor
	MarkTransferAsMerged(id TransferID, filename string, traceNumber string) error
	// contains filtered or unexported methods
}

type TransferRouter

type TransferRouter struct {
	// contains filtered or unexported fields
}

func NewTransferRouter

func NewTransferRouter(
	logger log.Logger,
	depositoryRepo DepositoryRepository,
	eventRepo EventRepository,
	receiverRepo receiverRepository,
	originatorsRepo originatorRepository,
	transferRepo TransferRepository,
	achClientFactory func(userID string) *achclient.ACH,
	accountsClient AccountsClient,
	accountsCallsDisabled bool,
) *TransferRouter

func (*TransferRouter) RegisterRoutes

func (c *TransferRouter) RegisterRoutes(router *mux.Router)

type TransferStatus

type TransferStatus string
const (
	TransferCanceled  TransferStatus = "canceled"
	TransferFailed    TransferStatus = "failed"
	TransferPending   TransferStatus = "pending"
	TransferProcessed TransferStatus = "processed"
	TransferReclaimed TransferStatus = "reclaimed"
)

func (TransferStatus) Equal

func (ts TransferStatus) Equal(other TransferStatus) bool

func (*TransferStatus) UnmarshalJSON

func (ts *TransferStatus) UnmarshalJSON(b []byte) error

type TransferType

type TransferType string
const (
	PushTransfer TransferType = "push"
	PullTransfer TransferType = "pull"
)

func (*TransferType) UnmarshalJSON

func (tt *TransferType) UnmarshalJSON(b []byte) error

type UploadableMicroDeposit

type UploadableMicroDeposit struct {
	DepositoryID string
	UserID       string
	Amount       *Amount
	FileID       string
	CreatedAt    time.Time
}

type WEBDetail

type WEBDetail struct {
	PaymentInformation string         `json:"paymentInformation,omitempty"`
	PaymentType        WEBPaymentType `json:"paymentType,omitempty"`
}

type WEBPaymentType

type WEBPaymentType string
const (
	WEBSingle      WEBPaymentType = "single"
	WEBReoccurring WEBPaymentType = "reoccurring"
)

func (*WEBPaymentType) UnmarshalJSON

func (t *WEBPaymentType) UnmarshalJSON(b []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL