upload

package
v0.31.3 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterAdminServer

func RegisterAdminServer(svc *admin.Server)

func RenderACHFilename

func RenderACHFilename(raw string, data FilenameData) (string, error)

Types

type Agent

type Agent interface {
	ID() string

	GetInboundFiles(ctx context.Context) ([]string, error)
	GetReconciliationFiles(ctx context.Context) ([]string, error)
	GetReturnFiles(ctx context.Context) ([]string, error)
	UploadFile(ctx context.Context, f File) error
	Delete(ctx context.Context, path string) error
	ReadFile(ctx context.Context, path string) (*File, error)

	InboundPath() string
	OutboundPath() string
	ReconciliationPath() string
	ReturnPath() string
	Hostname() string

	Ping() error
	Close() error
}

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

func New

func New(logger log.Logger, cfg service.UploadAgents, id string) (Agent, error)

type CreatedAgents

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

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(ctx context.Context, path string) error

func (*FTPTransferAgent) GetInboundFiles

func (agent *FTPTransferAgent) GetInboundFiles(ctx context.Context) ([]string, error)

func (*FTPTransferAgent) GetReconciliationFiles

func (agent *FTPTransferAgent) GetReconciliationFiles(ctx context.Context) ([]string, error)

func (*FTPTransferAgent) GetReturnFiles

func (agent *FTPTransferAgent) GetReturnFiles(ctx context.Context) ([]string, error)

func (*FTPTransferAgent) Hostname

func (agent *FTPTransferAgent) Hostname() string

func (*FTPTransferAgent) ID

func (agent *FTPTransferAgent) ID() string

func (*FTPTransferAgent) InboundPath

func (agent *FTPTransferAgent) InboundPath() string

func (*FTPTransferAgent) OutboundPath

func (agent *FTPTransferAgent) OutboundPath() string

func (*FTPTransferAgent) Ping

func (agent *FTPTransferAgent) Ping() error

func (*FTPTransferAgent) ReadFile added in v0.23.4

func (agent *FTPTransferAgent) ReadFile(ctx context.Context, path string) (*File, error)

func (*FTPTransferAgent) ReconciliationPath

func (agent *FTPTransferAgent) ReconciliationPath() string

func (*FTPTransferAgent) ReturnPath

func (agent *FTPTransferAgent) ReturnPath() string

func (*FTPTransferAgent) UploadFile

