payment_application

package
v0.0.0-...-36d8597 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EventList map[string]uint32

EventList - event notify list

Functions

func CommandPaymentApprove

func CommandPaymentApprove(ctx context.Context, in *billing.Payment) (*eventsourcing.BaseCommand, error)

func CommandPaymentClose

func CommandPaymentClose(ctx context.Context, in *billing.Payment) (*eventsourcing.BaseCommand, error)

func CommandPaymentCreate

func CommandPaymentCreate(ctx context.Context, in *billing.Payment) (*eventsourcing.BaseCommand, error)

func CommandPaymentReject

func CommandPaymentReject(ctx context.Context, in *billing.Payment) (*eventsourcing.BaseCommand, error)

func CommandPaymentUpdateBalance

func CommandPaymentUpdateBalance(ctx context.Context, in *billing.Payment) (*eventsourcing.BaseCommand, error)

Types

type Payment

type Payment struct {
	*eventsourcing.BaseAggregate
	*billing.Payment
}

func (*Payment) ApplyChange

func (p *Payment) ApplyChange(event *eventsourcing.Event) error

ApplyChange to payment

func (*Payment) HandleCommand

func (p *Payment) HandleCommand(ctx context.Context, command *eventsourcing.BaseCommand) error

HandleCommand create events and validate based on such command

type PaymentService

type PaymentService struct {

	// EventSourcing
	eventsourcing.CommandHandle
	// contains filtered or unexported fields
}

func New

func New(logger logger.Logger, paymentRepository event_store.EventStore) (*PaymentService, error)

func (*PaymentService) Add

Add - Create a payment

func (*PaymentService) Approve

func (p *PaymentService) Approve(ctx context.Context, id string) error

func (*PaymentService) Close

func (p *PaymentService) Close(ctx context.Context, id string) error

func (*PaymentService) Get

func (p *PaymentService) Get(ctx context.Context, aggregateId string) (*billing.Payment, error)

func (*PaymentService) Handle

func (p *PaymentService) Handle(ctx context.Context, aggregate *Payment, command *eventsourcing.BaseCommand) error

func (*PaymentService) List

func (p *PaymentService) List(ctx context.Context, filter interface{}) ([]*billing.Payment, error)

func (*PaymentService) PublishEvents

func (p *PaymentService) PublishEvents(ctx context.Context, events []*eventsourcing.Event) error

PublishEvents - send message about a new events

func (*PaymentService) Reject

func (p *PaymentService) Reject(ctx context.Context, id string) error

func (*PaymentService) UpdateBalance

func (p *PaymentService) UpdateBalance(ctx context.Context, in *billing.Payment) (*billing.Payment, error)

Jump to

Keyboard shortcuts

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