provider

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2025 License: MIT Imports: 3 Imported by: 0

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)
	HandleWebhook(
		ctx context.Context,
		payload []byte,
		signature string,
	) (*PaymentEvent, 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

Jump to

Keyboard shortcuts

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