directdebit

package
v0.0.0-...-35ec390 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArchiveConfig

type ArchiveConfig struct {
	Src     string
	Dest    string
	Enabled bool
}

ArchiveConfig configuration for the archive task

type AvailableToSend

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

AvailableToSend Represents a row of files which have been encrypted and are available to send

type BindingConfig

type BindingConfig struct {
	RoutingKey string
	Exchange   string
}

BindingConfig Queue/Exchange Bindings

type BusConfig

type BusConfig struct {
	User      string
	Password  string
	Host      string
	Port      string
	Vhost     string
	Exchanges []*ExchangeConfig
	Queues    []*QueueConfig `json:"queues"`
}

BusConfig RabbitMQ configuration definition

func (BusConfig) ConnectionString

func (config BusConfig) ConnectionString() string

ConnectionString Format an AMQP Connection String

type BusError

type BusError struct {
	Msg    string
	Action string
}

BusError indicates there is a connection issue with the bus and an action to take

type CleanUpConfig

type CleanUpConfig struct {
	Paths   []string `json:"paths"`
	Enabled bool     `json:"enabled"`
}

CleanUpConfig defines the configuration for the cleanup task

type EncryptFilesConfig

type EncryptFilesConfig struct {
	SrcDir    string                           `json:"srcDir"`
	OutputDir string                           `json:"outputDir"`
	Providers map[string]crypto.ProviderConfig `json:"providers"`
	Enabled   bool                             `json:"enabled"`
}

EncryptFilesConfig is the configuration requriements for the encryptFiles task

type EncryptionLog

type EncryptionLog struct {
	Conn *gorm.DB
	// contains filtered or unexported fields
}

EncryptionLog Stores a database log

func NewEncryptionRecorder

func NewEncryptionRecorder(Conn *gorm.DB, log *log.Entry) *EncryptionLog

NewEncryptionRecorder provides a service which records transfer records in the database

func (*EncryptionLog) Create

func (t *EncryptionLog) Create(txn *gorm.DB, rec *EncryptionRecord) error

Create Creates an encryption record

func (*EncryptionLog) GetByHash

func (t *EncryptionLog) GetByHash(hash string) (*EncryptionRecord, error)

GetByHash Gets a record for a given files hash

func (*EncryptionLog) Update

func (t *EncryptionLog) Update(txn *gorm.DB, rec *EncryptionRecord) error

Update Updates a record

type EncryptionRecord

type EncryptionRecord struct {
	gorm.Model
	LocalFileName     string
	LocalFilePath     string
	LocalFileSize     int64
	RecipientKey      string
	SigningKey        string
	LocalFileHash     string `gorm:"primary_key"`
	EncryptedFileHash string
	CorrelationID     string
}

EncryptionRecord Maps to a row in the FileTransfers table

func (EncryptionRecord) TableName

func (EncryptionRecord) TableName() string

TableName sets the table name to TransferRecord

type EncryptionRecorder

type EncryptionRecorder interface {
	Create(txn *gorm.DB, rec *EncryptionRecord) error
	GetByHash(hash string) (*EncryptionRecord, error)
}

EncryptionRecorder provides a mechanism to update the transfer status

type ExchangeConfig

type ExchangeConfig struct {
	Name         string
	ExchangeType string
	Durable      bool
}

ExchangeConfig RabbbitMQ Exchange configuration

type MessageConsumer

type MessageConsumer struct {
	Connection      *amqp.Connection
	ConsumerChannel *amqp.Channel

	Shutdown bool
	// contains filtered or unexported fields
}

MessageConsumer holds the configuration, current connection and open channel

func NewConsumer

func NewConsumer(config *BusConfig, log *log.Entry) *MessageConsumer

NewConsumer provides an instance of MessageConsumer

func (*MessageConsumer) Close

func (c *MessageConsumer) Close() error

Close Closes the connection to the rabbitmq server

func (*MessageConsumer) Configure

func (c *MessageConsumer) Configure(ch *amqp.Channel) (err error)

Configure Creates the Exchange and Queue

func (*MessageConsumer) Connect

func (c *MessageConsumer) Connect() (*amqp.Connection, error)

Connect Establishes a connection to rabbitmq

type MessagePayload

type MessagePayload struct {
	Task          string `json:"task"`
	StartDate     string `json:"start_date"`
	CorrelationID string `json:"correlationId"`
}

