filetransfer

package
v0.6.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFileTransferConfigRoutes

func AddFileTransferConfigRoutes(logger log.Logger, svc *admin.Server, repo Repository)

AddFileTransferConfigRoutes registers the admin HTTP routes for modifying file-transfer (uploading) configs.

func GetConfigs

func GetConfigs(logger log.Logger, repo Repository) http.HandlerFunc

GetConfigs returns all configurations (i.e. FTP, cutoff times, file-transfer configs with passwords masked. (e.g. 'p******d')

Types

type Agent

type Agent interface {
	GetInboundFiles() ([]File, error)
	GetReturnFiles() ([]File, error)
	UploadFile(f File) error
	Delete(path string) error

	InboundPath() string
	OutboundPath() string
	ReturnPath() string

	Close() error
}

Agent represents an interface for uploading and retrieving ACH files from a remote service.

func New

func New(_type string, cfg *Config, repo Repository) (Agent, error)

New returns an implementation of a Agent which is used to upload files to a remote server.

This function reads ACH_FILE_TRANSFERS_ROOT_CAFILE for a file with additional root certificates to be used in all secured connections.

type Config

type Config struct {
	RoutingNumber string

	InboundPath  string
	OutboundPath string
	ReturnPath   string
}

type CutoffTime

type CutoffTime struct {
	RoutingNumber string
	Cutoff        int            // 24-hour time value (0000 to 2400)
	Loc           *time.Location // timezone cutoff is in (usually America/New_York)
}

CutoffTime represents the time of a banking day when all ACH files need to be uploaded in order to be processed for that day. Files which miss the cutoff time won't be processed until the next day.

TODO(adam): How to handle multiple CutoffTime's for Same Day ACH?

func (*CutoffTime) Diff

func (c *CutoffTime) Diff(when time.Time) time.Duration

diff returns the time.Duration between when and the CutoffTime A negative value will be returned if the cutoff has already passed

func (CutoffTime) MarshalJSON

func (c CutoffTime) MarshalJSON() ([]byte, error)

type FTPConfig

type FTPConfig struct {
	RoutingNumber string

	Hostname string
	Username string
	Password string
}

type FTPTransferAgent

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

FTPTransferAgent is an FTP implementation of a Agent

func (*FTPTransferAgent) Close

func (agent *FTPTransferAgent) Close() error

func (*FTPTransferAgent) Delete

func (agent *FTPTransferAgent) Delete(path string) error

func (*FTPTransferAgent) GetInboundFiles

func (agent *FTPTransferAgent) GetInboundFiles() ([]File, error)

func (*FTPTransferAgent) GetReturnFiles

func (agent *FTPTransferAgent) GetReturnFiles() ([]File, error)

func (*FTPTransferAgent) InboundPath

func (agent *FTPTransferAgent) InboundPath() string

func (*FTPTransferAgent) OutboundPath

func (agent *FTPTransferAgent) OutboundPath() string

func (*FTPTransferAgent) ReturnPath

func (agent *FTPTransferAgent) ReturnPath() string

func (*FTPTransferAgent) UploadFile

func (agent *FTPTransferAgent) UploadFile(f File) error

uploadFile saves the content of File at the given filename in the OutboundPath directory

The File's contents will always be closed

type File

type File struct {
	Filename string
	Contents io.ReadCloser
}

func (File) Close

func (f File) Close() error

type Repository

type Repository interface {
	GetConfigs() ([]*Config, error)
	GetCutoffTimes() ([]*CutoffTime, error)

	GetFTPConfigs() ([]*FTPConfig, error)
	GetSFTPConfigs() ([]*SFTPConfig, error)

	Close() error
}

func NewRepository

func NewRepository(db *sql.DB, dbType string) Repository

type SFTPConfig

type SFTPConfig struct {
	RoutingNumber string

	Hostname string
	Username string

	Password         string
	ClientPrivateKey string
}

type SFTPTransferAgent

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

func (*SFTPTransferAgent) Close

func (a *SFTPTransferAgent) Close() error

func (*SFTPTransferAgent) Delete

func (agent *SFTPTransferAgent) Delete(path string) error

func (*SFTPTransferAgent) GetInboundFiles

func (agent *SFTPTransferAgent) GetInboundFiles() ([]File, error)

func (*SFTPTransferAgent) GetReturnFiles

func (agent *SFTPTransferAgent) GetReturnFiles() ([]File, error)

func (*SFTPTransferAgent) InboundPath

func (agent *SFTPTransferAgent) InboundPath() string

func (*SFTPTransferAgent) OutboundPath

func (agent *SFTPTransferAgent) OutboundPath() string

func (*SFTPTransferAgent) Ping

func (a *SFTPTransferAgent) Ping() error

func (*SFTPTransferAgent) ReturnPath

func (agent *SFTPTransferAgent) ReturnPath() string

func (*SFTPTransferAgent) UploadFile

func (agent *SFTPTransferAgent) UploadFile(f File) error

uploadFile saves the content of File at the given filename in the OutboundPath directory

The File's contents will always be closed

Jump to

Keyboard shortcuts

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