Documentation ¶
Overview ¶
Package transaction is a generated GoMock package.
Package transaction is a generated GoMock package.
Index ¶
- Constants
- Variables
- func ParseFloatWithComma(src string, isNegative bool) (float64, error)
- func ParseFloatWithPeriod(src string) (float64, error)
- func ParseNumericValueFromString(src string) (string, error)
- func ProvideTransactionRepository(db *gorm.DB, logger *logrus.Logger) (*database.Repository[*Model], error)
- type BaseModelBuilder
- func (b BaseModelBuilder) BuildDocuments(model Model) ([]document.Model, error)
- func (b BaseModelBuilder) ExtractCommissionAmount() (float64, error)
- func (b BaseModelBuilder) ExtractRateValue() (float64, error)
- func (b BaseModelBuilder) ExtractSharesAmount() (float64, error)
- func (b BaseModelBuilder) ExtractStatus() (string, error)
- func (b BaseModelBuilder) ExtractTaxAmount() (float64, error)
- func (b BaseModelBuilder) ExtractTimestamp() (time.Time, error)
- func (b BaseModelBuilder) ExtractTotalAmount() (float64, error)
- func (b BaseModelBuilder) HandleErr(err error) error
- type CSVEntryFactory
- type DepositBuilder
- type DividendPayoutBuilder
- type Handler
- type HandlerInterface
- type InterestPayoutBuilder
- type MockProcessorInterface
- type MockProcessorInterfaceMockRecorder
- type MockRepositoryInterface
- type MockRepositoryInterfaceMockRecorder
- type Model
- type ModelBuilderFactory
- type ModelBuilderFactoryInterface
- type ModelBuilderInterface
- type Processor
- type ProcessorInterface
- type PurchaseBuilder
- type RepositoryInterface
- type RoundUpBuilder
- type SaleBuilder
- type SavebackBuilder
- type WithdrawBuilder
Constants ¶
const ( TypePurchase = "Purchase" TypeSale = "Sale" TypeDividendPayout = "Dividends" TypeRoundUp = "Round up" TypeSaveback = "Saveback" TypeDeposit = "Deposit" TypeWithdrawal = "Withdrawal" TypeInterestPayout = "Interest payout" )
Variables ¶
var ( ErrModelBuilderUnsupportedType = errors.New("unsupported response") ErrModelBuilderInsufficientDataResolved = errors.New("insufficient data resolved") ErrModelBuilderUnknownType = errors.New("unknown response") )
var ErrNoMatch = errors.New("value did not match the pattern")
Functions ¶
func ParseFloatWithPeriod ¶
Types ¶
type BaseModelBuilder ¶
type BaseModelBuilder struct {
// contains filtered or unexported fields
}
func NewBaseModelBuilder ¶
func NewBaseModelBuilder( response details.NormalizedResponse, instrumentBuilder instrument.ModelBuilderInterface, documentsBuilder document.ModelBuilderInterface, logger *log.Logger, ) BaseModelBuilder
func (BaseModelBuilder) BuildDocuments ¶
func (b BaseModelBuilder) BuildDocuments(model Model) ([]document.Model, error)
func (BaseModelBuilder) ExtractCommissionAmount ¶
func (b BaseModelBuilder) ExtractCommissionAmount() (float64, error)
func (BaseModelBuilder) ExtractRateValue ¶
func (b BaseModelBuilder) ExtractRateValue() (float64, error)
func (BaseModelBuilder) ExtractSharesAmount ¶
func (b BaseModelBuilder) ExtractSharesAmount() (float64, error)
func (BaseModelBuilder) ExtractStatus ¶
func (b BaseModelBuilder) ExtractStatus() (string, error)
func (BaseModelBuilder) ExtractTaxAmount ¶
func (b BaseModelBuilder) ExtractTaxAmount() (float64, error)
func (BaseModelBuilder) ExtractTimestamp ¶
func (b BaseModelBuilder) ExtractTimestamp() (time.Time, error)
func (BaseModelBuilder) ExtractTotalAmount ¶
func (b BaseModelBuilder) ExtractTotalAmount() (float64, error)
func (BaseModelBuilder) HandleErr ¶
func (b BaseModelBuilder) HandleErr(err error) error
type CSVEntryFactory ¶
type CSVEntryFactory struct {
// contains filtered or unexported fields
}
func NewCSVEntryFactory ¶
func NewCSVEntryFactory(logger *log.Logger) CSVEntryFactory
func (CSVEntryFactory) Make ¶
func (f CSVEntryFactory) Make(transaction Model) (filesystem.CSVEntry, error)
type DepositBuilder ¶
type DepositBuilder struct {
BaseModelBuilder
}
func NewDepositBuilder ¶
func NewDepositBuilder(baseBuilder BaseModelBuilder) DepositBuilder
func (DepositBuilder) Build ¶
func (b DepositBuilder) Build() (Model, error)
func (DepositBuilder) ExtractTotalAmount ¶
func (b DepositBuilder) ExtractTotalAmount() (float64, error)
type DividendPayoutBuilder ¶
type DividendPayoutBuilder struct {
PurchaseBuilder
}
func NewDividendPayoutBuilder ¶
func NewDividendPayoutBuilder(purchaseBuilder PurchaseBuilder) DividendPayoutBuilder
func (DividendPayoutBuilder) Build ¶
func (b DividendPayoutBuilder) Build() (Model, error)
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandler( listClient transactions.ClientInterface, detailsClient details.ClientInterface, normalizer details.ResponseNormalizerInterface, eventTypeResolver transactions.EventTypeResolverInterface, processor ProcessorInterface, logger *log.Logger, ) Handler
func ProvideHandler ¶
func (Handler) GetTimelineTransactions ¶
func (h Handler) GetTimelineTransactions() ([]transactions.ResponseItem, error)
func (Handler) ProcessTransactionResponse ¶
func (h Handler) ProcessTransactionResponse(transaction transactions.ResponseItem) error
type HandlerInterface ¶
type HandlerInterface interface {
Handle() error
}
type InterestPayoutBuilder ¶
type InterestPayoutBuilder struct {
BaseModelBuilder
}
func NewInterestPayoutBuilder ¶
func NewInterestPayoutBuilder(baseBuilder BaseModelBuilder) InterestPayoutBuilder
func (InterestPayoutBuilder) Build ¶
func (b InterestPayoutBuilder) Build() (Model, error)
type MockProcessorInterface ¶
type MockProcessorInterface struct {
// contains filtered or unexported fields
}
MockProcessorInterface is a mock of ProcessorInterface interface.
func NewMockProcessorInterface ¶
func NewMockProcessorInterface(ctrl *gomock.Controller) *MockProcessorInterface
NewMockProcessorInterface creates a new mock instance.
func (*MockProcessorInterface) EXPECT ¶
func (m *MockProcessorInterface) EXPECT() *MockProcessorInterfaceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockProcessorInterface) Process ¶
func (m *MockProcessorInterface) Process(eventType transactions.EventType, response details.NormalizedResponse) error
Process mocks base method.
type MockProcessorInterfaceMockRecorder ¶
type MockProcessorInterfaceMockRecorder struct {
// contains filtered or unexported fields
}
MockProcessorInterfaceMockRecorder is the mock recorder for MockProcessorInterface.
type MockRepositoryInterface ¶
type MockRepositoryInterface struct {
// contains filtered or unexported fields
}
MockRepositoryInterface is a mock of RepositoryInterface interface.
func NewMockRepositoryInterface ¶
func NewMockRepositoryInterface(ctrl *gomock.Controller) *MockRepositoryInterface
NewMockRepositoryInterface creates a new mock instance.
func (*MockRepositoryInterface) Create ¶
func (m *MockRepositoryInterface) Create(model *Model) error
Create mocks base method.
func (*MockRepositoryInterface) EXPECT ¶
func (m *MockRepositoryInterface) EXPECT() *MockRepositoryInterfaceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockRepositoryInterfaceMockRecorder ¶
type MockRepositoryInterfaceMockRecorder struct {
// contains filtered or unexported fields
}
MockRepositoryInterfaceMockRecorder is the mock recorder for MockRepositoryInterface.
type Model ¶
type Model struct { UUID string `gorm:"primaryKey"` InstrumentISIN *string Instrument instrument.Model Documents []document.Model `gorm:"-"` Type string `gorm:"index"` Timestamp time.Time `gorm:"index"` Status string Yield float64 Profit float64 Rate float64 Commission float64 Total float64 TaxAmount float64 CreatedAt time.Time `gorm:"index"` UpdatedAt time.Time `gorm:"index"` }
func NewTransaction ¶
type ModelBuilderFactory ¶
type ModelBuilderFactory struct {
// contains filtered or unexported fields
}
func NewModelBuilderFactory ¶
func NewModelBuilderFactory( resolver details.TypeResolverInterface, instrumentBuilder instrument.ModelBuilderInterface, documentsBuilder document.ModelBuilderInterface, logger *log.Logger, ) ModelBuilderFactory
func ProvideModelBuilderFactory ¶
func ProvideModelBuilderFactory(logger *logrus.Logger) ModelBuilderFactory
func (ModelBuilderFactory) Create ¶
func (f ModelBuilderFactory) Create( eventType transactions.EventType, response details.NormalizedResponse, ) (ModelBuilderInterface, error)
type ModelBuilderFactoryInterface ¶
type ModelBuilderFactoryInterface interface {
Create(eventType transactions.EventType, response details.NormalizedResponse) (ModelBuilderInterface, error)
}
type ModelBuilderInterface ¶
type Processor ¶
type Processor struct {
// contains filtered or unexported fields
}
func NewProcessor ¶
func NewProcessor( builderFactory ModelBuilderFactoryInterface, transactionRepo RepositoryInterface, factory CSVEntryFactory, csvReader filesystem.CSVReaderInterface, csvWriter filesystem.CSVWriterInterface, docDownloader document.DownloaderInterface, logger *log.Logger, ) Processor
func (Processor) Process ¶
func (p Processor) Process(eventType transactions.EventType, response details.NormalizedResponse) error
type ProcessorInterface ¶
type ProcessorInterface interface {
Process(eventType transactions.EventType, response details.NormalizedResponse) error
}
type PurchaseBuilder ¶
type PurchaseBuilder struct {
BaseModelBuilder
}
func NewPurchaseBuilder ¶
func NewPurchaseBuilder(baseBuilder BaseModelBuilder) PurchaseBuilder
func (PurchaseBuilder) Build ¶
func (b PurchaseBuilder) Build() (Model, error)
type RepositoryInterface ¶
type RepositoryInterface interface { database.RepositoryInterface[*Model] }
type RoundUpBuilder ¶
type RoundUpBuilder struct {
PurchaseBuilder
}
func NewRoundUpBuilder ¶
func NewRoundUpBuilder(purchaseBuilder PurchaseBuilder) RoundUpBuilder
func (RoundUpBuilder) Build ¶
func (b RoundUpBuilder) Build() (Model, error)
type SaleBuilder ¶
type SaleBuilder struct {
PurchaseBuilder
}
func NewSaleBuilder ¶
func NewSaleBuilder(purchaseBuilder PurchaseBuilder) SaleBuilder
func (SaleBuilder) Build ¶
func (b SaleBuilder) Build() (Model, error)
func (SaleBuilder) ExtractPerformanceFloatVal ¶
func (b SaleBuilder) ExtractPerformanceFloatVal(titles ...string) (float64, error)
func (SaleBuilder) ExtractProfitAndLoss ¶
func (b SaleBuilder) ExtractProfitAndLoss() (float64, error)
func (SaleBuilder) ExtractYield ¶
func (b SaleBuilder) ExtractYield() (float64, error)
type SavebackBuilder ¶
type SavebackBuilder struct {
PurchaseBuilder
}
func NewSavebackBuilder ¶
func NewSavebackBuilder(purchaseBuilder PurchaseBuilder) SavebackBuilder
func (SavebackBuilder) Build ¶
func (b SavebackBuilder) Build() (Model, error)
type WithdrawBuilder ¶
type WithdrawBuilder struct {
DepositBuilder
}
func NewWithdrawBuilder ¶
func NewWithdrawBuilder(depositBuilder DepositBuilder) WithdrawBuilder
func (WithdrawBuilder) Build ¶
func (b WithdrawBuilder) Build() (Model, error)