application

package
v0.0.0-...-3a9fddd Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: MIT Imports: 3 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, orders OrderRepository,
) *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 OrderRepository

type OrderRepository interface {
	Complete(ctx context.Context, invoiceID, orderID string) error
}

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