Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExchangeRateProvider ¶
type ExchangeRateProvider interface {
// GetRate fetches the current exchange rate for a currency pair.
GetRate(from, to string) (*domain.ExchangeRate, error)
// GetRates fetches multiple exchange rates in a single request.
GetRates(from string, to []string) (map[string]*domain.ExchangeRate, error)
// Name returns the provider's name for logging and identification.
Name() string
// IsHealthy checks if the provider is currently available.
IsHealthy() bool
}
ExchangeRateProvider defines the interface for external exchange rate providers.
type GetPaymentStatusParams ¶
type GetPaymentStatusParams struct {
PaymentID string
}
GetPaymentStatusParams holds the parameters for the GetPaymentStatus method.
type InitiatePaymentParams ¶
type InitiatePaymentParams struct {
UserID uuid.UUID
AccountID uuid.UUID
TransactionID uuid.UUID
Amount int64
Currency string
}
InitiatePaymentParams holds the parameters for the InitiatePayment method.
type InitiatePaymentResponse ¶
type InitiatePaymentResponse struct {
Status PaymentStatus
// PaymentID is the ID of the payment in the payment provider
// (e.g., Stripe Checkout Session ID)
PaymentID string
}
type PaymentEvent ¶
type PaymentEvent struct {
ID string
Status PaymentStatus
Amount int64
Currency string
UserID uuid.UUID
AccountID uuid.UUID
Metadata map[string]string
}
PaymentEvent represents a payment event from Stripe.
type PaymentProvider ¶
type PaymentProvider interface {
InitiatePayment(
ctx context.Context,
params *InitiatePaymentParams,
) (*InitiatePaymentResponse, error)
GetPaymentStatus(
ctx context.Context,
params *GetPaymentStatusParams,
) (PaymentStatus, error)
HandleWebhook(
payload []byte,
signature string,
) (*PaymentEvent, error)
UpdatePaymentStatus(ctx context.Context, i *UpdatePaymentStatusParams) error
}
PaymentProvider is a interface for payment provider
type PaymentStatus ¶
type PaymentStatus string
PaymentStatus represents the status of a payment in the mock provider.
const ( // PaymentPending indicates the payment is still pending. PaymentPending PaymentStatus = "pending" // PaymentCompleted indicates the payment has completed successfully. PaymentCompleted PaymentStatus = "completed" // PaymentFailed indicates the payment has failed. PaymentFailed PaymentStatus = "failed" )
type UpdatePaymentStatusParams ¶
type UpdatePaymentStatusParams struct {
TransactionID uuid.UUID
PaymentID string
Status PaymentStatus
}
UpdatePaymentStatusParams holds the parameters for updating a payment status
Click to show internal directories.
Click to hide internal directories.