weave-typescript 0.4.5 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,657 @@
1
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
+ import { type CallOptions, ChannelCredentials, Client, type ClientOptions, type ClientUnaryCall, type handleUnaryCall, Metadata, type ServiceError, type UntypedServiceImplementation } from "@grpc/grpc-js";
3
+ import { Invoice, TaxRate } from "./invoice.pb";
4
+ import { Address, Discount, PaymentMethod, PricingPlan, SubscriptionStatus } from "./subscription.pb";
5
+ export declare const protobufPackage = "weaveapi.payment.v1";
6
+ export interface CreateCheckoutSessionRequest {
7
+ /** Stripe price ID for the plan */
8
+ priceId: string;
9
+ /** Where to redirect on success */
10
+ successUrl: string;
11
+ /** Where to redirect on cancel */
12
+ cancelUrl: string;
13
+ /** Optional parameters */
14
+ promoCode: string;
15
+ allowPromotionCodes: boolean;
16
+ trialDays: number;
17
+ metadata: {
18
+ [key: string]: string;
19
+ };
20
+ /** Customer info (if not logged in) */
21
+ customerEmail: string;
22
+ /** Tax */
23
+ automaticTax: boolean;
24
+ /** Types of tax IDs to collect */
25
+ taxIdCollection: string[];
26
+ }
27
+ export interface CreateCheckoutSessionRequest_MetadataEntry {
28
+ key: string;
29
+ value: string;
30
+ }
31
+ export interface CreateCheckoutSessionResponse {
32
+ sessionId: string;
33
+ /** Stripe hosted checkout URL */
34
+ checkoutUrl: string;
35
+ expiresAt: Date | undefined;
36
+ }
37
+ /** Uses JWT from Authorization header */
38
+ export interface GetSubscriptionStatusRequest {
39
+ }
40
+ export interface GetSubscriptionStatusResponse {
41
+ subscription: SubscriptionStatus | undefined;
42
+ }
43
+ export interface UpdateSubscriptionRequest {
44
+ paymentMethodId: string;
45
+ promoCode: string;
46
+ cancelAtPeriodEnd: boolean;
47
+ metadata: {
48
+ [key: string]: string;
49
+ };
50
+ }
51
+ export interface UpdateSubscriptionRequest_MetadataEntry {
52
+ key: string;
53
+ value: string;
54
+ }
55
+ export interface UpdateSubscriptionResponse {
56
+ subscription: SubscriptionStatus | undefined;
57
+ message: string;
58
+ }
59
+ export interface CancelSubscriptionRequest {
60
+ /** If true, cancel immediately; otherwise at period end */
61
+ immediately: boolean;
62
+ /** Optional cancellation reason */
63
+ reason: string;
64
+ /** Optional user feedback */
65
+ feedback: string;
66
+ }
67
+ export interface CancelSubscriptionResponse {
68
+ subscription: SubscriptionStatus | undefined;
69
+ effectiveDate: Date | undefined;
70
+ confirmation: string;
71
+ }
72
+ /** Resume a subscription that was set to cancel at period end */
73
+ export interface ResumeSubscriptionRequest {
74
+ }
75
+ export interface ResumeSubscriptionResponse {
76
+ subscription: SubscriptionStatus | undefined;
77
+ message: string;
78
+ }
79
+ export interface GetBillingHistoryRequest {
80
+ /** Default 10 */
81
+ limit: number;
82
+ /** Pagination cursor */
83
+ startingAfter: string;
84
+ /** Pagination cursor */
85
+ endingBefore: string;
86
+ /** Filters */
87
+ status: string;
88
+ createdAfter: Date | undefined;
89
+ createdBefore: Date | undefined;
90
+ }
91
+ export interface GetBillingHistoryResponse {
92
+ invoices: Invoice[];
93
+ hasMore: boolean;
94
+ nextCursor: string;
95
+ previousCursor: string;
96
+ }
97
+ /** Preview next invoice */
98
+ export interface GetUpcomingInvoiceRequest {
99
+ }
100
+ export interface GetUpcomingInvoiceResponse {
101
+ invoice: Invoice | undefined;
102
+ }
103
+ export interface ListPaymentMethodsRequest {
104
+ /** card, bank_account, or empty for all */
105
+ type: string;
106
+ }
107
+ export interface ListPaymentMethodsResponse {
108
+ paymentMethods: PaymentMethod[];
109
+ defaultPaymentMethodId: string;
110
+ }
111
+ export interface AddPaymentMethodRequest {
112
+ /** Stripe payment method ID from frontend */
113
+ paymentMethodId: string;
114
+ setAsDefault: boolean;
115
+ }
116
+ export interface AddPaymentMethodResponse {
117
+ paymentMethod: PaymentMethod | undefined;
118
+ isDefault: boolean;
119
+ }
120
+ export interface SetDefaultPaymentMethodRequest {
121
+ paymentMethodId: string;
122
+ }
123
+ export interface SetDefaultPaymentMethodResponse {
124
+ success: boolean;
125
+ message: string;
126
+ }
127
+ export interface RemovePaymentMethodRequest {
128
+ paymentMethodId: string;
129
+ }
130
+ export interface RemovePaymentMethodResponse {
131
+ success: boolean;
132
+ message: string;
133
+ remainingMethods: number;
134
+ }
135
+ export interface CreatePortalSessionRequest {
136
+ /** Where to return after portal session */
137
+ returnUrl: string;
138
+ }
139
+ export interface CreatePortalSessionResponse {
140
+ /** Stripe customer portal URL */
141
+ portalUrl: string;
142
+ expiresAt: Date | undefined;
143
+ }
144
+ export interface GetPricingPlansRequest {
145
+ /** Optional: filter by currency */
146
+ currency: string;
147
+ /** Only show active plans */
148
+ activeOnly: boolean;
149
+ }
150
+ export interface GetPricingPlansResponse {
151
+ plans: PricingPlan[];
152
+ recommendedPlanId: string;
153
+ /** User's current plan if logged in */
154
+ currentPlan: PricingPlan | undefined;
155
+ }
156
+ export interface ApplyPromoCodeRequest {
157
+ promoCode: string;
158
+ }
159
+ export interface ApplyPromoCodeResponse {
160
+ valid: boolean;
161
+ discount: Discount | undefined;
162
+ message: string;
163
+ expiresAt: Date | undefined;
164
+ }
165
+ export interface HandleStripeWebhookRequest {
166
+ /** Raw webhook payload */
167
+ payload: Uint8Array;
168
+ /** Stripe-Signature header */
169
+ signature: string;
170
+ }
171
+ export interface HandleStripeWebhookResponse {
172
+ success: boolean;
173
+ eventId: string;
174
+ eventType: string;
175
+ message: string;
176
+ }
177
+ export interface GetUsageSummaryRequest {
178
+ /** current, previous, custom */
179
+ period: string;
180
+ /** For custom period */
181
+ startDate: Date | undefined;
182
+ /** For custom period */
183
+ endDate: Date | undefined;
184
+ }
185
+ export interface GetUsageSummaryResponse {
186
+ currentPeriod: UsagePeriod | undefined;
187
+ previousPeriods: UsagePeriod[];
188
+ limits: UsageLimits | undefined;
189
+ }
190
+ export interface UsagePeriod {
191
+ startDate: Date | undefined;
192
+ endDate: Date | undefined;
193
+ /** API usage */
194
+ apiRequests: number;
195
+ apiRequestsLimit: number;
196
+ usagePercentage: number;
197
+ /** Breakdown */
198
+ requestsByEndpoint: {
199
+ [key: string]: number;
200
+ };
201
+ requestsByApiKey: {
202
+ [key: string]: number;
203
+ };
204
+ /** Billing */
205
+ billableRequests: number;
206
+ overageRequests: number;
207
+ overageCostCents: number;
208
+ }
209
+ export interface UsagePeriod_RequestsByEndpointEntry {
210
+ key: string;
211
+ value: number;
212
+ }
213
+ export interface UsagePeriod_RequestsByApiKeyEntry {
214
+ key: string;
215
+ value: number;
216
+ }
217
+ export interface UsageLimits {
218
+ tier: string;
219
+ requestsPerHour: number;
220
+ requestsPerDay: number;
221
+ requestsPerMonth: number;
222
+ unlimited: boolean;
223
+ /** Cost per 1000 requests over limit */
224
+ overageRateCents: number;
225
+ }
226
+ /** Get credit balance if using credit system */
227
+ export interface GetCreditBalanceRequest {
228
+ }
229
+ export interface GetCreditBalanceResponse {
230
+ credits: number;
231
+ pendingCredits: number;
232
+ expiresAt: Date | undefined;
233
+ recentTransactions: CreditTransaction[];
234
+ }
235
+ export interface CreditTransaction {
236
+ id: string;
237
+ /** purchase, usage, refund, bonus */
238
+ type: string;
239
+ /** Positive for credits, negative for usage */
240
+ amount: number;
241
+ description: string;
242
+ createdAt: Date | undefined;
243
+ }
244
+ export interface UpdateTaxInfoRequest {
245
+ /** VAT number, GST, etc */
246
+ taxId: string;
247
+ /** eu_vat, gb_vat, us_ein, etc */
248
+ taxIdType: string;
249
+ billingAddress: Address | undefined;
250
+ businessName: string;
251
+ taxExempt: boolean;
252
+ }
253
+ export interface UpdateTaxInfoResponse {
254
+ success: boolean;
255
+ message: string;
256
+ taxInfo: TaxInfo | undefined;
257
+ }
258
+ export interface TaxInfo {
259
+ taxId: string;
260
+ taxIdType: string;
261
+ /** pending, verified, unverified */
262
+ verificationStatus: string;
263
+ billingAddress: Address | undefined;
264
+ businessName: string;
265
+ taxExempt: boolean;
266
+ applicableRates: TaxRate[];
267
+ }
268
+ export interface DownloadInvoiceRequest {
269
+ invoiceId: string;
270
+ }
271
+ export interface DownloadInvoiceResponse {
272
+ pdfData: Uint8Array;
273
+ filename: string;
274
+ contentType: string;
275
+ }
276
+ export declare const CreateCheckoutSessionRequest: MessageFns<CreateCheckoutSessionRequest>;
277
+ export declare const CreateCheckoutSessionRequest_MetadataEntry: MessageFns<CreateCheckoutSessionRequest_MetadataEntry>;
278
+ export declare const CreateCheckoutSessionResponse: MessageFns<CreateCheckoutSessionResponse>;
279
+ export declare const GetSubscriptionStatusRequest: MessageFns<GetSubscriptionStatusRequest>;
280
+ export declare const GetSubscriptionStatusResponse: MessageFns<GetSubscriptionStatusResponse>;
281
+ export declare const UpdateSubscriptionRequest: MessageFns<UpdateSubscriptionRequest>;
282
+ export declare const UpdateSubscriptionRequest_MetadataEntry: MessageFns<UpdateSubscriptionRequest_MetadataEntry>;
283
+ export declare const UpdateSubscriptionResponse: MessageFns<UpdateSubscriptionResponse>;
284
+ export declare const CancelSubscriptionRequest: MessageFns<CancelSubscriptionRequest>;
285
+ export declare const CancelSubscriptionResponse: MessageFns<CancelSubscriptionResponse>;
286
+ export declare const ResumeSubscriptionRequest: MessageFns<ResumeSubscriptionRequest>;
287
+ export declare const ResumeSubscriptionResponse: MessageFns<ResumeSubscriptionResponse>;
288
+ export declare const GetBillingHistoryRequest: MessageFns<GetBillingHistoryRequest>;
289
+ export declare const GetBillingHistoryResponse: MessageFns<GetBillingHistoryResponse>;
290
+ export declare const GetUpcomingInvoiceRequest: MessageFns<GetUpcomingInvoiceRequest>;
291
+ export declare const GetUpcomingInvoiceResponse: MessageFns<GetUpcomingInvoiceResponse>;
292
+ export declare const ListPaymentMethodsRequest: MessageFns<ListPaymentMethodsRequest>;
293
+ export declare const ListPaymentMethodsResponse: MessageFns<ListPaymentMethodsResponse>;
294
+ export declare const AddPaymentMethodRequest: MessageFns<AddPaymentMethodRequest>;
295
+ export declare const AddPaymentMethodResponse: MessageFns<AddPaymentMethodResponse>;
296
+ export declare const SetDefaultPaymentMethodRequest: MessageFns<SetDefaultPaymentMethodRequest>;
297
+ export declare const SetDefaultPaymentMethodResponse: MessageFns<SetDefaultPaymentMethodResponse>;
298
+ export declare const RemovePaymentMethodRequest: MessageFns<RemovePaymentMethodRequest>;
299
+ export declare const RemovePaymentMethodResponse: MessageFns<RemovePaymentMethodResponse>;
300
+ export declare const CreatePortalSessionRequest: MessageFns<CreatePortalSessionRequest>;
301
+ export declare const CreatePortalSessionResponse: MessageFns<CreatePortalSessionResponse>;
302
+ export declare const GetPricingPlansRequest: MessageFns<GetPricingPlansRequest>;
303
+ export declare const GetPricingPlansResponse: MessageFns<GetPricingPlansResponse>;
304
+ export declare const ApplyPromoCodeRequest: MessageFns<ApplyPromoCodeRequest>;
305
+ export declare const ApplyPromoCodeResponse: MessageFns<ApplyPromoCodeResponse>;
306
+ export declare const HandleStripeWebhookRequest: MessageFns<HandleStripeWebhookRequest>;
307
+ export declare const HandleStripeWebhookResponse: MessageFns<HandleStripeWebhookResponse>;
308
+ export declare const GetUsageSummaryRequest: MessageFns<GetUsageSummaryRequest>;
309
+ export declare const GetUsageSummaryResponse: MessageFns<GetUsageSummaryResponse>;
310
+ export declare const UsagePeriod: MessageFns<UsagePeriod>;
311
+ export declare const UsagePeriod_RequestsByEndpointEntry: MessageFns<UsagePeriod_RequestsByEndpointEntry>;
312
+ export declare const UsagePeriod_RequestsByApiKeyEntry: MessageFns<UsagePeriod_RequestsByApiKeyEntry>;
313
+ export declare const UsageLimits: MessageFns<UsageLimits>;
314
+ export declare const GetCreditBalanceRequest: MessageFns<GetCreditBalanceRequest>;
315
+ export declare const GetCreditBalanceResponse: MessageFns<GetCreditBalanceResponse>;
316
+ export declare const CreditTransaction: MessageFns<CreditTransaction>;
317
+ export declare const UpdateTaxInfoRequest: MessageFns<UpdateTaxInfoRequest>;
318
+ export declare const UpdateTaxInfoResponse: MessageFns<UpdateTaxInfoResponse>;
319
+ export declare const TaxInfo: MessageFns<TaxInfo>;
320
+ export declare const DownloadInvoiceRequest: MessageFns<DownloadInvoiceRequest>;
321
+ export declare const DownloadInvoiceResponse: MessageFns<DownloadInvoiceResponse>;
322
+ /** PaymentService handles subscription management and payment processing */
323
+ export type PaymentService = typeof PaymentService;
324
+ export declare const PaymentService: {
325
+ /** Create a Stripe checkout session for subscription */
326
+ readonly createCheckoutSession: {
327
+ readonly path: "/weaveapi.payment.v1.Payment/CreateCheckoutSession";
328
+ readonly requestStream: false;
329
+ readonly responseStream: false;
330
+ readonly requestSerialize: (value: CreateCheckoutSessionRequest) => Buffer<ArrayBuffer>;
331
+ readonly requestDeserialize: (value: Buffer) => CreateCheckoutSessionRequest;
332
+ readonly responseSerialize: (value: CreateCheckoutSessionResponse) => Buffer<ArrayBuffer>;
333
+ readonly responseDeserialize: (value: Buffer) => CreateCheckoutSessionResponse;
334
+ };
335
+ /** Get current subscription status */
336
+ readonly getSubscriptionStatus: {
337
+ readonly path: "/weaveapi.payment.v1.Payment/GetSubscriptionStatus";
338
+ readonly requestStream: false;
339
+ readonly responseStream: false;
340
+ readonly requestSerialize: (value: GetSubscriptionStatusRequest) => Buffer<ArrayBuffer>;
341
+ readonly requestDeserialize: (value: Buffer) => GetSubscriptionStatusRequest;
342
+ readonly responseSerialize: (value: GetSubscriptionStatusResponse) => Buffer<ArrayBuffer>;
343
+ readonly responseDeserialize: (value: Buffer) => GetSubscriptionStatusResponse;
344
+ };
345
+ /** Update subscription (change payment method, etc) */
346
+ readonly updateSubscription: {
347
+ readonly path: "/weaveapi.payment.v1.Payment/UpdateSubscription";
348
+ readonly requestStream: false;
349
+ readonly responseStream: false;
350
+ readonly requestSerialize: (value: UpdateSubscriptionRequest) => Buffer<ArrayBuffer>;
351
+ readonly requestDeserialize: (value: Buffer) => UpdateSubscriptionRequest;
352
+ readonly responseSerialize: (value: UpdateSubscriptionResponse) => Buffer<ArrayBuffer>;
353
+ readonly responseDeserialize: (value: Buffer) => UpdateSubscriptionResponse;
354
+ };
355
+ /** Cancel subscription */
356
+ readonly cancelSubscription: {
357
+ readonly path: "/weaveapi.payment.v1.Payment/CancelSubscription";
358
+ readonly requestStream: false;
359
+ readonly responseStream: false;
360
+ readonly requestSerialize: (value: CancelSubscriptionRequest) => Buffer<ArrayBuffer>;
361
+ readonly requestDeserialize: (value: Buffer) => CancelSubscriptionRequest;
362
+ readonly responseSerialize: (value: CancelSubscriptionResponse) => Buffer<ArrayBuffer>;
363
+ readonly responseDeserialize: (value: Buffer) => CancelSubscriptionResponse;
364
+ };
365
+ /** Resume cancelled subscription */
366
+ readonly resumeSubscription: {
367
+ readonly path: "/weaveapi.payment.v1.Payment/ResumeSubscription";
368
+ readonly requestStream: false;
369
+ readonly responseStream: false;
370
+ readonly requestSerialize: (value: ResumeSubscriptionRequest) => Buffer<ArrayBuffer>;
371
+ readonly requestDeserialize: (value: Buffer) => ResumeSubscriptionRequest;
372
+ readonly responseSerialize: (value: ResumeSubscriptionResponse) => Buffer<ArrayBuffer>;
373
+ readonly responseDeserialize: (value: Buffer) => ResumeSubscriptionResponse;
374
+ };
375
+ /** Get billing history */
376
+ readonly getBillingHistory: {
377
+ readonly path: "/weaveapi.payment.v1.Payment/GetBillingHistory";
378
+ readonly requestStream: false;
379
+ readonly responseStream: false;
380
+ readonly requestSerialize: (value: GetBillingHistoryRequest) => Buffer<ArrayBuffer>;
381
+ readonly requestDeserialize: (value: Buffer) => GetBillingHistoryRequest;
382
+ readonly responseSerialize: (value: GetBillingHistoryResponse) => Buffer<ArrayBuffer>;
383
+ readonly responseDeserialize: (value: Buffer) => GetBillingHistoryResponse;
384
+ };
385
+ /** Get upcoming invoice preview */
386
+ readonly getUpcomingInvoice: {
387
+ readonly path: "/weaveapi.payment.v1.Payment/GetUpcomingInvoice";
388
+ readonly requestStream: false;
389
+ readonly responseStream: false;
390
+ readonly requestSerialize: (value: GetUpcomingInvoiceRequest) => Buffer<ArrayBuffer>;
391
+ readonly requestDeserialize: (value: Buffer) => GetUpcomingInvoiceRequest;
392
+ readonly responseSerialize: (value: GetUpcomingInvoiceResponse) => Buffer<ArrayBuffer>;
393
+ readonly responseDeserialize: (value: Buffer) => GetUpcomingInvoiceResponse;
394
+ };
395
+ /** List payment methods */
396
+ readonly listPaymentMethods: {
397
+ readonly path: "/weaveapi.payment.v1.Payment/ListPaymentMethods";
398
+ readonly requestStream: false;
399
+ readonly responseStream: false;
400
+ readonly requestSerialize: (value: ListPaymentMethodsRequest) => Buffer<ArrayBuffer>;
401
+ readonly requestDeserialize: (value: Buffer) => ListPaymentMethodsRequest;
402
+ readonly responseSerialize: (value: ListPaymentMethodsResponse) => Buffer<ArrayBuffer>;
403
+ readonly responseDeserialize: (value: Buffer) => ListPaymentMethodsResponse;
404
+ };
405
+ /** Add payment method */
406
+ readonly addPaymentMethod: {
407
+ readonly path: "/weaveapi.payment.v1.Payment/AddPaymentMethod";
408
+ readonly requestStream: false;
409
+ readonly responseStream: false;
410
+ readonly requestSerialize: (value: AddPaymentMethodRequest) => Buffer<ArrayBuffer>;
411
+ readonly requestDeserialize: (value: Buffer) => AddPaymentMethodRequest;
412
+ readonly responseSerialize: (value: AddPaymentMethodResponse) => Buffer<ArrayBuffer>;
413
+ readonly responseDeserialize: (value: Buffer) => AddPaymentMethodResponse;
414
+ };
415
+ /** Set default payment method */
416
+ readonly setDefaultPaymentMethod: {
417
+ readonly path: "/weaveapi.payment.v1.Payment/SetDefaultPaymentMethod";
418
+ readonly requestStream: false;
419
+ readonly responseStream: false;
420
+ readonly requestSerialize: (value: SetDefaultPaymentMethodRequest) => Buffer<ArrayBuffer>;
421
+ readonly requestDeserialize: (value: Buffer) => SetDefaultPaymentMethodRequest;
422
+ readonly responseSerialize: (value: SetDefaultPaymentMethodResponse) => Buffer<ArrayBuffer>;
423
+ readonly responseDeserialize: (value: Buffer) => SetDefaultPaymentMethodResponse;
424
+ };
425
+ /** Remove payment method */
426
+ readonly removePaymentMethod: {
427
+ readonly path: "/weaveapi.payment.v1.Payment/RemovePaymentMethod";
428
+ readonly requestStream: false;
429
+ readonly responseStream: false;
430
+ readonly requestSerialize: (value: RemovePaymentMethodRequest) => Buffer<ArrayBuffer>;
431
+ readonly requestDeserialize: (value: Buffer) => RemovePaymentMethodRequest;
432
+ readonly responseSerialize: (value: RemovePaymentMethodResponse) => Buffer<ArrayBuffer>;
433
+ readonly responseDeserialize: (value: Buffer) => RemovePaymentMethodResponse;
434
+ };
435
+ /** Create Stripe customer portal session */
436
+ readonly createPortalSession: {
437
+ readonly path: "/weaveapi.payment.v1.Payment/CreatePortalSession";
438
+ readonly requestStream: false;
439
+ readonly responseStream: false;
440
+ readonly requestSerialize: (value: CreatePortalSessionRequest) => Buffer<ArrayBuffer>;
441
+ readonly requestDeserialize: (value: Buffer) => CreatePortalSessionRequest;
442
+ readonly responseSerialize: (value: CreatePortalSessionResponse) => Buffer<ArrayBuffer>;
443
+ readonly responseDeserialize: (value: Buffer) => CreatePortalSessionResponse;
444
+ };
445
+ /** Get available pricing plans */
446
+ readonly getPricingPlans: {
447
+ readonly path: "/weaveapi.payment.v1.Payment/GetPricingPlans";
448
+ readonly requestStream: false;
449
+ readonly responseStream: false;
450
+ readonly requestSerialize: (value: GetPricingPlansRequest) => Buffer<ArrayBuffer>;
451
+ readonly requestDeserialize: (value: Buffer) => GetPricingPlansRequest;
452
+ readonly responseSerialize: (value: GetPricingPlansResponse) => Buffer<ArrayBuffer>;
453
+ readonly responseDeserialize: (value: Buffer) => GetPricingPlansResponse;
454
+ };
455
+ /** Apply promo code */
456
+ readonly applyPromoCode: {
457
+ readonly path: "/weaveapi.payment.v1.Payment/ApplyPromoCode";
458
+ readonly requestStream: false;
459
+ readonly responseStream: false;
460
+ readonly requestSerialize: (value: ApplyPromoCodeRequest) => Buffer<ArrayBuffer>;
461
+ readonly requestDeserialize: (value: Buffer) => ApplyPromoCodeRequest;
462
+ readonly responseSerialize: (value: ApplyPromoCodeResponse) => Buffer<ArrayBuffer>;
463
+ readonly responseDeserialize: (value: Buffer) => ApplyPromoCodeResponse;
464
+ };
465
+ /** Handle Stripe webhook events */
466
+ readonly handleStripeWebhook: {
467
+ readonly path: "/weaveapi.payment.v1.Payment/HandleStripeWebhook";
468
+ readonly requestStream: false;
469
+ readonly responseStream: false;
470
+ readonly requestSerialize: (value: HandleStripeWebhookRequest) => Buffer<ArrayBuffer>;
471
+ readonly requestDeserialize: (value: Buffer) => HandleStripeWebhookRequest;
472
+ readonly responseSerialize: (value: HandleStripeWebhookResponse) => Buffer<ArrayBuffer>;
473
+ readonly responseDeserialize: (value: Buffer) => HandleStripeWebhookResponse;
474
+ };
475
+ /** Get usage summary for billing period */
476
+ readonly getUsageSummary: {
477
+ readonly path: "/weaveapi.payment.v1.Payment/GetUsageSummary";
478
+ readonly requestStream: false;
479
+ readonly responseStream: false;
480
+ readonly requestSerialize: (value: GetUsageSummaryRequest) => Buffer<ArrayBuffer>;
481
+ readonly requestDeserialize: (value: Buffer) => GetUsageSummaryRequest;
482
+ readonly responseSerialize: (value: GetUsageSummaryResponse) => Buffer<ArrayBuffer>;
483
+ readonly responseDeserialize: (value: Buffer) => GetUsageSummaryResponse;
484
+ };
485
+ /** Get credit balance (if applicable) */
486
+ readonly getCreditBalance: {
487
+ readonly path: "/weaveapi.payment.v1.Payment/GetCreditBalance";
488
+ readonly requestStream: false;
489
+ readonly responseStream: false;
490
+ readonly requestSerialize: (value: GetCreditBalanceRequest) => Buffer<ArrayBuffer>;
491
+ readonly requestDeserialize: (value: Buffer) => GetCreditBalanceRequest;
492
+ readonly responseSerialize: (value: GetCreditBalanceResponse) => Buffer<ArrayBuffer>;
493
+ readonly responseDeserialize: (value: Buffer) => GetCreditBalanceResponse;
494
+ };
495
+ /** Update tax information */
496
+ readonly updateTaxInfo: {
497
+ readonly path: "/weaveapi.payment.v1.Payment/UpdateTaxInfo";
498
+ readonly requestStream: false;
499
+ readonly responseStream: false;
500
+ readonly requestSerialize: (value: UpdateTaxInfoRequest) => Buffer<ArrayBuffer>;
501
+ readonly requestDeserialize: (value: Buffer) => UpdateTaxInfoRequest;
502
+ readonly responseSerialize: (value: UpdateTaxInfoResponse) => Buffer<ArrayBuffer>;
503
+ readonly responseDeserialize: (value: Buffer) => UpdateTaxInfoResponse;
504
+ };
505
+ /** Download invoice PDF */
506
+ readonly downloadInvoice: {
507
+ readonly path: "/weaveapi.payment.v1.Payment/DownloadInvoice";
508
+ readonly requestStream: false;
509
+ readonly responseStream: false;
510
+ readonly requestSerialize: (value: DownloadInvoiceRequest) => Buffer<ArrayBuffer>;
511
+ readonly requestDeserialize: (value: Buffer) => DownloadInvoiceRequest;
512
+ readonly responseSerialize: (value: DownloadInvoiceResponse) => Buffer<ArrayBuffer>;
513
+ readonly responseDeserialize: (value: Buffer) => DownloadInvoiceResponse;
514
+ };
515
+ };
516
+ export interface PaymentServer extends UntypedServiceImplementation {
517
+ /** Create a Stripe checkout session for subscription */
518
+ createCheckoutSession: handleUnaryCall<CreateCheckoutSessionRequest, CreateCheckoutSessionResponse>;
519
+ /** Get current subscription status */
520
+ getSubscriptionStatus: handleUnaryCall<GetSubscriptionStatusRequest, GetSubscriptionStatusResponse>;
521
+ /** Update subscription (change payment method, etc) */
522
+ updateSubscription: handleUnaryCall<UpdateSubscriptionRequest, UpdateSubscriptionResponse>;
523
+ /** Cancel subscription */
524
+ cancelSubscription: handleUnaryCall<CancelSubscriptionRequest, CancelSubscriptionResponse>;
525
+ /** Resume cancelled subscription */
526
+ resumeSubscription: handleUnaryCall<ResumeSubscriptionRequest, ResumeSubscriptionResponse>;
527
+ /** Get billing history */
528
+ getBillingHistory: handleUnaryCall<GetBillingHistoryRequest, GetBillingHistoryResponse>;
529
+ /** Get upcoming invoice preview */
530
+ getUpcomingInvoice: handleUnaryCall<GetUpcomingInvoiceRequest, GetUpcomingInvoiceResponse>;
531
+ /** List payment methods */
532
+ listPaymentMethods: handleUnaryCall<ListPaymentMethodsRequest, ListPaymentMethodsResponse>;
533
+ /** Add payment method */
534
+ addPaymentMethod: handleUnaryCall<AddPaymentMethodRequest, AddPaymentMethodResponse>;
535
+ /** Set default payment method */
536
+ setDefaultPaymentMethod: handleUnaryCall<SetDefaultPaymentMethodRequest, SetDefaultPaymentMethodResponse>;
537
+ /** Remove payment method */
538
+ removePaymentMethod: handleUnaryCall<RemovePaymentMethodRequest, RemovePaymentMethodResponse>;
539
+ /** Create Stripe customer portal session */
540
+ createPortalSession: handleUnaryCall<CreatePortalSessionRequest, CreatePortalSessionResponse>;
541
+ /** Get available pricing plans */
542
+ getPricingPlans: handleUnaryCall<GetPricingPlansRequest, GetPricingPlansResponse>;
543
+ /** Apply promo code */
544
+ applyPromoCode: handleUnaryCall<ApplyPromoCodeRequest, ApplyPromoCodeResponse>;
545
+ /** Handle Stripe webhook events */
546
+ handleStripeWebhook: handleUnaryCall<HandleStripeWebhookRequest, HandleStripeWebhookResponse>;
547
+ /** Get usage summary for billing period */
548
+ getUsageSummary: handleUnaryCall<GetUsageSummaryRequest, GetUsageSummaryResponse>;
549
+ /** Get credit balance (if applicable) */
550
+ getCreditBalance: handleUnaryCall<GetCreditBalanceRequest, GetCreditBalanceResponse>;
551
+ /** Update tax information */
552
+ updateTaxInfo: handleUnaryCall<UpdateTaxInfoRequest, UpdateTaxInfoResponse>;
553
+ /** Download invoice PDF */
554
+ downloadInvoice: handleUnaryCall<DownloadInvoiceRequest, DownloadInvoiceResponse>;
555
+ }
556
+ export interface PaymentClient extends Client {
557
+ /** Create a Stripe checkout session for subscription */
558
+ createCheckoutSession(request: CreateCheckoutSessionRequest, callback: (error: ServiceError | null, response: CreateCheckoutSessionResponse) => void): ClientUnaryCall;
559
+ createCheckoutSession(request: CreateCheckoutSessionRequest, metadata: Metadata, callback: (error: ServiceError | null, response: CreateCheckoutSessionResponse) => void): ClientUnaryCall;
560
+ createCheckoutSession(request: CreateCheckoutSessionRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: CreateCheckoutSessionResponse) => void): ClientUnaryCall;
561
+ /** Get current subscription status */
562
+ getSubscriptionStatus(request: GetSubscriptionStatusRequest, callback: (error: ServiceError | null, response: GetSubscriptionStatusResponse) => void): ClientUnaryCall;
563
+ getSubscriptionStatus(request: GetSubscriptionStatusRequest, metadata: Metadata, callback: (error: ServiceError | null, response: GetSubscriptionStatusResponse) => void): ClientUnaryCall;
564
+ getSubscriptionStatus(request: GetSubscriptionStatusRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: GetSubscriptionStatusResponse) => void): ClientUnaryCall;
565
+ /** Update subscription (change payment method, etc) */
566
+ updateSubscription(request: UpdateSubscriptionRequest, callback: (error: ServiceError | null, response: UpdateSubscriptionResponse) => void): ClientUnaryCall;
567
+ updateSubscription(request: UpdateSubscriptionRequest, metadata: Metadata, callback: (error: ServiceError | null, response: UpdateSubscriptionResponse) => void): ClientUnaryCall;
568
+ updateSubscription(request: UpdateSubscriptionRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: UpdateSubscriptionResponse) => void): ClientUnaryCall;
569
+ /** Cancel subscription */
570
+ cancelSubscription(request: CancelSubscriptionRequest, callback: (error: ServiceError | null, response: CancelSubscriptionResponse) => void): ClientUnaryCall;
571
+ cancelSubscription(request: CancelSubscriptionRequest, metadata: Metadata, callback: (error: ServiceError | null, response: CancelSubscriptionResponse) => void): ClientUnaryCall;
572
+ cancelSubscription(request: CancelSubscriptionRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: CancelSubscriptionResponse) => void): ClientUnaryCall;
573
+ /** Resume cancelled subscription */
574
+ resumeSubscription(request: ResumeSubscriptionRequest, callback: (error: ServiceError | null, response: ResumeSubscriptionResponse) => void): ClientUnaryCall;
575
+ resumeSubscription(request: ResumeSubscriptionRequest, metadata: Metadata, callback: (error: ServiceError | null, response: ResumeSubscriptionResponse) => void): ClientUnaryCall;
576
+ resumeSubscription(request: ResumeSubscriptionRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: ResumeSubscriptionResponse) => void): ClientUnaryCall;
577
+ /** Get billing history */
578
+ getBillingHistory(request: GetBillingHistoryRequest, callback: (error: ServiceError | null, response: GetBillingHistoryResponse) => void): ClientUnaryCall;
579
+ getBillingHistory(request: GetBillingHistoryRequest, metadata: Metadata, callback: (error: ServiceError | null, response: GetBillingHistoryResponse) => void): ClientUnaryCall;
580
+ getBillingHistory(request: GetBillingHistoryRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: GetBillingHistoryResponse) => void): ClientUnaryCall;
581
+ /** Get upcoming invoice preview */
582
+ getUpcomingInvoice(request: GetUpcomingInvoiceRequest, callback: (error: ServiceError | null, response: GetUpcomingInvoiceResponse) => void): ClientUnaryCall;
583
+ getUpcomingInvoice(request: GetUpcomingInvoiceRequest, metadata: Metadata, callback: (error: ServiceError | null, response: GetUpcomingInvoiceResponse) => void): ClientUnaryCall;
584
+ getUpcomingInvoice(request: GetUpcomingInvoiceRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: GetUpcomingInvoiceResponse) => void): ClientUnaryCall;
585
+ /** List payment methods */
586
+ listPaymentMethods(request: ListPaymentMethodsRequest, callback: (error: ServiceError | null, response: ListPaymentMethodsResponse) => void): ClientUnaryCall;
587
+ listPaymentMethods(request: ListPaymentMethodsRequest, metadata: Metadata, callback: (error: ServiceError | null, response: ListPaymentMethodsResponse) => void): ClientUnaryCall;
588
+ listPaymentMethods(request: ListPaymentMethodsRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: ListPaymentMethodsResponse) => void): ClientUnaryCall;
589
+ /** Add payment method */
590
+ addPaymentMethod(request: AddPaymentMethodRequest, callback: (error: ServiceError | null, response: AddPaymentMethodResponse) => void): ClientUnaryCall;
591
+ addPaymentMethod(request: AddPaymentMethodRequest, metadata: Metadata, callback: (error: ServiceError | null, response: AddPaymentMethodResponse) => void): ClientUnaryCall;
592
+ addPaymentMethod(request: AddPaymentMethodRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: AddPaymentMethodResponse) => void): ClientUnaryCall;
593
+ /** Set default payment method */
594
+ setDefaultPaymentMethod(request: SetDefaultPaymentMethodRequest, callback: (error: ServiceError | null, response: SetDefaultPaymentMethodResponse) => void): ClientUnaryCall;
595
+ setDefaultPaymentMethod(request: SetDefaultPaymentMethodRequest, metadata: Metadata, callback: (error: ServiceError | null, response: SetDefaultPaymentMethodResponse) => void): ClientUnaryCall;
596
+ setDefaultPaymentMethod(request: SetDefaultPaymentMethodRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: SetDefaultPaymentMethodResponse) => void): ClientUnaryCall;
597
+ /** Remove payment method */
598
+ removePaymentMethod(request: RemovePaymentMethodRequest, callback: (error: ServiceError | null, response: RemovePaymentMethodResponse) => void): ClientUnaryCall;
599
+ removePaymentMethod(request: RemovePaymentMethodRequest, metadata: Metadata, callback: (error: ServiceError | null, response: RemovePaymentMethodResponse) => void): ClientUnaryCall;
600
+ removePaymentMethod(request: RemovePaymentMethodRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: RemovePaymentMethodResponse) => void): ClientUnaryCall;
601
+ /** Create Stripe customer portal session */
602
+ createPortalSession(request: CreatePortalSessionRequest, callback: (error: ServiceError | null, response: CreatePortalSessionResponse) => void): ClientUnaryCall;
603
+ createPortalSession(request: CreatePortalSessionRequest, metadata: Metadata, callback: (error: ServiceError | null, response: CreatePortalSessionResponse) => void): ClientUnaryCall;
604
+ createPortalSession(request: CreatePortalSessionRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: CreatePortalSessionResponse) => void): ClientUnaryCall;
605
+ /** Get available pricing plans */
606
+ getPricingPlans(request: GetPricingPlansRequest, callback: (error: ServiceError | null, response: GetPricingPlansResponse) => void): ClientUnaryCall;
607
+ getPricingPlans(request: GetPricingPlansRequest, metadata: Metadata, callback: (error: ServiceError | null, response: GetPricingPlansResponse) => void): ClientUnaryCall;
608
+ getPricingPlans(request: GetPricingPlansRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: GetPricingPlansResponse) => void): ClientUnaryCall;
609
+ /** Apply promo code */
610
+ applyPromoCode(request: ApplyPromoCodeRequest, callback: (error: ServiceError | null, response: ApplyPromoCodeResponse) => void): ClientUnaryCall;
611
+ applyPromoCode(request: ApplyPromoCodeRequest, metadata: Metadata, callback: (error: ServiceError | null, response: ApplyPromoCodeResponse) => void): ClientUnaryCall;
612
+ applyPromoCode(request: ApplyPromoCodeRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: ApplyPromoCodeResponse) => void): ClientUnaryCall;
613
+ /** Handle Stripe webhook events */
614
+ handleStripeWebhook(request: HandleStripeWebhookRequest, callback: (error: ServiceError | null, response: HandleStripeWebhookResponse) => void): ClientUnaryCall;
615
+ handleStripeWebhook(request: HandleStripeWebhookRequest, metadata: Metadata, callback: (error: ServiceError | null, response: HandleStripeWebhookResponse) => void): ClientUnaryCall;
616
+ handleStripeWebhook(request: HandleStripeWebhookRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: HandleStripeWebhookResponse) => void): ClientUnaryCall;
617
+ /** Get usage summary for billing period */
618
+ getUsageSummary(request: GetUsageSummaryRequest, callback: (error: ServiceError | null, response: GetUsageSummaryResponse) => void): ClientUnaryCall;
619
+ getUsageSummary(request: GetUsageSummaryRequest, metadata: Metadata, callback: (error: ServiceError | null, response: GetUsageSummaryResponse) => void): ClientUnaryCall;
620
+ getUsageSummary(request: GetUsageSummaryRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: GetUsageSummaryResponse) => void): ClientUnaryCall;
621
+ /** Get credit balance (if applicable) */
622
+ getCreditBalance(request: GetCreditBalanceRequest, callback: (error: ServiceError | null, response: GetCreditBalanceResponse) => void): ClientUnaryCall;
623
+ getCreditBalance(request: GetCreditBalanceRequest, metadata: Metadata, callback: (error: ServiceError | null, response: GetCreditBalanceResponse) => void): ClientUnaryCall;
624
+ getCreditBalance(request: GetCreditBalanceRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: GetCreditBalanceResponse) => void): ClientUnaryCall;
625
+ /** Update tax information */
626
+ updateTaxInfo(request: UpdateTaxInfoRequest, callback: (error: ServiceError | null, response: UpdateTaxInfoResponse) => void): ClientUnaryCall;
627
+ updateTaxInfo(request: UpdateTaxInfoRequest, metadata: Metadata, callback: (error: ServiceError | null, response: UpdateTaxInfoResponse) => void): ClientUnaryCall;
628
+ updateTaxInfo(request: UpdateTaxInfoRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: UpdateTaxInfoResponse) => void): ClientUnaryCall;
629
+ /** Download invoice PDF */
630
+ downloadInvoice(request: DownloadInvoiceRequest, callback: (error: ServiceError | null, response: DownloadInvoiceResponse) => void): ClientUnaryCall;
631
+ downloadInvoice(request: DownloadInvoiceRequest, metadata: Metadata, callback: (error: ServiceError | null, response: DownloadInvoiceResponse) => void): ClientUnaryCall;
632
+ downloadInvoice(request: DownloadInvoiceRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: DownloadInvoiceResponse) => void): ClientUnaryCall;
633
+ }
634
+ export declare const PaymentClient: {
635
+ new (address: string, credentials: ChannelCredentials, options?: Partial<ClientOptions>): PaymentClient;
636
+ service: typeof PaymentService;
637
+ serviceName: string;
638
+ };
639
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
640
+ export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
641
+ [K in keyof T]?: DeepPartial<T[K]>;
642
+ } : Partial<T>;
643
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
644
+ export type Exact<P, I extends P> = P extends Builtin ? P : P & {
645
+ [K in keyof P]: Exact<P[K], I[K]>;
646
+ } & {
647
+ [K in Exclude<keyof I, KeysOfUnion<P>>]: never;
648
+ };
649
+ export interface MessageFns<T> {
650
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
651
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
652
+ fromJSON(object: any): T;
653
+ toJSON(message: T): unknown;
654
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
655
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
656
+ }
657
+ export {};