Documentation
¶
Overview ¶
Package mock provides a mock payment provider for testing.
Index ¶
- type Provider
- func (p *Provider) AddSubscriptionItem(ctx context.Context, subscriptionID string, priceID string, quantity int) (string, error)
- func (p *Provider) AttachPaymentMethod(ctx context.Context, customerID, paymentMethodID string) error
- func (p *Provider) CancelSubscription(ctx context.Context, subscriptionID string, immediate bool) error
- func (p *Provider) CreateCheckoutSession(ctx context.Context, req *types.CheckoutRequest) (*types.CheckoutSession, error)
- func (p *Provider) CreateCustomer(ctx context.Context, email, name string, metadata map[string]interface{}) (string, error)
- func (p *Provider) CreatePortalSession(ctx context.Context, customerID, returnURL string) (string, error)
- func (p *Provider) CreateSetupIntent(ctx context.Context, customerID string) (*core.SetupIntentResult, error)
- func (p *Provider) CreateSubscription(ctx context.Context, customerID, priceID string, quantity, trialDays int, ...) (string, error)
- func (p *Provider) DeleteCustomer(ctx context.Context, customerID string) error
- func (p *Provider) DeleteProviderFeature(ctx context.Context, featureID string) error
- func (p *Provider) DetachPaymentMethod(ctx context.Context, paymentMethodID string) error
- func (p *Provider) GetInvoice(ctx context.Context, invoiceID string) (*types.ProviderInvoice, error)
- func (p *Provider) GetInvoicePDF(ctx context.Context, invoiceID string) (string, error)
- func (p *Provider) GetPaymentMethod(ctx context.Context, paymentMethodID string) (*core.PaymentMethod, error)
- func (p *Provider) GetProduct(ctx context.Context, productID string) (*types.ProviderProduct, error)
- func (p *Provider) GetProviderFeature(ctx context.Context, featureID string) (*types.ProviderFeature, error)
- func (p *Provider) GetSubscription(ctx context.Context, subscriptionID string) (*types.ProviderSubscription, error)
- func (p *Provider) HandleWebhook(ctx context.Context, payload []byte, signature string) (*types.WebhookEvent, error)
- func (p *Provider) ListInvoices(ctx context.Context, customerID string, limit int) ([]*types.ProviderInvoice, error)
- func (p *Provider) ListPrices(ctx context.Context, productID string) ([]*types.ProviderPrice, error)
- func (p *Provider) ListProducts(ctx context.Context) ([]*types.ProviderProduct, error)
- func (p *Provider) ListProviderFeatures(ctx context.Context, productID string) ([]*types.ProviderFeature, error)
- func (p *Provider) ListSubscriptionInvoices(ctx context.Context, subscriptionID string, limit int) ([]*types.ProviderInvoice, error)
- func (p *Provider) Name() string
- func (p *Provider) PauseSubscription(ctx context.Context, subscriptionID string) error
- func (p *Provider) RemoveSubscriptionItem(ctx context.Context, subscriptionID string, itemID string) error
- func (p *Provider) ReportUsage(ctx context.Context, subscriptionItemID string, records []*core.UsageRecord) (string, error)
- func (p *Provider) ResumeSubscription(ctx context.Context, subscriptionID string) error
- func (p *Provider) SetDefaultPaymentMethod(ctx context.Context, customerID, paymentMethodID string) error
- func (p *Provider) SyncAddOn(ctx context.Context, addon *core.AddOn) error
- func (p *Provider) SyncFeature(ctx context.Context, feature *core.Feature) (string, error)
- func (p *Provider) SyncPlan(ctx context.Context, plan *core.Plan) error
- func (p *Provider) UpdateCustomer(ctx context.Context, customerID, email, name string, ...) error
- func (p *Provider) UpdateSubscription(ctx context.Context, subscriptionID, priceID string, quantity int) error
- func (p *Provider) UpdateSubscriptionItem(ctx context.Context, subscriptionID string, itemID string, quantity int) error
- func (p *Provider) VoidInvoice(ctx context.Context, invoiceID string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider implements a mock payment provider for testing
func (*Provider) AddSubscriptionItem ¶ added in v0.0.5
func (p *Provider) AddSubscriptionItem(ctx context.Context, subscriptionID string, priceID string, quantity int) (string, error)
AddSubscriptionItem adds an item to a subscription
func (*Provider) AttachPaymentMethod ¶
func (*Provider) CancelSubscription ¶
func (*Provider) CreateCheckoutSession ¶
func (p *Provider) CreateCheckoutSession(ctx context.Context, req *types.CheckoutRequest) (*types.CheckoutSession, error)
func (*Provider) CreateCustomer ¶
func (*Provider) CreatePortalSession ¶
func (*Provider) CreateSetupIntent ¶
func (*Provider) CreateSubscription ¶
func (*Provider) DeleteCustomer ¶
func (*Provider) DeleteProviderFeature ¶ added in v0.0.5
DeleteProviderFeature deletes a feature from the mock provider
func (*Provider) DetachPaymentMethod ¶
func (*Provider) GetInvoice ¶
func (*Provider) GetInvoicePDF ¶
func (*Provider) GetPaymentMethod ¶
func (*Provider) GetProduct ¶
func (*Provider) GetProviderFeature ¶ added in v0.0.5
func (p *Provider) GetProviderFeature(ctx context.Context, featureID string) (*types.ProviderFeature, error)
GetProviderFeature gets a specific feature from the mock provider
func (*Provider) GetSubscription ¶
func (*Provider) HandleWebhook ¶
func (*Provider) ListInvoices ¶ added in v0.0.5
func (p *Provider) ListInvoices(ctx context.Context, customerID string, limit int) ([]*types.ProviderInvoice, error)
ListInvoices lists invoices for a customer
func (*Provider) ListPrices ¶
func (*Provider) ListProducts ¶
func (*Provider) ListProviderFeatures ¶ added in v0.0.5
func (p *Provider) ListProviderFeatures(ctx context.Context, productID string) ([]*types.ProviderFeature, error)
ListProviderFeatures lists all features from the mock provider
func (*Provider) ListSubscriptionInvoices ¶ added in v0.0.5
func (p *Provider) ListSubscriptionInvoices(ctx context.Context, subscriptionID string, limit int) ([]*types.ProviderInvoice, error)
ListSubscriptionInvoices lists invoices for a subscription
func (*Provider) PauseSubscription ¶
func (*Provider) RemoveSubscriptionItem ¶ added in v0.0.5
func (p *Provider) RemoveSubscriptionItem(ctx context.Context, subscriptionID string, itemID string) error
RemoveSubscriptionItem removes an item from a subscription
func (*Provider) ReportUsage ¶
func (*Provider) ResumeSubscription ¶
func (*Provider) SetDefaultPaymentMethod ¶
func (*Provider) SyncFeature ¶ added in v0.0.5
SyncFeature syncs a feature to the mock provider
func (*Provider) UpdateCustomer ¶
func (*Provider) UpdateSubscription ¶
Click to show internal directories.
Click to hide internal directories.