MessagePayload represents the message content in a TransferFilesPayload from the message bus

type Pipeline

type Pipeline interface {
	StartListener(listenerError chan error)
	Execute(string) []error
	Close() error
	// contains filtered or unexported methods
}

Pipeline is an implementation of a pipeline

func New

func New(c *PipelineConfig) (Pipeline, error)

New Pipeline

type PipelineConfig

type PipelineConfig struct {
	Database mysql.Config
	Rabbitmq *BusConfig
	Tasks    *TasksConfig
}

PipelineConfig defines the required arguements for the pipeline

type QueueClient

type QueueClient interface {
	Connect()
	Configure() error
	Close() error
}

QueueClient Consumes a message for the pipeline

type QueueConfig

type QueueConfig struct {
	Name           string
	Durable        bool            `json:"durable"`
	DeleteOnUnused bool            `json:"deleteOnUnused"`
	Exclusive      bool            `json:"exclusive"`
	NoWait         bool            `json:"noWait"`
	Args           string          `json:"args"`
	Bindings       []BindingConfig `json:"bindings"`
}

QueueConfig RabbitMQ Queue definition

type SftpConfig

type SftpConfig struct {
	RemoteDir string        `json:"remoteDir"`
	LocalDir  string        `json:"localDir"`
	Sftp      sftp.Endpoint `json:"sftp"`
	Enabled   bool          `json:"enabled"`
}

SftpConfig Required Params for transferring to or from an SFTP Server

type TasksConfig

type TasksConfig struct {
	GetFilesFromBFP    *SftpConfig         `json:"getFilesFromBFP"`
	CleanBFP           *SftpConfig         `json:"cleanBFP"`
	EncryptFiles       *EncryptFilesConfig `json:"encryptFiles"`
	SftpFilesToANZ     *SftpConfig         `json:"sftpFilesToANZ"`
	SftpFilesToPx      *SftpConfig         `json:"sftpFilesToPx"`
	SftpFilesToBNZ     *SftpConfig         `json:"sftpFilesToBNZ"`
	ArchiveTransferred *ArchiveConfig      `json:"archiveTransferred"`
	CleanDirtyFiles    *CleanUpConfig
}

TasksConfig Configuration

type TransferFilesPayload

type TransferFilesPayload struct {
	MessageType []string
	Message     MessagePayload
}

TransferFilesPayload represents the payload received from the message bus

type TransferLog

type TransferLog struct {
	Conn *gorm.DB
	// contains filtered or unexported fields
}

TransferLog Stores a database log

func NewTransferRecorder

func NewTransferRecorder(Conn *gorm.DB, log *log.Entry) *TransferLog

NewTransferRecorder provides a service which records transfer records in the database

func (TransferLog) Create

func (t TransferLog) Create(txn *gorm.DB, rec *TransferRecord) error

Create Creates a TransferRecord

func (TransferLog) FileAlreadySent

func (t TransferLog) FileAlreadySent(txn *gorm.DB, hash string, remoteHost string) (bool, error)

FileAlreadySent Determines if a file has been

func (TransferLog) RecordError

func (t TransferLog) RecordError(txn *gorm.DB, rec *TransferRecord) error

RecordError Updates the transfer record in the database to record the error message

func (TransferLog) Update

func (t TransferLog) Update(txn *gorm.DB, rec *TransferRecord) error

Update updates the record

type TransferRecord

type TransferRecord struct {
	gorm.Model
	LocalFileName       string
	LocalFilePath       string
	LocalFileSize       int64
	RemoteFileName      string
	RemoteFilePath      string
	RemoteFileSize      int64
	RecipientName       string
	SenderName          string
	LocalFileHash       string `gorm:"primary_key"`
	TransferredFileHash string
	LocalHostID         string
	RemoteHost          string `gorm:"primary_key"`
	TransferStart       time.Time
	TransferEnd         time.Time
	TransferErrors      string
	CorrelationID       string
}

TransferRecord Maps to a row in the FileTransfers table

func (TransferRecord) TableName

func (TransferRecord) TableName() string

TableName sets the table name to TransferRecord

type TransferRecorder

type TransferRecorder interface {
	Create(txn *gorm.DB, rec *TransferRecord) error
	FileAlreadySent(txn *gorm.DB, localFileHash string, remoteHost string) (bool, error)
}

TransferRecorder provides a mechanism to update the transfer status

Jump to

Keyboard shortcuts

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