mock

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package mock provides a mock payment provider for testing.

Index

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 NewMockProvider

func NewMockProvider() *Provider

NewMockProvider creates a new mock provider

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 (p *Provider) AttachPaymentMethod(ctx context.Context, customerID, paymentMethodID string) error

func (*Provider) CancelSubscription

func (p *Provider) CancelSubscription(ctx context.Context, subscriptionID string, immediate bool) error

func (*Provider) CreateCheckoutSession

func (p *Provider) CreateCheckoutSession(ctx context.Context, req *types.CheckoutRequest) (*types.CheckoutSession, error)

func (*Provider) CreateCustomer

func (p *Provider) CreateCustomer(ctx context.Context, email, name string, metadata map[string]interface{}) (string, error)

func (*Provider) CreatePortalSession

func (p *Provider) CreatePortalSession(ctx context.Context, customerID, returnURL string) (string, error)

func (*Provider) CreateSetupIntent

func (p *Provider) CreateSetupIntent(ctx context.Context, customerID string) (*core.SetupIntentResult, error)

func (*Provider) CreateSubscription

func (p *Provider) CreateSubscription(ctx context.Context, customerID, priceID string, quantity, trialDays int, metadata map[string]interface{}) (string, error)

func (*Provider) DeleteCustomer

func (p *Provider) DeleteCustomer(ctx context.Context, customerID string) error

func (*Provider) DeleteProviderFeature added in v0.0.5

func (p *Provider) DeleteProviderFeature(ctx context.Context, featureID string) error

DeleteProviderFeature deletes a feature from the mock provider

func (*Provider) DetachPaymentMethod

func (p *Provider) DetachPaymentMethod(ctx context.Context, paymentMethodID string) error

func (*Provider) GetInvoice

func (p *Provider) GetInvoice(ctx context.Context, invoiceID string) (*types.ProviderInvoice, error)

func (*Provider) GetInvoicePDF

func (p *Provider) GetInvoicePDF(ctx context.Context, invoiceID string) (string, error)

func (*Provider) GetPaymentMethod

func (p *Provider) GetPaymentMethod(ctx context.Context, paymentMethodID string) (*core.PaymentMethod, error)

func (*Provider) GetProduct

func (p *Provider) GetProduct(ctx context.Context, productID string) (*types.ProviderProduct, error)

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 (p *Provider) GetSubscription(ctx context.Context, subscriptionID string) (*types.ProviderSubscription, error)

func (*Provider) HandleWebhook

func (p *Provider) HandleWebhook(ctx context.Context, payload []byte, signature string) (*types.WebhookEvent, error)

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 (p *Provider) ListPrices(ctx context.Context, productID string) ([]*types.ProviderPrice, error)

func (*Provider) ListProducts

func (p *Provider) ListProducts(ctx context.Context) ([]*types.ProviderProduct, error)

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) Name

func (p *Provider) Name() string

func (*Provider) PauseSubscription

func (p *Provider) PauseSubscription(ctx context.Context, subscriptionID string) error

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 (p *Provider) ReportUsage(ctx context.Context, subscriptionItemID string, records []*core.UsageRecord) (string, error)

func (*Provider) ResumeSubscription

func (p *Provider) ResumeSubscription(ctx context.Context, subscriptionID string) error

func (*Provider) SetDefaultPaymentMethod

func (p *Provider) SetDefaultPaymentMethod(ctx context.Context, customerID, paymentMethodID string) error

func (*Provider) SyncAddOn

func (p *Provider) SyncAddOn(ctx context.Context, addon *core.AddOn) error

func (*Provider) SyncFeature added in v0.0.5

func (p *Provider) SyncFeature(ctx context.Context, feature *core.Feature) (string, error)

SyncFeature syncs a feature to the mock provider

func (*Provider) SyncPlan

func (p *Provider) SyncPlan(ctx context.Context, plan *core.Plan) error

func (*Provider) UpdateCustomer

func (p *Provider) UpdateCustomer(ctx context.Context, customerID, email, name string, metadata map[string]interface{}) error

func (*Provider) UpdateSubscription

func (p *Provider) UpdateSubscription(ctx context.Context, subscriptionID, priceID string, quantity int) error

func (*Provider) UpdateSubscriptionItem added in v0.0.5

func (p *Provider) UpdateSubscriptionItem(ctx context.Context, subscriptionID string, itemID string, quantity int) error

UpdateSubscriptionItem updates the quantity of a subscription item

func (*Provider) VoidInvoice

func (p *Provider) VoidInvoice(ctx context.Context, invoiceID string) error

Jump to

Keyboard shortcuts

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