27 lines
943 B
Go
27 lines
943 B
Go
package card
|
|
|
|
import "context"
|
|
|
|
// CardInfo holds bank card details for Stripe payments.
|
|
type CardInfo struct {
|
|
Number string // Card number
|
|
ExpMonth string // Expiration month MM
|
|
ExpYear string // Expiration year YYYY
|
|
CVC string // CVC code
|
|
Name string // Cardholder name (optional)
|
|
Country string // Country code e.g. JP, US
|
|
Currency string // Currency e.g. JPY, USD
|
|
Address string // Street address (optional)
|
|
City string // City (optional)
|
|
State string // State/province (optional)
|
|
PostalCode string // Postal/ZIP code (optional)
|
|
}
|
|
|
|
// CardProvider is the pluggable interface for bank card sources.
|
|
type CardProvider interface {
|
|
// GetCard returns an available card for payment.
|
|
GetCard(ctx context.Context) (*CardInfo, error)
|
|
// ReportResult reports the usage outcome so the provider can manage its card pool.
|
|
ReportResult(ctx context.Context, card *CardInfo, success bool) error
|
|
}
|