@vendasta/billing 7.0.0 → 8.2.0

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.
Files changed (58) hide show
  1. package/bundles/vendasta-billing.umd.js +782 -10
  2. package/bundles/vendasta-billing.umd.js.map +1 -1
  3. package/bundles/vendasta-billing.umd.min.js +2 -2
  4. package/bundles/vendasta-billing.umd.min.js.map +1 -1
  5. package/esm2015/lib/_internal/enums/index.js +3 -1
  6. package/esm2015/lib/_internal/enums/payment-processor.enum.js +13 -0
  7. package/esm2015/lib/_internal/enums/recurring-invoice.enum.js +29 -0
  8. package/esm2015/lib/_internal/index.js +2 -1
  9. package/esm2015/lib/_internal/interfaces/billable-item.interface.js +1 -1
  10. package/esm2015/lib/_internal/interfaces/index.js +1 -1
  11. package/esm2015/lib/_internal/interfaces/payment-processor.interface.js +8 -0
  12. package/esm2015/lib/_internal/interfaces/recurring-invoice.interface.js +2 -0
  13. package/esm2015/lib/_internal/interfaces/subscription.interface.js +1 -1
  14. package/esm2015/lib/_internal/objects/billable-item.js +7 -1
  15. package/esm2015/lib/_internal/objects/index.js +2 -1
  16. package/esm2015/lib/_internal/objects/payment-processor.js +7 -0
  17. package/esm2015/lib/_internal/objects/recurring-invoice.js +324 -0
  18. package/esm2015/lib/_internal/objects/subscription.js +25 -1
  19. package/esm2015/lib/_internal/recurring-invoice.api.service.js +61 -0
  20. package/esm2015/lib/billable-item/billable-item.js +3 -2
  21. package/esm2015/lib/index.js +2 -1
  22. package/esm2015/lib/invoice-template/invoice-template.service.js +2 -3
  23. package/esm2015/lib/recurring_invoice/collection-method.js +31 -0
  24. package/esm2015/lib/recurring_invoice/index.js +6 -0
  25. package/esm2015/lib/recurring_invoice/interval.js +42 -0
  26. package/esm2015/lib/recurring_invoice/payment-processor.js +32 -0
  27. package/esm2015/lib/recurring_invoice/recurring-invoice.js +123 -0
  28. package/esm2015/lib/recurring_invoice/recurring-invoice.service.js +64 -0
  29. package/esm2015/lib/recurring_invoice/status.js +37 -0
  30. package/fesm2015/vendasta-billing.js +769 -19
  31. package/fesm2015/vendasta-billing.js.map +1 -1
  32. package/lib/_internal/enums/index.d.ts +2 -0
  33. package/lib/_internal/enums/payment-processor.enum.d.ts +5 -0
  34. package/lib/_internal/enums/recurring-invoice.enum.d.ts +19 -0
  35. package/lib/_internal/index.d.ts +1 -0
  36. package/lib/_internal/interfaces/billable-item.interface.d.ts +1 -0
  37. package/lib/_internal/interfaces/index.d.ts +2 -0
  38. package/lib/_internal/interfaces/payment-processor.interface.d.ts +1 -0
  39. package/lib/_internal/interfaces/recurring-invoice.interface.d.ts +54 -0
  40. package/lib/_internal/interfaces/subscription.interface.d.ts +4 -0
  41. package/lib/_internal/objects/billable-item.d.ts +1 -0
  42. package/lib/_internal/objects/index.d.ts +2 -0
  43. package/lib/_internal/objects/payment-processor.d.ts +1 -0
  44. package/lib/_internal/objects/recurring-invoice.d.ts +83 -0
  45. package/lib/_internal/objects/subscription.d.ts +4 -0
  46. package/lib/_internal/recurring-invoice.api.service.d.ts +16 -0
  47. package/lib/billable-item/billable-item.d.ts +1 -0
  48. package/lib/index.d.ts +1 -0
  49. package/lib/invoice-template/invoice-template.service.d.ts +1 -1
  50. package/lib/recurring_invoice/collection-method.d.ts +4 -0
  51. package/lib/recurring_invoice/index.d.ts +5 -0
  52. package/lib/recurring_invoice/interval.d.ts +10 -0
  53. package/lib/recurring_invoice/payment-processor.d.ts +8 -0
  54. package/lib/recurring_invoice/recurring-invoice.d.ts +62 -0
  55. package/lib/recurring_invoice/recurring-invoice.service.d.ts +14 -0
  56. package/lib/recurring_invoice/status.d.ts +9 -0
  57. package/package.json +1 -1
  58. package/vendasta-billing.metadata.json +1 -1
@@ -433,6 +433,48 @@
433
433
  RenewalState[RenewalState["RENEWAL_STATE_DELAYED"] = 1] = "RENEWAL_STATE_DELAYED";
434
434
  })(RenewalState || (RenewalState = {}));
435
435
 
436
+ // *********************************
437
+ // Code generated by sdkgen
438
+ // DO NOT EDIT!.
439
+ //
440
+ // Enums.
441
+ // *********************************
442
+ var PaymentProcessor;
443
+ (function (PaymentProcessor) {
444
+ PaymentProcessor[PaymentProcessor["PAYMENT_PROCESSOR_INVALID"] = 0] = "PAYMENT_PROCESSOR_INVALID";
445
+ PaymentProcessor[PaymentProcessor["PAYMENT_PROCESSOR_UNSET"] = 1] = "PAYMENT_PROCESSOR_UNSET";
446
+ PaymentProcessor[PaymentProcessor["PAYMENT_PROCESSOR_STRIPE"] = 2] = "PAYMENT_PROCESSOR_STRIPE";
447
+ })(PaymentProcessor || (PaymentProcessor = {}));
448
+
449
+ // *********************************
450
+ // Code generated by sdkgen
451
+ // DO NOT EDIT!.
452
+ //
453
+ // Enums.
454
+ // *********************************
455
+ var CollectionMethod;
456
+ (function (CollectionMethod) {
457
+ CollectionMethod[CollectionMethod["COLLECTION_METHOD_INVALID"] = 0] = "COLLECTION_METHOD_INVALID";
458
+ CollectionMethod[CollectionMethod["COLLECTION_METHOD_MANUAL"] = 1] = "COLLECTION_METHOD_MANUAL";
459
+ CollectionMethod[CollectionMethod["COLLECTION_METHOD_EMAIL"] = 2] = "COLLECTION_METHOD_EMAIL";
460
+ CollectionMethod[CollectionMethod["COLLECTION_METHOD_CHARGE_AUTOMATICALLY"] = 3] = "COLLECTION_METHOD_CHARGE_AUTOMATICALLY";
461
+ })(CollectionMethod || (CollectionMethod = {}));
462
+ var Interval;
463
+ (function (Interval) {
464
+ Interval[Interval["INTERVAL_INVALID"] = 0] = "INTERVAL_INVALID";
465
+ Interval[Interval["INTERVAL_DAY"] = 1] = "INTERVAL_DAY";
466
+ Interval[Interval["INTERVAL_WEEK"] = 2] = "INTERVAL_WEEK";
467
+ Interval[Interval["INTERVAL_MONTH"] = 3] = "INTERVAL_MONTH";
468
+ Interval[Interval["INTERVAL_YEAR"] = 4] = "INTERVAL_YEAR";
469
+ })(Interval || (Interval = {}));
470
+ var RecurringInvoiceStatus;
471
+ (function (RecurringInvoiceStatus) {
472
+ RecurringInvoiceStatus[RecurringInvoiceStatus["RECURRING_INVOICE_STATUS_INVALID"] = 0] = "RECURRING_INVOICE_STATUS_INVALID";
473
+ RecurringInvoiceStatus[RecurringInvoiceStatus["RECURRING_INVOICE_STATUS_INACTIVE"] = 1] = "RECURRING_INVOICE_STATUS_INACTIVE";
474
+ RecurringInvoiceStatus[RecurringInvoiceStatus["RECURRING_INVOICE_STATUS_ACTIVE"] = 2] = "RECURRING_INVOICE_STATUS_ACTIVE";
475
+ RecurringInvoiceStatus[RecurringInvoiceStatus["RECURRING_INVOICE_STATUS_ARCHIVED"] = 3] = "RECURRING_INVOICE_STATUS_ARCHIVED";
476
+ })(RecurringInvoiceStatus || (RecurringInvoiceStatus = {}));
477
+
436
478
  // *********************************
