config

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultEmailTemplate = template.Must(template.New("email").Parse(`
A file has been {{ .Verb }}ed{{ if .Hostname }}{{ if eq .Verb "upload" }} to{{ else }} from{{end}} {{ .Hostname }}{{end}} - {{ .Filename }}
Name: {{ .CompanyName }}
Debits:  ${{ .DebitTotal | printf "%.2f" }}
Credits: ${{ .CreditTotal | printf "%.2f" }}

Batches: {{ .BatchCount }}
Total Entries: {{ .EntryCount }}
`))
)
View Source
var (
	// DefaultFilenameTemplate is paygate's standard filename format for ACH files which are uploaded to an ODFI
	//
	// The format consists of a few parts: "year month day" timestamp, "hour minute" timestamp, and routing number
	//
	// Examples:
	//  - 20191010-0830-987654320.ach
	//  - 20191010-0830-987654320.ach.gpg (GPG encrypted)
	DefaultFilenameTemplate = `{{ date "20060102" }}-{{ date "1504" }}-{{ .RoutingNumber }}.ach{{ if .GPG }}.gpg{{ end }}`
)

Functions

This section is empty.

Types

type Accounts

type Accounts struct {
	Decryptor Decryptor
}

type Addendum

type Addendum struct {
	Create05 bool
}

type Admin

type Admin struct {
	BindAddress           string
	DisableConfigEndpoint bool
}

type AuditTrail

type AuditTrail struct {
	BucketURI string
	GPG       *GPG
}

func (*AuditTrail) Validate

func (cfg *AuditTrail) Validate() error

type BatchHeader added in v0.9.0

type BatchHeader struct {
	CompanyIdentification string
}

func (BatchHeader) Validate added in v0.9.0

func (cfg BatchHeader) Validate() error

type Config

type Config struct {
	Logger  log.Logger `yaml:"-" json:"-"`
	Logging Logging

	Http  HTTP
	Admin Admin

	Organization Organization
	Database     Database

	ODFI       ODFI
	Pipeline   Pipeline
	Transfers  Transfers
	Validation Validation

	Customers Customers
}

func Empty

func Empty() *Config

func FromFile

func FromFile(path string) (*Config, error)

func Read

func Read(data []byte) (*Config, error)

func (*Config) Validate

func (cfg *Config) Validate() error

Validate checks a Config fields and performs various confirmations their values conform to expectations.

type Customers

type Customers struct {
	Endpoint string
	Accounts Accounts
	Debug    bool
}

func (Customers) Validate

func (cfg Customers) Validate() error

type Cutoffs

type Cutoffs struct {
	Timezone string
	Windows  []string
}

func (Cutoffs) Location

func (cfg Cutoffs) Location() *time.Location

func (Cutoffs) Validate

func (cfg Cutoffs) Validate() error

type Database

type Database struct {
	SQLite *SQLite
	MySQL  *MySQL
}

type Decryptor

type Decryptor struct {
	Symmetric *Symmetric
}

func (Decryptor) Validate

func (cfg Decryptor) Validate() error

type Email

type Email struct {
	From string
	To   []string

	// ConnectionURI is a URI used to connect with a remote SFTP server.
	// This config typically needs to contain enough values to successfully
	// authenticate with the server.
	// - insecure_skip_verify is an optional parameter for disabling certificate verification
	//
	// Example: smtps://user:pass@localhost:1025/?insecure_skip_verify=true
	ConnectionURI string

	Template    string
	CompanyName string
}

func (*Email) Tmpl

func (e *Email) Tmpl() *template.Template

type FTP

type FTP struct {
	Hostname string
	Username string
	Password string

	CAFilepath   string
	DialTimeout  time.Duration
	DisabledEPSV bool
}

func (*FTP) CAFile

func (cfg *FTP) CAFile() string

func (*FTP) DisableEPSV

func (cfg *FTP) DisableEPSV() bool

func (*FTP) String

func (cfg *FTP) String() string

func (*FTP) Timeout

func (cfg *FTP) Timeout() time.Duration

type FileConfig added in v0.9.0

type FileConfig struct {
	BatchHeader BatchHeader

	BalanceEntries bool
	Addendum       Addendum
	CompanyName    string
}

func (FileConfig) Validate added in v0.9.0

func (cfg FileConfig) Validate() error

type FixedLimits added in v0.9.0

type FixedLimits struct {
	// SoftLimit is a numerical value which is used to force created Transfer
	// objects into the REVIEWABLE status for manual approval prior to upload.
	SoftLimit int64

	// HardLimit is a numerical value. No Transfer amount is allowed to exceed this value
	// when specified.
	HardLimit int64
}

func (*FixedLimits) OverHardLimit added in v0.9.0

func (cfg *FixedLimits) OverHardLimit(amt client.Amount) bool

func (*FixedLimits) OverSoftLimit added in v0.9.0

func (cfg *FixedLimits) OverSoftLimit(amt client.Amount) bool

func (*FixedLimits) Validate added in v0.9.0

func (cfg *FixedLimits) Validate() error

type FlattenBatches added in v0.10.0

type FlattenBatches struct{}

type GPG

type GPG struct {
	KeyFile string
	Signer  *Signer
}

type Gateway

type Gateway struct {
	Origin          string
	OriginName      string
	Destination     string
	DestinationName string
}

type HTTP

type HTTP struct {
	BindAddress string
}

type InMemPipeline

