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,1747 @@
1
+ "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v2.6.1
5
+ // protoc unknown
6
+ // source: weaveapi/payment/v1/subscription.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.Discount = exports.Address = exports.BillingDetails = exports.BankDetails = exports.CardDetails = exports.PaymentMethod = exports.SubscriptionFeatures = exports.PricingPlan = exports.SubscriptionStatus = exports.protobufPackage = void 0;
9
+ /* eslint-disable */
10
+ const wire_1 = require("@bufbuild/protobuf/wire");
11
+ const timestamp_pb_1 = require("../../../google/protobuf/timestamp.pb");
12
+ exports.protobufPackage = "weaveapi.payment.v1";
13
+ function createBaseSubscriptionStatus() {
14
+ return {
15
+ id: "",
16
+ status: "",
17
+ tier: "",
18
+ plan: undefined,
19
+ currentPeriodStart: undefined,
20
+ currentPeriodEnd: undefined,
21
+ cancelAt: undefined,
22
+ canceledAt: undefined,
23
+ cancelAtPeriodEnd: false,
24
+ defaultPaymentMethod: undefined,
25
+ currency: "",
26
+ amountCents: 0,
27
+ isTrial: false,
28
+ trialStart: undefined,
29
+ trialEnd: undefined,
30
+ activeDiscount: undefined,
31
+ createdAt: undefined,
32
+ updatedAt: undefined,
33
+ features: undefined,
34
+ };
35
+ }
36
+ exports.SubscriptionStatus = {
37
+ encode(message, writer = new wire_1.BinaryWriter()) {
38
+ if (message.id !== "") {
39
+ writer.uint32(10).string(message.id);
40
+ }
41
+ if (message.status !== "") {
42
+ writer.uint32(18).string(message.status);
43
+ }
44
+ if (message.tier !== "") {
45
+ writer.uint32(26).string(message.tier);
46
+ }
47
+ if (message.plan !== undefined) {
48
+ exports.PricingPlan.encode(message.plan, writer.uint32(34).fork()).join();
49
+ }
50
+ if (message.currentPeriodStart !== undefined) {
51
+ timestamp_pb_1.Timestamp.encode(toTimestamp(message.currentPeriodStart), writer.uint32(42).fork()).join();
52
+ }
53
+ if (message.currentPeriodEnd !== undefined) {
54
+ timestamp_pb_1.Timestamp.encode(toTimestamp(message.currentPeriodEnd), writer.uint32(50).fork()).join();
55
+ }
56
+ if (message.cancelAt !== undefined) {
57
+ timestamp_pb_1.Timestamp.encode(toTimestamp(message.cancelAt), writer.uint32(58).fork()).join();
58
+ }
59
+ if (message.canceledAt !== undefined) {
60
+ timestamp_pb_1.Timestamp.encode(toTimestamp(message.canceledAt), writer.uint32(66).fork()).join();
61
+ }
62
+ if (message.cancelAtPeriodEnd !== false) {
63
+ writer.uint32(72).bool(message.cancelAtPeriodEnd);
64
+ }
65
+ if (message.defaultPaymentMethod !== undefined) {
66
+ exports.PaymentMethod.encode(message.defaultPaymentMethod, writer.uint32(82).fork()).join();
67
+ }
68
+ if (message.currency !== "") {
69
+ writer.uint32(90).string(message.currency);
70
+ }
71
+ if (message.amountCents !== 0) {
72
+ writer.uint32(96).int64(message.amountCents);
73
+ }
74
+ if (message.isTrial !== false) {
75
+ writer.uint32(104).bool(message.isTrial);
76
+ }
77
+ if (message.trialStart !== undefined) {
78
+ timestamp_pb_1.Timestamp.encode(toTimestamp(message.trialStart), writer.uint32(114).fork()).join();
79
+ }
80
+ if (message.trialEnd !== undefined) {
81
+ timestamp_pb_1.Timestamp.encode(toTimestamp(message.trialEnd), writer.uint32(122).fork()).join();
82
+ }
83
+ if (message.activeDiscount !== undefined) {
84
+ exports.Discount.encode(message.activeDiscount, writer.uint32(130).fork()).join();
85
+ }
86
+ if (message.createdAt !== undefined) {
87
+ timestamp_pb_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(138).fork()).join();
88
+ }
89
+ if (message.updatedAt !== undefined) {
90
+ timestamp_pb_1.Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(146).fork()).join();
91
+ }
92
+ if (message.features !== undefined) {
93
+ exports.SubscriptionFeatures.encode(message.features, writer.uint32(154).fork()).join();
94
+ }
95
+ return writer;
96
+ },
97
+ decode(input, length) {
98
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
99
+ let end = length === undefined ? reader.len : reader.pos + length;
100
+ const message = createBaseSubscriptionStatus();
101
+ while (reader.pos < end) {
102
+ const tag = reader.uint32();
103
+ switch (tag >>> 3) {
104
+ case 1: {
105
+ if (tag !== 10) {
106
+ break;
107
+ }
108
+ message.id = reader.string();
109
+ continue;
110
+ }
111
+ case 2: {
112
+ if (tag !== 18) {
113
+ break;
114
+ }
115
+ message.status = reader.string();
116
+ continue;
117
+ }
118
+ case 3: {
119
+ if (tag !== 26) {
120
+ break;
121
+ }
122
+ message.tier = reader.string();
123
+ continue;
124
+ }
125
+ case 4: {
126
+ if (tag !== 34) {
127
+ break;
128
+ }
129
+ message.plan = exports.PricingPlan.decode(reader, reader.uint32());
130
+ continue;
131
+ }
132
+ case 5: {
133
+ if (tag !== 42) {
134
+ break;
135
+ }
136
+ message.currentPeriodStart = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
137
+ continue;
138
+ }
139
+ case 6: {
140
+ if (tag !== 50) {
141
+ break;
142
+ }
143
+ message.currentPeriodEnd = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
144
+ continue;
145
+ }
146
+ case 7: {
147
+ if (tag !== 58) {
148
+ break;
149
+ }
150
+ message.cancelAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
151
+ continue;
152
+ }
153
+ case 8: {
154
+ if (tag !== 66) {
155
+ break;
156
+ }
157
+ message.canceledAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
158
+ continue;
159
+ }
160
+ case 9: {
161
+ if (tag !== 72) {
162
+ break;
163
+ }
164
+ message.cancelAtPeriodEnd = reader.bool();
165
+ continue;
166
+ }
167
+ case 10: {
168
+ if (tag !== 82) {
169
+ break;
170
+ }
171
+ message.defaultPaymentMethod = exports.PaymentMethod.decode(reader, reader.uint32());
172
+ continue;
173
+ }
174
+ case 11: {
175
+ if (tag !== 90) {
176
+ break;
177
+ }
178
+ message.currency = reader.string();
179
+ continue;
180
+ }
181
+ case 12: {
182
+ if (tag !== 96) {
183
+ break;
184
+ }
185
+ message.amountCents = longToNumber(reader.int64());
186
+ continue;
187
+ }
188
+ case 13: {
189
+ if (tag !== 104) {
190
+ break;
191
+ }
192
+ message.isTrial = reader.bool();
193
+ continue;
194
+ }
195
+ case 14: {
196
+ if (tag !== 114) {
197
+ break;
198
+ }
199
+ message.trialStart = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
200
+ continue;
201
+ }
202
+ case 15: {
203
+ if (tag !== 122) {
204
+ break;
205
+ }
206
+ message.trialEnd = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
207
+ continue;
208
+ }
209
+ case 16: {
210
+ if (tag !== 130) {
211
+ break;
212
+ }
213
+ message.activeDiscount = exports.Discount.decode(reader, reader.uint32());
214
+ continue;
215
+ }
216
+ case 17: {
217
+ if (tag !== 138) {
218
+ break;
219
+ }
220
+ message.createdAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
221
+ continue;
222
+ }
223
+ case 18: {
224
+ if (tag !== 146) {
225
+ break;
226
+ }
227
+ message.updatedAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
228
+ continue;
229
+ }
230
+ case 19: {
231
+ if (tag !== 154) {
232
+ break;
233
+ }
234
+ message.features = exports.SubscriptionFeatures.decode(reader, reader.uint32());
235
+ continue;
236
+ }
237
+ }
238
+ if ((tag & 7) === 4 || tag === 0) {
239
+ break;
240
+ }
241
+ reader.skip(tag & 7);
242
+ }
243
+ return message;
244
+ },
245
+ fromJSON(object) {
246
+ return {
247
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
248
+ status: isSet(object.status) ? globalThis.String(object.status) : "",
249
+ tier: isSet(object.tier) ? globalThis.String(object.tier) : "",
250
+ plan: isSet(object.plan) ? exports.PricingPlan.fromJSON(object.plan) : undefined,
251
+ currentPeriodStart: isSet(object.currentPeriodStart) ? fromJsonTimestamp(object.currentPeriodStart) : undefined,
252
+ currentPeriodEnd: isSet(object.currentPeriodEnd) ? fromJsonTimestamp(object.currentPeriodEnd) : undefined,
253
+ cancelAt: isSet(object.cancelAt) ? fromJsonTimestamp(object.cancelAt) : undefined,
254
+ canceledAt: isSet(object.canceledAt) ? fromJsonTimestamp(object.canceledAt) : undefined,
255
+ cancelAtPeriodEnd: isSet(object.cancelAtPeriodEnd) ? globalThis.Boolean(object.cancelAtPeriodEnd) : false,
256
+ defaultPaymentMethod: isSet(object.defaultPaymentMethod)
257
+ ? exports.PaymentMethod.fromJSON(object.defaultPaymentMethod)
258
+ : undefined,
259
+ currency: isSet(object.currency) ? globalThis.String(object.currency) : "",
260
+ amountCents: isSet(object.amountCents) ? globalThis.Number(object.amountCents) : 0,
261
+ isTrial: isSet(object.isTrial) ? globalThis.Boolean(object.isTrial) : false,
262
+ trialStart: isSet(object.trialStart) ? fromJsonTimestamp(object.trialStart) : undefined,
263
+ trialEnd: isSet(object.trialEnd) ? fromJsonTimestamp(object.trialEnd) : undefined,
264
+ activeDiscount: isSet(object.activeDiscount) ? exports.Discount.fromJSON(object.activeDiscount) : undefined,
265
+ createdAt: isSet(object.createdAt) ? fromJsonTimestamp(object.createdAt) : undefined,
266
+ updatedAt: isSet(object.updatedAt) ? fromJsonTimestamp(object.updatedAt) : undefined,
267
+ features: isSet(object.features) ? exports.SubscriptionFeatures.fromJSON(object.features) : undefined,
268
+ };
269
+ },
270
+ toJSON(message) {
271
+ const obj = {};
272
+ if (message.id !== "") {
273
+ obj.id = message.id;
274
+ }
275
+ if (message.status !== "") {
276
+ obj.status = message.status;
277
+ }
278
+ if (message.tier !== "") {
279
+ obj.tier = message.tier;
280
+ }
281
+ if (message.plan !== undefined) {
282
+ obj.plan = exports.PricingPlan.toJSON(message.plan);
283
+ }
284
+ if (message.currentPeriodStart !== undefined) {
285
+ obj.currentPeriodStart = message.currentPeriodStart.toISOString();
286
+ }
287
+ if (message.currentPeriodEnd !== undefined) {
288
+ obj.currentPeriodEnd = message.currentPeriodEnd.toISOString();
289
+ }
290
+ if (message.cancelAt !== undefined) {
291
+ obj.cancelAt = message.cancelAt.toISOString();
292
+ }
293
+ if (message.canceledAt !== undefined) {
294
+ obj.canceledAt = message.canceledAt.toISOString();
295
+ }
296
+ if (message.cancelAtPeriodEnd !== false) {
297
+ obj.cancelAtPeriodEnd = message.cancelAtPeriodEnd;
298
+ }
299
+ if (message.defaultPaymentMethod !== undefined) {
300
+ obj.defaultPaymentMethod = exports.PaymentMethod.toJSON(message.defaultPaymentMethod);
301
+ }
302
+ if (message.currency !== "") {
303
+ obj.currency = message.currency;
304
+ }
305
+ if (message.amountCents !== 0) {
306
+ obj.amountCents = Math.round(message.amountCents);
307
+ }
308
+ if (message.isTrial !== false) {
309
+ obj.isTrial = message.isTrial;
310
+ }
311
+ if (message.trialStart !== undefined) {
312
+ obj.trialStart = message.trialStart.toISOString();
313
+ }
314
+ if (message.trialEnd !== undefined) {
315
+ obj.trialEnd = message.trialEnd.toISOString();
316
+ }
317
+ if (message.activeDiscount !== undefined) {
318
+ obj.activeDiscount = exports.Discount.toJSON(message.activeDiscount);
319
+ }
320
+ if (message.createdAt !== undefined) {
321
+ obj.createdAt = message.createdAt.toISOString();
322
+ }
323
+ if (message.updatedAt !== undefined) {
324
+ obj.updatedAt = message.updatedAt.toISOString();
325
+ }
326
+ if (message.features !== undefined) {
327
+ obj.features = exports.SubscriptionFeatures.toJSON(message.features);
328
+ }
329
+ return obj;
330
+ },
331
+ create(base) {
332
+ return exports.SubscriptionStatus.fromPartial(base !== null && base !== void 0 ? base : {});
333
+ },
334
+ fromPartial(object) {
335
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
336
+ const message = createBaseSubscriptionStatus();
337
+ message.id = (_a = object.id) !== null && _a !== void 0 ? _a : "";
338
+ message.status = (_b = object.status) !== null && _b !== void 0 ? _b : "";
339
+ message.tier = (_c = object.tier) !== null && _c !== void 0 ? _c : "";
340
+ message.plan = (object.plan !== undefined && object.plan !== null)
341
+ ? exports.PricingPlan.fromPartial(object.plan)
342
+ : undefined;
343
+ message.currentPeriodStart = (_d = object.currentPeriodStart) !== null && _d !== void 0 ? _d : undefined;
344
+ message.currentPeriodEnd = (_e = object.currentPeriodEnd) !== null && _e !== void 0 ? _e : undefined;
345
+ message.cancelAt = (_f = object.cancelAt) !== null && _f !== void 0 ? _f : undefined;
346
+ message.canceledAt = (_g = object.canceledAt) !== null && _g !== void 0 ? _g : undefined;
347
+ message.cancelAtPeriodEnd = (_h = object.cancelAtPeriodEnd) !== null && _h !== void 0 ? _h : false;
348
+ message.defaultPaymentMethod = (object.defaultPaymentMethod !== undefined && object.defaultPaymentMethod !== null)
349
+ ? exports.PaymentMethod.fromPartial(object.defaultPaymentMethod)
350
+ : undefined;
351
+ message.currency = (_j = object.currency) !== null && _j !== void 0 ? _j : "";
352
+ message.amountCents = (_k = object.amountCents) !== null && _k !== void 0 ? _k : 0;
353
+ message.isTrial = (_l = object.isTrial) !== null && _l !== void 0 ? _l : false;
354
+ message.trialStart = (_m = object.trialStart) !== null && _m !== void 0 ? _m : undefined;
355
+ message.trialEnd = (_o = object.trialEnd) !== null && _o !== void 0 ? _o : undefined;
356
+ message.activeDiscount = (object.activeDiscount !== undefined && object.activeDiscount !== null)
357
+ ? exports.Discount.fromPartial(object.activeDiscount)
358
+ : undefined;
359
+ message.createdAt = (_p = object.createdAt) !== null && _p !== void 0 ? _p : undefined;
360
+ message.updatedAt = (_q = object.updatedAt) !== null && _q !== void 0 ? _q : undefined;
361
+ message.features = (object.features !== undefined && object.features !== null)
362
+ ? exports.SubscriptionFeatures.fromPartial(object.features)
363
+ : undefined;
364
+ return message;
365
+ },
366
+ };
367
+ function createBasePricingPlan() {
368
+ return {
369
+ id: "",
370
+ productId: "",
371
+ name: "",
372
+ description: "",
373
+ amountCents: 0,
374
+ currency: "",
375
+ interval: "",
376
+ intervalCount: 0,
377
+ features: undefined,
378
+ isDefault: false,
379
+ isPopular: false,
380
+ highlights: [],
381
+ };
382
+ }
383
+ exports.PricingPlan = {
384
+ encode(message, writer = new wire_1.BinaryWriter()) {
385
+ if (message.id !== "") {
386
+ writer.uint32(10).string(message.id);
387
+ }
388
+ if (message.productId !== "") {
389
+ writer.uint32(18).string(message.productId);
390
+ }
391
+ if (message.name !== "") {
392
+ writer.uint32(26).string(message.name);
393
+ }
394
+ if (message.description !== "") {
395
+ writer.uint32(34).string(message.description);
396
+ }
397
+ if (message.amountCents !== 0) {
398
+ writer.uint32(40).int64(message.amountCents);
399
+ }
400
+ if (message.currency !== "") {
401
+ writer.uint32(50).string(message.currency);
402
+ }
403
+ if (message.interval !== "") {
404
+ writer.uint32(58).string(message.interval);
405
+ }
406
+ if (message.intervalCount !== 0) {
407
+ writer.uint32(64).int32(message.intervalCount);
408
+ }
409
+ if (message.features !== undefined) {
410
+ exports.SubscriptionFeatures.encode(message.features, writer.uint32(74).fork()).join();
411
+ }
412
+ if (message.isDefault !== false) {
413
+ writer.uint32(80).bool(message.isDefault);
414
+ }
415
+ if (message.isPopular !== false) {
416
+ writer.uint32(88).bool(message.isPopular);
417
+ }
418
+ for (const v of message.highlights) {
419
+ writer.uint32(98).string(v);
420
+ }
421
+ return writer;
422
+ },
423
+ decode(input, length) {
424
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
425
+ let end = length === undefined ? reader.len : reader.pos + length;
426
+ const message = createBasePricingPlan();
427
+ while (reader.pos < end) {
428
+ const tag = reader.uint32();
429
+ switch (tag >>> 3) {
430
+ case 1: {
431
+ if (tag !== 10) {
432
+ break;
433
+ }
434
+ message.id = reader.string();
435
+ continue;
436
+ }
437
+ case 2: {
438
+ if (tag !== 18) {
439
+ break;
440
+ }
441
+ message.productId = reader.string();
442
+ continue;
443
+ }
444
+ case 3: {
445
+ if (tag !== 26) {
446
+ break;
447
+ }
448
+ message.name = reader.string();
449
+ continue;
450
+ }
451
+ case 4: {
452
+ if (tag !== 34) {
453
+ break;
454
+ }
455
+ message.description = reader.string();
456
+ continue;
457
+ }
458
+ case 5: {
459
+ if (tag !== 40) {
460
+ break;
461
+ }
462
+ message.amountCents = longToNumber(reader.int64());
463
+ continue;
464
+ }
465
+ case 6: {
466
+ if (tag !== 50) {
467
+ break;
468
+ }
469
+ message.currency = reader.string();
470
+ continue;
471
+ }
472
+ case 7: {
473
+ if (tag !== 58) {
474
+ break;
475
+ }
476
+ message.interval = reader.string();
477
+ continue;
478
+ }
479
+ case 8: {
480
+ if (tag !== 64) {
481
+ break;
482
+ }
483
+ message.intervalCount = reader.int32();
484
+ continue;
485
+ }
486
+ case 9: {
487
+ if (tag !== 74) {
488
+ break;
489
+ }
490
+ message.features = exports.SubscriptionFeatures.decode(reader, reader.uint32());
491
+ continue;
492
+ }
493
+ case 10: {
494
+ if (tag !== 80) {
495
+ break;
496
+ }
497
+ message.isDefault = reader.bool();
498
+ continue;
499
+ }
500
+ case 11: {
501
+ if (tag !== 88) {
502
+ break;
503
+ }
504
+ message.isPopular = reader.bool();
505
+ continue;
506
+ }
507
+ case 12: {
508
+ if (tag !== 98) {
509
+ break;
510
+ }
511
+ message.highlights.push(reader.string());
512
+ continue;
513
+ }
514
+ }
515
+ if ((tag & 7) === 4 || tag === 0) {
516
+ break;
517
+ }
518
+ reader.skip(tag & 7);
519
+ }
520
+ return message;
521
+ },
522
+ fromJSON(object) {
523
+ return {
524
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
525
+ productId: isSet(object.productId) ? globalThis.String(object.productId) : "",
526
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
527
+ description: isSet(object.description) ? globalThis.String(object.description) : "",
528
+ amountCents: isSet(object.amountCents) ? globalThis.Number(object.amountCents) : 0,
529
+ currency: isSet(object.currency) ? globalThis.String(object.currency) : "",
530
+ interval: isSet(object.interval) ? globalThis.String(object.interval) : "",
531
+ intervalCount: isSet(object.intervalCount) ? globalThis.Number(object.intervalCount) : 0,
532
+ features: isSet(object.features) ? exports.SubscriptionFeatures.fromJSON(object.features) : undefined,
533
+ isDefault: isSet(object.isDefault) ? globalThis.Boolean(object.isDefault) : false,
534
+ isPopular: isSet(object.isPopular) ? globalThis.Boolean(object.isPopular) : false,
535
+ highlights: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.highlights)
536
+ ? object.highlights.map((e) => globalThis.String(e))
537
+ : [],
538
+ };
539
+ },
540
+ toJSON(message) {
541
+ var _a;
542
+ const obj = {};
543
+ if (message.id !== "") {
544
+ obj.id = message.id;
545
+ }
546
+ if (message.productId !== "") {
547
+ obj.productId = message.productId;
548
+ }
549
+ if (message.name !== "") {
550
+ obj.name = message.name;
551
+ }
552
+ if (message.description !== "") {
553
+ obj.description = message.description;
554
+ }
555
+ if (message.amountCents !== 0) {
556
+ obj.amountCents = Math.round(message.amountCents);
557
+ }
558
+ if (message.currency !== "") {
559
+ obj.currency = message.currency;
560
+ }
561
+ if (message.interval !== "") {
562
+ obj.interval = message.interval;
563
+ }
564
+ if (message.intervalCount !== 0) {
565
+ obj.intervalCount = Math.round(message.intervalCount);
566
+ }
567
+ if (message.features !== undefined) {
568
+ obj.features = exports.SubscriptionFeatures.toJSON(message.features);
569
+ }
570
+ if (message.isDefault !== false) {
571
+ obj.isDefault = message.isDefault;
572
+ }
573
+ if (message.isPopular !== false) {
574
+ obj.isPopular = message.isPopular;
575
+ }
576
+ if ((_a = message.highlights) === null || _a === void 0 ? void 0 : _a.length) {
577
+ obj.highlights = message.highlights;
578
+ }
579
+ return obj;
580
+ },
581
+ create(base) {
582
+ return exports.PricingPlan.fromPartial(base !== null && base !== void 0 ? base : {});
583
+ },
584
+ fromPartial(object) {
585
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
586
+ const message = createBasePricingPlan();
587
+ message.id = (_a = object.id) !== null && _a !== void 0 ? _a : "";
588
+ message.productId = (_b = object.productId) !== null && _b !== void 0 ? _b : "";
589
+ message.name = (_c = object.name) !== null && _c !== void 0 ? _c : "";
590
+ message.description = (_d = object.description) !== null && _d !== void 0 ? _d : "";
591
+ message.amountCents = (_e = object.amountCents) !== null && _e !== void 0 ? _e : 0;
592
+ message.currency = (_f = object.currency) !== null && _f !== void 0 ? _f : "";
593
+ message.interval = (_g = object.interval) !== null && _g !== void 0 ? _g : "";
594
+ message.intervalCount = (_h = object.intervalCount) !== null && _h !== void 0 ? _h : 0;
595
+ message.features = (object.features !== undefined && object.features !== null)
596
+ ? exports.SubscriptionFeatures.fromPartial(object.features)
597
+ : undefined;
598
+ message.isDefault = (_j = object.isDefault) !== null && _j !== void 0 ? _j : false;
599
+ message.isPopular = (_k = object.isPopular) !== null && _k !== void 0 ? _k : false;
600
+ message.highlights = ((_l = object.highlights) === null || _l === void 0 ? void 0 : _l.map((e) => e)) || [];
601
+ return message;
602
+ },
603
+ };
604
+ function createBaseSubscriptionFeatures() {
605
+ return {
606
+ apiRequestsPerHour: 0,
607
+ apiRequestsPerDay: 0,
608
+ apiRequestsPerMonth: 0,
609
+ unlimitedRequests: false,
610
+ apiKeysLimit: 0,
611
+ unlimitedApiKeys: false,
612
+ webhookAccess: false,
613
+ exportAccess: false,
614
+ prioritySupport: false,
615
+ customLimits: false,
616
+ teamAccess: false,
617
+ teamMembersLimit: 0,
618
+ ssoAccess: false,
619
+ auditLogs: false,
620
+ slaGuarantee: false,
621
+ };
622
+ }
623
+ exports.SubscriptionFeatures = {
624
+ encode(message, writer = new wire_1.BinaryWriter()) {
625
+ if (message.apiRequestsPerHour !== 0) {
626
+ writer.uint32(8).int64(message.apiRequestsPerHour);
627
+ }
628
+ if (message.apiRequestsPerDay !== 0) {
629
+ writer.uint32(16).int64(message.apiRequestsPerDay);
630
+ }
631
+ if (message.apiRequestsPerMonth !== 0) {
632
+ writer.uint32(24).int64(message.apiRequestsPerMonth);
633
+ }
634
+ if (message.unlimitedRequests !== false) {
635
+ writer.uint32(32).bool(message.unlimitedRequests);
636
+ }
637
+ if (message.apiKeysLimit !== 0) {
638
+ writer.uint32(40).int32(message.apiKeysLimit);
639
+ }
640
+ if (message.unlimitedApiKeys !== false) {
641
+ writer.uint32(48).bool(message.unlimitedApiKeys);
642
+ }
643
+ if (message.webhookAccess !== false) {
644
+ writer.uint32(56).bool(message.webhookAccess);
645
+ }
646
+ if (message.exportAccess !== false) {
647
+ writer.uint32(64).bool(message.exportAccess);
648
+ }
649
+ if (message.prioritySupport !== false) {
650
+ writer.uint32(72).bool(message.prioritySupport);
651
+ }
652
+ if (message.customLimits !== false) {
653
+ writer.uint32(80).bool(message.customLimits);
654
+ }
655
+ if (message.teamAccess !== false) {
656
+ writer.uint32(88).bool(message.teamAccess);
657
+ }
658
+ if (message.teamMembersLimit !== 0) {
659
+ writer.uint32(96).int32(message.teamMembersLimit);
660
+ }
661
+ if (message.ssoAccess !== false) {
662
+ writer.uint32(104).bool(message.ssoAccess);
663
+ }
664
+ if (message.auditLogs !== false) {
665
+ writer.uint32(112).bool(message.auditLogs);
666
+ }
667
+ if (message.slaGuarantee !== false) {
668
+ writer.uint32(120).bool(message.slaGuarantee);
669
+ }
670
+ return writer;
671
+ },
672
+ decode(input, length) {
673
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
674
+ let end = length === undefined ? reader.len : reader.pos + length;
675
+ const message = createBaseSubscriptionFeatures();
676
+ while (reader.pos < end) {
677
+ const tag = reader.uint32();
678
+ switch (tag >>> 3) {
679
+ case 1: {
680
+ if (tag !== 8) {
681
+ break;
682
+ }
683
+ message.apiRequestsPerHour = longToNumber(reader.int64());
684
+ continue;
685
+ }
686
+ case 2: {
687
+ if (tag !== 16) {
688
+ break;
689
+ }
690
+ message.apiRequestsPerDay = longToNumber(reader.int64());
691
+ continue;
692
+ }
693
+ case 3: {
694
+ if (tag !== 24) {
695
+ break;
696
+ }
697
+ message.apiRequestsPerMonth = longToNumber(reader.int64());
698
+ continue;
699
+ }
700
+ case 4: {
701
+ if (tag !== 32) {
702
+ break;
703
+ }
704
+ message.unlimitedRequests = reader.bool();
705
+ continue;
706
+ }
707
+ case 5: {
708
+ if (tag !== 40) {
709
+ break;
710
+ }
711
+ message.apiKeysLimit = reader.int32();
712
+ continue;
713
+ }
714
+ case 6: {
715
+ if (tag !== 48) {
716
+ break;
717
+ }
718
+ message.unlimitedApiKeys = reader.bool();
719
+ continue;
720
+ }
721
+ case 7: {
722
+ if (tag !== 56) {
723
+ break;
724
+ }
725
+ message.webhookAccess = reader.bool();
726
+ continue;
727
+ }
728
+ case 8: {
729
+ if (tag !== 64) {
730
+ break;
731
+ }
732
+ message.exportAccess = reader.bool();
733
+ continue;
734
+ }
735
+ case 9: {
736
+ if (tag !== 72) {
737
+ break;
738
+ }
739
+ message.prioritySupport = reader.bool();
740
+ continue;
741
+ }
742
+ case 10: {
743
+ if (tag !== 80) {
744
+ break;
745
+ }
746
+ message.customLimits = reader.bool();
747
+ continue;
748
+ }
749
+ case 11: {
750
+ if (tag !== 88) {
751
+ break;
752
+ }
753
+ message.teamAccess = reader.bool();
754
+ continue;
755
+ }
756
+ case 12: {
757
+ if (tag !== 96) {
758
+ break;
759
+ }
760
+ message.teamMembersLimit = reader.int32();
761
+ continue;
762
+ }
763
+ case 13: {
764
+ if (tag !== 104) {
765
+ break;
766
+ }
767
+ message.ssoAccess = reader.bool();
768
+ continue;
769
+ }
770
+ case 14: {
771
+ if (tag !== 112) {
772
+ break;
773
+ }
774
+ message.auditLogs = reader.bool();
775
+ continue;
776
+ }
777
+ case 15: {
778
+ if (tag !== 120) {
779
+ break;
780
+ }
781
+ message.slaGuarantee = reader.bool();
782
+ continue;
783
+ }
784
+ }
785
+ if ((tag & 7) === 4 || tag === 0) {
786
+ break;
787
+ }
788
+ reader.skip(tag & 7);
789
+ }
790
+ return message;
791
+ },
792
+ fromJSON(object) {
793
+ return {
794
+ apiRequestsPerHour: isSet(object.apiRequestsPerHour) ? globalThis.Number(object.apiRequestsPerHour) : 0,
795
+ apiRequestsPerDay: isSet(object.apiRequestsPerDay) ? globalThis.Number(object.apiRequestsPerDay) : 0,
796
+ apiRequestsPerMonth: isSet(object.apiRequestsPerMonth) ? globalThis.Number(object.apiRequestsPerMonth) : 0,
797
+ unlimitedRequests: isSet(object.unlimitedRequests) ? globalThis.Boolean(object.unlimitedRequests) : false,
798
+ apiKeysLimit: isSet(object.apiKeysLimit) ? globalThis.Number(object.apiKeysLimit) : 0,
799
+ unlimitedApiKeys: isSet(object.unlimitedApiKeys) ? globalThis.Boolean(object.unlimitedApiKeys) : false,
800
+ webhookAccess: isSet(object.webhookAccess) ? globalThis.Boolean(object.webhookAccess) : false,
801
+ exportAccess: isSet(object.exportAccess) ? globalThis.Boolean(object.exportAccess) : false,
802
+ prioritySupport: isSet(object.prioritySupport) ? globalThis.Boolean(object.prioritySupport) : false,
803
+ customLimits: isSet(object.customLimits) ? globalThis.Boolean(object.customLimits) : false,
804
+ teamAccess: isSet(object.teamAccess) ? globalThis.Boolean(object.teamAccess) : false,
805
+ teamMembersLimit: isSet(object.teamMembersLimit) ? globalThis.Number(object.teamMembersLimit) : 0,
806
+ ssoAccess: isSet(object.ssoAccess) ? globalThis.Boolean(object.ssoAccess) : false,
807
+ auditLogs: isSet(object.auditLogs) ? globalThis.Boolean(object.auditLogs) : false,
808
+ slaGuarantee: isSet(object.slaGuarantee) ? globalThis.Boolean(object.slaGuarantee) : false,
809
+ };
810
+ },
811
+ toJSON(message) {
812
+ const obj = {};
813
+ if (message.apiRequestsPerHour !== 0) {
814
+ obj.apiRequestsPerHour = Math.round(message.apiRequestsPerHour);
815
+ }
816
+ if (message.apiRequestsPerDay !== 0) {
817
+ obj.apiRequestsPerDay = Math.round(message.apiRequestsPerDay);
818
+ }
819
+ if (message.apiRequestsPerMonth !== 0) {
820
+ obj.apiRequestsPerMonth = Math.round(message.apiRequestsPerMonth);
821
+ }
822
+ if (message.unlimitedRequests !== false) {
823
+ obj.unlimitedRequests = message.unlimitedRequests;
824
+ }
825
+ if (message.apiKeysLimit !== 0) {
826
+ obj.apiKeysLimit = Math.round(message.apiKeysLimit);
827
+ }
828
+ if (message.unlimitedApiKeys !== false) {
829
+ obj.unlimitedApiKeys = message.unlimitedApiKeys;
830
+ }
831
+ if (message.webhookAccess !== false) {
832
+ obj.webhookAccess = message.webhookAccess;
833
+ }
834
+ if (message.exportAccess !== false) {
835
+ obj.exportAccess = message.exportAccess;
836
+ }
837
+ if (message.prioritySupport !== false) {
838
+ obj.prioritySupport = message.prioritySupport;
839
+ }
840
+ if (message.customLimits !== false) {
841
+ obj.customLimits = message.customLimits;
842
+ }
843
+ if (message.teamAccess !== false) {
844
+ obj.teamAccess = message.teamAccess;
845
+ }
846
+ if (message.teamMembersLimit !== 0) {
847
+ obj.teamMembersLimit = Math.round(message.teamMembersLimit);
848
+ }
849
+ if (message.ssoAccess !== false) {
850
+ obj.ssoAccess = message.ssoAccess;
851
+ }
852
+ if (message.auditLogs !== false) {
853
+ obj.auditLogs = message.auditLogs;
854
+ }
855
+ if (message.slaGuarantee !== false) {
856
+ obj.slaGuarantee = message.slaGuarantee;
857
+ }
858
+ return obj;
859
+ },
860
+ create(base) {
861
+ return exports.SubscriptionFeatures.fromPartial(base !== null && base !== void 0 ? base : {});
862
+ },
863
+ fromPartial(object) {
864
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
865
+ const message = createBaseSubscriptionFeatures();
866
+ message.apiRequestsPerHour = (_a = object.apiRequestsPerHour) !== null && _a !== void 0 ? _a : 0;
867
+ message.apiRequestsPerDay = (_b = object.apiRequestsPerDay) !== null && _b !== void 0 ? _b : 0;
868
+ message.apiRequestsPerMonth = (_c = object.apiRequestsPerMonth) !== null && _c !== void 0 ? _c : 0;
869
+ message.unlimitedRequests = (_d = object.unlimitedRequests) !== null && _d !== void 0 ? _d : false;
870
+ message.apiKeysLimit = (_e = object.apiKeysLimit) !== null && _e !== void 0 ? _e : 0;
871
+ message.unlimitedApiKeys = (_f = object.unlimitedApiKeys) !== null && _f !== void 0 ? _f : false;
872
+ message.webhookAccess = (_g = object.webhookAccess) !== null && _g !== void 0 ? _g : false;
873
+ message.exportAccess = (_h = object.exportAccess) !== null && _h !== void 0 ? _h : false;
874
+ message.prioritySupport = (_j = object.prioritySupport) !== null && _j !== void 0 ? _j : false;
875
+ message.customLimits = (_k = object.customLimits) !== null && _k !== void 0 ? _k : false;
876
+ message.teamAccess = (_l = object.teamAccess) !== null && _l !== void 0 ? _l : false;
877
+ message.teamMembersLimit = (_m = object.teamMembersLimit) !== null && _m !== void 0 ? _m : 0;
878
+ message.ssoAccess = (_o = object.ssoAccess) !== null && _o !== void 0 ? _o : false;
879
+ message.auditLogs = (_p = object.auditLogs) !== null && _p !== void 0 ? _p : false;
880
+ message.slaGuarantee = (_q = object.slaGuarantee) !== null && _q !== void 0 ? _q : false;
881
+ return message;
882
+ },
883
+ };
884
+ function createBasePaymentMethod() {
885
+ return {
886
+ id: "",
887
+ type: "",
888
+ isDefault: false,
889
+ card: undefined,
890
+ bank: undefined,
891
+ billingDetails: undefined,
892
+ createdAt: undefined,
893
+ };
894
+ }
895
+ exports.PaymentMethod = {
896
+ encode(message, writer = new wire_1.BinaryWriter()) {
897
+ if (message.id !== "") {
898
+ writer.uint32(10).string(message.id);
899
+ }
900
+ if (message.type !== "") {
901
+ writer.uint32(18).string(message.type);
902
+ }
903
+ if (message.isDefault !== false) {
904
+ writer.uint32(24).bool(message.isDefault);
905
+ }
906
+ if (message.card !== undefined) {
907
+ exports.CardDetails.encode(message.card, writer.uint32(34).fork()).join();
908
+ }
909
+ if (message.bank !== undefined) {
910
+ exports.BankDetails.encode(message.bank, writer.uint32(42).fork()).join();
911
+ }
912
+ if (message.billingDetails !== undefined) {
913
+ exports.BillingDetails.encode(message.billingDetails, writer.uint32(50).fork()).join();
914
+ }
915
+ if (message.createdAt !== undefined) {
916
+ timestamp_pb_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(58).fork()).join();
917
+ }
918
+ return writer;
919
+ },
920
+ decode(input, length) {
921
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
922
+ let end = length === undefined ? reader.len : reader.pos + length;
923
+ const message = createBasePaymentMethod();
924
+ while (reader.pos < end) {
925
+ const tag = reader.uint32();
926
+ switch (tag >>> 3) {
927
+ case 1: {
928
+ if (tag !== 10) {
929
+ break;
930
+ }
931
+ message.id = reader.string();
932
+ continue;
933
+ }
934
+ case 2: {
935
+ if (tag !== 18) {
936
+ break;
937
+ }
938
+ message.type = reader.string();
939
+ continue;
940
+ }
941
+ case 3: {
942
+ if (tag !== 24) {
943
+ break;
944
+ }
945
+ message.isDefault = reader.bool();
946
+ continue;
947
+ }
948
+ case 4: {
949
+ if (tag !== 34) {
950
+ break;
951
+ }
952
+ message.card = exports.CardDetails.decode(reader, reader.uint32());
953
+ continue;
954
+ }
955
+ case 5: {
956
+ if (tag !== 42) {
957
+ break;
958
+ }
959
+ message.bank = exports.BankDetails.decode(reader, reader.uint32());
960
+ continue;
961
+ }
962
+ case 6: {
963
+ if (tag !== 50) {
964
+ break;
965
+ }
966
+ message.billingDetails = exports.BillingDetails.decode(reader, reader.uint32());
967
+ continue;
968
+ }
969
+ case 7: {
970
+ if (tag !== 58) {
971
+ break;
972
+ }
973
+ message.createdAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
974
+ continue;
975
+ }
976
+ }
977
+ if ((tag & 7) === 4 || tag === 0) {
978
+ break;
979
+ }
980
+ reader.skip(tag & 7);
981
+ }
982
+ return message;
983
+ },
984
+ fromJSON(object) {
985
+ return {
986
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
987
+ type: isSet(object.type) ? globalThis.String(object.type) : "",
988
+ isDefault: isSet(object.isDefault) ? globalThis.Boolean(object.isDefault) : false,
989
+ card: isSet(object.card) ? exports.CardDetails.fromJSON(object.card) : undefined,
990
+ bank: isSet(object.bank) ? exports.BankDetails.fromJSON(object.bank) : undefined,
991
+ billingDetails: isSet(object.billingDetails) ? exports.BillingDetails.fromJSON(object.billingDetails) : undefined,
992
+ createdAt: isSet(object.createdAt) ? fromJsonTimestamp(object.createdAt) : undefined,
993
+ };
994
+ },
995
+ toJSON(message) {
996
+ const obj = {};
997
+ if (message.id !== "") {
998
+ obj.id = message.id;
999
+ }
1000
+ if (message.type !== "") {
1001
+ obj.type = message.type;
1002
+ }
1003
+ if (message.isDefault !== false) {
1004
+ obj.isDefault = message.isDefault;
1005
+ }
1006
+ if (message.card !== undefined) {
1007
+ obj.card = exports.CardDetails.toJSON(message.card);
1008
+ }
1009
+ if (message.bank !== undefined) {
1010
+ obj.bank = exports.BankDetails.toJSON(message.bank);
1011
+ }
1012
+ if (message.billingDetails !== undefined) {
1013
+ obj.billingDetails = exports.BillingDetails.toJSON(message.billingDetails);
1014
+ }
1015
+ if (message.createdAt !== undefined) {
1016
+ obj.createdAt = message.createdAt.toISOString();
1017
+ }
1018
+ return obj;
1019
+ },
1020
+ create(base) {
1021
+ return exports.PaymentMethod.fromPartial(base !== null && base !== void 0 ? base : {});
1022
+ },
1023
+ fromPartial(object) {
1024
+ var _a, _b, _c, _d;
1025
+ const message = createBasePaymentMethod();
1026
+ message.id = (_a = object.id) !== null && _a !== void 0 ? _a : "";
1027
+ message.type = (_b = object.type) !== null && _b !== void 0 ? _b : "";
1028
+ message.isDefault = (_c = object.isDefault) !== null && _c !== void 0 ? _c : false;
1029
+ message.card = (object.card !== undefined && object.card !== null)
1030
+ ? exports.CardDetails.fromPartial(object.card)
1031
+ : undefined;
1032
+ message.bank = (object.bank !== undefined && object.bank !== null)
1033
+ ? exports.BankDetails.fromPartial(object.bank)
1034
+ : undefined;
1035
+ message.billingDetails = (object.billingDetails !== undefined && object.billingDetails !== null)
1036
+ ? exports.BillingDetails.fromPartial(object.billingDetails)
1037
+ : undefined;
1038
+ message.createdAt = (_d = object.createdAt) !== null && _d !== void 0 ? _d : undefined;
1039
+ return message;
1040
+ },
1041
+ };
1042
+ function createBaseCardDetails() {
1043
+ return { brand: "", last4: "", expMonth: 0, expYear: 0, funding: "", country: "", fingerprint: "" };
1044
+ }
1045
+ exports.CardDetails = {
1046
+ encode(message, writer = new wire_1.BinaryWriter()) {
1047
+ if (message.brand !== "") {
1048
+ writer.uint32(10).string(message.brand);
1049
+ }
1050
+ if (message.last4 !== "") {
1051
+ writer.uint32(18).string(message.last4);
1052
+ }
1053
+ if (message.expMonth !== 0) {
1054
+ writer.uint32(24).int32(message.expMonth);
1055
+ }
1056
+ if (message.expYear !== 0) {
1057
+ writer.uint32(32).int32(message.expYear);
1058
+ }
1059
+ if (message.funding !== "") {
1060
+ writer.uint32(42).string(message.funding);
1061
+ }
1062
+ if (message.country !== "") {
1063
+ writer.uint32(50).string(message.country);
1064
+ }
1065
+ if (message.fingerprint !== "") {
1066
+ writer.uint32(58).string(message.fingerprint);
1067
+ }
1068
+ return writer;
1069
+ },
1070
+ decode(input, length) {
1071
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1072
+ let end = length === undefined ? reader.len : reader.pos + length;
1073
+ const message = createBaseCardDetails();
1074
+ while (reader.pos < end) {
1075
+ const tag = reader.uint32();
1076
+ switch (tag >>> 3) {
1077
+ case 1: {
1078
+ if (tag !== 10) {
1079
+ break;
1080
+ }
1081
+ message.brand = reader.string();
1082
+ continue;
1083
+ }
1084
+ case 2: {
1085
+ if (tag !== 18) {
1086
+ break;
1087
+ }
1088
+ message.last4 = reader.string();
1089
+ continue;
1090
+ }
1091
+ case 3: {
1092
+ if (tag !== 24) {
1093
+ break;
1094
+ }
1095
+ message.expMonth = reader.int32();
1096
+ continue;
1097
+ }
1098
+ case 4: {
1099
+ if (tag !== 32) {
1100
+ break;
1101
+ }
1102
+ message.expYear = reader.int32();
1103
+ continue;
1104
+ }
1105
+ case 5: {
1106
+ if (tag !== 42) {
1107
+ break;
1108
+ }
1109
+ message.funding = reader.string();
1110
+ continue;
1111
+ }
1112
+ case 6: {
1113
+ if (tag !== 50) {
1114
+ break;
1115
+ }
1116
+ message.country = reader.string();
1117
+ continue;
1118
+ }
1119
+ case 7: {
1120
+ if (tag !== 58) {
1121
+ break;
1122
+ }
1123
+ message.fingerprint = reader.string();
1124
+ continue;
1125
+ }
1126
+ }
1127
+ if ((tag & 7) === 4 || tag === 0) {
1128
+ break;
1129
+ }
1130
+ reader.skip(tag & 7);
1131
+ }
1132
+ return message;
1133
+ },
1134
+ fromJSON(object) {
1135
+ return {
1136
+ brand: isSet(object.brand) ? globalThis.String(object.brand) : "",
1137
+ last4: isSet(object.last4) ? globalThis.String(object.last4) : "",
1138
+ expMonth: isSet(object.expMonth) ? globalThis.Number(object.expMonth) : 0,
1139
+ expYear: isSet(object.expYear) ? globalThis.Number(object.expYear) : 0,
1140
+ funding: isSet(object.funding) ? globalThis.String(object.funding) : "",
1141
+ country: isSet(object.country) ? globalThis.String(object.country) : "",
1142
+ fingerprint: isSet(object.fingerprint) ? globalThis.String(object.fingerprint) : "",
1143
+ };
1144
+ },
1145
+ toJSON(message) {
1146
+ const obj = {};
1147
+ if (message.brand !== "") {
1148
+ obj.brand = message.brand;
1149
+ }
1150
+ if (message.last4 !== "") {
1151
+ obj.last4 = message.last4;
1152
+ }
1153
+ if (message.expMonth !== 0) {
1154
+ obj.expMonth = Math.round(message.expMonth);
1155
+ }
1156
+ if (message.expYear !== 0) {
1157
+ obj.expYear = Math.round(message.expYear);
1158
+ }
1159
+ if (message.funding !== "") {
1160
+ obj.funding = message.funding;
1161
+ }
1162
+ if (message.country !== "") {
1163
+ obj.country = message.country;
1164
+ }
1165
+ if (message.fingerprint !== "") {
1166
+ obj.fingerprint = message.fingerprint;
1167
+ }
1168
+ return obj;
1169
+ },
1170
+ create(base) {
1171
+ return exports.CardDetails.fromPartial(base !== null && base !== void 0 ? base : {});
1172
+ },
1173
+ fromPartial(object) {
1174
+ var _a, _b, _c, _d, _e, _f, _g;
1175
+ const message = createBaseCardDetails();
1176
+ message.brand = (_a = object.brand) !== null && _a !== void 0 ? _a : "";
1177
+ message.last4 = (_b = object.last4) !== null && _b !== void 0 ? _b : "";
1178
+ message.expMonth = (_c = object.expMonth) !== null && _c !== void 0 ? _c : 0;
1179
+ message.expYear = (_d = object.expYear) !== null && _d !== void 0 ? _d : 0;
1180
+ message.funding = (_e = object.funding) !== null && _e !== void 0 ? _e : "";
1181
+ message.country = (_f = object.country) !== null && _f !== void 0 ? _f : "";
1182
+ message.fingerprint = (_g = object.fingerprint) !== null && _g !== void 0 ? _g : "";
1183
+ return message;
1184
+ },
1185
+ };
1186
+ function createBaseBankDetails() {
1187
+ return { bankName: "", last4: "", accountType: "", country: "", currency: "" };
1188
+ }
1189
+ exports.BankDetails = {
1190
+ encode(message, writer = new wire_1.BinaryWriter()) {
1191
+ if (message.bankName !== "") {
1192
+ writer.uint32(10).string(message.bankName);
1193
+ }
1194
+ if (message.last4 !== "") {
1195
+ writer.uint32(18).string(message.last4);
1196
+ }
1197
+ if (message.accountType !== "") {
1198
+ writer.uint32(26).string(message.accountType);
1199
+ }
1200
+ if (message.country !== "") {
1201
+ writer.uint32(34).string(message.country);
1202
+ }
1203
+ if (message.currency !== "") {
1204
+ writer.uint32(42).string(message.currency);
1205
+ }
1206
+ return writer;
1207
+ },
1208
+ decode(input, length) {
1209
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1210
+ let end = length === undefined ? reader.len : reader.pos + length;
1211
+ const message = createBaseBankDetails();
1212
+ while (reader.pos < end) {
1213
+ const tag = reader.uint32();
1214
+ switch (tag >>> 3) {
1215
+ case 1: {
1216
+ if (tag !== 10) {
1217
+ break;
1218
+ }
1219
+ message.bankName = reader.string();
1220
+ continue;
1221
+ }
1222
+ case 2: {
1223
+ if (tag !== 18) {
1224
+ break;
1225
+ }
1226
+ message.last4 = reader.string();
1227
+ continue;
1228
+ }
1229
+ case 3: {
1230
+ if (tag !== 26) {
1231
+ break;
1232
+ }
1233
+ message.accountType = reader.string();
1234
+ continue;
1235
+ }
1236
+ case 4: {
1237
+ if (tag !== 34) {
1238
+ break;
1239
+ }
1240
+ message.country = reader.string();
1241
+ continue;
1242
+ }
1243
+ case 5: {
1244
+ if (tag !== 42) {
1245
+ break;
1246
+ }
1247
+ message.currency = reader.string();
1248
+ continue;
1249
+ }
1250
+ }
1251
+ if ((tag & 7) === 4 || tag === 0) {
1252
+ break;
1253
+ }
1254
+ reader.skip(tag & 7);
1255
+ }
1256
+ return message;
1257
+ },
1258
+ fromJSON(object) {
1259
+ return {
1260
+ bankName: isSet(object.bankName) ? globalThis.String(object.bankName) : "",
1261
+ last4: isSet(object.last4) ? globalThis.String(object.last4) : "",
1262
+ accountType: isSet(object.accountType) ? globalThis.String(object.accountType) : "",
1263
+ country: isSet(object.country) ? globalThis.String(object.country) : "",
1264
+ currency: isSet(object.currency) ? globalThis.String(object.currency) : "",
1265
+ };
1266
+ },
1267
+ toJSON(message) {
1268
+ const obj = {};
1269
+ if (message.bankName !== "") {
1270
+ obj.bankName = message.bankName;
1271
+ }
1272
+ if (message.last4 !== "") {
1273
+ obj.last4 = message.last4;
1274
+ }
1275
+ if (message.accountType !== "") {
1276
+ obj.accountType = message.accountType;
1277
+ }
1278
+ if (message.country !== "") {
1279
+ obj.country = message.country;
1280
+ }
1281
+ if (message.currency !== "") {
1282
+ obj.currency = message.currency;
1283
+ }
1284
+ return obj;
1285
+ },
1286
+ create(base) {
1287
+ return exports.BankDetails.fromPartial(base !== null && base !== void 0 ? base : {});
1288
+ },
1289
+ fromPartial(object) {
1290
+ var _a, _b, _c, _d, _e;
1291
+ const message = createBaseBankDetails();
1292
+ message.bankName = (_a = object.bankName) !== null && _a !== void 0 ? _a : "";
1293
+ message.last4 = (_b = object.last4) !== null && _b !== void 0 ? _b : "";
1294
+ message.accountType = (_c = object.accountType) !== null && _c !== void 0 ? _c : "";
1295
+ message.country = (_d = object.country) !== null && _d !== void 0 ? _d : "";
1296
+ message.currency = (_e = object.currency) !== null && _e !== void 0 ? _e : "";
1297
+ return message;
1298
+ },
1299
+ };
1300
+ function createBaseBillingDetails() {
1301
+ return { name: "", email: "", phone: "", address: undefined };
1302
+ }
1303
+ exports.BillingDetails = {
1304
+ encode(message, writer = new wire_1.BinaryWriter()) {
1305
+ if (message.name !== "") {
1306
+ writer.uint32(10).string(message.name);
1307
+ }
1308
+ if (message.email !== "") {
1309
+ writer.uint32(18).string(message.email);
1310
+ }
1311
+ if (message.phone !== "") {
1312
+ writer.uint32(26).string(message.phone);
1313
+ }
1314
+ if (message.address !== undefined) {
1315
+ exports.Address.encode(message.address, writer.uint32(34).fork()).join();
1316
+ }
1317
+ return writer;
1318
+ },
1319
+ decode(input, length) {
1320
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1321
+ let end = length === undefined ? reader.len : reader.pos + length;
1322
+ const message = createBaseBillingDetails();
1323
+ while (reader.pos < end) {
1324
+ const tag = reader.uint32();
1325
+ switch (tag >>> 3) {
1326
+ case 1: {
1327
+ if (tag !== 10) {
1328
+ break;
1329
+ }
1330
+ message.name = reader.string();
1331
+ continue;
1332
+ }
1333
+ case 2: {
1334
+ if (tag !== 18) {
1335
+ break;
1336
+ }
1337
+ message.email = reader.string();
1338
+ continue;
1339
+ }
1340
+ case 3: {
1341
+ if (tag !== 26) {
1342
+ break;
1343
+ }
1344
+ message.phone = reader.string();
1345
+ continue;
1346
+ }
1347
+ case 4: {
1348
+ if (tag !== 34) {
1349
+ break;
1350
+ }
1351
+ message.address = exports.Address.decode(reader, reader.uint32());
1352
+ continue;
1353
+ }
1354
+ }
1355
+ if ((tag & 7) === 4 || tag === 0) {
1356
+ break;
1357
+ }
1358
+ reader.skip(tag & 7);
1359
+ }
1360
+ return message;
1361
+ },
1362
+ fromJSON(object) {
1363
+ return {
1364
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
1365
+ email: isSet(object.email) ? globalThis.String(object.email) : "",
1366
+ phone: isSet(object.phone) ? globalThis.String(object.phone) : "",
1367
+ address: isSet(object.address) ? exports.Address.fromJSON(object.address) : undefined,
1368
+ };
1369
+ },
1370
+ toJSON(message) {
1371
+ const obj = {};
1372
+ if (message.name !== "") {
1373
+ obj.name = message.name;
1374
+ }
1375
+ if (message.email !== "") {
1376
+ obj.email = message.email;
1377
+ }
1378
+ if (message.phone !== "") {
1379
+ obj.phone = message.phone;
1380
+ }
1381
+ if (message.address !== undefined) {
1382
+ obj.address = exports.Address.toJSON(message.address);
1383
+ }
1384
+ return obj;
1385
+ },
1386
+ create(base) {
1387
+ return exports.BillingDetails.fromPartial(base !== null && base !== void 0 ? base : {});
1388
+ },
1389
+ fromPartial(object) {
1390
+ var _a, _b, _c;
1391
+ const message = createBaseBillingDetails();
1392
+ message.name = (_a = object.name) !== null && _a !== void 0 ? _a : "";
1393
+ message.email = (_b = object.email) !== null && _b !== void 0 ? _b : "";
1394
+ message.phone = (_c = object.phone) !== null && _c !== void 0 ? _c : "";
1395
+ message.address = (object.address !== undefined && object.address !== null)
1396
+ ? exports.Address.fromPartial(object.address)
1397
+ : undefined;
1398
+ return message;
1399
+ },
1400
+ };
1401
+ function createBaseAddress() {
1402
+ return { line1: "", line2: "", city: "", state: "", postalCode: "", country: "" };
1403
+ }
1404
+ exports.Address = {
1405
+ encode(message, writer = new wire_1.BinaryWriter()) {
1406
+ if (message.line1 !== "") {
1407
+ writer.uint32(10).string(message.line1);
1408
+ }
1409
+ if (message.line2 !== "") {
1410
+ writer.uint32(18).string(message.line2);
1411
+ }
1412
+ if (message.city !== "") {
1413
+ writer.uint32(26).string(message.city);
1414
+ }
1415
+ if (message.state !== "") {
1416
+ writer.uint32(34).string(message.state);
1417
+ }
1418
+ if (message.postalCode !== "") {
1419
+ writer.uint32(42).string(message.postalCode);
1420
+ }
1421
+ if (message.country !== "") {
1422
+ writer.uint32(50).string(message.country);
1423
+ }
1424
+ return writer;
1425
+ },
1426
+ decode(input, length) {
1427
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1428
+ let end = length === undefined ? reader.len : reader.pos + length;
1429
+ const message = createBaseAddress();
1430
+ while (reader.pos < end) {
1431
+ const tag = reader.uint32();
1432
+ switch (tag >>> 3) {
1433
+ case 1: {
1434
+ if (tag !== 10) {
1435
+ break;
1436
+ }
1437
+ message.line1 = reader.string();
1438
+ continue;
1439
+ }
1440
+ case 2: {
1441
+ if (tag !== 18) {
1442
+ break;
1443
+ }
1444
+ message.line2 = reader.string();
1445
+ continue;
1446
+ }
1447
+ case 3: {
1448
+ if (tag !== 26) {
1449
+ break;
1450
+ }
1451
+ message.city = reader.string();
1452
+ continue;
1453
+ }
1454
+ case 4: {
1455
+ if (tag !== 34) {
1456
+ break;
1457
+ }
1458
+ message.state = reader.string();
1459
+ continue;
1460
+ }
1461
+ case 5: {
1462
+ if (tag !== 42) {
1463
+ break;
1464
+ }
1465
+ message.postalCode = reader.string();
1466
+ continue;
1467
+ }
1468
+ case 6: {
1469
+ if (tag !== 50) {
1470
+ break;
1471
+ }
1472
+ message.country = reader.string();
1473
+ continue;
1474
+ }
1475
+ }
1476
+ if ((tag & 7) === 4 || tag === 0) {
1477
+ break;
1478
+ }
1479
+ reader.skip(tag & 7);
1480
+ }
1481
+ return message;
1482
+ },
1483
+ fromJSON(object) {
1484
+ return {
1485
+ line1: isSet(object.line1) ? globalThis.String(object.line1) : "",
1486
+ line2: isSet(object.line2) ? globalThis.String(object.line2) : "",
1487
+ city: isSet(object.city) ? globalThis.String(object.city) : "",
1488
+ state: isSet(object.state) ? globalThis.String(object.state) : "",
1489
+ postalCode: isSet(object.postalCode) ? globalThis.String(object.postalCode) : "",
1490
+ country: isSet(object.country) ? globalThis.String(object.country) : "",
1491
+ };
1492
+ },
1493
+ toJSON(message) {
1494
+ const obj = {};
1495
+ if (message.line1 !== "") {
1496
+ obj.line1 = message.line1;
1497
+ }
1498
+ if (message.line2 !== "") {
1499
+ obj.line2 = message.line2;
1500
+ }
1501
+ if (message.city !== "") {
1502
+ obj.city = message.city;
1503
+ }
1504
+ if (message.state !== "") {
1505
+ obj.state = message.state;
1506
+ }
1507
+ if (message.postalCode !== "") {
1508
+ obj.postalCode = message.postalCode;
1509
+ }
1510
+ if (message.country !== "") {
1511
+ obj.country = message.country;
1512
+ }
1513
+ return obj;
1514
+ },
1515
+ create(base) {
1516
+ return exports.Address.fromPartial(base !== null && base !== void 0 ? base : {});
1517
+ },
1518
+ fromPartial(object) {
1519
+ var _a, _b, _c, _d, _e, _f;
1520
+ const message = createBaseAddress();
1521
+ message.line1 = (_a = object.line1) !== null && _a !== void 0 ? _a : "";
1522
+ message.line2 = (_b = object.line2) !== null && _b !== void 0 ? _b : "";
1523
+ message.city = (_c = object.city) !== null && _c !== void 0 ? _c : "";
1524
+ message.state = (_d = object.state) !== null && _d !== void 0 ? _d : "";
1525
+ message.postalCode = (_e = object.postalCode) !== null && _e !== void 0 ? _e : "";
1526
+ message.country = (_f = object.country) !== null && _f !== void 0 ? _f : "";
1527
+ return message;
1528
+ },
1529
+ };
1530
+ function createBaseDiscount() {
1531
+ return {
1532
+ id: "",
1533
+ name: "",
1534
+ type: "",
1535
+ percentOff: 0,
1536
+ amountOffCents: 0,
1537
+ duration: "",
1538
+ durationInMonths: 0,
1539
+ validUntil: undefined,
1540
+ appliedAt: undefined,
1541
+ };
1542
+ }
1543
+ exports.Discount = {
1544
+ encode(message, writer = new wire_1.BinaryWriter()) {
1545
+ if (message.id !== "") {
1546
+ writer.uint32(10).string(message.id);
1547
+ }
1548
+ if (message.name !== "") {
1549
+ writer.uint32(18).string(message.name);
1550
+ }
1551
+ if (message.type !== "") {
1552
+ writer.uint32(26).string(message.type);
1553
+ }
1554
+ if (message.percentOff !== 0) {
1555
+ writer.uint32(33).double(message.percentOff);
1556
+ }
1557
+ if (message.amountOffCents !== 0) {
1558
+ writer.uint32(40).int64(message.amountOffCents);
1559
+ }
1560
+ if (message.duration !== "") {
1561
+ writer.uint32(50).string(message.duration);
1562
+ }
1563
+ if (message.durationInMonths !== 0) {
1564
+ writer.uint32(56).int32(message.durationInMonths);
1565
+ }
1566
+ if (message.validUntil !== undefined) {
1567
+ timestamp_pb_1.Timestamp.encode(toTimestamp(message.validUntil), writer.uint32(66).fork()).join();
1568
+ }
1569
+ if (message.appliedAt !== undefined) {
1570
+ timestamp_pb_1.Timestamp.encode(toTimestamp(message.appliedAt), writer.uint32(74).fork()).join();
1571
+ }
1572
+ return writer;
1573
+ },
1574
+ decode(input, length) {
1575
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1576
+ let end = length === undefined ? reader.len : reader.pos + length;
1577
+ const message = createBaseDiscount();
1578
+ while (reader.pos < end) {
1579
+ const tag = reader.uint32();
1580
+ switch (tag >>> 3) {
1581
+ case 1: {
1582
+ if (tag !== 10) {
1583
+ break;
1584
+ }
1585
+ message.id = reader.string();
1586
+ continue;
1587
+ }
1588
+ case 2: {
1589
+ if (tag !== 18) {
1590
+ break;
1591
+ }
1592
+ message.name = reader.string();
1593
+ continue;
1594
+ }
1595
+ case 3: {
1596
+ if (tag !== 26) {
1597
+ break;
1598
+ }
1599
+ message.type = reader.string();
1600
+ continue;
1601
+ }
1602
+ case 4: {
1603
+ if (tag !== 33) {
1604
+ break;
1605
+ }
1606
+ message.percentOff = reader.double();
1607
+ continue;
1608
+ }
1609
+ case 5: {
1610
+ if (tag !== 40) {
1611
+ break;
1612
+ }
1613
+ message.amountOffCents = longToNumber(reader.int64());
1614
+ continue;
1615
+ }
1616
+ case 6: {
1617
+ if (tag !== 50) {
1618
+ break;
1619
+ }
1620
+ message.duration = reader.string();
1621
+ continue;
1622
+ }
1623
+ case 7: {
1624
+ if (tag !== 56) {
1625
+ break;
1626
+ }
1627
+ message.durationInMonths = reader.int32();
1628
+ continue;
1629
+ }
1630
+ case 8: {
1631
+ if (tag !== 66) {
1632
+ break;
1633
+ }
1634
+ message.validUntil = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
1635
+ continue;
1636
+ }
1637
+ case 9: {
1638
+ if (tag !== 74) {
1639
+ break;
1640
+ }
1641
+ message.appliedAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
1642
+ continue;
1643
+ }
1644
+ }
1645
+ if ((tag & 7) === 4 || tag === 0) {
1646
+ break;
1647
+ }
1648
+ reader.skip(tag & 7);
1649
+ }
1650
+ return message;
1651
+ },
1652
+ fromJSON(object) {
1653
+ return {
1654
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
1655
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
1656
+ type: isSet(object.type) ? globalThis.String(object.type) : "",
1657
+ percentOff: isSet(object.percentOff) ? globalThis.Number(object.percentOff) : 0,
1658
+ amountOffCents: isSet(object.amountOffCents) ? globalThis.Number(object.amountOffCents) : 0,
1659
+ duration: isSet(object.duration) ? globalThis.String(object.duration) : "",
1660
+ durationInMonths: isSet(object.durationInMonths) ? globalThis.Number(object.durationInMonths) : 0,
1661
+ validUntil: isSet(object.validUntil) ? fromJsonTimestamp(object.validUntil) : undefined,
1662
+ appliedAt: isSet(object.appliedAt) ? fromJsonTimestamp(object.appliedAt) : undefined,
1663
+ };
1664
+ },
1665
+ toJSON(message) {
1666
+ const obj = {};
1667
+ if (message.id !== "") {
1668
+ obj.id = message.id;
1669
+ }
1670
+ if (message.name !== "") {
1671
+ obj.name = message.name;
1672
+ }
1673
+ if (message.type !== "") {
1674
+ obj.type = message.type;
1675
+ }
1676
+ if (message.percentOff !== 0) {
1677
+ obj.percentOff = message.percentOff;
1678
+ }
1679
+ if (message.amountOffCents !== 0) {
1680
+ obj.amountOffCents = Math.round(message.amountOffCents);
1681
+ }
1682
+ if (message.duration !== "") {
1683
+ obj.duration = message.duration;
1684
+ }
1685
+ if (message.durationInMonths !== 0) {
1686
+ obj.durationInMonths = Math.round(message.durationInMonths);
1687
+ }
1688
+ if (message.validUntil !== undefined) {
1689
+ obj.validUntil = message.validUntil.toISOString();
1690
+ }
1691
+ if (message.appliedAt !== undefined) {
1692
+ obj.appliedAt = message.appliedAt.toISOString();
1693
+ }
1694
+ return obj;
1695
+ },
1696
+ create(base) {
1697
+ return exports.Discount.fromPartial(base !== null && base !== void 0 ? base : {});
1698
+ },
1699
+ fromPartial(object) {
1700
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1701
+ const message = createBaseDiscount();
1702
+ message.id = (_a = object.id) !== null && _a !== void 0 ? _a : "";
1703
+ message.name = (_b = object.name) !== null && _b !== void 0 ? _b : "";
1704
+ message.type = (_c = object.type) !== null && _c !== void 0 ? _c : "";
1705
+ message.percentOff = (_d = object.percentOff) !== null && _d !== void 0 ? _d : 0;
1706
+ message.amountOffCents = (_e = object.amountOffCents) !== null && _e !== void 0 ? _e : 0;
1707
+ message.duration = (_f = object.duration) !== null && _f !== void 0 ? _f : "";
1708
+ message.durationInMonths = (_g = object.durationInMonths) !== null && _g !== void 0 ? _g : 0;
1709
+ message.validUntil = (_h = object.validUntil) !== null && _h !== void 0 ? _h : undefined;
1710
+ message.appliedAt = (_j = object.appliedAt) !== null && _j !== void 0 ? _j : undefined;
1711
+ return message;
1712
+ },
1713
+ };
1714
+ function toTimestamp(date) {
1715
+ const seconds = Math.trunc(date.getTime() / 1000);
1716
+ const nanos = (date.getTime() % 1000) * 1000000;
1717
+ return { seconds, nanos };
1718
+ }
1719
+ function fromTimestamp(t) {
1720
+ let millis = (t.seconds || 0) * 1000;
1721
+ millis += (t.nanos || 0) / 1000000;
1722
+ return new globalThis.Date(millis);
1723
+ }
1724
+ function fromJsonTimestamp(o) {
1725
+ if (o instanceof globalThis.Date) {
1726
+ return o;
1727
+ }
1728
+ else if (typeof o === "string") {
1729
+ return new globalThis.Date(o);
1730
+ }
1731
+ else {
1732
+ return fromTimestamp(timestamp_pb_1.Timestamp.fromJSON(o));
1733
+ }
1734
+ }
1735
+ function longToNumber(int64) {
1736
+ const num = globalThis.Number(int64.toString());
1737
+ if (num > globalThis.Number.MAX_SAFE_INTEGER) {
1738
+ throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
1739
+ }
1740
+ if (num < globalThis.Number.MIN_SAFE_INTEGER) {
1741
+ throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
1742
+ }
1743
+ return num;
1744
+ }
1745
+ function isSet(value) {
1746
+ return value !== null && value !== undefined;
1747
+ }