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 PaymentStatus ¶
type PaymentStatus string
const ( PaymentStatusPaid PaymentStatus = "paid" PaymentStatusPending PaymentStatus = "pending" PaymentStatusFailed PaymentStatus = "failed" )
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() }
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.