func (agent *FTPTransferAgent) UploadFile(ctx context.Context, 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 {
	Filepath string
	Contents io.ReadCloser
}

func (File) Close

func (f File) Close() error

type FilenameData

type FilenameData struct {
	RoutingNumber string

	// GPG is true if the file has been encrypted with GPG
	GPG bool

	// Index is the Nth file uploaded for a shard during a cutoff time
	Index int

	// ShardName is the name of a shard uploading this file
	ShardName string
}

type MockAgent

type MockAgent struct {
	InboundFilepaths        []string
	ReconciliationFilepaths []string
	ReturnFilepaths         []string

	UploadedFile *File  // non-nil on file upload
	DeletedFile  string // filepath of last deleted file
	ReadableFile *File

	Err error
	// contains filtered or unexported fields
}

func (*MockAgent) Close

func (a *MockAgent) Close() error

func (*MockAgent) Delete

func (a *MockAgent) Delete(_ context.Context, path string) error

func (*MockAgent) GetInboundFiles

func (a *MockAgent) GetInboundFiles(_ context.Context) ([]string, error)

func (*MockAgent) GetReconciliationFiles

func (a *MockAgent) GetReconciliationFiles(_ context.Context) ([]string, error)

func (*MockAgent) GetReturnFiles

func (a *MockAgent) GetReturnFiles(_ context.Context) ([]string, error)

func (*MockAgent) Hostname

func (a *MockAgent) Hostname() string

func (*MockAgent) ID

func (a *MockAgent) ID() string

func (*MockAgent) InboundPath

func (a *MockAgent) InboundPath() string

func (*MockAgent) OutboundPath

func (a *MockAgent) OutboundPath() string

func (*MockAgent) Ping

func (a *MockAgent) Ping() error

func (*MockAgent) ReadFile added in v0.23.4

func (a *MockAgent) ReadFile(_ context.Context, path string) (*File, error)

func (*MockAgent) ReconciliationPath

func (a *MockAgent) ReconciliationPath() string

func (*MockAgent) ReturnPath

func (a *MockAgent) ReturnPath() string

func (*MockAgent) UploadFile

func (a *MockAgent) UploadFile(_ context.Context, f File) error

type RetryAgent

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

func (*RetryAgent) Close

func (rt *RetryAgent) Close() error

func (*RetryAgent) Delete

func (rt *RetryAgent) Delete(ctx context.Context, path string) error

func (*RetryAgent) GetInboundFiles

func (rt *RetryAgent) GetInboundFiles(ctx context.Context) ([]string, error)

Network'd calls

func (*RetryAgent) GetReconciliationFiles

func (rt *RetryAgent) GetReconciliationFiles(ctx context.Context) ([]string, error)

func (*RetryAgent) GetReturnFiles

func (rt *RetryAgent) GetReturnFiles(ctx context.Context) ([]string, error)

func (*RetryAgent) Hostname

func (rt *RetryAgent) Hostname() string

func (*RetryAgent) ID

func (rt *RetryAgent) ID() string

func (*RetryAgent) InboundPath

func (rt *RetryAgent) InboundPath() string

Non-Network calls, so pass-through

func (*RetryAgent) OutboundPath

func (rt *RetryAgent) OutboundPath() string

func (*RetryAgent) Ping

func (rt *RetryAgent) Ping() error

func (*RetryAgent) ReadFile added in v0.23.4

func (rt *RetryAgent) ReadFile(ctx context.Context, path string) (*File, error)

func (*RetryAgent) ReconciliationPath

func (rt *RetryAgent) ReconciliationPath() string

func (*RetryAgent) ReturnPath

func (rt *RetryAgent) ReturnPath() string

func (*RetryAgent) String

func (rt *RetryAgent) String() string

func (*RetryAgent) UploadFile

func (rt *RetryAgent) UploadFile(ctx context.Context, f File) error

type SFTPTransferAgent

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

func (*SFTPTransferAgent) Close

func (agent *SFTPTransferAgent) Close() error

func (*SFTPTransferAgent) Delete

func (agent *SFTPTransferAgent) Delete(ctx context.Context, path string) error

func (*SFTPTransferAgent) GetInboundFiles

func (agent *SFTPTransferAgent) GetInboundFiles(ctx context.Context) ([]string, error)

func (*SFTPTransferAgent) GetReconciliationFiles

func (agent *SFTPTransferAgent) GetReconciliationFiles(ctx context.Context) ([]string, error)

func (*SFTPTransferAgent) GetReturnFiles

func (agent *SFTPTransferAgent) GetReturnFiles(ctx context.Context) ([]string, error)

func (*SFTPTransferAgent) Hostname

func (agent *SFTPTransferAgent) Hostname() string

func (*SFTPTransferAgent) ID

func (agent *SFTPTransferAgent) ID() string

func (*SFTPTransferAgent) InboundPath

func (agent *SFTPTransferAgent) InboundPath() string

func (*SFTPTransferAgent) OutboundPath

func (agent *SFTPTransferAgent) OutboundPath() string

func (*SFTPTransferAgent) Ping

func (agent *SFTPTransferAgent) Ping() error

func (*SFTPTransferAgent) ReadFile added in v0.23.4

func (agent *SFTPTransferAgent) ReadFile(ctx context.Context, path string) (*File, error)

func (*SFTPTransferAgent) ReconciliationPath

func (agent *SFTPTransferAgent) ReconciliationPath() string

func (*SFTPTransferAgent) ReturnPath

func (agent *SFTPTransferAgent) ReturnPath() string

func (*SFTPTransferAgent) UploadFile

func (agent *SFTPTransferAgent) UploadFile(ctx context.Context, 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