Documentation
¶
Index ¶
- type BackgroundService
- type CreatePaymentRequest
- type CreatePaymentResponse
- type GetPaymentRequest
- type GetPaymentResponse
- type Payment
- type PaymentStatus
- type Request1
- type Request2
- type Request3
- type Response1
- type Response2
- type Response3
- type Service
- type UpdatePaymentRequest
- type UpdatePaymentResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackgroundService ¶
type BackgroundService interface {
StartProcessingPayments()
}
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 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
}
func PaymentFromPaymentCreationRequestMessage ¶ added in v1.1.6
func PaymentFromPaymentCreationRequestMessage(p messages.PaymentCreationRequestMessage) (*Payment, error)
type PaymentStatus ¶
type PaymentStatus string
const ( PaymentStatusPaid PaymentStatus = "paid" PaymentStatusPending PaymentStatus = "pending" PaymentStatusFailed PaymentStatus = "failed" PaymentStatusClosed PaymentStatus = "closed" )
func MockPaymentProcess ¶
func MockPaymentProcess(p PaymentStatus) PaymentStatus
MockPaymentProcess is a function that simulates a payment process and returns a mock payment status. It takes a pointer to a PaymentStatus struct as input and returns a PaymentStatus value. The function generates a random payment status between paid and failed, with a preference for paid.
type Service ¶
type Service interface {
CreatePayment(ctx context.Context, request CreatePaymentRequest) (CreatePaymentResponse, error)
UpdatePayment(ctx context.Context, request UpdatePaymentRequest) (UpdatePaymentResponse, error)
GetPayment(ctx context.Context, request GetPaymentRequest) (GetPaymentResponse, error)
StartProcessingPayments()
StartConsumingPayments()
}
func NewService ¶
func NewService(redisStore datastore.RedisStore) Service
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"`
}
Click to show internal directories.
Click to hide internal directories.