application

package
v0.0.0-...-76fafce Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdjustInvoice

type AdjustInvoice struct {
	ID     string
	Amount float64
}

type App

type App interface {
	AuthorizePayment(ctx context.Context, authorize AuthorizePayment) error
	ConfirmPayment(ctx context.Context, confirm ConfirmPayment) error
	CreateInvoice(ctx context.Context, create CreateInvoice) error
	AdjustInvoice(ctx context.Context, adjust AdjustInvoice) error
	PayInvoice(ctx context.Context, pay PayInvoice) error
	CancelInvoice(ctx context.Context, cancel CancelInvoice) error
}

type Application

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

func New

func New(invoices InvoiceRepository, payments PaymentRepository, publisher ddd.EventPublisher[ddd.Event]) *Application

func (Application) AdjustInvoice

func (a Application) AdjustInvoice(ctx context.Context, adjust AdjustInvoice) error

func (Application) AuthorizePayment

func (a Application) AuthorizePayment(ctx context.Context, authorize AuthorizePayment) error

func (Application) CancelInvoice

func (a Application) CancelInvoice(ctx context.Context, cancel CancelInvoice) error

func (Application) ConfirmPayment

func (a Application) ConfirmPayment(ctx context.Context, confirm ConfirmPayment) error

func (Application) CreateInvoice

func (a Application) CreateInvoice(ctx context.Context, create CreateInvoice) error

func (Application) PayInvoice

func (a Application) PayInvoice(ctx context.Context, pay PayInvoice) error

type AuthorizePayment

type AuthorizePayment struct {
	ID         string
	CustomerID string
	Amount     float64
}

type CancelInvoice

type CancelInvoice struct {
	ID string
}

type ConfirmPayment

type ConfirmPayment struct {
	ID string
}

type CreateInvoice

type CreateInvoice struct {
	ID        string
	OrderID   string
	PaymentID string
	Amount    float64
}

type InvoiceRepository

type InvoiceRepository interface {
	Find(ctx context.Context, invoiceID string) (*models.Invoice, error)
	Save(ctx context.Context, invoice *models.Invoice) error
	Update(ctx context.Context, invoice *models.Invoice) error
}

type MockApp

type MockApp struct {
	mock.Mock
}

MockApp is an autogenerated mock type for the App type

func NewMockApp

func NewMockApp(t mockConstructorTestingTNewMockApp) *MockApp

NewMockApp creates a new instance of MockApp. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockApp) AdjustInvoice

func (_m *MockApp) AdjustInvoice(ctx context.Context, adjust AdjustInvoice) error

AdjustInvoice provides a mock function with given fields: ctx, adjust

func (*MockApp) AuthorizePayment

func (_m *MockApp) AuthorizePayment(ctx context.Context, authorize AuthorizePayment) error

AuthorizePayment provides a mock function with given fields: ctx, authorize

func (*MockApp) CancelInvoice

func (_m *MockApp) CancelInvoice(ctx context.Context, cancel CancelInvoice) error

CancelInvoice provides a mock function with given fields: ctx, cancel

func (*MockApp) ConfirmPayment

func (_m *MockApp) ConfirmPayment(ctx context.Context, confirm ConfirmPayment) error

ConfirmPayment provides a mock function with given fields: ctx, confirm

func (*MockApp) CreateInvoice

func (_m *MockApp) CreateInvoice(ctx context.Context, create CreateInvoice) error

CreateInvoice provides a mock function with given fields: ctx, create

func (*MockApp) PayInvoice

func (_m *MockApp) PayInvoice(ctx context.Context, pay PayInvoice) error

PayInvoice provides a mock function with given fields: ctx, pay

type MockInvoiceRepository

type MockInvoiceRepository struct {
	mock.Mock
}

MockInvoiceRepository is an autogenerated mock type for the InvoiceRepository type

func NewMockInvoiceRepository

func NewMockInvoiceRepository(t mockConstructorTestingTNewMockInvoiceRepository) *MockInvoiceRepository

NewMockInvoiceRepository creates a new instance of MockInvoiceRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockInvoiceRepository) Find

func (_m *MockInvoiceRepository) Find(ctx context.Context, invoiceID string) (*models.Invoice, error)

Find provides a mock function with given fields: ctx, invoiceID

func (*MockInvoiceRepository) Save

func (_m *MockInvoiceRepository) Save(ctx context.Context, invoice *models.Invoice) error

Save provides a mock function with given fields: ctx, invoice

func (*MockInvoiceRepository) Update

func (_m *MockInvoiceRepository) Update(ctx context.Context, invoice *models.Invoice) error

Update provides a mock function with given fields: ctx, invoice

type MockPaymentRepository

type MockPaymentRepository struct {
	mock.Mock
}

MockPaymentRepository is an autogenerated mock type for the PaymentRepository type

func NewMockPaymentRepository

func NewMockPaymentRepository(t mockConstructorTestingTNewMockPaymentRepository) *MockPaymentRepository

NewMockPaymentRepository creates a new instance of MockPaymentRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockPaymentRepository) Find

func (_m *MockPaymentRepository) Find(ctx context.Context, paymentID string) (*models.Payment, error)

Find provides a mock function with given fields: ctx, paymentID

func (*MockPaymentRepository) Save

func (_m *MockPaymentRepository) Save(ctx context.Context, payment *models.Payment) error

Save provides a mock function with given fields: ctx, payment

type PayInvoice

type PayInvoice struct {
	ID string
}

type PaymentRepository

type PaymentRepository interface {
	Save(ctx context.Context, payment *models.Payment) error
	Find(ctx context.Context, paymentID string) (*models.Payment, error)
}

Jump to

Keyboard shortcuts

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