437
479
 
438
480
  function enumStringToValue(enumRef, value) {
@@ -629,6 +671,9 @@
629
671
  if (proto.nextRetailRenewal) {
630
672
  m.nextRetailRenewal = new Date(proto.nextRetailRenewal);
631
673
  }
674
+ if (proto.retailUnitPrice) {
675
+ m.retailUnitPrice = parseInt(proto.retailUnitPrice, 10);
676
+ }
632
677
  return m;
633
678
  };
634
679
  BillableItem.prototype.toApiJson = function () {
@@ -681,6 +726,9 @@
681
726
  if (typeof this.nextRetailRenewal !== 'undefined' && this.nextRetailRenewal !== null) {
682
727
  toReturn['nextRetailRenewal'] = 'toApiJson' in this.nextRetailRenewal ? this.nextRetailRenewal.toApiJson() : this.nextRetailRenewal;
683
728
  }
729
+ if (typeof this.retailUnitPrice !== 'undefined') {
730
+ toReturn['retailUnitPrice'] = this.retailUnitPrice;
731
+ }
684
732
  return toReturn;
685
733
  };
686
734
  return BillableItem;
@@ -10635,6 +10683,12 @@
10635
10683
  if (proto.frequency) {
10636
10684
  m.frequency = enumStringToValue$w(exports.GeneratedFrequency, proto.frequency);
10637
10685
  }
10686
+ if (proto.retailAmount) {
10687
+ m.retailAmount = parseInt(proto.retailAmount, 10);
10688
+ }
10689
+ if (proto.retailFrequency) {
10690
+ m.retailFrequency = enumStringToValue$w(exports.GeneratedFrequency, proto.retailFrequency);
10691
+ }
10638
10692
  return m;
10639
10693
  };
10640
10694
  CreateSubscriptionRequest.prototype.toApiJson = function () {
@@ -10675,6 +10729,12 @@
10675
10729
  if (typeof this.frequency !== 'undefined') {
10676
10730
  toReturn['frequency'] = this.frequency;
10677
10731
  }
10732
+ if (typeof this.retailAmount !== 'undefined') {
10733
+ toReturn['retailAmount'] = this.retailAmount;
10734
+ }
10735
+ if (typeof this.retailFrequency !== 'undefined') {
10736
+ toReturn['retailFrequency'] = this.retailFrequency;
10737
+ }
10678
10738
  return toReturn;
10679
10739
  };
10680
10740
  return CreateSubscriptionRequest;
@@ -10848,6 +10908,12 @@
10848
10908
  if (proto.frequency) {
10849
10909
  m.frequency = enumStringToValue$w(exports.GeneratedFrequency, proto.frequency);
10850
10910
  }
10911
+ if (proto.retailAmount) {
10912
+ m.retailAmount = parseInt(proto.retailAmount, 10);
10913
+ }
10914
+ if (proto.retailFrequency) {
10915
+ m.retailFrequency = enumStringToValue$w(exports.GeneratedFrequency, proto.retailFrequency);
10916
+ }
10851
10917
  return m;
10852
10918
  };
10853
10919
  Subscription.prototype.toApiJson = function () {
@@ -10888,6 +10954,12 @@
10888
10954
  if (typeof this.frequency !== 'undefined') {
10889
10955
  toReturn['frequency'] = this.frequency;
10890
10956
  }
10957
+ if (typeof this.retailAmount !== 'undefined') {
10958
+ toReturn['retailAmount'] = this.retailAmount;
10959
+ }
10960
+ if (typeof this.retailFrequency !== 'undefined') {
10961
+ toReturn['retailFrequency'] = this.retailFrequency;
10962
+ }
10891
10963
  return toReturn;
10892
10964
  };
10893
10965
  return Subscription;
@@ -12109,6 +12181,337 @@
12109
12181
  }
12110
12182
  return enumRef[value];
12111
12183
  }
