Documentation
¶
Index ¶
- Variables
- func BoolPointer(v bool) *bool
- func CountTotalInvoices(subscriptionID string) (int64, error)
- func GetCustomerByID(ctx context.Context, customerID string) (customerDetails *stripe.Customer, err error)
- func IsValidEmail(email string) bool
- type AddSeatReply
- type AddSeatRequest
- type Address
- type BillingAddressReply
- type BillingAddressRequest
- type BillingPortalReply
- type CancelStateReply
- type ChangePaymentReply
- type CheckoutCreateSubscriptionReply
- type CheckoutCreateSubscriptionRequest
- type CheckoutProductReply
- type CheckoutProductRequest
- type CheckoutSetupIntentReply
- type CheckoutSetupIntentRequest
- type DeleteSeatReply
- type DeleteSeatRequest
- type Invoice
- type ListInvoicesReply
- type ListInvoicesRequest
- type ListSeatReply
- type ListSeatRequest
- type PaymentHandler
- func (paymentHandler *PaymentHandler) CancelSubscription(c context.Context, tokenDetails firebasemanager.TokenDetails, ...) (SubscriptionCancelReply, error)
- func (paymentHandler *PaymentHandler) ChangeCustomerAddress(c context.Context, setupIntent stripe.SetupIntent) error
- func (paymentHandler *PaymentHandler) ChangePaymentDefault(c context.Context, setupIntent stripe.SetupIntent) error
- func (paymentHandler *PaymentHandler) CreateCheckoutSetupIntent(c context.Context, tokenDetails firebasemanager.TokenDetails, ...) (CheckoutSetupIntentReply, error)
- func (paymentHandler *PaymentHandler) CreateCheckoutSubscription(c context.Context, tokenDetails firebasemanager.TokenDetails, ...) (CheckoutCreateSubscriptionReply, error)
- func (paymentHandler *PaymentHandler) GetBillingAddress(c context.Context, tokenDetails firebasemanager.TokenDetails, ...) (BillingAddressReply, error)
- func (paymentHandler *PaymentHandler) GetBillingPortal(c context.Context, tokenDetails firebasemanager.TokenDetails) (billingPortalModel BillingPortalReply, err error)
- func (paymentHandler *PaymentHandler) GetCancelState(c context.Context, tokenDetails firebasemanager.TokenDetails, ...) (CancelStateReply, error)
- func (paymentHandler *PaymentHandler) GetChangePaymentSetupIntent(c context.Context, tokenDetails firebasemanager.TokenDetails) (ChangePaymentReply, error)
- func (paymentHandler *PaymentHandler) GetCheckoutProduct(c context.Context, tokenDetails firebasemanager.TokenDetails, ...) (CheckoutProductReply, error)
- func (paymentHandler *PaymentHandler) GetCustomerByUID(ctx context.Context, uid string) (customerDetails *stripe.Customer, err error)
- func (paymentHandler *PaymentHandler) GetCustomerIDByUID(ctx context.Context, uid string) (string, error)
- func (paymentHandler *PaymentHandler) GetMyPermission(c context.Context, tokenDetails firebasemanager.TokenDetails, ...) (PermissionReply, error)
- func (paymentHandler *PaymentHandler) GetPaymentMethodOverview(c context.Context, tokenDetails firebasemanager.TokenDetails) (PaymentMethodOverviewReply, error)
- func (paymentHandler *PaymentHandler) GetProductTiers(c context.Context, prodType ProductType) (ProductTiersReply, error)
- func (paymentHandler *PaymentHandler) GetSubscriptionAddSeat(c context.Context, tokenDetails firebasemanager.TokenDetails, ...) (AddSeatReply, error)
- func (paymentHandler *PaymentHandler) GetSubscriptionDetailByID(c context.Context, tokenDetails firebasemanager.TokenDetails, ...) (SubscriptionDetailReply, error)
- func (paymentHandler *PaymentHandler) GetSubscriptionInvoices(c context.Context, tokenDetails firebasemanager.TokenDetails, ...) (ListInvoicesReply, error)
- func (paymentHandler *PaymentHandler) GetSubscriptionListSeats(c context.Context, tokenDetails firebasemanager.TokenDetails, ...) (ListSeatReply, error)
- func (paymentHandler *PaymentHandler) GetSubscriptionRemoveSeat(c context.Context, tokenDetails firebasemanager.TokenDetails, ...) (DeleteSeatReply, error)
- func (paymentHandler *PaymentHandler) GetSubscriptionSeatDetail(c context.Context, tokenDetails firebasemanager.TokenDetails, ...) (SeatDetailReply, error)
- func (paymentHandler *PaymentHandler) GetSubscriptionUpdateSeat(c context.Context, tokenDetails firebasemanager.TokenDetails, ...) (UpdateSeatDetailReply, error)
- func (paymentHandler *PaymentHandler) GetSubscriptionsOverview(c context.Context, tokenDetails firebasemanager.TokenDetails) (subscriptionOverview []SubscriptionOverviewReply, err error)
- func (paymentHandler *PaymentHandler) ResumeSubscription(c context.Context, tokenDetails firebasemanager.TokenDetails, ...) (SubscriptionResumeReply, error)
- func (paymentHandler *PaymentHandler) UpdateBillingAddress(c context.Context, tokenDetails firebasemanager.TokenDetails, ...) (UpdateBillingAddressReply, error)
- type PaymentMethodOverviewCard
- type PaymentMethodOverviewPayPal
- type PaymentMethodOverviewReply
- type PaymentMethodOverviewSEPADebit
- type PermissionReply
- type PermissionRequest
- type ProductTier
- type ProductTiersReply
- type ProductTiersRequest
- type ProductType
- type SeatDetailReply
- type SeatDetailRequest
- type SetupIntentMeta
- type StripeConnection
- func (stripeConnection *StripeConnection) CreateCustomer(ctx context.Context, email string) (*stripe.Customer, error)
- func (stripeConnection *StripeConnection) GetDefaultPaymentMethod(c context.Context, cus *stripe.Customer) (*stripe.PaymentMethod, error)
- func (stripeConnection *StripeConnection) GetPaymentMethod(c context.Context, paymentMethodID string) (*stripe.PaymentMethod, error)
- func (stripeConnection *StripeConnection) GetPrice(c context.Context, productID string) (*stripe.Price, error)
- func (stripeConnection *StripeConnection) GetProduct(c context.Context, productID string) (*stripe.Product, error)
- func (stripeConnection *StripeConnection) GetSubscriptionByID(c context.Context, subscriptionID string) (*stripe.Subscription, error)
- type SubscriptionCancelReply
- type SubscriptionCancelRequest
- type SubscriptionDetailReply
- type SubscriptionOverviewReply
- type SubscriptionResumeReply
- type SubscriptionResumeRequest
- type UpdateBillingAddressReply
- type UpdateBillingAddressRequest
- type UpdateSeatDetailReply
- type UpdateSeatDetailRequest
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrDefaultPaymentMethodNotFound = errors.New("DefaultPaymentMethod not found")
Functions ¶
func BoolPointer ¶
func CountTotalInvoices ¶
func GetCustomerByID ¶
func IsValidEmail ¶
Types ¶
type AddSeatReply ¶
type AddSeatRequest ¶
type AddSeatRequest struct {
SubscriptionID string `json:"subscriptionID" validate:"required"`
EMail string `json:"email" validate:"required"`
Roles []mongomanager.Role `json:"roles" validate:"required"`
}
type BillingAddressReply ¶
type BillingAddressRequest ¶
type BillingAddressRequest struct {
SubscriptionID string `json:"subscriptionID" validate:"required"`
}
type BillingPortalReply ¶
type BillingPortalReply struct {
URL string `json:"url" validate:"required"`
}
type CancelStateReply ¶
type ChangePaymentReply ¶
type CheckoutCreateSubscriptionReply ¶
type CheckoutCreateSubscriptionReply struct {
Status string `json:"status" validate:"required"`
SubscriptionID string `json:"subscriptionID" validate:"required"`
ProductName string `json:"productName" validate:"required"`
EMail string `json:"email" validate:"required"`
TrialEnd int64 `json:"trialEnd" validate:"gte=0"`
}
type CheckoutProductReply ¶
type CheckoutProductReply struct {
ProductID string `json:"productID" validate:"required"`
Name string `json:"name" validate:"required"`
StorageAmount int64 `json:"storageAmount" validate:"required"`
StorageUnit string `json:"storageUnit" validate:"required"`
TrialDays int64 `json:"trialDays" validate:"required"`
PricePerMonth int64 `json:"pricePerMonth" validate:"required"`
Currency string `json:"currency" validate:"required"`
HasValidPaymentMethod *bool `json:"has_valid_payment_method" validate:"required"`
}
type CheckoutProductRequest ¶
type CheckoutProductRequest struct {
ProductID string `json:"productID" binding:"required"`
}
type DeleteSeatReply ¶
type DeleteSeatReply struct {
DeletedSeat mongomanager.Seat `json:"deletedSeat" validate:"required"`
Success bool `json:"success" validate:"required"`
}
type DeleteSeatRequest ¶
type DeleteSeatRequest struct {
SeatToDelete mongomanager.Seat `json:"seatToDelete" validate:"required"`
}
type Invoice ¶
type Invoice struct {
InvoiceID string `json:"invoiceID" validate:"required"`
SubscriptionID string `json:"subscriptionID" validate:"required"`
Created int64 `json:"created" validate:"required"`
Total int64 `json:"total" validate:"required"`
Currency string `json:"currency" validate:"required"`
Status stripe.InvoiceStatus `json:"status" validate:"required"`
InvoicePDF string `json:"invoice_pdf" validate:"required"`
}
type ListInvoicesReply ¶
type ListInvoicesRequest ¶
type ListSeatReply ¶
type ListSeatReply struct {
SubscriptionID string `json:"subscriptionID" validate:"required"`
MaxSeats int64 `json:"maxSeats" validate:"required"`
Seats []mongomanager.Seat `json:"seats" validate:"required"`
PageIndex int `json:"pageIndex" validate:"gte=0"`
TotalResults int64 `json:"totalResults" validate:"gte=1"`
}
type ListSeatRequest ¶
type PaymentHandler ¶
type PaymentHandler struct {
FirebaseConnection *firebasemanager.FirebaseConnection
StripeConnection *StripeConnection
MongoConnection *mongomanager.MongoConnection
EMailConnection *emailmanager.EMailConnection
NewsletterConnection *newslettermanager.NewsletterConnection
Log *zap.Logger
}
func (*PaymentHandler) CancelSubscription ¶
func (paymentHandler *PaymentHandler) CancelSubscription(c context.Context, tokenDetails firebasemanager.TokenDetails, request SubscriptionCancelRequest) (SubscriptionCancelReply, error)
func (*PaymentHandler) ChangeCustomerAddress ¶
func (paymentHandler *PaymentHandler) ChangeCustomerAddress(c context.Context, setupIntent stripe.SetupIntent) error
func (*PaymentHandler) ChangePaymentDefault ¶
func (paymentHandler *PaymentHandler) ChangePaymentDefault(c context.Context, setupIntent stripe.SetupIntent) error
func (*PaymentHandler) CreateCheckoutSetupIntent ¶
func (paymentHandler *PaymentHandler) CreateCheckoutSetupIntent(c context.Context, tokenDetails firebasemanager.TokenDetails, checkoutSetupIntentRequest CheckoutSetupIntentRequest) (CheckoutSetupIntentReply, error)
func (*PaymentHandler) CreateCheckoutSubscription ¶
func (paymentHandler *PaymentHandler) CreateCheckoutSubscription(c context.Context, tokenDetails firebasemanager.TokenDetails, checkoutCreateSubscriptionRequest CheckoutCreateSubscriptionRequest) (CheckoutCreateSubscriptionReply, error)
func (*PaymentHandler) GetBillingAddress ¶
func (paymentHandler *PaymentHandler) GetBillingAddress(c context.Context, tokenDetails firebasemanager.TokenDetails, request BillingAddressRequest) (BillingAddressReply, error)
func (*PaymentHandler) GetBillingPortal ¶
func (paymentHandler *PaymentHandler) GetBillingPortal(c context.Context, tokenDetails firebasemanager.TokenDetails) (billingPortalModel BillingPortalReply, err error)
func (*PaymentHandler) GetCancelState ¶
func (paymentHandler *PaymentHandler) GetCancelState(c context.Context, tokenDetails firebasemanager.TokenDetails, subscriptionID string) (CancelStateReply, error)
func (*PaymentHandler) GetChangePaymentSetupIntent ¶
func (paymentHandler *PaymentHandler) GetChangePaymentSetupIntent(c context.Context, tokenDetails firebasemanager.TokenDetails) (ChangePaymentReply, error)
func (*PaymentHandler) GetCheckoutProduct ¶
func (paymentHandler *PaymentHandler) GetCheckoutProduct(c context.Context, tokenDetails firebasemanager.TokenDetails, checkoutProductRequest CheckoutProductRequest) (CheckoutProductReply, error)
func (*PaymentHandler) GetCustomerByUID ¶
func (*PaymentHandler) GetCustomerIDByUID ¶
func (*PaymentHandler) GetMyPermission ¶
func (paymentHandler *PaymentHandler) GetMyPermission(c context.Context, tokenDetails firebasemanager.TokenDetails, request PermissionRequest) (PermissionReply, error)
func (*PaymentHandler) GetPaymentMethodOverview ¶
func (paymentHandler *PaymentHandler) GetPaymentMethodOverview(c context.Context, tokenDetails firebasemanager.TokenDetails) (PaymentMethodOverviewReply, error)
func (*PaymentHandler) GetProductTiers ¶
func (paymentHandler *PaymentHandler) GetProductTiers(c context.Context, prodType ProductType) (ProductTiersReply, error)
func (*PaymentHandler) GetSubscriptionAddSeat ¶
func (paymentHandler *PaymentHandler) GetSubscriptionAddSeat(c context.Context, tokenDetails firebasemanager.TokenDetails, request AddSeatRequest) (AddSeatReply, error)
func (*PaymentHandler) GetSubscriptionDetailByID ¶
func (paymentHandler *PaymentHandler) GetSubscriptionDetailByID(c context.Context, tokenDetails firebasemanager.TokenDetails, subscriptionID string) (SubscriptionDetailReply, error)
func (*PaymentHandler) GetSubscriptionInvoices ¶
func (paymentHandler *PaymentHandler) GetSubscriptionInvoices(c context.Context, tokenDetails firebasemanager.TokenDetails, request ListInvoicesRequest) (ListInvoicesReply, error)
func (*PaymentHandler) GetSubscriptionListSeats ¶
func (paymentHandler *PaymentHandler) GetSubscriptionListSeats(c context.Context, tokenDetails firebasemanager.TokenDetails, request ListSeatRequest) (ListSeatReply, error)
func (*PaymentHandler) GetSubscriptionRemoveSeat ¶
func (paymentHandler *PaymentHandler) GetSubscriptionRemoveSeat(c context.Context, tokenDetails firebasemanager.TokenDetails, request DeleteSeatRequest) (DeleteSeatReply, error)
func (*PaymentHandler) GetSubscriptionSeatDetail ¶
func (paymentHandler *PaymentHandler) GetSubscriptionSeatDetail(c context.Context, tokenDetails firebasemanager.TokenDetails, request SeatDetailRequest) (SeatDetailReply, error)
func (*PaymentHandler) GetSubscriptionUpdateSeat ¶
func (paymentHandler *PaymentHandler) GetSubscriptionUpdateSeat(c context.Context, tokenDetails firebasemanager.TokenDetails, request UpdateSeatDetailRequest) (UpdateSeatDetailReply, error)
func (*PaymentHandler) GetSubscriptionsOverview ¶
func (paymentHandler *PaymentHandler) GetSubscriptionsOverview(c context.Context, tokenDetails firebasemanager.TokenDetails) (subscriptionOverview []SubscriptionOverviewReply, err error)
func (*PaymentHandler) ResumeSubscription ¶
func (paymentHandler *PaymentHandler) ResumeSubscription(c context.Context, tokenDetails firebasemanager.TokenDetails, request SubscriptionResumeRequest) (SubscriptionResumeReply, error)
func (*PaymentHandler) UpdateBillingAddress ¶
func (paymentHandler *PaymentHandler) UpdateBillingAddress(c context.Context, tokenDetails firebasemanager.TokenDetails, request UpdateBillingAddressRequest) (UpdateBillingAddressReply, error)
type PaymentMethodOverviewPayPal ¶
type PaymentMethodOverviewPayPal struct {
Email string `json:"email"`
}
type PaymentMethodOverviewReply ¶
type PaymentMethodOverviewReply struct {
HasValidPaymentMethod *bool `json:"has_valid_payment_method" validate:"required"`
Type string `json:"type" validate:"required"`
PaymentMethodOverviewCard PaymentMethodOverviewCard `json:"card,omitempty"`
PaymentMethodOverviewSEPADebit PaymentMethodOverviewSEPADebit `json:"sepa_debit,omitempty"`
PaymentMethodOverviewPayPal PaymentMethodOverviewPayPal `json:"paypal,omitempty"`
}
type PermissionReply ¶
type PermissionReply struct {
MySeat mongomanager.Seat `json:"mySeat" validate:"required"`
}
type PermissionRequest ¶
type PermissionRequest struct {
SubscriptionID string `json:"subscriptionID" validate:"required"`
}
type ProductTier ¶
type ProductTier struct {
ProductType ProductType `json:"productType" validate:"required"`
ProductID string `json:"productID" validate:"required"`
Name string `json:"name" validate:"required"`
StorageAmount int `json:"storageAmount" validate:"required"`
StorageUnit string `json:"storageUnit" validate:"required"`
TrialDays int64 `json:"trialDays" validate:"required"`
PricePerMonth int64 `json:"pricePerMonth" validate:"required"`
}
type ProductTiersReply ¶
type ProductTiersReply struct {
ProductType ProductType `json:"productType" validate:"required"`
ProductTiers []ProductTier `json:"productTiers" validate:"required"`
}
type ProductTiersRequest ¶
type ProductTiersRequest struct {
ProductType ProductType `json:"productType" validate:"required"`
}
type ProductType ¶
type ProductType string
const ( ProductNextcloud ProductType = "Nextcloud" ProductSynology ProductType = "Synology" )
type SeatDetailReply ¶
type SeatDetailReply struct {
SelectedSeat mongomanager.Seat `json:"selectedSeat" validate:"required"`
MySeat mongomanager.Seat `json:"mySeat" validate:"required"`
}
type SeatDetailRequest ¶
type SetupIntentMeta ¶
type SetupIntentMeta string
const ( CreateSubscription SetupIntentMeta = "createSubscription" ChangePayment SetupIntentMeta = "changePayment" )
const SetupIntentMetaKey SetupIntentMeta = "setupIntentMeta"
type StripeConnection ¶
func InitStripeConnection ¶
func (*StripeConnection) CreateCustomer ¶
func (*StripeConnection) GetDefaultPaymentMethod ¶
func (stripeConnection *StripeConnection) GetDefaultPaymentMethod(c context.Context, cus *stripe.Customer) (*stripe.PaymentMethod, error)
func (*StripeConnection) GetPaymentMethod ¶
func (stripeConnection *StripeConnection) GetPaymentMethod(c context.Context, paymentMethodID string) (*stripe.PaymentMethod, error)
func (*StripeConnection) GetProduct ¶
func (*StripeConnection) GetSubscriptionByID ¶
func (stripeConnection *StripeConnection) GetSubscriptionByID(c context.Context, subscriptionID string) (*stripe.Subscription, error)
type SubscriptionCancelReply ¶
type SubscriptionCancelRequest ¶
type SubscriptionCancelRequest struct {
SubscriptionID string `json:"subscriptionID" binding:"required"`
}
type SubscriptionDetailReply ¶
type SubscriptionDetailReply struct {
ID string `json:"id" validate:"required"`
Active *bool `json:"active" validate:"required"`
ProductName string `json:"product_name" validate:"required"`
ProductType string `json:"product_type" validate:"required"`
StorageAmount int `json:"storage_amount" validate:"required"`
UserCount int64 `json:"user_count" validate:"required"`
PricePerMonth int64 `json:"price_per_month" validate:"required"`
Currency string `json:"currency" validate:"required"`
CancelAtPeriodEnd *bool `json:"cancel_at_period_end" validate:"required"`
CancelAt int64 `json:"cancel_at"`
Status string `json:"status" validate:"required"`
TrialEnd int64 `json:"trial_end"`
CurrentPeriodEnd int64 `json:"current_period_end" validate:"required"`
}
type SubscriptionOverviewReply ¶
type SubscriptionOverviewReply struct {
ID string `json:"id" validate:"required"`
Acive *bool `json:"active" validate:"required"`
ProductName string `json:"productName" validate:"required"`
ProductType string `json:"productType" validate:"required"`
StorageAmount int `json:"storageAmount" validate:"required"`
UserCount int64 `json:"userCount" validate:"required"`
}
type SubscriptionResumeReply ¶
type SubscriptionResumeRequest ¶
type SubscriptionResumeRequest struct {
SubscriptionID string `json:"subscriptionID" binding:"required"`
}
type UpdateBillingAddressReply ¶
type UpdateBillingAddressReply struct {
SubscriptionID string `json:"subscriptionID" validate:"required"`
}
type UpdateSeatDetailReply ¶
type UpdateSeatDetailReply struct {
Seat mongomanager.Seat `json:"seat" validate:"required"`
}
type UpdateSeatDetailRequest ¶
type UpdateSeatDetailRequest struct {
SeatUpdated mongomanager.Seat `json:"seatUpdated" validate:"required"`
}
Source Files
¶
- billing-address-manager.go
- billing-address-model.go
- billing-portal-manager.go
- billing-portal-model.go
- change-payment-manager.go
- change-payment-method-model.go
- checkout-manager-payment-intent.go
- checkout-manager-setup-intent.go
- checkout-manager.go
- checkout-model-payment-intent.go
- checkout-model-setup-intent.go
- customer-manager.go
- detail-manager.go
- detail-model.go
- invoices-model.go
- invoices.manager.go
- overview-manager.go
- overview-model.go
- owner-manager.go
- payment-method-manager.go
- payment-overview-manager.go
- payment-overview-model.go
- price-manager.go
- product-manager.go
- product-model.go
- seat-manager.go
- seat-model.go
- stripe-manager.go
- subscription-cancel-model.go
- subscription-item-manager.go
- subscription-manager.go
- subscription-resume-model.go
- trial-manager.go
Click to show internal directories.
Click to hide internal directories.