payment

package
v0.0.0-...-7e31de2 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidPaymentStatus = errors.New("not a valid PaymentStatus")
View Source
var ErrNoDepositAgentIsAvailable = errors.New("there is no deposit agent available")
View Source
var ErrNoProviderFound = errors.New("there is no provider to handle the request")

Functions

This section is empty.

Types

type Deposit

type Deposit struct {
	ID         string
	TrackingId string
	IBAN       string
	Gateway    string
	Amount     decimal.Decimal
	CreatedAt  time.Time
	UpdatedAt  time.Time
}

func FromNewDepositDtoToDepositModel

func FromNewDepositDtoToDepositModel(d dto.NewDepositDTO) Deposit

func (*Deposit) GetEvent

func (d *Deposit) GetEvent() (events.Event[events.NewDepositEvent], string)

type DepositService

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

func NewDepositService

func NewDepositService(
	logger *slog.Logger,
	session db.Session,
	inboxRepo inboxRepo,
	depositRepo depositRepo,
	outboxRepo outboxRepo,
) *DepositService

func (*DepositService) AddDeposit

func (svc *DepositService) AddDeposit(ctx context.Context, d dto.NewDepositDTO) error

type PaymentStatus

type PaymentStatus string

ENUM(

PROCESSING = "PROCESSING"
COMPLETED = "COMPLETED"
FAILED = "FAILED"

)

const (
	// PROCESSING is a PaymentStatus of type PROCESSING.
	PROCESSING PaymentStatus = "PROCESSING"
	// COMPLETED is a PaymentStatus of type COMPLETED.
	COMPLETED PaymentStatus = "COMPLETED"
	// FAILED is a PaymentStatus of type FAILED.
	FAILED PaymentStatus = "FAILED"
)

func ParsePaymentStatus

func ParsePaymentStatus(name string) (PaymentStatus, error)

ParsePaymentStatus attempts to convert a string to a PaymentStatus.

func (PaymentStatus) IsValid

func (x PaymentStatus) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (PaymentStatus) MarshalText

func (x PaymentStatus) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (PaymentStatus) String

func (x PaymentStatus) String() string

String implements the Stringer interface.

func (*PaymentStatus) UnmarshalText

func (x *PaymentStatus) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type Withdrawal

type Withdrawal struct {
	ID          string
	TrackingId  string
	Destination string
	Gateway     string
	Amount      decimal.Decimal
	Status      PaymentStatus
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

func FromNewWithdrawalDtoToTransaction

func FromNewWithdrawalDtoToTransaction(d dto.NewWithdrawalDto) Withdrawal

func FromUpdateWithdrawalDtoToTransaction

func FromUpdateWithdrawalDtoToTransaction(d dto.UpdateWithdrawalStatusDTO) Withdrawal

func (*Withdrawal) GetFinishedEvent

func (t *Withdrawal) GetFinishedEvent() (events.Event[events.FinishedEvent], string)

func (*Withdrawal) GetProcessingEvent

func (t *Withdrawal) GetProcessingEvent() (events.Event[events.ProcessingEvent], string)

type WithdrawalService

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

func NewWithdrawalService

func NewWithdrawalService(
	logger *slog.Logger,
	session db.Session,
	outboxRepo outboxRepo,
	inboxRepo inboxRepo,
	transactionRepo withdrawalRepo,
	paymentGateways ...paymentGateway,
) *WithdrawalService

func (*WithdrawalService) AddNewWithdrawTransaction

func (svc *WithdrawalService) AddNewWithdrawTransaction(ctx context.Context, d dto.NewWithdrawalDto) error

func (WithdrawalService) UpdateWithdrawalStatus

func (svc WithdrawalService) UpdateWithdrawalStatus(ctx context.Context, d dto.UpdateWithdrawalStatusDTO) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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