12184
+ var DeleteRecurringInvoiceRequest = /** @class */ (function () {
12185
+ function DeleteRecurringInvoiceRequest(kwargs) {
12186
+ if (!kwargs) {
12187
+ return;
12188
+ }
12189
+ Object.assign(this, kwargs);
12190
+ }
12191
+ DeleteRecurringInvoiceRequest.fromProto = function (proto) {
12192
+ var m = new DeleteRecurringInvoiceRequest();
12193
+ m = Object.assign(m, proto);
12194
+ return m;
12195
+ };
12196
+ DeleteRecurringInvoiceRequest.prototype.toApiJson = function () {
12197
+ var toReturn = {};
12198
+ if (typeof this.id !== 'undefined') {
12199
+ toReturn['id'] = this.id;
12200
+ }
12201
+ return toReturn;
12202
+ };
12203
+ return DeleteRecurringInvoiceRequest;
12204
+ }());
12205
+ var GetRecurringInvoiceRequest = /** @class */ (function () {
12206
+ function GetRecurringInvoiceRequest(kwargs) {
12207
+ if (!kwargs) {
12208
+ return;
12209
+ }
12210
+ Object.assign(this, kwargs);
12211
+ }
12212
+ GetRecurringInvoiceRequest.fromProto = function (proto) {
12213
+ var m = new GetRecurringInvoiceRequest();
12214
+ m = Object.assign(m, proto);
12215
+ return m;
12216
+ };
12217
+ GetRecurringInvoiceRequest.prototype.toApiJson = function () {
12218
+ var toReturn = {};
12219
+ if (typeof this.id !== 'undefined') {
12220
+ toReturn['id'] = this.id;
12221
+ }
12222
+ return toReturn;
12223
+ };
12224
+ return GetRecurringInvoiceRequest;
12225
+ }());
12226
+ var ListRecurringInvoicesRequest = /** @class */ (function () {
12227
+ function ListRecurringInvoicesRequest(kwargs) {
12228
+ if (!kwargs) {
12229
+ return;
12230
+ }
12231
+ Object.assign(this, kwargs);
12232
+ }
12233
+ ListRecurringInvoicesRequest.fromProto = function (proto) {
12234
+ var m = new ListRecurringInvoicesRequest();
12235
+ m = Object.assign(m, proto);
12236
+ if (proto.pagingOptions) {
12237
+ m.pagingOptions = PagedRequestOptions.fromProto(proto.pagingOptions);
12238
+ }
12239
+ return m;
12240
+ };
12241
+ ListRecurringInvoicesRequest.prototype.toApiJson = function () {
12242
+ var toReturn = {};
12243
+ if (typeof this.pagingOptions !== 'undefined' && this.pagingOptions !== null) {
12244
+ toReturn['pagingOptions'] = 'toApiJson' in this.pagingOptions ? this.pagingOptions.toApiJson() : this.pagingOptions;
12245
+ }
12246
+ if (typeof this.merchantId !== 'undefined') {
12247
+ toReturn['merchantId'] = this.merchantId;
12248
+ }
12249
+ if (typeof this.customerId !== 'undefined') {
12250
+ toReturn['customerId'] = this.customerId;
12251
+ }
12252
+ return toReturn;
12253
+ };
12254
+ return ListRecurringInvoicesRequest;
12255
+ }());
12256
+ var ListRecurringInvoicesResponse = /** @class */ (function () {
12257
+ function ListRecurringInvoicesResponse(kwargs) {
12258
+ if (!kwargs) {
12259
+ return;
12260
+ }
12261
+ Object.assign(this, kwargs);
12262
+ }
12263
+ ListRecurringInvoicesResponse.fromProto = function (proto) {
12264
+ var m = new ListRecurringInvoicesResponse();
12265
+ m = Object.assign(m, proto);
12266
+ if (proto.recurringInvoices) {
12267
+ m.recurringInvoices = proto.recurringInvoices.map(RecurringInvoice.fromProto);
12268
+ }
12269
+ if (proto.pagingMetadata) {
12270
+ m.pagingMetadata = PagedResponseMetadata.fromProto(proto.pagingMetadata);
12271
+ }
12272
+ return m;
12273
+ };
12274
+ ListRecurringInvoicesResponse.prototype.toApiJson = function () {
12275
+ var toReturn = {};
12276
+ if (typeof this.recurringInvoices !== 'undefined' && this.recurringInvoices !== null) {
12277
+ toReturn['recurringInvoices'] = 'toApiJson' in this.recurringInvoices ? this.recurringInvoices.toApiJson() : this.recurringInvoices;
12278
+ }
12279
+ if (typeof this.pagingMetadata !== 'undefined' && this.pagingMetadata !== null) {
12280
+ toReturn['pagingMetadata'] = 'toApiJson' in this.pagingMetadata ? this.pagingMetadata.toApiJson() : this.pagingMetadata;
12281
+ }
12282
+ return toReturn;
12283
+ };
12284
+ return ListRecurringInvoicesResponse;
12285
+ }());
12286
+ var RecurringInvoice = /** @class */ (function () {
12287
+ function RecurringInvoice(kwargs) {
12288
+ if (!kwargs) {
12289
+ return;
12290
+ }
12291
+ Object.assign(this, kwargs);
12292
+ }
12293
+ RecurringInvoice.fromProto = function (proto) {
12294
+ var m = new RecurringInvoice();
12295
+ m = Object.assign(m, proto);
12296
+ if (proto.created) {
12297
+ m.created = new Date(proto.created);
12298
+ }
12299
+ if (proto.updated) {
12300
+ m.updated = new Date(proto.updated);
12301
+ }
12302
+ if (proto.status) {
12303
+ m.status = enumStringToValue$B(RecurringInvoiceStatus, proto.status);
12304
+ }
12305
+ if (proto.issuedAt) {
12306
+ m.issuedAt = new Date(proto.issuedAt);
12307
+ }
12308
+ if (proto.nextIssue) {
12309
+ m.nextIssue = new Date(proto.nextIssue);
12310
+ }
12311
+ if (proto.intervalCount) {
12312
+ m.intervalCount = parseInt(proto.intervalCount, 10);
12313
+ }
12314
+ if (proto.interval) {
12315
+ m.interval = enumStringToValue$B(Interval, proto.interval);
12316
+ }
12317
+ if (proto.collectionMethod) {
12318
+ m.collectionMethod = enumStringToValue$B(CollectionMethod, proto.collectionMethod);
12319
+ }
12320
+ if (proto.paymentProcessor) {
12321
+ m.paymentProcessor = enumStringToValue$B(PaymentProcessor, proto.paymentProcessor);
12322
+ }
12323
+ if (proto.items) {
12324
+ m.items = proto.items.map(RecurringInvoiceItem.fromProto);
12325
+ }
12326
+ if (proto.totalAmount) {
12327
+ m.totalAmount = parseInt(proto.totalAmount, 10);
12328
+ }
12329
+ return m;
12330
+ };
12331
+ RecurringInvoice.prototype.toApiJson = function () {
12332
+ var toReturn = {};
12333
+ if (typeof this.id !== 'undefined') {
12334
+ toReturn['id'] = this.id;
12335
+ }
12336
+ if (typeof this.created !== 'undefined' && this.created !== null) {
12337
+ toReturn['created'] = 'toApiJson' in this.created ? this.created.toApiJson() : this.created;
12338
+ }
12339
+ if (typeof this.updated !== 'undefined' && this.updated !== null) {
12340
+ toReturn['updated'] = 'toApiJson' in this.updated ? this.updated.toApiJson() : this.updated;
12341
+ }
12342
+ if (typeof this.customerId !== 'undefined') {
12343
+ toReturn['customerId'] = this.customerId;
12344
+ }
12345
+ if (typeof this.status !== 'undefined') {
12346
+ toReturn['status'] = this.status;
12347
+ }
12348
+ if (typeof this.issuedAt !== 'undefined' && this.issuedAt !== null) {
12349
+ toReturn['issuedAt'] = 'toApiJson' in this.issuedAt ? this.issuedAt.toApiJson() : this.issuedAt;
12350
+ }
12351
+ if (typeof this.nextIssue !== 'undefined' && this.nextIssue !== null) {
12352
+ toReturn['nextIssue'] = 'toApiJson' in this.nextIssue ? this.nextIssue.toApiJson() : this.nextIssue;
12353
+ }
12354
+ if (typeof this.intervalCount !== 'undefined') {
12355
+ toReturn['intervalCount'] = this.intervalCount;
12356
+ }
12357
+ if (typeof this.interval !== 'undefined') {
12358
+ toReturn['interval'] = this.interval;
12359
+ }
12360
+ if (typeof this.collectionMethod !== 'undefined') {
12361
+ toReturn['collectionMethod'] = this.collectionMethod;
12362
+ }
12363
+ if (typeof this.recipientUserId !== 'undefined') {
12364
+ toReturn['recipientUserId'] = this.recipientUserId;
12365
+ }
12366
+ if (typeof this.paymentProcessor !== 'undefined') {
12367
+ toReturn['paymentProcessor'] = this.paymentProcessor;
12368
+ }
12369
+ if (typeof this.paymentProcessorId !== 'undefined') {
12370
+ toReturn['paymentProcessorId'] = this.paymentProcessorId;
12371
+ }
12372
+ if (typeof this.items !== 'undefined' && this.items !== null) {
12373
+ toReturn['items'] = 'toApiJson' in this.items ? this.items.toApiJson() : this.items;
12374
+ }
12375
+ if (typeof this.totalAmount !== 'undefined') {
12376
+ toReturn['totalAmount'] = this.totalAmount;
12377
+ }
12378
+ if (typeof this.currencyCode !== 'undefined') {
12379
+ toReturn['currencyCode'] = this.currencyCode;
12380
+ }
12381
+ return toReturn;
12382
+ };
12383
+ return RecurringInvoice;
12384
+ }());
12385
+ var RecurringInvoiceBundle = /** @class */ (function () {
12386
+ function RecurringInvoiceBundle(kwargs) {
12387
+ if (!kwargs) {
12388
+ return;
12389
+ }
12390
+ Object.assign(this, kwargs);
12391
+ }
12392
+ RecurringInvoiceBundle.fromProto = function (proto) {
12393
+ var m = new RecurringInvoiceBundle();
12394
+ m = Object.assign(m, proto);
12395
+ if (proto.lineItems) {
12396
+ m.lineItems = proto.lineItems.map(RecurringInvoiceLineItem.fromProto);
12397
+ }
12398
+ return m;
12399
+ };
12400
+ RecurringInvoiceBundle.prototype.toApiJson = function () {
12401
+ var toReturn = {};
12402
+ if (typeof this.name !== 'undefined') {
12403
+ toReturn['name'] = this.name;
12404
+ }
12405
+ if (typeof this.hideLineItems !== 'undefined') {
12406
+ toReturn['hideLineItems'] = this.hideLineItems;
12407
+ }
12408
+ if (typeof this.lineItems !== 'undefined' && this.lineItems !== null) {
12409
+ toReturn['lineItems'] = 'toApiJson' in this.lineItems ? this.lineItems.toApiJson() : this.lineItems;
12410
+ }
12411
+ return toReturn;
12412
+ };
12413
+ return RecurringInvoiceBundle;
12414
+ }());
12415
+ var RecurringInvoiceItem = /** @class */ (function () {
12416
+ function RecurringInvoiceItem(kwargs) {
12417
+ if (!kwargs) {
12418
+ return;
12419
+ }
12420
+ Object.assign(this, kwargs);
12421
+ }
12422
+ RecurringInvoiceItem.fromProto = function (proto) {
12423
+ var m = new RecurringInvoiceItem();
12424
+ m = Object.assign(m, proto);
12425
+ if (proto.lineItem) {
12426
+ m.lineItem = RecurringInvoiceLineItem.fromProto(proto.lineItem);
12427
+ }
12428
+ if (proto.bundle) {
12429
+ m.bundle = RecurringInvoiceBundle.fromProto(proto.bundle);
12430
+ }
12431
+ return m;
12432
+ };
12433
+ RecurringInvoiceItem.prototype.toApiJson = function () {
12434
+ var toReturn = {};
12435
+ if (typeof this.lineItem !== 'undefined' && this.lineItem !== null) {
12436
+ toReturn['lineItem'] = 'toApiJson' in this.lineItem ? this.lineItem.toApiJson() : this.lineItem;
12437
+ }
12438
+ if (typeof this.bundle !== 'undefined' && this.bundle !== null) {
12439
+ toReturn['bundle'] = 'toApiJson' in this.bundle ? this.bundle.toApiJson() : this.bundle;
12440
+ }
12441
+ return toReturn;
12442
+ };
12443
+ return RecurringInvoiceItem;
12444
+ }());
12445
+ var RecurringInvoiceLineItem = /** @class */ (function () {
12446
+ function RecurringInvoiceLineItem(kwargs) {
12447
+ if (!kwargs) {
12448
+ return;
12449
+ }
12450
+ Object.assign(this, kwargs);
12451
+ }
12452
+ RecurringInvoiceLineItem.fromProto = function (proto) {
12453
+ var m = new RecurringInvoiceLineItem();
12454
+ m = Object.assign(m, proto);
12455
+ if (proto.unitPrice) {
12456
+ m.unitPrice = parseInt(proto.unitPrice, 10);
12457
+ }
12458
+ if (proto.quantity) {
12459
+ m.quantity = parseInt(proto.quantity, 10);
12460
+ }
12461
+ return m;
12462
+ };
12463
+ RecurringInvoiceLineItem.prototype.toApiJson = function () {
12464
+ var toReturn = {};
12465
+ if (typeof this.sku !== 'undefined') {
12466
+ toReturn['sku'] = this.sku;
12467
+ }
12468
+ if (typeof this.unitPrice !== 'undefined') {
12469
+ toReturn['unitPrice'] = this.unitPrice;
12470
+ }
12471
+ if (typeof this.quantity !== 'undefined') {
12472
+ toReturn['quantity'] = this.quantity;
12473
+ }
12474
+ if (typeof this.name !== 'undefined') {
12475
+ toReturn['name'] = this.name;
12476
+ }
12477
+ if (typeof this.taxRateIds !== 'undefined') {
12478
+ toReturn['taxRateIds'] = this.taxRateIds;
12479
+ }
12480
+ return toReturn;
12481
+ };
12482
+ return RecurringInvoiceLineItem;
12483
+ }());
12484
+ var UpdateRecurringInvoiceRequest = /** @class */ (function () {
12485
+ function UpdateRecurringInvoiceRequest(kwargs) {
12486
+ if (!kwargs) {
12487
+ return;
12488
+ }
12489
+ Object.assign(this, kwargs);
12490
+ }
12491
+ UpdateRecurringInvoiceRequest.fromProto = function (proto) {
12492
+ var m = new UpdateRecurringInvoiceRequest();
12493
+ m = Object.assign(m, proto);
12494
+ if (proto.recurringInvoice) {
12495
+ m.recurringInvoice = RecurringInvoice.fromProto(proto.recurringInvoice);
12496
+ }
12497
+ return m;
12498
+ };
12499
+ UpdateRecurringInvoiceRequest.prototype.toApiJson = function () {
12500
+ var toReturn = {};
12501
+ if (typeof this.recurringInvoice !== 'undefined' && this.recurringInvoice !== null) {
12502
+ toReturn['recurringInvoice'] = 'toApiJson' in this.recurringInvoice ? this.recurringInvoice.toApiJson() : this.recurringInvoice;
12503
+ }
12504
+ return toReturn;
12505
+ };
12506
+ return UpdateRecurringInvoiceRequest;
12507
+ }());
12508
+
12509
+ function enumStringToValue$C(enumRef, value) {
12510
+ if (typeof value === 'number') {
12511
+ return value;
12512
+ }
12513
+ return enumRef[value];
12514
+ }
12112
12515
  var DeleteRetailPricingRequest = /** @class */ (function () {
12113
12516
  function DeleteRetailPricingRequest(kwargs) {
12114
12517
  if (!kwargs) {
@@ -12375,7 +12778,7 @@
12375
12778
  var m = new GetMultiRetailPricingRequest();
12376
12779
  m = Object.assign(m, proto);
12377
12780
  if (proto.currency) {
12378
- m.currency = enumStringToValue$B(Currency, proto.currency);
12781
+ m.currency = enumStringToValue$C(Currency, proto.currency);
12379
12782
  }
12380
12783
  return m;
12381
12784
  };
@@ -12441,7 +12844,7 @@
12441
12844
  m.quantity = parseInt(proto.quantity, 10);
12442
12845
  }
12443
12846
  if (proto.frequency) {
12444
- m.frequency = enumStringToValue$B(exports.GeneratedFrequency, proto.frequency);
12847
+ m.frequency = enumStringToValue$C(exports.GeneratedFrequency, proto.frequency);
12445
12848
  }
12446
12849
  return m;
12447
12850
  };
@@ -12477,10 +12880,10 @@
12477
12880
  m.totalCost = parseInt(proto.totalCost, 10);
12478
12881
  }
