payment

package
v0.50.4 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Customer

type Customer struct {
	ID                 string
	Name               string
	Email              string
	HasPaymentMethod   bool
	HasBillableAddress bool
}

type Provider

type Provider interface {
	CreateCustomer(ctx context.Context, organization *database.Organization) (*Customer, error)
	FindCustomer(ctx context.Context, customerID string) (*Customer, error)
	// FindCustomerForOrg Use with caution - This should only be used if we don't have payment customer ID in the org and we want to check if the customer already exists. Use FindCustomer instead if payment customer ID is available.
	// Stripe implementation for this is not optimal and list all customers around org creation time to find this customer.
	FindCustomerForOrg(ctx context.Context, organization *database.Organization) (*Customer, error)
	UpdateCustomerEmail(ctx context.Context, customerID, email string) error
	DeleteCustomer(ctx context.Context, customerID string) error
	// GetBillingPortalURL returns the payment portal URL to collect payment information from the customer.
	GetBillingPortalURL(ctx context.Context, customerID, returnURL string) (string, error)

	// WebhookHandlerFunc returns a http.HandlerFunc that can be used to handle incoming webhooks from the payment provider. Return nil if you don't want to register any webhook handlers. jobs is used to enqueue jobs for processing the webhook events.
	WebhookHandlerFunc(ctx context.Context, jobs jobs.Client) httputil.Handler
}

func NewNoop

func NewNoop() Provider

type Stripe

type Stripe struct {
	// contains filtered or unexported fields
}

func NewStripe

func NewStripe(logger *zap.Logger, stripeKey, stripeWebhookSecret string) *Stripe

func (*Stripe) CreateCustomer

func (s *Stripe) CreateCustomer(ctx context.Context, organization *database.Organization) (*Customer, error)

func (*Stripe) DeleteCustomer

func (s *Stripe) DeleteCustomer(ctx context.Context, customerID string) error

func (*Stripe) FindCustomer

func (s *Stripe) FindCustomer(ctx context.Context, customerID string) (*Customer, error)

func (*Stripe) FindCustomerForOrg

func (s *Stripe) FindCustomerForOrg(ctx context.Context, organization *database.Organization) (*Customer, error)

func (*Stripe) GetBillingPortalURL

func (s *Stripe) GetBillingPortalURL(ctx context.Context, customerID, returnURL string) (string, error)

func (*Stripe) UpdateCustomerEmail added in v0.49.0

func (s *Stripe) UpdateCustomerEmail(ctx context.Context, customerID, email string) error

func (*Stripe) WebhookHandlerFunc added in v0.50.0

func (s *Stripe) WebhookHandlerFunc(ctx context.Context, jc jobs.Client) httputil.Handler

Jump to

Keyboard shortcuts

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