api

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreatePaymentRequest

type CreatePaymentRequest struct {
	Payment Payment `json:"payment"`
}

type CreatePaymentResponse

type CreatePaymentResponse struct {
	PaymentID uuid.UUID     `json:"payment_id"`
	Status    PaymentStatus `json:"status"`
}

type GetPaymentRequest

type GetPaymentRequest struct {
	PaymentID uuid.UUID `json:"payment_id"`
}

type GetPaymentResponse

type GetPaymentResponse struct {
	Payment      Payment       `json:"payment"`
	Status       PaymentStatus `json:"status"`
	PaymentError string        `json:"payment_error,omitempty"`
}

type Payment

type Payment struct {
	ID        uuid.UUID
	CreatedAt time.Time
	UpdatedAt time.Time
	Price     decimal.Decimal
	OrderID   uuid.UUID
	Status    PaymentStatus
}

type PaymentAPI

type PaymentAPI interface {
	CreatePayment(request CreatePaymentRequest) (CreatePaymentResponse, error)
	GetPayment(request GetPaymentRequest) (GetPaymentResponse, error)
}

func NewClient

func NewClient(baseURL string, logger kitlog.Logger) PaymentAPI

type PaymentStatus

type PaymentStatus string
const (
	PaymentStatusPaid    PaymentStatus = "paid"
	PaymentStatusPending PaymentStatus = "pending"
	PaymentStatusFailed  PaymentStatus = "failed"
)

type UpdatePaymentRequest

type UpdatePaymentRequest struct {
	PaymentID     uuid.UUID     `json:"payment_id"`
	PaymentStatus PaymentStatus `json:"payment_status"`
}

type UpdatePaymentResponse

type UpdatePaymentResponse struct {
	PaymentID    uuid.UUID     `json:"payment_id"`
	Status       PaymentStatus `json:"status"`
	PaymentError string        `json:"payment_error,omitempty"`
}

Jump to

Keyboard shortcuts

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