12479
12882
  if (proto.currency) {
12480
- m.currency = enumStringToValue$B(Currency, proto.currency);
12883
+ m.currency = enumStringToValue$C(Currency, proto.currency);
12481
12884
  }
12482
12885
  if (proto.strategy) {
12483
- m.strategy = enumStringToValue$B(exports.PricingPlanBillingStrategy, proto.strategy);
12886
+ m.strategy = enumStringToValue$C(exports.PricingPlanBillingStrategy, proto.strategy);
12484
12887
  }
12485
12888
  if (proto.commitment) {
12486
12889
  m.commitment = Commitment.fromProto(proto.commitment);
@@ -12861,7 +13264,7 @@
12861
13264
  var m = new SetWholesaleProductStrategyRequest();
12862
13265
  m = Object.assign(m, proto);
12863
13266
  if (proto.strategy) {
12864
- m.strategy = enumStringToValue$B(exports.PricingPlanBillingStrategy, proto.strategy);
13267
+ m.strategy = enumStringToValue$C(exports.PricingPlanBillingStrategy, proto.strategy);
12865
13268
  }
12866
13269
  return m;
12867
13270
  };
@@ -12939,7 +13342,7 @@
12939
13342
  var m = new UpsertRetailPricingRequest();
12940
13343
  m = Object.assign(m, proto);
