payment

package
v0.48.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2024 License: Apache-2.0 Imports: 8 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
	ValidPaymentMethod 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)
	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)
}

func NewNoop

func NewNoop() Provider

type Stripe

type Stripe struct{}

func NewStripe

func NewStripe(stripeKey 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)

Jump to

Keyboard shortcuts

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