Documentation
¶
Index ¶
- Constants
- Variables
- type Checkout
- type CreditService
- type CustomerService
- type Filter
- type OrganizationService
- type PlanService
- type ProductService
- type Repository
- type Service
- func (s *Service) Apply(ctx context.Context, ch Checkout) (*subscription.Subscription, *product.Product, error)
- func (s *Service) Close() error
- func (s *Service) Create(ctx context.Context, ch Checkout) (Checkout, error)
- func (s *Service) CreateSessionForPaymentMethod(ctx context.Context, ch Checkout) (Checkout, error)
- func (s *Service) GetByID(ctx context.Context, id string) (Checkout, error)
- func (s *Service) Init(ctx context.Context)
- func (s *Service) List(ctx context.Context, filter Filter) ([]Checkout, error)
- func (s *Service) SyncWithProvider(ctx context.Context, customerID string) error
- type State
- type SubscriptionService
Constants ¶
View Source
const ( SessionValidity = time.Hour * 24 SyncDelay = time.Second * 60 AmountSubscriptionMetadataKey = "amount_total" CurrencySubscriptionMetadataKey = "currency" ProviderIDSubscriptionMetadataKey = "provider_subscription_id" )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Checkout ¶
type Checkout struct {
ID string
ProviderID string // identifier set by the billing engine provider
CustomerID string
PlanID string // uuid of plan if resource type is subscription
ProductID string
// CancelUrl is the URL to which provider sends customers when payment is canceled
CancelUrl string
// SuccessUrl is the URL to which provider sends customers when payment is complete
SuccessUrl string
// CheckoutUrl is the URL to which provider sends customers to finish payment
CheckoutUrl string
State string
PaymentStatus string
Metadata metadata.Metadata
CreatedAt time.Time
UpdatedAt time.Time
ExpireAt time.Time
}
type CreditService ¶
type CustomerService ¶
type OrganizationService ¶ added in v0.8.13
type PlanService ¶
type ProductService ¶ added in v0.8.14
type Repository ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(stripeClient *client.API, stripeAutoTax bool, repository Repository, customerService CustomerService, planService PlanService, subscriptionService SubscriptionService, productService ProductService, creditService CreditService, orgService OrganizationService) *Service
func (*Service) Apply ¶ added in v0.8.16
func (s *Service) Apply(ctx context.Context, ch Checkout) (*subscription.Subscription, *product.Product, error)
Apply applies the actual request directly without creating a checkout session for example when a request is created for a plan, it will be directly subscribe without actually paying for it
func (*Service) CreateSessionForPaymentMethod ¶ added in v0.8.16
type SubscriptionService ¶
type SubscriptionService interface {
List(ctx context.Context, filter subscription.Filter) ([]subscription.Subscription, error)
Create(ctx context.Context, sub subscription.Subscription) (subscription.Subscription, error)
GetByProviderID(ctx context.Context, id string) (subscription.Subscription, error)
}
Click to show internal directories.
Click to hide internal directories.