12941
13344
  if (proto.frequency) {
12942
- m.frequency = enumStringToValue$B(exports.GeneratedFrequency, proto.frequency);
13345
+ m.frequency = enumStringToValue$C(exports.GeneratedFrequency, proto.frequency);
12943
13346
  }
12944
13347
  if (proto.pricing) {
12945
13348
  m.pricing = Object.keys(proto.pricing).reduce(function (obj, k) { obj[k] = PricingPlanProductPricing.fromProto(proto.pricing[k]); return obj; }, {});
@@ -14106,6 +14509,55 @@
14106
14509
  { type: HostService }
14107
14510
  ]; };
14108
14511
 
14512
+ // *********************************
14513
+ var RecurringInvoiceApiService = /** @class */ (function () {
14514
+ function RecurringInvoiceApiService(http, hostService) {
14515
+ this.http = http;
14516
+ this.hostService = hostService;
14517
+ }
14518
+ RecurringInvoiceApiService.prototype.apiOptions = function () {
14519
+ return {
14520
+ headers: new i1$1.HttpHeaders({
14521
+ 'Content-Type': 'application/json'
14522
+ }),
14523
+ withCredentials: true
14524
+ };
14525
+ };
14526
+ RecurringInvoiceApiService.prototype.createRecurringInvoice = function (r) {
14527
+ var request = (r.toApiJson) ? r : new RecurringInvoice(r);
14528
+ return this.http.post(this.hostService.hostWithScheme() + "/billing.v1.RecurringInvoiceService/CreateRecurringInvoice", request.toApiJson(), this.apiOptions())
14529
+ .pipe(operators.map(function (resp) { return RecurringInvoice.fromProto(resp); }), operators.share());
14530
+ };
14531
+ RecurringInvoiceApiService.prototype.updateRecurringInvoice = function (r) {
14532
+ var request = (r.toApiJson) ? r : new UpdateRecurringInvoiceRequest(r);
14533
+ return this.http.post(this.hostService.hostWithScheme() + "/billing.v1.RecurringInvoiceService/UpdateRecurringInvoice", request.toApiJson(), this.apiOptions())
14534
+ .pipe(operators.map(function (resp) { return RecurringInvoice.fromProto(resp); }), operators.share());
14535
+ };
14536
+ RecurringInvoiceApiService.prototype.getRecurringInvoice = function (r) {
14537
+ var request = (r.toApiJson) ? r : new GetRecurringInvoiceRequest(r);
14538
+ return this.http.post(this.hostService.hostWithScheme() + "/billing.v1.RecurringInvoiceService/GetRecurringInvoice", request.toApiJson(), this.apiOptions())
14539
+ .pipe(operators.map(function (resp) { return RecurringInvoice.fromProto(resp); }), operators.share());
14540
+ };
14541
+ RecurringInvoiceApiService.prototype.listRecurringInvoices = function (r) {
14542
+ var request = (r.toApiJson) ? r : new ListRecurringInvoicesRequest(r);
14543
+ return this.http.post(this.hostService.hostWithScheme() + "/billing.v1.RecurringInvoiceService/ListRecurringInvoices", request.toApiJson(), this.apiOptions())
14544
+ .pipe(operators.map(function (resp) { return ListRecurringInvoicesResponse.fromProto(resp); }), operators.share());
14545
+ };
14546
+ RecurringInvoiceApiService.prototype.deleteRecurringInvoice = function (r) {
14547
+ var request = (r.toApiJson) ? r : new DeleteRecurringInvoiceRequest(r);
14548
+ return this.http.post(this.hostService.hostWithScheme() + "/billing.v1.RecurringInvoiceService/DeleteRecurringInvoice", request.toApiJson(), Object.assign(Object.assign({}, this.apiOptions()), { observe: 'response' }));
14549
+ };
14550
+ return RecurringInvoiceApiService;
14551
+ }());
14552
+ RecurringInvoiceApiService.ɵprov = i0.ɵɵdefineInjectable({ factory: function RecurringInvoiceApiService_Factory() { return new RecurringInvoiceApiService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(HostService)); }, token: RecurringInvoiceApiService, providedIn: "root" });
14553
+ RecurringInvoiceApiService.decorators = [
14554
+ { type: i0.Injectable, args: [{ providedIn: 'root' },] }
14555
+ ];
14556
+ RecurringInvoiceApiService.ctorParameters = function () { return [
14557
+ { type: i1$1.HttpClient },
14558
+ { type: HostService }
14559
+ ]; };
14560
+
14109
14561
  // *********************************
