billing

package
v0.4.73 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func New

func New(
	client *stripeapiclient.API,
	cfg *Config,
) *Client

func (*Client) GetSubscriptions

func (c *Client) GetSubscriptions(customerId string) SubscriptionIter

func (*Client) NewBillingPortalSession

func (c *Client) NewBillingPortalSession(customerId, accountSlug string) (*stripe.BillingPortalSession, error)

func (*Client) NewCheckoutSession

func (c *Client) NewCheckoutSession(customerId, accountSlug, userId string, logger *slog.Logger) (*stripe.CheckoutSession, error)

func (*Client) NewCustomer

func (c *Client) NewCustomer(req *CustomerRequest) (*stripe.Customer, error)

func (*Client) NewMeterEvent added in v0.4.71

func (c *Client) NewMeterEvent(req *MeterEventRequest) (*stripe.BillingMeterEvent, error)

type Config

type Config struct {
	AppBaseUrl   string
	PriceLookups PriceQuantity
}

type CustomerRequest

type CustomerRequest struct {
	Email     string
	Name      string
	AccountId string
	UserId    string
}

type Interface

type Interface interface {
	NewCustomer(req *CustomerRequest) (*stripe.Customer, error)
	NewBillingPortalSession(customerId, accountSlug string) (*stripe.BillingPortalSession, error)
	NewCheckoutSession(customerId, accountSlug, userId string, logger *slog.Logger) (*stripe.CheckoutSession, error)
	GetSubscriptions(customerId string) SubscriptionIter
	NewMeterEvent(req *MeterEventRequest) (*stripe.BillingMeterEvent, error)
}

type MeterEventRequest added in v0.4.71

type MeterEventRequest struct {
	EventName  string
	Identifier string
	Timestamp  *int64
	CustomerId string
	Value      string
}

type MockInterface

type MockInterface struct {
	mock.Mock
}

MockInterface is an autogenerated mock type for the Interface type

func NewMockInterface

func NewMockInterface(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockInterface

NewMockInterface creates a new instance of MockInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockInterface) EXPECT

func (_m *MockInterface) EXPECT() *MockInterface_Expecter

func (*MockInterface) GetSubscriptions

func (_m *MockInterface) GetSubscriptions(customerId string) SubscriptionIter

GetSubscriptions provides a mock function with given fields: customerId

func (*MockInterface) NewBillingPortalSession

func (_m *MockInterface) NewBillingPortalSession(customerId string, accountSlug string) (*stripe.BillingPortalSession, error)

NewBillingPortalSession provides a mock function with given fields: customerId, accountSlug

func (*MockInterface) NewCheckoutSession

func (_m *MockInterface) NewCheckoutSession(customerId string, accountSlug string, userId string, logger *slog.Logger) (*stripe.CheckoutSession, error)

NewCheckoutSession provides a mock function with given fields: customerId, accountSlug, userId, logger

func (*MockInterface) NewCustomer

func (_m *MockInterface) NewCustomer(req *CustomerRequest) (*stripe.Customer, error)

NewCustomer provides a mock function with given fields: req

func (*MockInterface) NewMeterEvent added in v0.4.71

func (_m *MockInterface) NewMeterEvent(req *MeterEventRequest) (*stripe.BillingMeterEvent, error)

NewMeterEvent provides a mock function with given fields: req

type MockInterface_Expecter

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

func (*MockInterface_Expecter) GetSubscriptions

func (_e *MockInterface_Expecter) GetSubscriptions(customerId interface{}) *MockInterface_GetSubscriptions_Call

GetSubscriptions is a helper method to define mock.On call

  • customerId string

func (*MockInterface_Expecter) NewBillingPortalSession

func (_e *MockInterface_Expecter) NewBillingPortalSession(customerId interface{}, accountSlug interface{}) *MockInterface_NewBillingPortalSession_Call

NewBillingPortalSession is a helper method to define mock.On call

  • customerId string
  • accountSlug string

func (*MockInterface_Expecter) NewCheckoutSession

func (_e *MockInterface_Expecter) NewCheckoutSession(customerId interface{}, accountSlug interface{}, userId interface{}, logger interface{}) *MockInterface_NewCheckoutSession_Call

NewCheckoutSession is a helper method to define mock.On call

  • customerId string
  • accountSlug string
  • userId string
  • logger *slog.Logger

func (*MockInterface_Expecter) NewCustomer

func (_e *MockInterface_Expecter) NewCustomer(req interface{}) *MockInterface_NewCustomer_Call

NewCustomer is a helper method to define mock.On call

  • req *CustomerRequest

func (*MockInterface_Expecter) NewMeterEvent added in v0.4.71

func (_e *MockInterface_Expecter) NewMeterEvent(req interface{}) *MockInterface_NewMeterEvent_Call

NewMeterEvent is a helper method to define mock.On call

  • req *MeterEventRequest

type MockInterface_GetSubscriptions_Call

type MockInterface_GetSubscriptions_Call struct {
	*mock.Call
}

MockInterface_GetSubscriptions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSubscriptions'

func (*MockInterface_GetSubscriptions_Call) Return

func (*MockInterface_GetSubscriptions_Call) Run

func (*MockInterface_GetSubscriptions_Call) RunAndReturn

type MockInterface_NewBillingPortalSession_Call

type MockInterface_NewBillingPortalSession_Call struct {
	*mock.Call
}

MockInterface_NewBillingPortalSession_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewBillingPortalSession'

func (*MockInterface_NewBillingPortalSession_Call) Return

func (*MockInterface_NewBillingPortalSession_Call) Run

func (*MockInterface_NewBillingPortalSession_Call) RunAndReturn

type MockInterface_NewCheckoutSession_Call

type MockInterface_NewCheckoutSession_Call struct {
	*mock.Call
}

MockInterface_NewCheckoutSession_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewCheckoutSession'

func (*MockInterface_NewCheckoutSession_Call) Return

func (*MockInterface_NewCheckoutSession_Call) Run

func (_c *MockInterface_NewCheckoutSession_Call) Run(run func(customerId string, accountSlug string, userId string, logger *slog.Logger)) *MockInterface_NewCheckoutSession_Call

func (*MockInterface_NewCheckoutSession_Call) RunAndReturn

type MockInterface_NewCustomer_Call

type MockInterface_NewCustomer_Call struct {
	*mock.Call
}

MockInterface_NewCustomer_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewCustomer'

func (*MockInterface_NewCustomer_Call) Return

func (*MockInterface_NewCustomer_Call) Run

func (*MockInterface_NewCustomer_Call) RunAndReturn

type MockInterface_NewMeterEvent_Call added in v0.4.71

type MockInterface_NewMeterEvent_Call struct {
	*mock.Call
}

MockInterface_NewMeterEvent_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewMeterEvent'

func (*MockInterface_NewMeterEvent_Call) Return added in v0.4.71

func (*MockInterface_NewMeterEvent_Call) Run added in v0.4.71

func (*MockInterface_NewMeterEvent_Call) RunAndReturn added in v0.4.71

type PriceQuantity

type PriceQuantity map[string]int

type SubscriptionIter

type SubscriptionIter interface {
	Subscription() *stripe.Subscription
	Next() bool
	Err() error
}

Jump to

Keyboard shortcuts

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