// Package billing is the Billing & Subscription bounded context: plans, // Stripe checkout/portal, webhook ingestion, and the per-plan daily // message quota. System of record for `subscriptions`, `stripe_events` // and `usage_daily` (see services/billing/migrations/0001_init.sql). // // Mirrors internal/handlers/billing.go + internal/billing/*.go + // internal/db/subscriptions.go. // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.5.1 // - protoc v3.21.12 // source: billing/v1/billing.proto package billingv1 import ( context "context" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" ) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. // Requires gRPC-Go v1.64.0 or later. const _ = grpc.SupportPackageIsVersion9 const ( BillingService_GetOrCreateSubscription_FullMethodName = "/enkly.billing.v1.BillingService/GetOrCreateSubscription" BillingService_GetPlanCatalog_FullMethodName = "/enkly.billing.v1.BillingService/GetPlanCatalog" BillingService_CreateCheckoutSession_FullMethodName = "/enkly.billing.v1.BillingService/CreateCheckoutSession" BillingService_SyncCheckoutSession_FullMethodName = "/enkly.billing.v1.BillingService/SyncCheckoutSession" BillingService_CreateBillingPortalSession_FullMethodName = "/enkly.billing.v1.BillingService/CreateBillingPortalSession" BillingService_IngestStripeWebhook_FullMethodName = "/enkly.billing.v1.BillingService/IngestStripeWebhook" BillingService_CheckAndIncrementUsage_FullMethodName = "/enkly.billing.v1.BillingService/CheckAndIncrementUsage" BillingService_GetDailyUsage_FullMethodName = "/enkly.billing.v1.BillingService/GetDailyUsage" ) // BillingServiceClient is the client API for BillingService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type BillingServiceClient interface { // GetOrCreateSubscription replaces db.GetOrCreateSubscription: lazily // inserts the default free-plan row the first time a user's // subscription is looked up. GetOrCreateSubscription(ctx context.Context, in *GetOrCreateSubscriptionRequest, opts ...grpc.CallOption) (*Subscription, error) // GetPlanCatalog replaces billing.Catalog + billing.PlanPriceIDs for // rendering /subscription — returns every plan and whether its Stripe // price is currently configured (so an unconfigured plan renders as // "Unavailable", same as today). GetPlanCatalog(ctx context.Context, in *GetPlanCatalogRequest, opts ...grpc.CallOption) (*GetPlanCatalogResponse, error) // CreateCheckoutSession replaces Handlers.CreateCheckout. CreateCheckoutSession(ctx context.Context, in *CreateCheckoutSessionRequest, opts ...grpc.CallOption) (*CreateCheckoutSessionResponse, error) // SyncCheckoutSession replaces Handlers.syncCheckoutSession, the // fallback path SubscriptionSuccess uses when the webhook hasn't // landed yet. SyncCheckoutSession(ctx context.Context, in *SyncCheckoutSessionRequest, opts ...grpc.CallOption) (*Subscription, error) // CreateBillingPortalSession replaces Handlers.BillingPortal. CreateBillingPortalSession(ctx context.Context, in *CreateBillingPortalSessionRequest, opts ...grpc.CallOption) (*CreateBillingPortalSessionResponse, error) // IngestStripeWebhook replaces Handlers.StripeWebhook / // applyStripeEvent. The gateway still terminates the public // POST /webhooks/stripe route (so the URL Stripe is configured with // never changes) but forwards the raw body and signature header here // untouched — signature verification needs STRIPE_WEBHOOK_SECRET, // which only billing holds. IngestStripeWebhook(ctx context.Context, in *IngestStripeWebhookRequest, opts ...grpc.CallOption) (*IngestStripeWebhookResponse, error) // CheckAndIncrementUsage replaces the daily-cap check + db. // IncrementDailyUsage call in Handlers.Chat. Called by the agent // service once per chat turn, after the message is accepted and // before the agent run starts (same ordering as the monolith). CheckAndIncrementUsage(ctx context.Context, in *CheckAndIncrementUsageRequest, opts ...grpc.CallOption) (*CheckAndIncrementUsageResponse, error) // GetDailyUsage replaces db.DailyUsage — a read-only lookup (no // increment) used by the gateway's /subscription page to show // today's count without miscounting it as a sent message. GetDailyUsage(ctx context.Context, in *GetDailyUsageRequest, opts ...grpc.CallOption) (*GetDailyUsageResponse, error) } type billingServiceClient struct { cc grpc.ClientConnInterface } func NewBillingServiceClient(cc grpc.ClientConnInterface) BillingServiceClient { return &billingServiceClient{cc} } func (c *billingServiceClient) GetOrCreateSubscription(ctx context.Context, in *GetOrCreateSubscriptionRequest, opts ...grpc.CallOption) (*Subscription, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(Subscription) err := c.cc.Invoke(ctx, BillingService_GetOrCreateSubscription_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *billingServiceClient) GetPlanCatalog(ctx context.Context, in *GetPlanCatalogRequest, opts ...grpc.CallOption) (*GetPlanCatalogResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(GetPlanCatalogResponse) err := c.cc.Invoke(ctx, BillingService_GetPlanCatalog_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *billingServiceClient) CreateCheckoutSession(ctx context.Context, in *CreateCheckoutSessionRequest, opts ...grpc.CallOption) (*CreateCheckoutSessionResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(CreateCheckoutSessionResponse) err := c.cc.Invoke(ctx, BillingService_CreateCheckoutSession_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *billingServiceClient) SyncCheckoutSession(ctx context.Context, in *SyncCheckoutSessionRequest, opts ...grpc.CallOption) (*Subscription, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(Subscription) err := c.cc.Invoke(ctx, BillingService_SyncCheckoutSession_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *billingServiceClient) CreateBillingPortalSession(ctx context.Context, in *CreateBillingPortalSessionRequest, opts ...grpc.CallOption) (*CreateBillingPortalSessionResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(CreateBillingPortalSessionResponse) err := c.cc.Invoke(ctx, BillingService_CreateBillingPortalSession_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *billingServiceClient) IngestStripeWebhook(ctx context.Context, in *IngestStripeWebhookRequest, opts ...grpc.CallOption) (*IngestStripeWebhookResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(IngestStripeWebhookResponse) err := c.cc.Invoke(ctx, BillingService_IngestStripeWebhook_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *billingServiceClient) CheckAndIncrementUsage(ctx context.Context, in *CheckAndIncrementUsageRequest, opts ...grpc.CallOption) (*CheckAndIncrementUsageResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(CheckAndIncrementUsageResponse) err := c.cc.Invoke(ctx, BillingService_CheckAndIncrementUsage_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *billingServiceClient) GetDailyUsage(ctx context.Context, in *GetDailyUsageRequest, opts ...grpc.CallOption) (*GetDailyUsageResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(GetDailyUsageResponse) err := c.cc.Invoke(ctx, BillingService_GetDailyUsage_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } // BillingServiceServer is the server API for BillingService service. // All implementations must embed UnimplementedBillingServiceServer // for forward compatibility. type BillingServiceServer interface { // GetOrCreateSubscription replaces db.GetOrCreateSubscription: lazily // inserts the default free-plan row the first time a user's // subscription is looked up. GetOrCreateSubscription(context.Context, *GetOrCreateSubscriptionRequest) (*Subscription, error) // GetPlanCatalog replaces billing.Catalog + billing.PlanPriceIDs for // rendering /subscription — returns every plan and whether its Stripe // price is currently configured (so an unconfigured plan renders as // "Unavailable", same as today). GetPlanCatalog(context.Context, *GetPlanCatalogRequest) (*GetPlanCatalogResponse, error) // CreateCheckoutSession replaces Handlers.CreateCheckout. CreateCheckoutSession(context.Context, *CreateCheckoutSessionRequest) (*CreateCheckoutSessionResponse, error) // SyncCheckoutSession replaces Handlers.syncCheckoutSession, the // fallback path SubscriptionSuccess uses when the webhook hasn't // landed yet. SyncCheckoutSession(context.Context, *SyncCheckoutSessionRequest) (*Subscription, error) // CreateBillingPortalSession replaces Handlers.BillingPortal. CreateBillingPortalSession(context.Context, *CreateBillingPortalSessionRequest) (*CreateBillingPortalSessionResponse, error) // IngestStripeWebhook replaces Handlers.StripeWebhook / // applyStripeEvent. The gateway still terminates the public // POST /webhooks/stripe route (so the URL Stripe is configured with // never changes) but forwards the raw body and signature header here // untouched — signature verification needs STRIPE_WEBHOOK_SECRET, // which only billing holds. IngestStripeWebhook(context.Context, *IngestStripeWebhookRequest) (*IngestStripeWebhookResponse, error) // CheckAndIncrementUsage replaces the daily-cap check + db. // IncrementDailyUsage call in Handlers.Chat. Called by the agent // service once per chat turn, after the message is accepted and // before the agent run starts (same ordering as the monolith). CheckAndIncrementUsage(context.Context, *CheckAndIncrementUsageRequest) (*CheckAndIncrementUsageResponse, error) // GetDailyUsage replaces db.DailyUsage — a read-only lookup (no // increment) used by the gateway's /subscription page to show // today's count without miscounting it as a sent message. GetDailyUsage(context.Context, *GetDailyUsageRequest) (*GetDailyUsageResponse, error) mustEmbedUnimplementedBillingServiceServer() } // UnimplementedBillingServiceServer must be embedded to have // forward compatible implementations. // // NOTE: this should be embedded by value instead of pointer to avoid a nil // pointer dereference when methods are called. type UnimplementedBillingServiceServer struct{} func (UnimplementedBillingServiceServer) GetOrCreateSubscription(context.Context, *GetOrCreateSubscriptionRequest) (*Subscription, error) { return nil, status.Errorf(codes.Unimplemented, "method GetOrCreateSubscription not implemented") } func (UnimplementedBillingServiceServer) GetPlanCatalog(context.Context, *GetPlanCatalogRequest) (*GetPlanCatalogResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetPlanCatalog not implemented") } func (UnimplementedBillingServiceServer) CreateCheckoutSession(context.Context, *CreateCheckoutSessionRequest) (*CreateCheckoutSessionResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateCheckoutSession not implemented") } func (UnimplementedBillingServiceServer) SyncCheckoutSession(context.Context, *SyncCheckoutSessionRequest) (*Subscription, error) { return nil, status.Errorf(codes.Unimplemented, "method SyncCheckoutSession not implemented") } func (UnimplementedBillingServiceServer) CreateBillingPortalSession(context.Context, *CreateBillingPortalSessionRequest) (*CreateBillingPortalSessionResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateBillingPortalSession not implemented") } func (UnimplementedBillingServiceServer) IngestStripeWebhook(context.Context, *IngestStripeWebhookRequest) (*IngestStripeWebhookResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method IngestStripeWebhook not implemented") } func (UnimplementedBillingServiceServer) CheckAndIncrementUsage(context.Context, *CheckAndIncrementUsageRequest) (*CheckAndIncrementUsageResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CheckAndIncrementUsage not implemented") } func (UnimplementedBillingServiceServer) GetDailyUsage(context.Context, *GetDailyUsageRequest) (*GetDailyUsageResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetDailyUsage not implemented") } func (UnimplementedBillingServiceServer) mustEmbedUnimplementedBillingServiceServer() {} func (UnimplementedBillingServiceServer) testEmbeddedByValue() {} // UnsafeBillingServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to BillingServiceServer will // result in compilation errors. type UnsafeBillingServiceServer interface { mustEmbedUnimplementedBillingServiceServer() } func RegisterBillingServiceServer(s grpc.ServiceRegistrar, srv BillingServiceServer) { // If the following call pancis, it indicates UnimplementedBillingServiceServer was // embedded by pointer and is nil. This will cause panics if an // unimplemented method is ever invoked, so we test this at initialization // time to prevent it from happening at runtime later due to I/O. if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { t.testEmbeddedByValue() } s.RegisterService(&BillingService_ServiceDesc, srv) } func _BillingService_GetOrCreateSubscription_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetOrCreateSubscriptionRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(BillingServiceServer).GetOrCreateSubscription(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: BillingService_GetOrCreateSubscription_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(BillingServiceServer).GetOrCreateSubscription(ctx, req.(*GetOrCreateSubscriptionRequest)) } return interceptor(ctx, in, info, handler) } func _BillingService_GetPlanCatalog_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetPlanCatalogRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(BillingServiceServer).GetPlanCatalog(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: BillingService_GetPlanCatalog_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(BillingServiceServer).GetPlanCatalog(ctx, req.(*GetPlanCatalogRequest)) } return interceptor(ctx, in, info, handler) } func _BillingService_CreateCheckoutSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(CreateCheckoutSessionRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(BillingServiceServer).CreateCheckoutSession(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: BillingService_CreateCheckoutSession_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(BillingServiceServer).CreateCheckoutSession(ctx, req.(*CreateCheckoutSessionRequest)) } return interceptor(ctx, in, info, handler) } func _BillingService_SyncCheckoutSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SyncCheckoutSessionRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(BillingServiceServer).SyncCheckoutSession(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: BillingService_SyncCheckoutSession_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(BillingServiceServer).SyncCheckoutSession(ctx, req.(*SyncCheckoutSessionRequest)) } return interceptor(ctx, in, info, handler) } func _BillingService_CreateBillingPortalSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(CreateBillingPortalSessionRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(BillingServiceServer).CreateBillingPortalSession(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: BillingService_CreateBillingPortalSession_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(BillingServiceServer).CreateBillingPortalSession(ctx, req.(*CreateBillingPortalSessionRequest)) } return interceptor(ctx, in, info, handler) } func _BillingService_IngestStripeWebhook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(IngestStripeWebhookRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(BillingServiceServer).IngestStripeWebhook(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: BillingService_IngestStripeWebhook_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(BillingServiceServer).IngestStripeWebhook(ctx, req.(*IngestStripeWebhookRequest)) } return interceptor(ctx, in, info, handler) } func _BillingService_CheckAndIncrementUsage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(CheckAndIncrementUsageRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(BillingServiceServer).CheckAndIncrementUsage(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: BillingService_CheckAndIncrementUsage_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(BillingServiceServer).CheckAndIncrementUsage(ctx, req.(*CheckAndIncrementUsageRequest)) } return interceptor(ctx, in, info, handler) } func _BillingService_GetDailyUsage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetDailyUsageRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(BillingServiceServer).GetDailyUsage(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: BillingService_GetDailyUsage_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(BillingServiceServer).GetDailyUsage(ctx, req.(*GetDailyUsageRequest)) } return interceptor(ctx, in, info, handler) } // BillingService_ServiceDesc is the grpc.ServiceDesc for BillingService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var BillingService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "enkly.billing.v1.BillingService", HandlerType: (*BillingServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "GetOrCreateSubscription", Handler: _BillingService_GetOrCreateSubscription_Handler, }, { MethodName: "GetPlanCatalog", Handler: _BillingService_GetPlanCatalog_Handler, }, { MethodName: "CreateCheckoutSession", Handler: _BillingService_CreateCheckoutSession_Handler, }, { MethodName: "SyncCheckoutSession", Handler: _BillingService_SyncCheckoutSession_Handler, }, { MethodName: "CreateBillingPortalSession", Handler: _BillingService_CreateBillingPortalSession_Handler, }, { MethodName: "IngestStripeWebhook", Handler: _BillingService_IngestStripeWebhook_Handler, }, { MethodName: "CheckAndIncrementUsage", Handler: _BillingService_CheckAndIncrementUsage_Handler, }, { MethodName: "GetDailyUsage", Handler: _BillingService_GetDailyUsage_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "billing/v1/billing.proto", }