14110
14562
  var RefundApiService = /** @class */ (function () {
14111
14563
  function RefundApiService(http, hostService) {
@@ -15497,7 +15949,8 @@
15497
15949
  nextRenewal: apiItem.nextRenewal.valueOf() !== zeroDate ? new Date(apiItem.nextRenewal) : null,
15498
15950
  nextRetailRenewal: apiItem.nextRetailRenewal.valueOf() !== zeroDate ? new Date(apiItem.nextRetailRenewal) : null,
15499
15951
  customerAddress: customerAddressFromApi(apiItem.customerAddress),
15500
- customUnitPrice: apiItem.customUnitPrice || 0
15952
+ customUnitPrice: apiItem.customUnitPrice || 0,
15953
+ retailUnitPrice: apiItem.retailUnitPrice || 0
15501
15954
  };
15502
15955
  }
15503
15956
  function listSubscriptionsFiltersToHTTPJson(filters) {
@@ -17115,7 +17568,7 @@
17115
17568
  function InvoiceTemplateService(invoiceTemplateApiService) {
17116
17569
  this.invoiceTemplateApiService = invoiceTemplateApiService;
17117
17570
  }
17118
- InvoiceTemplateService.prototype.upsert = function (merchantId, customerId, items, defaultTaxRates, currencyCode) {
17571
+ InvoiceTemplateService.prototype.upsert = function (merchantId, customerId, items, defaultTaxRates) {
17119
17572
  var itemsRequest = (items || []).map(function (item) {
17120
17573
  var appliedDiscounts = (item.appliedDiscounts || []).map(function (ad) { return appliedDiscountToApi(ad); });
17121
17574
  return new UpsertInvoiceTemplateRequestInvoiceTemplateItemRequest({
@@ -17133,7 +17586,6 @@
17133
17586
  customerId: customerId,
17134
17587
  items: itemsRequest || [],
17135
17588
  defaultTaxRates: defaultTaxRates,
17136
- currencyCode: currencyCode
17137
17589
  });
17138
17590
  return this.invoiceTemplateApiService.upsert(req).pipe(operators.map(function (resp) { return convertApiInvoiceTemplate(resp === null || resp === void 0 ? void 0 : resp.invoiceTemplate); }));
17139
17591
  };
@@ -18510,6 +18962,321 @@
18510
18962
  { type: RefundApiService }
18511
18963
  ]; };
18512
18964
 
18965
+ function convertFromApiCollectionMethod(s) {
18966
+ switch (s) {
18967
+ case CollectionMethod.COLLECTION_METHOD_INVALID:
18968
+ return exports.CollectionMethod.UNSET;
18969
+ case CollectionMethod.COLLECTION_METHOD_MANUAL:
18970
+ return exports.CollectionMethod.MANUAL_COLLECTION;
18971
+ case CollectionMethod.COLLECTION_METHOD_EMAIL:
18972
+ return exports.CollectionMethod.SEND_EMAIL;
18973
+ case CollectionMethod.COLLECTION_METHOD_CHARGE_AUTOMATICALLY:
18974
+ return exports.CollectionMethod.CHARGE_AUTOMATICALLY;
18975
+ default:
18976
+ return exports.CollectionMethod.UNSET;
18977
+ }
18978
+ }
18979
+ function convertToApiCollectionMethod(s) {
18980
+ switch (s) {
18981
+ case exports.CollectionMethod.UNSET:
18982
+ return CollectionMethod.COLLECTION_METHOD_INVALID;
18983
+ case exports.CollectionMethod.MANUAL_COLLECTION:
18984
+ return CollectionMethod.COLLECTION_METHOD_MANUAL;
18985
+ case exports.CollectionMethod.SEND_EMAIL:
18986
+ return CollectionMethod.COLLECTION_METHOD_EMAIL;
18987
+ case exports.CollectionMethod.CHARGE_AUTOMATICALLY:
18988
+ return CollectionMethod.COLLECTION_METHOD_CHARGE_AUTOMATICALLY;
18989
+ default:
18990
+ return CollectionMethod.COLLECTION_METHOD_INVALID;
18991
+ }
18992
+ }
18993
+
18994
+ (function (Interval) {
18995
+ Interval["INVALID"] = "Invalid";
18996
+ Interval["DAY"] = "Daily";
18997
+ Interval["WEEK"] = "Weekly";
18998
+ Interval["MONTH"] = "Monthly";
18999
+ Interval["YEAR"] = "Yearly";
19000
+ })(exports.Interval || (exports.Interval = {}));
19001
+ function convertFromApiInterval(s) {
19002
+ switch (s) {
19003
+ case Interval.INTERVAL_INVALID:
19004
+ return exports.Interval.INVALID;
19005
+ case Interval.INTERVAL_DAY:
19006
+ return exports.Interval.DAY;
19007
+ case Interval.INTERVAL_WEEK:
19008
+ return exports.Interval.WEEK;
19009
+ case Interval.INTERVAL_MONTH:
19010
+ return exports.Interval.MONTH;
19011
+ case Interval.INTERVAL_YEAR:
19012
+ return exports.Interval.YEAR;
19013
+ default:
19014
+ return exports.Interval.INVALID;
19015
+ }
19016
+ }
19017
+ function convertToApiInterval(s) {
19018
+ switch (s) {
19019
+ case exports.Interval.INVALID:
19020
+ return Interval.INTERVAL_INVALID;
19021
+ case exports.Interval.DAY:
19022
+ return Interval.INTERVAL_DAY;
19023
+ case exports.Interval.WEEK:
19024
+ return Interval.INTERVAL_WEEK;
19025
+ case exports.Interval.MONTH:
19026
+ return Interval.INTERVAL_MONTH;
19027
+ case exports.Interval.YEAR:
19028
+ return Interval.INTERVAL_YEAR;
19029
+ default:
19030
+ return Interval.INTERVAL_INVALID;
19031
+ }
19032
+ }
19033
+
19034
+ (function (PaymentProcessor) {
19035
+ PaymentProcessor["INVALID"] = "Invalid";
19036
+ PaymentProcessor["UNSET"] = "Unset";
19037
+ PaymentProcessor["STRIPE"] = "Stripe";
19038
+ })(exports.PaymentProcessor || (exports.PaymentProcessor = {}));
19039
+ function convertFromApiPaymentProcessor(s) {
19040
+ switch (s) {
19041
+ case PaymentProcessor.PAYMENT_PROCESSOR_INVALID:
19042
+ return exports.PaymentProcessor.INVALID;
19043
+ case PaymentProcessor.PAYMENT_PROCESSOR_UNSET:
19044
+ return exports.PaymentProcessor.UNSET;
19045
+ case PaymentProcessor.PAYMENT_PROCESSOR_STRIPE:
19046
+ return exports.PaymentProcessor.STRIPE;
19047
+ default:
19048
+ return exports.PaymentProcessor.INVALID;
19049
+ }
19050
+ }
19051
+ function convertToApiPaymentProcessor(s) {
19052
+ switch (s) {
19053
+ case exports.PaymentProcessor.INVALID:
19054
+ return PaymentProcessor.PAYMENT_PROCESSOR_INVALID;
19055
+ case exports.PaymentProcessor.UNSET:
19056
+ return PaymentProcessor.PAYMENT_PROCESSOR_UNSET;
19057
+ case exports.PaymentProcessor.STRIPE:
19058
+ return PaymentProcessor.PAYMENT_PROCESSOR_STRIPE;
19059
+ default:
19060
+ return PaymentProcessor.PAYMENT_PROCESSOR_INVALID;
19061
+ }
19062
+ }
19063
+
19064
+ (function (RecurringInvoiceStatus) {
19065
+ RecurringInvoiceStatus["INVALID"] = "Invalid";
19066
+ RecurringInvoiceStatus["INACTIVE"] = "Inactive";
19067
+ RecurringInvoiceStatus["ACTIVE"] = "Active";
19068
+ RecurringInvoiceStatus["ARCHIVED"] = "Archived";
19069
+ })(exports.RecurringInvoiceStatus || (exports.RecurringInvoiceStatus = {}));
19070
+ function convertFromApiRecurringInvoiceStatus(s) {
19071
+ switch (s) {
19072
+ case RecurringInvoiceStatus.RECURRING_INVOICE_STATUS_INVALID:
19073
+ return exports.RecurringInvoiceStatus.INVALID;
19074
+ case RecurringInvoiceStatus.RECURRING_INVOICE_STATUS_INACTIVE:
19075
+ return exports.RecurringInvoiceStatus.INACTIVE;
19076
+ case RecurringInvoiceStatus.RECURRING_INVOICE_STATUS_ACTIVE:
19077
+ return exports.RecurringInvoiceStatus.ACTIVE;
19078
+ case RecurringInvoiceStatus.RECURRING_INVOICE_STATUS_ARCHIVED:
19079
+ return exports.RecurringInvoiceStatus.ARCHIVED;
19080
+ default:
19081
+ return exports.RecurringInvoiceStatus.INVALID;
19082
+ }
19083
+ }
19084
+ function convertToApiRecurringInvoiceStatus(s) {
19085
+ switch (s) {
19086
+ case exports.RecurringInvoiceStatus.INVALID:
19087
+ return RecurringInvoiceStatus.RECURRING_INVOICE_STATUS_INVALID;
19088
+ case exports.RecurringInvoiceStatus.INACTIVE:
19089
+ return RecurringInvoiceStatus.RECURRING_INVOICE_STATUS_INACTIVE;
19090
+ case exports.RecurringInvoiceStatus.ACTIVE:
19091
+ return RecurringInvoiceStatus.RECURRING_INVOICE_STATUS_ACTIVE;
19092
+ case exports.RecurringInvoiceStatus.ARCHIVED:
19093
+ return RecurringInvoiceStatus.RECURRING_INVOICE_STATUS_ARCHIVED;
19094
+ default:
19095
+ return RecurringInvoiceStatus.RECURRING_INVOICE_STATUS_INVALID;
19096
+ }
19097
+ }
19098
+
19099
+ var ListRecurringInvoicesByCustomerID = /** @class */ (function () {
19100
+ function ListRecurringInvoicesByCustomerID(customerId) {
19101
+ this.customerId = customerId;
19102
+ }
19103
+ return ListRecurringInvoicesByCustomerID;
19104
+ }());
19105
+ var ListRecurringInvoicesByMerchantID = /** @class */ (function () {
19106
+ function ListRecurringInvoicesByMerchantID(merchantId) {
19107
+ this.merchantId = merchantId;
19108
+ }
19109
+ return ListRecurringInvoicesByMerchantID;
19110
+ }());
19111
+ var LineItem = /** @class */ (function () {
19112
+ function LineItem(name) {
19113
+ this.name = name;
19114
+ }
19115
+ return LineItem;
19116
+ }());
19117
+ var RecurringInvoiceLineItem$1 = /** @class */ (function (_super) {
19118
+ __extends(RecurringInvoiceLineItem, _super);
19119
+ function RecurringInvoiceLineItem(kwargs) {
19120
+ var _this = _super.call(this, kwargs.name) || this;
19121
+ if (!kwargs) {
19122
+ return _this;
19123
+ }
19124
+ Object.assign(_this, kwargs);
19125
+ return _this;
19126
+ }
19127
+ return RecurringInvoiceLineItem;
19128
+ }(LineItem));
19129
+ var RecurringInvoiceBundle$1 = /** @class */ (function (_super) {
19130
+ __extends(RecurringInvoiceBundle, _super);
19131
+ function RecurringInvoiceBundle(kwargs) {
19132
+ var _this = _super.call(this, kwargs.name) || this;
19133
+ if (!kwargs) {
19134
+ return _this;
19135
+ }
19136
+ Object.assign(_this, kwargs);
19137
+ return _this;
19138
+ }
19139
+ return RecurringInvoiceBundle;
19140
+ }(LineItem));
19141
+ function convertFromApiRecurringInvoiceLineItem(li) {
19142
+ if (!li) {
19143
+ return;
19144
+ }
19145
+ return new RecurringInvoiceLineItem$1({
19146
+ sku: li.sku,
19147
+ unitPrice: li.unitPrice,
19148
+ quantity: li.quantity,
19149
+ name: li.name,
19150
+ taxRateIds: li.taxRateIds || [],
19151
+ });
19152
+ }
19153
+ function convertFromApiRecurringInvoiceLineItemBundle(li) {
19154
+ if (!li) {
19155
+ return;
19156
+ }
19157
+ return new RecurringInvoiceBundle$1({
19158
+ name: li.name,
19159
+ hideLineItems: li.hideLineItems || false,
19160
+ lineItems: (li.lineItems || []).map(function (i) { return convertFromApiRecurringInvoiceLineItem(i); })
19161
+ });
19162
+ }
19163
+ function convertFromApiRecurringInvoiceItem(i) {
19164
+ if (!!i.lineItem) {
19165
+ return convertFromApiRecurringInvoiceLineItem(i.lineItem);
19166
+ }
19167
+ else if (!!i.bundle) {
19168
+ return convertFromApiRecurringInvoiceLineItemBundle(i.bundle);
19169
+ }
19170
+ return null;
19171
+ }
19172
+ function convertFromApiRecurringInvoice(i) {
19173
+ if (!i) {
19174
+ return;
19175
+ }
19176
+ var zeroDate = new Date('0001-01-01T00:00:00Z').valueOf();
19177
+ return {
19178
+ id: i.id,
19179
+ created: i.created.valueOf() !== zeroDate ? i.created : null,
19180
+ updated: i.updated.valueOf() !== zeroDate ? i.updated : null,
19181
+ customerId: i.customerId,
19182
+ status: convertFromApiRecurringInvoiceStatus(i.status),
19183
+ issuedAt: i.issuedAt.valueOf() !== zeroDate ? i.issuedAt : null,
19184
+ nextIssue: i.nextIssue.valueOf() !== zeroDate ? i.nextIssue : null,
19185
+ intervalCount: i.intervalCount,
19186
+ interval: convertFromApiInterval(i.interval),
19187
+ collectionMethod: convertFromApiCollectionMethod(i.collectionMethod),
19188
+ recipientUserId: i.recipientUserId,
19189
+ paymentProcessor: convertFromApiPaymentProcessor(i.paymentProcessor),
19190
+ paymentProcessorId: i.paymentProcessorId,
19191
+ items: (i.items || []).map(function (li) { return convertFromApiRecurringInvoiceItem(li); }),
19192
+ totalAmount: i.totalAmount || 0,
19193
+ currencyCode: i.currencyCode
19194
+ };
19195
+ }
19196
+ function convertToApiRecurringInvoiceLineItem(li) {
19197
+ if (!li) {
19198
+ return;
19199
+ }
19200
+ return new RecurringInvoiceLineItem({
19201
+ sku: li.sku,
19202
+ unitPrice: li.unitPrice,
19203
+ quantity: li.quantity,
19204
+ name: li.name,
19205
+ taxRateIds: li.taxRateIds
19206
+ });
19207
+ }
19208
+ function convertToApiRecurringInvoiceItem(li) {
19209
+ var lineItem;
19210
+ var bundle;
19211
+ if (li instanceof RecurringInvoiceLineItem$1) {
19212
+ lineItem = convertToApiRecurringInvoiceLineItem(li);
19213
+ }
19214
+ else if (li instanceof RecurringInvoiceBundle$1) {
19215
+ bundle = new RecurringInvoiceBundle({
19216
+ name: li.name,
19217
+ hideLineItems: li.hideLineItems,
19218
+ lineItems: (li.lineItems || []).map(function (item) { return convertToApiRecurringInvoiceLineItem(item); })
19219
+ });
19220
+ }
19221
+ return new RecurringInvoiceItem({
19222
+ lineItem: lineItem, bundle: bundle
19223
+ });
19224
+ }
19225
+
19226
+ var RecurringInvoiceService = /** @class */ (function () {
19227
+ function RecurringInvoiceService(recurringInvoiceApiService) {
19228
+ this.recurringInvoiceApiService = recurringInvoiceApiService;
19229
+ }
19230
+ RecurringInvoiceService.prototype.create = function (request) {
19231
+ var req = new RecurringInvoice(Object.assign(Object.assign({}, request), { status: convertToApiRecurringInvoiceStatus(request.status), interval: convertToApiInterval(request.interval), collectionMethod: convertToApiCollectionMethod(request.collectionMethod), paymentProcessor: convertToApiPaymentProcessor(request.paymentProcessor), items: (request.items || []).map(function (i) { return convertToApiRecurringInvoiceItem(i); }) }));
19232
+ return this.recurringInvoiceApiService.createRecurringInvoice(req).pipe(operators.map(function (res) { return convertFromApiRecurringInvoice(res); }));
19233
+ };
19234
+ RecurringInvoiceService.prototype.get = function (id) {
19235
+ var req = new GetRecurringInvoiceRequest({
19236
+ id: id
19237
+ });
19238
+ return this.recurringInvoiceApiService.getRecurringInvoice(req).pipe(operators.map(function (resp) { return convertFromApiRecurringInvoice(resp); }));
19239
+ };
19240
+ RecurringInvoiceService.prototype.delete = function (id) {
19241
+ var req = new DeleteRecurringInvoiceRequest({
19242
+ id: id
19243
+ });
19244
+ return this.recurringInvoiceApiService.deleteRecurringInvoice(req);
19245
+ };
19246
+ RecurringInvoiceService.prototype.list = function (filter, cursor, pageSize) {
19247
+ var req = new ListRecurringInvoicesRequest({
19248
+ pagingOptions: {
19249
+ cursor: cursor,
19250
+ pageSize: pageSize,
19251
+ },
19252
+ });
19253
+ if (filter instanceof ListRecurringInvoicesByCustomerID) {
19254
+ req.customerId = filter.customerId;
19255
+ }
19256
+ else if (filter instanceof ListRecurringInvoicesByMerchantID) {
19257
+ req.merchantId = filter.merchantId;
19258
+ }
19259
+ return this.recurringInvoiceApiService.listRecurringInvoices(req).pipe(operators.map(function (resp) {
19260
+ var invoices = (resp.recurringInvoices || []).map(function (item) { return convertFromApiRecurringInvoice(item); });
19261
+ return new PagedResponse(invoices, resp.pagingMetadata.nextCursor, resp.pagingMetadata.hasMore);
19262
+ }));
19263
+ };
19264
+ RecurringInvoiceService.prototype.update = function (recurringInvoice) {
19265
+ var req = new UpdateRecurringInvoiceRequest({
19266
+ recurringInvoice: new RecurringInvoice(Object.assign(Object.assign({}, recurringInvoice), { status: convertToApiRecurringInvoiceStatus(recurringInvoice.status), interval: convertToApiInterval(recurringInvoice.interval), collectionMethod: convertToApiCollectionMethod(recurringInvoice.collectionMethod), paymentProcessor: convertToApiPaymentProcessor(recurringInvoice.paymentProcessor), items: (recurringInvoice.items || []).map(function (i) { return convertToApiRecurringInvoiceItem(i); }) }))
19267
+ });
19268
+ return this.recurringInvoiceApiService.updateRecurringInvoice(req).pipe(operators.map(function (res) { return convertFromApiRecurringInvoice(res); }));
19269
+ };
19270
+ return RecurringInvoiceService;
19271
+ }());
19272
+ RecurringInvoiceService.ɵprov = i0.ɵɵdefineInjectable({ factory: function RecurringInvoiceService_Factory() { return new RecurringInvoiceService(i0.ɵɵinject(RecurringInvoiceApiService)); }, token: RecurringInvoiceService, providedIn: "root" });
19273
+ RecurringInvoiceService.decorators = [
19274
+ { type: i0.Injectable, args: [{ providedIn: 'root' },] }
19275
+ ];
19276
+ RecurringInvoiceService.ctorParameters = function () { return [
19277
+ { type: RecurringInvoiceApiService }
19278
+ ]; };
19279
+
18513
19280
  (function (SalesCreditNoteStatus) {
18514
19281
  SalesCreditNoteStatus["InProgress"] = "IN_PROGRESS";
18515
19282
  SalesCreditNoteStatus["ReadyToPost"] = "READY_TO_POST";
@@ -19009,6 +19776,8 @@
19009
19776
  exports.ListPurchaseItemsResponse = ListPurchaseItemsResponse;
19010
19777
  exports.ListPurchaseRequest = ListPurchaseRequest;
19011
19778
  exports.ListPurchaseResponse = ListPurchaseResponse;
19779
+ exports.ListRecurringInvoicesByCustomerID = ListRecurringInvoicesByCustomerID;
19780
+ exports.ListRecurringInvoicesByMerchantID = ListRecurringInvoicesByMerchantID;
19012
19781
  exports.ListRefundsRequest = ListRefundsRequest;
19013
19782
  exports.ListRefundsResponse = ListRefundsResponse;
19014
19783
  exports.ListRetailPaymentsRequest = ListRetailPaymentsRequest;
@@ -19033,6 +19802,9 @@
19033
19802
  exports.ProductSummaryService = ProductSummaryService;
19034
19803
  exports.PurchaseService = PurchaseService;
19035
19804
  exports.REPUTATION_MANGEMENT_SKU = REPUTATION_MANGEMENT_SKU;
19805
+ exports.RecurringInvoiceBundle = RecurringInvoiceBundle$1;
19806
+ exports.RecurringInvoiceLineItem = RecurringInvoiceLineItem$1;
19807
+ exports.RecurringInvoiceService = RecurringInvoiceService;
19036
19808
  exports.RefundApiService = RefundApiService;
19037
19809
  exports.RefundService = RefundService;
19038
19810
  exports.ResetContractPricingRequest = ResetContractPricingRequest;
@@ -19087,7 +19859,7 @@
19087
19859
  exports.currencyPricingMapToApi = currencyPricingMapToApi;
19088
19860
  exports.disputeFromApi = disputeFromApi;
19089
19861
  exports.disputeStatusFromApi = disputeStatusFromApi;
19090
- exports.enumStringToValue = enumStringToValue$B;
19862
+ exports.enumStringToValue = enumStringToValue$C;
19091
19863
  exports.frequencyFromApi = frequencyFromApi;
19092
19864
  exports.frequencyFromLegacyApi = frequencyFromLegacyApi;
19093
19865
  exports.frequencyToApi = frequencyToApi;