type InMemPipeline struct {
	URL string
}

type Inbound

type Inbound struct {
	Interval time.Duration
}

type KafkaPipeline

type KafkaPipeline struct {
	Brokers []string
	Group   string
	Topic   string
}

type Limits added in v0.9.0

type Limits struct {
	Fixed *FixedLimits
}

func (Limits) Validate added in v0.9.0

func (cfg Limits) Validate() error

type Local

type Local struct {
	Directory string
}

type Logging

type Logging struct {
	Format string
	Level  string
}

type Merging

type Merging struct {
	Directory      string
	FlattenBatches *FlattenBatches
}

func (*Merging) Validate

func (cfg *Merging) Validate() error

type MicroDeposits

type MicroDeposits struct {
	Source Source

	// Description is the default for what appears in the Online Banking
	// system for end-users of PayGate. Per NACHA limits this is restricted
	// to 10 characters.
	Description string

	SameDay bool
}

func (*MicroDeposits) Validate

func (cfg *MicroDeposits) Validate() error

type MySQL

type MySQL struct {
	Address  string
	Username string
	Password string
	Database string
}

func (*MySQL) GetPassword

func (cfg *MySQL) GetPassword() string

type ODFI

type ODFI struct {
	// RoutingNumber is a valid ABA routing number
	RoutingNumber string

	// Gateway holds FileHeader information which the ODFI requires is set
	// on all files uploaded.
	Gateway Gateway

	Cutoffs Cutoffs

	InboundPath  string
	OutboundPath string
	ReturnPath   string

	// AllowedIPs is a comma separated list of IP addresses and CIDR ranges
	// where connections are allowed. If this value is non-empty remote servers
	// not within these ranges will not be connected to.
	AllowedIPs string

	OutboundFilenameTemplate string

	FTP  *FTP
	SFTP *SFTP

	Inbound Inbound

	FileConfig FileConfig

	Storage *Storage
}

ODFI holds all the configuration for sending and retrieving ACH files with a financial institution to originate files.

func (*ODFI) FilenameTemplate

func (cfg *ODFI) FilenameTemplate() string

func (*ODFI) SplitAllowedIPs

func (cfg *ODFI) SplitAllowedIPs() []string

func (*ODFI) Validate

func (cfg *ODFI) Validate() error

type Organization added in v0.9.0

type Organization struct {
	Header  string
	Default string
}

type Output

type Output struct {
	Format string
}

func (*Output) Validate

func (cfg *Output) Validate() error

type PagerDuty

type PagerDuty struct {
	ApiKey     string
	From       string
	ServiceKey string
}

type Pipeline

type Pipeline struct {
	PreUpload     *PreUpload
	Output        *Output
	Merging       *Merging
	AuditTrail    *AuditTrail
	Stream        *StreamPipeline
	Notifications *PipelineNotifications
}

func (Pipeline) Validate

func (cfg Pipeline) Validate() error

type PipelineNotifications

type PipelineNotifications struct {
	Email     *Email
	PagerDuty *PagerDuty
	Slack     *Slack
}

func (*PipelineNotifications) Validate

func (cfg *PipelineNotifications) Validate() error

type PreUpload

type PreUpload struct {
	GPG *GPG
}

func (*PreUpload) Validate

func (cfg *PreUpload) Validate() error

type SFTP

type SFTP struct {
	Hostname string
	Username string

	Password         string
	ClientPrivateKey string
	HostPublicKey    string

	DialTimeout           time.Duration
	MaxConnectionsPerFile int
	MaxPacketSize         int
}

func (*SFTP) MaxConnections

func (cfg *SFTP) MaxConnections() int

func (*SFTP) PacketSize

func (cfg *SFTP) PacketSize() int

func (*SFTP) String

func (cfg *SFTP) String() string

func (*SFTP) Timeout

func (cfg *SFTP) Timeout() time.Duration

type SQLite

type SQLite struct {
	Path string
}

type Signer

type Signer struct {
	KeyFile     string
	KeyPassword string
}

func (*Signer) Password

func (cfg *Signer) Password() string

type Slack

type Slack struct {
	WebhookURL string
}

func (*Slack) Validate

func (cfg *Slack) Validate() error

type Source

type Source struct {
	CustomerID   string
	AccountID    string
	Organization string
}

func (Source) Validate

func (cfg Source) Validate() error

type Storage

type Storage struct {
	// CleanupLocalDirectory determines if we delete the local directory after
	// processing is finished. Leaving these files around helps debugging, but
	// also exposes customer information.
	CleanupLocalDirectory bool

	// KeepRemoteFiles determines if we delete the remote file on an ODFI's server
	// after downloading and processing of each file.
	KeepRemoteFiles bool

	// RemoveZeroByteFilesAfter The amount of time to wait before deleting zero byte files.
	RemoveZeroByteFilesAfter time.Duration

	Local *Local
}

type StreamPipeline

type StreamPipeline struct {
	InMem *InMemPipeline
	Kafka *KafkaPipeline
}

func (*StreamPipeline) Validate

func (cfg *StreamPipeline) Validate() error

type Symmetric

type Symmetric struct {
	KeyURI string
}

type Transfers

type Transfers struct {
	Limits Limits
}

func (Transfers) Validate added in v0.9.0

func (cfg Transfers) Validate() error

type Validation

type Validation struct {
	MicroDeposits *MicroDeposits
}

func (Validation) Validate

func (cfg Validation) Validate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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