Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Payment ¶
type Payment struct {
ID string `json:"id"`
IdempotencyKey string `json:"idempotency_key"`
DestinationType types.PaymentDestinationType `json:"destination_type"`
DestinationID string `json:"destination_id"`
PaymentMethodType types.PaymentMethodType `json:"payment_method_type"`
PaymentMethodID string `json:"payment_method_id"`
PaymentGateway *string `json:"payment_gateway,omitempty"`
GatewayPaymentID *string `json:"gateway_payment_id,omitempty"`
Amount decimal.Decimal `json:"amount"`
Currency string `json:"currency"`
PaymentStatus types.PaymentStatus `json:"payment_status"`
TrackAttempts bool `json:"track_attempts"`
Metadata types.Metadata `json:"metadata,omitempty"`
SucceededAt *time.Time `json:"succeeded_at,omitempty"`
FailedAt *time.Time `json:"failed_at,omitempty"`
RefundedAt *time.Time `json:"refunded_at,omitempty"`
ErrorMessage *string `json:"error_message,omitempty"`
Attempts []*PaymentAttempt `json:"attempts,omitempty"`
EnvironmentID string `json:"environment_id"`
types.BaseModel
}
Payment represents a payment transaction
func FromEntList ¶
FromEntList converts a list of Ent payments to domain payments
type PaymentAttempt ¶
type PaymentAttempt struct {
ID string `json:"id"`
PaymentID string `json:"payment_id"`
AttemptNumber int `json:"attempt_number"`
PaymentStatus types.PaymentStatus `json:"payment_status"`
GatewayAttemptID *string `json:"gateway_attempt_id,omitempty"`
ErrorMessage *string `json:"error_message,omitempty"`
Metadata types.Metadata `json:"metadata,omitempty"`
EnvironmentID string `json:"environment_id"`
types.BaseModel
}
PaymentAttempt represents an attempt to process a payment
func FromEntAttempt ¶
func FromEntAttempt(a *ent.PaymentAttempt) *PaymentAttempt
FromEntAttempt converts an Ent payment attempt to a domain payment attempt
func FromEntAttemptList ¶
func FromEntAttemptList(attempts []*ent.PaymentAttempt) []*PaymentAttempt
FromEntAttemptList converts a list of Ent payment attempts to domain payment attempts
func (*PaymentAttempt) TableName ¶
func (pa *PaymentAttempt) TableName() string
TableName returns the table name for the payment attempt
func (*PaymentAttempt) Validate ¶
func (pa *PaymentAttempt) Validate() error
Validate validates the payment attempt
type Repository ¶
type Repository interface {
// Payment operations
Create(ctx context.Context, payment *Payment) error
Get(ctx context.Context, id string) (*Payment, error)
Update(ctx context.Context, payment *Payment) error
Delete(ctx context.Context, id string) error
List(ctx context.Context, filter *types.PaymentFilter) ([]*Payment, error)
Count(ctx context.Context, filter *types.PaymentFilter) (int, error)
GetByIdempotencyKey(ctx context.Context, key string) (*Payment, error)
// Payment attempt operations
CreateAttempt(ctx context.Context, attempt *PaymentAttempt) error
GetAttempt(ctx context.Context, id string) (*PaymentAttempt, error)
UpdateAttempt(ctx context.Context, attempt *PaymentAttempt) error
ListAttempts(ctx context.Context, paymentID string) ([]*PaymentAttempt, error)
GetLatestAttempt(ctx context.Context, paymentID string) (*PaymentAttempt, error)
}
Repository defines the interface for payment persistence
Click to show internal directories.
Click to hide internal directories.