@vendasta/billing 8.1.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 (46) hide show
  1. package/bundles/vendasta-billing.umd.js +749 -7
  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/index.js +1 -1
  10. package/esm2015/lib/_internal/interfaces/payment-processor.interface.js +8 -0
  11. package/esm2015/lib/_internal/interfaces/recurring-invoice.interface.js +2 -0
  12. package/esm2015/lib/_internal/objects/index.js +2 -1
  13. package/esm2015/lib/_internal/objects/payment-processor.js +7 -0
  14. package/esm2015/lib/_internal/objects/recurring-invoice.js +324 -0
  15. package/esm2015/lib/_internal/recurring-invoice.api.service.js +61 -0
  16. package/esm2015/lib/index.js +2 -1
  17. package/esm2015/lib/recurring_invoice/collection-method.js +31 -0
  18. package/esm2015/lib/recurring_invoice/index.js +6 -0
  19. package/esm2015/lib/recurring_invoice/interval.js +42 -0
  20. package/esm2015/lib/recurring_invoice/payment-processor.js +32 -0
  21. package/esm2015/lib/recurring_invoice/recurring-invoice.js +123 -0
  22. package/esm2015/lib/recurring_invoice/recurring-invoice.service.js +64 -0
  23. package/esm2015/lib/recurring_invoice/status.js +37 -0
  24. package/fesm2015/vendasta-billing.js +736 -16
  25. package/fesm2015/vendasta-billing.js.map +1 -1
  26. package/lib/_internal/enums/index.d.ts +2 -0
  27. package/lib/_internal/enums/payment-processor.enum.d.ts +5 -0
  28. package/lib/_internal/enums/recurring-invoice.enum.d.ts +19 -0
  29. package/lib/_internal/index.d.ts +1 -0
  30. package/lib/_internal/interfaces/index.d.ts +2 -0
  31. package/lib/_internal/interfaces/payment-processor.interface.d.ts +1 -0
  32. package/lib/_internal/interfaces/recurring-invoice.interface.d.ts +54 -0
  33. package/lib/_internal/objects/index.d.ts +2 -0
  34. package/lib/_internal/objects/payment-processor.d.ts +1 -0
  35. package/lib/_internal/objects/recurring-invoice.d.ts +83 -0
  36. package/lib/_internal/recurring-invoice.api.service.d.ts +16 -0
  37. package/lib/index.d.ts +1 -0
  38. package/lib/recurring_invoice/collection-method.d.ts +4 -0
  39. package/lib/recurring_invoice/index.d.ts +5 -0
  40. package/lib/recurring_invoice/interval.d.ts +10 -0
  41. package/lib/recurring_invoice/payment-processor.d.ts +8 -0
  42. package/lib/recurring_invoice/recurring-invoice.d.ts +62 -0
  43. package/lib/recurring_invoice/recurring-invoice.service.d.ts +14 -0
  44. package/lib/recurring_invoice/status.d.ts +9 -0
  45. package/package.json +1 -1
  46. package/vendasta-billing.metadata.json +1 -1
@@ -1,4 +1,4 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/common/http"),require("@vendasta/core"),require("rxjs/operators"),require("rxjs")):"function"==typeof define&&define.amd?define("@vendasta/billing",["exports","@angular/core","@angular/common/http","@vendasta/core","rxjs/operators","rxjs"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).vendasta=t.vendasta||{},t.vendasta.billing={}),t.ng.core,t.ng.common.http,t.i1,t.rxjs.operators,t.rxjs)}(this,(function(t,e,i,n,o,r){"use strict";function s(t){return t?{bundleId:t.bundleId,bundleInstanceId:t.bundleInstanceId,name:t.name,hideBundleItems:t.hideBundleItems||!1}:null}var a,c,u,p,d,h,l,m,v,f,g,I,y,A,S,P,b,T,O,E,R,D,C,_,J,w,j,N,U,M,B,k,F,x,L,Y,q,G,W;(a=t.GeneratedFrequency||(t.GeneratedFrequency={}))[a.INVALID=0]="INVALID",a[a.MONTHLY=1]="MONTHLY",a[a.YEARLY=2]="YEARLY",a[a.ONE_TIME=3]="ONE_TIME",function(t){t[t.DISCOUNT_TYPE_FIXED_AMOUNT=0]="DISCOUNT_TYPE_FIXED_AMOUNT",t[t.DISCOUNT_TYPE_PERCENT_AMOUNT=1]="DISCOUNT_TYPE_PERCENT_AMOUNT",t[t.DISCOUNT_TYPE_FIXED_NUMBER_OF_UNITS=2]="DISCOUNT_TYPE_FIXED_NUMBER_OF_UNITS",t[t.DISCOUNT_TYPE_FIXED_AMOUNT_PER_UNIT=3]="DISCOUNT_TYPE_FIXED_AMOUNT_PER_UNIT"}(c||(c={})),function(t){t[t.USD=0]="USD",t[t.CAD=1]="CAD",t[t.EUR=2]="EUR",t[t.AUD=3]="AUD",t[t.GBP=4]="GBP",t[t.NZD=5]="NZD",t[t.BRL=6]="BRL",t[t.CHF=7]="CHF",t[t.CNY=8]="CNY",t[t.CZK=9]="CZK",t[t.INR=10]="INR",t[t.JPY=11]="JPY",t[t.KHR=12]="KHR",t[t.KRW=13]="KRW",t[t.MXN=14]="MXN",t[t.NOK=15]="NOK",t[t.RUB=16]="RUB",t[t.SEK=17]="SEK",t[t.SGD=18]="SGD",t[t.TRY=19]="TRY",t[t.ZAR=20]="ZAR",t[t.DZD=21]="DZD",t[t.AWG=22]="AWG",t[t.FJD=23]="FJD",t[t.KYD=24]="KYD"}(u||(u={})),function(t){t[t.CONTRACT_SUBSCRIPTION_STATUS_UNSET=0]="CONTRACT_SUBSCRIPTION_STATUS_UNSET",t[t.CONTRACT_SUBSCRIPTION_STATUS_PENDING=1]="CONTRACT_SUBSCRIPTION_STATUS_PENDING",t[t.CONTRACT_SUBSCRIPTION_STATUS_SUCCEEDED=2]="CONTRACT_SUBSCRIPTION_STATUS_SUCCEEDED",t[t.CONTRACT_SUBSCRIPTION_STATUS_FAILED=3]="CONTRACT_SUBSCRIPTION_STATUS_FAILED"}(p||(p={})),(d=t.ProductSummaryBillingStrategy||(t.ProductSummaryBillingStrategy={}))[d.CHARGE_AT_END_OF_BILLING_PERIOD=0]="CHARGE_AT_END_OF_BILLING_PERIOD",d[d.CHARGE_AT_START_OF_BILLING_PERIOD=1]="CHARGE_AT_START_OF_BILLING_PERIOD",d[d.CHARGE_INSTANTLY=2]="CHARGE_INSTANTLY",d[d.CHARGE_AT_END_OF_DAY=3]="CHARGE_AT_END_OF_DAY",function(t){t[t.FIXED_AMOUNT=0]="FIXED_AMOUNT",t[t.PERCENT_AMOUNT=1]="PERCENT_AMOUNT",t[t.FIXED_NUMBER_OF_UNITS=2]="FIXED_NUMBER_OF_UNITS",t[t.FIXED_AMOUNT_PER_UNIT=3]="FIXED_AMOUNT_PER_UNIT"}(h||(h={})),(l=t.ProductType||(t.ProductType={}))[l.BUNDLE=0]="BUNDLE",l[l.FEE=1]="FEE",l[l.PRODUCT=2]="PRODUCT",l[l.SUBSCRIPTION=3]="SUBSCRIPTION",l[l.VENDASTA_PRODUCT=4]="VENDASTA_PRODUCT",function(t){t[t.STANDARD=0]="STANDARD",t[t.STAIRSTEP=1]="STAIRSTEP",t[t.TIERED=2]="TIERED",t[t.CUSTOM=3]="CUSTOM"}(m||(m={})),function(t){t[t.CREATED=0]="CREATED"}(v||(v={})),function(t){t[t.DRAFT=0]="DRAFT",t[t.DUE=1]="DUE",t[t.PAID=2]="PAID",t[t.VOID=3]="VOID"}(f||(f={})),(g=t.PayoutStatus||(t.PayoutStatus={}))[g.PAYOUT_STATUS_NOT_SET=0]="PAYOUT_STATUS_NOT_SET",g[g.PAYOUT_STATUS_PAID=1]="PAYOUT_STATUS_PAID",g[g.PAYOUT_STATUS_PENDING=2]="PAYOUT_STATUS_PENDING",g[g.PAYOUT_STATUS_IN_TRANSIT=3]="PAYOUT_STATUS_IN_TRANSIT",g[g.PAYOUT_STATUS_CANCELED=4]="PAYOUT_STATUS_CANCELED",g[g.PAYOUT_STATUS_FAILED=5]="PAYOUT_STATUS_FAILED",function(t){t[t.PAYOUT_TYPE_NOT_SET=0]="PAYOUT_TYPE_NOT_SET",t[t.PAYOUT_TYPE_BANK_ACCOUNT=1]="PAYOUT_TYPE_BANK_ACCOUNT",t[t.PAYOUT_TYPE_CARD=2]="PAYOUT_TYPE_CARD"}(I||(I={})),function(t){t[t.SORT_DIRECTION_ASCENDING=0]="SORT_DIRECTION_ASCENDING",t[t.SORT_DIRECTION_DESCENDING=1]="SORT_DIRECTION_DESCENDING"}(y||(y={})),function(t){t[t.SEARCH_MERCHANTS_REQUEST_SORT_BY_MERCHANT_ID=0]="SEARCH_MERCHANTS_REQUEST_SORT_BY_MERCHANT_ID",t[t.SEARCH_MERCHANTS_REQUEST_SORT_BY_COMPANY_NAME=1]="SEARCH_MERCHANTS_REQUEST_SORT_BY_COMPANY_NAME",t[t.SEARCH_MERCHANTS_REQUEST_SORT_BY_CONTACT_NAME=2]="SEARCH_MERCHANTS_REQUEST_SORT_BY_CONTACT_NAME",t[t.SEARCH_MERCHANTS_REQUEST_SORT_BY_EMAIL_ADDRESS=3]="SEARCH_MERCHANTS_REQUEST_SORT_BY_EMAIL_ADDRESS",t[t.SEARCH_MERCHANTS_REQUEST_SORT_BY_COUNTRY=4]="SEARCH_MERCHANTS_REQUEST_SORT_BY_COUNTRY",t[t.SEARCH_MERCHANTS_REQUEST_SORT_BY_STATE=5]="SEARCH_MERCHANTS_REQUEST_SORT_BY_STATE",t[t.SEARCH_MERCHANTS_REQUEST_SORT_BY_CREATED=6]="SEARCH_MERCHANTS_REQUEST_SORT_BY_CREATED",t[t.SEARCH_MERCHANTS_REQUEST_SORT_BY_UPDATED=7]="SEARCH_MERCHANTS_REQUEST_SORT_BY_UPDATED"}(A||(A={})),function(t){t[t.INVALID_MONTH=0]="INVALID_MONTH",t[t.JANUARY=1]="JANUARY",t[t.FEBRUARY=2]="FEBRUARY",t[t.MARCH=3]="MARCH",t[t.APRIL=4]="APRIL",t[t.MAY=5]="MAY",t[t.JUNE=6]="JUNE",t[t.JULY=7]="JULY",t[t.AUGUST=8]="AUGUST",t[t.SEPTEMBER=9]="SEPTEMBER",t[t.OCTOBER=10]="OCTOBER",t[t.NOVEMBER=11]="NOVEMBER",t[t.DECEMBER=12]="DECEMBER"}(S||(S={})),function(t){t[t.FAILED=0]="FAILED",t[t.PENDING=1]="PENDING",t[t.COMPLETED=2]="COMPLETED"}(P||(P={})),function(t){t[t.CARD_TYPE_UNKNOWN=0]="CARD_TYPE_UNKNOWN",t[t.CARD_TYPE_VISA=1]="CARD_TYPE_VISA",t[t.CARD_TYPE_MASTERCARD=2]="CARD_TYPE_MASTERCARD",t[t.CARD_TYPE_AMEX=3]="CARD_TYPE_AMEX",t[t.CARD_TYPE_DISCOVER=4]="CARD_TYPE_DISCOVER",t[t.CARD_TYPE_JCB=5]="CARD_TYPE_JCB",t[t.CARD_TYPE_DINERS_CLUB=6]="CARD_TYPE_DINERS_CLUB"}(b||(b={})),function(t){t[t.DISPUTE_STATUS_UNSET=0]="DISPUTE_STATUS_UNSET",t[t.DISPUTE_STATUS_WARNING_NEEDS_RESPONSE=1]="DISPUTE_STATUS_WARNING_NEEDS_RESPONSE",t[t.DISPUTE_STATUS_WARNING_UNDER_REVIEW=2]="DISPUTE_STATUS_WARNING_UNDER_REVIEW",t[t.DISPUTE_STATUS_WARNING_CLOSED=3]="DISPUTE_STATUS_WARNING_CLOSED",t[t.DISPUTE_STATUS_NEEDS_RESPONSE=4]="DISPUTE_STATUS_NEEDS_RESPONSE",t[t.DISPUTE_STATUS_UNDER_REVIEW=5]="DISPUTE_STATUS_UNDER_REVIEW",t[t.DISPUTE_STATUS_CHARGE_REFUNDED=6]="DISPUTE_STATUS_CHARGE_REFUNDED",t[t.DISPUTE_STATUS_WON=7]="DISPUTE_STATUS_WON",t[t.DISPUTE_STATUS_LOST=8]="DISPUTE_STATUS_LOST"}(T||(T={})),function(t){t[t.PAYMENT_ALLOCATION_TYPE_UNSET=0]="PAYMENT_ALLOCATION_TYPE_UNSET",t[t.PAYMENT_ALLOCATION_TYPE_PURCHASE=1]="PAYMENT_ALLOCATION_TYPE_PURCHASE",t[t.PAYMENT_ALLOCATION_TYPE_INVOICE=2]="PAYMENT_ALLOCATION_TYPE_INVOICE"}(O||(O={})),function(t){t[t.PAYMENT_SOURCE_NONE=0]="PAYMENT_SOURCE_NONE",t[t.PAYMENT_SOURCE_STRIPE=1]="PAYMENT_SOURCE_STRIPE",t[t.PAYMENT_SOURCE_VCASH=2]="PAYMENT_SOURCE_VCASH"}(E||(E={})),function(t){t[t.PAYMENT_STATUS_UNSET=0]="PAYMENT_STATUS_UNSET",t[t.PAYMENT_STATUS_SUCCEEDED=1]="PAYMENT_STATUS_SUCCEEDED",t[t.PAYMENT_STATUS_FAILED=2]="PAYMENT_STATUS_FAILED",t[t.PAYMENT_STATUS_REFUNDED=3]="PAYMENT_STATUS_REFUNDED",t[t.PAYMENT_STATUS_PARTIALLY_REFUNDED=4]="PAYMENT_STATUS_PARTIALLY_REFUNDED"}(R||(R={})),(D=t.RetailPaymentReferenceTypeEnum||(t.RetailPaymentReferenceTypeEnum={}))[D.RETAIL_PAYMENT_REFERENCE_TYPE_UNSET=0]="RETAIL_PAYMENT_REFERENCE_TYPE_UNSET",D[D.RETAIL_PAYMENT_REFERENCE_TYPE_INVOICE=1]="RETAIL_PAYMENT_REFERENCE_TYPE_INVOICE",D[D.RETAIL_PAYMENT_REFERENCE_TYPE_SALES_ORDER=2]="RETAIL_PAYMENT_REFERENCE_TYPE_SALES_ORDER",(C=t.CARD_TYPE||(t.CARD_TYPE={}))[C.UNKNOWN=0]="UNKNOWN",C[C.VISA=1]="VISA",C[C.MASTERCARD=2]="MASTERCARD",C[C.AMEX=3]="AMEX",C[C.DISCOVER=4]="DISCOVER",C[C.JCB=5]="JCB",C[C.DINERS_CLUB=6]="DINERS_CLUB",function(t){t[t.FUNDING_TYPE_UNKNOWN=0]="FUNDING_TYPE_UNKNOWN",t[t.FUNDING_TYPE_CREDIT=1]="FUNDING_TYPE_CREDIT",t[t.FUNDING_TYPE_DEBIT=2]="FUNDING_TYPE_DEBIT",t[t.FUNDING_TYPE_PREPAID=3]="FUNDING_TYPE_PREPAID"}(_||(_={})),(J=t.PricingPlanBillingStrategy||(t.PricingPlanBillingStrategy={}))[J.BILLING_STRATEGY_NONE=0]="BILLING_STRATEGY_NONE",J[J.BILLING_STRATEGY_END_OF_PERIOD=1]="BILLING_STRATEGY_END_OF_PERIOD",J[J.BILLING_STRATEGY_START_OF_PERIOD=2]="BILLING_STRATEGY_START_OF_PERIOD",J[J.BILLING_STRATEGY_INSTANTLY=3]="BILLING_STRATEGY_INSTANTLY",J[J.BILLING_STRATEGY_END_OF_DAY=4]="BILLING_STRATEGY_END_OF_DAY",function(t){t[t.PRODUCT_PRICING_TYPE_INVALID=0]="PRODUCT_PRICING_TYPE_INVALID",t[t.PRODUCT_PRICING_TYPE_STANDARD=1]="PRODUCT_PRICING_TYPE_STANDARD",t[t.PRODUCT_PRICING_TYPE_STAIRSTEP=2]="PRODUCT_PRICING_TYPE_STAIRSTEP",t[t.PRODUCT_PRICING_TYPE_TIERED=3]="PRODUCT_PRICING_TYPE_TIERED"}(w||(w={})),function(t){t[t.PRODUCT_TYPE_INVALID=0]="PRODUCT_TYPE_INVALID",t[t.PRODUCT_TYPE_STANDARD_PRODUCT=1]="PRODUCT_TYPE_STANDARD_PRODUCT",t[t.PRODUCT_TYPE_VENDASTA_PRODUCT=2]="PRODUCT_TYPE_VENDASTA_PRODUCT",t[t.PRODUCT_TYPE_SUBSCRIPTION=3]="PRODUCT_TYPE_SUBSCRIPTION",t[t.PRODUCT_TYPE_FEE=4]="PRODUCT_TYPE_FEE",t[t.PRODUCT_TYPE_PRIVATE_PRODUCT=5]="PRODUCT_TYPE_PRIVATE_PRODUCT",t[t.PRODUCT_TYPE_PARTNER_SUPPORT_SALES=6]="PRODUCT_TYPE_PARTNER_SUPPORT_SALES"}(j||(j={})),function(t){t[t.CREDIT_TYPE_UNSET=0]="CREDIT_TYPE_UNSET",t[t.CREDIT_TYPE_CREDIT_NOTE=1]="CREDIT_TYPE_CREDIT_NOTE",t[t.CREDIT_TYPE_PROMOTIONAL=2]="CREDIT_TYPE_PROMOTIONAL"}(N||(N={})),(U=t.PurchaseStatusEnum||(t.PurchaseStatusEnum={}))[U.PURCHASE_STATUS_UNSET=0]="PURCHASE_STATUS_UNSET",U[U.PURCHASE_STATUS_PENDING=1]="PURCHASE_STATUS_PENDING",U[U.PURCHASE_STATUS_DUE=2]="PURCHASE_STATUS_DUE",U[U.PURCHASE_STATUS_SUCCESS=3]="PURCHASE_STATUS_SUCCESS",U[U.PURCHASE_STATUS_DUNNING=4]="PURCHASE_STATUS_DUNNING",U[U.PURCHASE_STATUS_FAILED=5]="PURCHASE_STATUS_FAILED",(M=t.State||(t.State={}))[M.LIST_PURCHASE_REQUEST_STATE_ALL=0]="LIST_PURCHASE_REQUEST_STATE_ALL",M[M.LIST_PURCHASE_REQUEST_STATE_OVERDUE=1]="LIST_PURCHASE_REQUEST_STATE_OVERDUE",(B=t.ReferenceTypeEnum||(t.ReferenceTypeEnum={}))[B.PURCHASE=0]="PURCHASE",B[B.PURCHASE_ITEM=1]="PURCHASE_ITEM",B[B.INVOICE=2]="INVOICE",(k=t.RefundReasonEnum||(t.RefundReasonEnum={}))[k.REQUESTED_BY_CUSTOMER=0]="REQUESTED_BY_CUSTOMER",k[k.DUPLICATE=1]="DUPLICATE",k[k.FRAUDULENT=2]="FRAUDULENT",(F=t.RefundStatusEnum||(t.RefundStatusEnum={}))[F.SUCCEEDED=0]="SUCCEEDED",F[F.FAILED=1]="FAILED",F[F.PENDING=3]="PENDING",function(t){t[t.SALES_CREDIT_NOTE_STATUS_IN_PROGRESS=0]="SALES_CREDIT_NOTE_STATUS_IN_PROGRESS",t[t.SALES_CREDIT_NOTE_STATUS_READY_TO_POST=1]="SALES_CREDIT_NOTE_STATUS_READY_TO_POST",t[t.SALES_CREDIT_NOTE_STATUS_COMPLETE=2]="SALES_CREDIT_NOTE_STATUS_COMPLETE",t[t.SALES_CREDIT_NOTE_STATUS_DISCARDED=3]="SALES_CREDIT_NOTE_STATUS_DISCARDED"}(x||(x={})),function(t){t[t.PAYMENT_STATUSES_NOT_SET=0]="PAYMENT_STATUSES_NOT_SET",t[t.PAYMENT_STATUSES_UNPAID=1]="PAYMENT_STATUSES_UNPAID",t[t.PAYMENT_STATUSES_PAID=2]="PAYMENT_STATUSES_PAID",t[t.PAYMENT_STATUSES_PART_PAID=3]="PAYMENT_STATUSES_PART_PAID",t[t.PAYMENT_STATUSES_NOT_APPLICABLE=4]="PAYMENT_STATUSES_NOT_APPLICABLE"}(L||(L={})),function(t){t[t.SALES_INVOICE_STATUS_IN_PROGRESS=0]="SALES_INVOICE_STATUS_IN_PROGRESS",t[t.SALES_INVOICE_STATUS_READY_TO_POST=1]="SALES_INVOICE_STATUS_READY_TO_POST",t[t.SALES_INVOICE_STATUS_COMPLETE=2]="SALES_INVOICE_STATUS_COMPLETE",t[t.SALES_INVOICE_STATUS_DISCARDED=3]="SALES_INVOICE_STATUS_DISCARDED"}(Y||(Y={})),function(t){t[t.SALES_INVOICE_TYPE_UNSET=0]="SALES_INVOICE_TYPE_UNSET",t[t.SALES_INVOICE_TYPE_INVOICED=1]="SALES_INVOICE_TYPE_INVOICED",t[t.SALES_INVOICE_TYPE_INSTANT=2]="SALES_INVOICE_TYPE_INSTANT"}(q||(q={})),(G=t.SubscribeValidationStatus||(t.SubscribeValidationStatus={}))[G.SUBSCRIBE_VALIDATION_STATUS_UNSET=0]="SUBSCRIBE_VALIDATION_STATUS_UNSET",G[G.SUBSCRIBE_VALIDATION_STATUS_CANNOT_INSTANT_BILL=1]="SUBSCRIBE_VALIDATION_STATUS_CANNOT_INSTANT_BILL",G[G.SUBSCRIBE_VALIDATION_STATUS_MISSING_MERCHANT_INFO=2]="SUBSCRIBE_VALIDATION_STATUS_MISSING_MERCHANT_INFO",G[G.SUBSCRIBE_VALIDATION_STATUS_MISSING_PAYMENT_INFO=3]="SUBSCRIBE_VALIDATION_STATUS_MISSING_PAYMENT_INFO",G[G.SUBSCRIBE_VALIDATION_STATUS_WILL_CAUSE_FUTURE_CHARGES=4]="SUBSCRIBE_VALIDATION_STATUS_WILL_CAUSE_FUTURE_CHARGES",function(t){t[t.RENEWAL_STATE_IMMEDIATE=0]="RENEWAL_STATE_IMMEDIATE",t[t.RENEWAL_STATE_DELAYED=1]="RENEWAL_STATE_DELAYED"}(W||(W={}));var H=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.pageSize&&(i.pageSize=parseInt(e.pageSize,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.cursor&&(t.cursor=this.cursor),void 0!==this.pageSize&&(t.pageSize=this.pageSize),t},t}(),V=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.nextCursor&&(t.nextCursor=this.nextCursor),void 0!==this.hasMore&&(t.hasMore=this.hasMore),t},t}();function z(t,e){return"number"==typeof e?e:t[e]}var K=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.billingStart&&(i.billingStart=new Date(e.billingStart)),e.proratedTo&&(i.proratedTo=new Date(e.proratedTo)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.orderId&&(t.orderId=this.orderId),void 0!==this.billingStart&&null!==this.billingStart&&(t.billingStart="toApiJson"in this.billingStart?this.billingStart.toApiJson():this.billingStart),void 0!==this.proratedTo&&null!==this.proratedTo&&(t.proratedTo="toApiJson"in this.proratedTo?this.proratedTo.toApiJson():this.proratedTo),t},t}(),X=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.items&&(i.items=e.items.map(ct.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.items&&null!==this.items&&(t.items="toApiJson"in this.items?this.items.toApiJson():this.items),t},t}(),Q=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.id&&(t.id=this.id),t},t}(),Z=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.expiry&&(n.expiry=new Date(i.expiry)),i.billingStart&&(n.billingStart=new Date(i.billingStart)),i.created&&(n.created=new Date(i.created)),i.updated&&(n.updated=new Date(i.updated)),i.frequency&&(n.frequency=z(t.GeneratedFrequency,i.frequency)),i.nextRenewal&&(n.nextRenewal=new Date(i.nextRenewal)),i.customerAddress&&(n.customerAddress=tt.fromProto(i.customerAddress)),i.customUnitPrice&&(n.customUnitPrice=parseInt(i.customUnitPrice,10)),i.retailFrequency&&(n.retailFrequency=z(t.GeneratedFrequency,i.retailFrequency)),i.nextRetailRenewal&&(n.nextRetailRenewal=new Date(i.nextRetailRenewal)),i.retailUnitPrice&&(n.retailUnitPrice=parseInt(i.retailUnitPrice,10)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.orderId&&(t.orderId=this.orderId),void 0!==this.expiry&&null!==this.expiry&&(t.expiry="toApiJson"in this.expiry?this.expiry.toApiJson():this.expiry),void 0!==this.billingStart&&null!==this.billingStart&&(t.billingStart="toApiJson"in this.billingStart?this.billingStart.toApiJson():this.billingStart),void 0!==this.created&&null!==this.created&&(t.created="toApiJson"in this.created?this.created.toApiJson():this.created),void 0!==this.updated&&null!==this.updated&&(t.updated="toApiJson"in this.updated?this.updated.toApiJson():this.updated),void 0!==this.frequency&&(t.frequency=this.frequency),void 0!==this.nextRenewal&&null!==this.nextRenewal&&(t.nextRenewal="toApiJson"in this.nextRenewal?this.nextRenewal.toApiJson():this.nextRenewal),void 0!==this.customerName&&(t.customerName=this.customerName),void 0!==this.productName&&(t.productName=this.productName),void 0!==this.customerAddress&&null!==this.customerAddress&&(t.customerAddress="toApiJson"in this.customerAddress?this.customerAddress.toApiJson():this.customerAddress),void 0!==this.customUnitPrice&&(t.customUnitPrice=this.customUnitPrice),void 0!==this.retailFrequency&&(t.retailFrequency=this.retailFrequency),void 0!==this.nextRetailRenewal&&null!==this.nextRetailRenewal&&(t.nextRetailRenewal="toApiJson"in this.nextRetailRenewal?this.nextRetailRenewal.toApiJson():this.nextRetailRenewal),void 0!==this.retailUnitPrice&&(t.retailUnitPrice=this.retailUnitPrice),t},e}(),$=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),t},t}(),tt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.address&&(t.address=this.address),void 0!==this.city&&(t.city=this.city),void 0!==this.state&&(t.state=this.state),void 0!==this.zip&&(t.zip=this.zip),void 0!==this.country&&(t.country=this.country),t},t}(),et=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.orderId&&(t.orderId=this.orderId),t},t}(),it=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.expiry&&(i.expiry=new Date(e.expiry)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.orderId&&(t.orderId=this.orderId),void 0!==this.expiry&&null!==this.expiry&&(t.expiry="toApiJson"in this.expiry?this.expiry.toApiJson():this.expiry),t},t}(),nt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.skus&&(t.skus=this.skus),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),t},t}(),ot=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.orderId&&(t.orderId=this.orderId),t},t}(),rt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.item&&(i.item=Z.fromProto(e.item)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.item&&null!==this.item&&(t.item="toApiJson"in this.item?this.item.toApiJson():this.item),t},t}(),st=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.subscriptionKeys&&(i.subscriptionKeys=e.subscriptionKeys.map(ut.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.subscriptionKeys&&null!==this.subscriptionKeys&&(t.subscriptionKeys="toApiJson"in this.subscriptionKeys?this.subscriptionKeys.toApiJson():this.subscriptionKeys),t},t}(),at=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.subscriptions&&(i.subscriptions=e.subscriptions.map(Z.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.subscriptions&&null!==this.subscriptions&&(t.subscriptions="toApiJson"in this.subscriptions?this.subscriptions.toApiJson():this.subscriptions),t},t}(),ct=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.billingStart&&(i.billingStart=new Date(e.billingStart)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.orderId&&(t.orderId=this.orderId),void 0!==this.billingStart&&null!==this.billingStart&&(t.billingStart="toApiJson"in this.billingStart?this.billingStart.toApiJson():this.billingStart),t},t}(),ut=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.orderId&&(t.orderId=this.orderId),t},t}(),pt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.filters&&(i.filters=nt.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=H.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),void 0!==this.searchTerm&&(t.searchTerm=this.searchTerm),t},t}(),dt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.items&&(i.items=e.items.map(Z.fromProto)),e.pagingMetadata&&(i.pagingMetadata=V.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.items&&null!==this.items&&(t.items="toApiJson"in this.items?this.items.toApiJson():this.items),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}();var ht=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i,n,o=new t;return o=Object.assign(o,e),e.type&&(o.type=(i=c,"number"==typeof(n=e.type)?n:i[n])),e.value&&(o.value=parseInt(e.value,10)),e.totalAmount&&(o.totalAmount=parseInt(e.totalAmount,10)),o},t.prototype.toApiJson=function(){var t={};return void 0!==this.type&&(t.type=this.type),void 0!==this.value&&(t.value=this.value),void 0!==this.totalAmount&&(t.totalAmount=this.totalAmount),void 0!==this.description&&(t.description=this.description),t},t}();function lt(t,e){return"number"==typeof e?e:t[e]}var mt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.items&&(i.items=e.items.map(vt.fromProto)),e.created&&(i.created=new Date(e.created)),e.updated&&(i.updated=new Date(e.updated)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.bundleId&&(t.bundleId=this.bundleId),void 0!==this.name&&(t.name=this.name),void 0!==this.items&&null!==this.items&&(t.items="toApiJson"in this.items?this.items.toApiJson():this.items),void 0!==this.created&&null!==this.created&&(t.created="toApiJson"in this.created?this.created.toApiJson():this.created),void 0!==this.updated&&null!==this.updated&&(t.updated="toApiJson"in this.updated?this.updated.toApiJson():this.updated),void 0!==this.hideBundleDetails&&(t.hideBundleDetails=this.hideBundleDetails),t},t}(),vt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.discountType&&(i.discountType=lt(c,e.discountType)),e.discountAmount&&(i.discountAmount=parseInt(e.discountAmount,10)),e.quantity&&(i.quantity=parseInt(e.quantity,10)),e.price&&(i.price=Pt.fromProto(e.price)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.productId&&(t.productId=this.productId),void 0!==this.discountType&&(t.discountType=this.discountType),void 0!==this.discountAmount&&(t.discountAmount=this.discountAmount),void 0!==this.quantity&&(t.quantity=this.quantity),void 0!==this.defaultSku&&(t.defaultSku=this.defaultSku),void 0!==this.price&&null!==this.price&&(t.price="toApiJson"in this.price?this.price.toApiJson():this.price),t},t}(),ft=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.prices&&(i.prices=e.prices.map(bt.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.bundleId&&(t.bundleId=this.bundleId),void 0!==this.currency&&(t.currency=this.currency),void 0!==this.prices&&null!==this.prices&&(t.prices="toApiJson"in this.prices?this.prices.toApiJson():this.prices),t},t}(),gt=(function(){function t(t){t&&Object.assign(this,t)}t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.value&&(i.value=mt.fromProto(e.value)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.key&&(t.key=this.key),void 0!==this.value&&null!==this.value&&(t.value="toApiJson"in this.value?this.value.toApiJson():this.value),t}}(),function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}()),It=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.bundleIds&&(t.bundleIds=this.bundleIds),t},t}(),yt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.bundles&&(i.bundles=Object.keys(e.bundles).reduce((function(t,i){return t[i]=mt.fromProto(e.bundles[i]),t}),{})),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.bundles&&null!==this.bundles&&(t.bundles="toApiJson"in this.bundles?this.bundles.toApiJson():this.bundles),t},t}(),At=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.filters&&(i.filters=gt.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=H.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),void 0!==this.searchTerm&&(t.searchTerm=this.searchTerm),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),St=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.bundles&&(i.bundles=e.bundles.map(mt.fromProto)),e.pagingMetadata&&(i.pagingMetadata=V.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.bundles&&null!==this.bundles&&(t.bundles="toApiJson"in this.bundles?this.bundles.toApiJson():this.bundles),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),Pt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.amount&&(i.amount=parseInt(e.amount,10)),e.setupFee&&(i.setupFee=parseInt(e.setupFee,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.amount&&(t.amount=this.amount),void 0!==this.setupFee&&(t.setupFee=this.setupFee),t},t}(),bt=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.frequency&&(n.frequency=lt(t.GeneratedFrequency,i.frequency)),i.effectivePrice&&(n.effectivePrice=parseInt(i.effectivePrice,10)),i.initialPrice&&(n.initialPrice=parseInt(i.initialPrice,10)),i.setupFee&&(n.setupFee=parseInt(i.setupFee,10)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.frequency&&(t.frequency=this.frequency),void 0!==this.effectivePrice&&(t.effectivePrice=this.effectivePrice),void 0!==this.initialPrice&&(t.initialPrice=this.initialPrice),void 0!==this.setupFee&&(t.setupFee=this.setupFee),t},e}(),Tt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.items&&(i.items=e.items.map(vt.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.bundleId&&(t.bundleId=this.bundleId),void 0!==this.name&&(t.name=this.name),void 0!==this.items&&null!==this.items&&(t.items="toApiJson"in this.items?this.items.toApiJson():this.items),void 0!==this.hideBundleDetails&&(t.hideBundleDetails=this.hideBundleDetails),t},t}();var Ot=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.initial&&(i.initial=parseInt(e.initial,10)),e.recurring&&(i.recurring=parseInt(e.recurring,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.initial&&(t.initial=this.initial),void 0!==this.recurring&&(t.recurring=this.recurring),t},t}();function Et(t,e){return"number"==typeof e?e:t[e]}var Rt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.netD&&(i.netD=parseInt(e.netD,10)),e.created&&(i.created=new Date(e.created)),e.currency&&(i.currency=Et(u,e.currency)),e.signed&&(i.signed=new Date(e.signed)),e.activated&&(i.activated=new Date(e.activated)),e.modified&&(i.modified=new Date(e.modified)),e.verified&&(i.verified=new Date(e.verified)),e.creditLimit&&(i.creditLimit=parseInt(e.creditLimit,10)),e.end&&(i.end=new Date(e.end)),e.subscriptionUpdateStatus&&(i.subscriptionUpdateStatus=Et(p,e.subscriptionUpdateStatus)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.netD&&(t.netD=this.netD),void 0!==this.created&&null!==this.created&&(t.created="toApiJson"in this.created?this.created.toApiJson():this.created),void 0!==this.subscriptionId&&(t.subscriptionId=this.subscriptionId),void 0!==this.currency&&(t.currency=this.currency),void 0!==this.signed&&null!==this.signed&&(t.signed="toApiJson"in this.signed?this.signed.toApiJson():this.signed),void 0!==this.activated&&null!==this.activated&&(t.activated="toApiJson"in this.activated?this.activated.toApiJson():this.activated),void 0!==this.modified&&null!==this.modified&&(t.modified="toApiJson"in this.modified?this.modified.toApiJson():this.modified),void 0!==this.verified&&null!==this.verified&&(t.verified="toApiJson"in this.verified?this.verified.toApiJson():this.verified),void 0!==this.status&&(t.status=this.status),void 0!==this.creditLimit&&(t.creditLimit=this.creditLimit),void 0!==this.dimension&&(t.dimension=this.dimension),void 0!==this.pricingPlanId&&(t.pricingPlanId=this.pricingPlanId),void 0!==this.end&&null!==this.end&&(t.end="toApiJson"in this.end?this.end.toApiJson():this.end),void 0!==this.subscriptionUpdateStatus&&(t.subscriptionUpdateStatus=this.subscriptionUpdateStatus),t},t}(),Dt=(function(){function t(t){t&&Object.assign(this,t)}t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.value&&(i.value=Rt.fromProto(e.value)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.key&&(t.key=this.key),void 0!==this.value&&null!==this.value&&(t.value="toApiJson"in this.value?this.value.toApiJson():this.value),t}}(),function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.currencyCode&&(t.currencyCode=this.currencyCode),t},t}()),Ct=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.contract&&(i.contract=Rt.fromProto(e.contract)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.contract&&null!==this.contract&&(t.contract="toApiJson"in this.contract?this.contract.toApiJson():this.contract),t},t}(),_t=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),Jt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.contract&&(i.contract=Rt.fromProto(e.contract)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.contract&&null!==this.contract&&(t.contract="toApiJson"in this.contract?this.contract.toApiJson():this.contract),t},t}(),wt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantIds&&(t.merchantIds=this.merchantIds),t},t}(),jt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.contracts&&(i.contracts=Object.keys(e.contracts).reduce((function(t,i){return t[i]=Rt.fromProto(e.contracts[i]),t}),{})),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.contracts&&null!==this.contracts&&(t.contracts="toApiJson"in this.contracts?this.contracts.toApiJson():this.contracts),t},t}(),Nt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.pagingOptions&&(i.pagingOptions=H.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),Ut=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.contracts&&(i.contracts=e.contracts.map(Rt.fromProto)),e.pagingMetadata&&(i.pagingMetadata=V.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.contracts&&null!==this.contracts&&(t.contracts="toApiJson"in this.contracts?this.contracts.toApiJson():this.contracts),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),Mt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.netD&&(i.netD=parseInt(e.netD,10)),e.signed&&(i.signed=new Date(e.signed)),e.activated&&(i.activated=new Date(e.activated)),e.end&&(i.end=new Date(e.end)),e.modified&&(i.modified=new Date(e.modified)),e.creditLimit&&(i.creditLimit=parseInt(e.creditLimit,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.netD&&(t.netD=this.netD),void 0!==this.currencyCode&&(t.currencyCode=this.currencyCode),void 0!==this.status&&(t.status=this.status),void 0!==this.dimension&&(t.dimension=this.dimension),void 0!==this.signed&&null!==this.signed&&(t.signed="toApiJson"in this.signed?this.signed.toApiJson():this.signed),void 0!==this.activated&&null!==this.activated&&(t.activated="toApiJson"in this.activated?this.activated.toApiJson():this.activated),void 0!==this.end&&null!==this.end&&(t.end="toApiJson"in this.end?this.end.toApiJson():this.end),void 0!==this.modified&&null!==this.modified&&(t.modified="toApiJson"in this.modified?this.modified.toApiJson():this.modified),void 0!==this.creditLimit&&(t.creditLimit=this.creditLimit),void 0!==this.subscriptionId&&(t.subscriptionId=this.subscriptionId),t},t}(),Bt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),kt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.mutations&&(i.mutations=e.mutations.map(Mt.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.mutations&&null!==this.mutations&&(t.mutations="toApiJson"in this.mutations?this.mutations.toApiJson():this.mutations),t},t}(),Ft=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.contract&&(i.contract=Rt.fromProto(e.contract)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.contract&&null!==this.contract&&(t.contract="toApiJson"in this.contract?this.contract.toApiJson():this.contract),t},t}(),xt=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.frequency&&(n.frequency=Et(t.GeneratedFrequency,i.frequency)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.subscriptionId&&(t.subscriptionId=this.subscriptionId),void 0!==this.frequency&&(t.frequency=this.frequency),t},e}();var Lt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i,n,o=new t;return o=Object.assign(o,e),e.purchaseItemQuantity&&(o.purchaseItemQuantity=parseInt(e.purchaseItemQuantity,10)),e.purchaseItemTotal&&(o.purchaseItemTotal=parseInt(e.purchaseItemTotal,10)),e.currency&&(o.currency=(i=u,"number"==typeof(n=e.currency)?n:i[n])),o},t.prototype.toApiJson=function(){var t={};return void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.purchaseItemQuantity&&(t.purchaseItemQuantity=this.purchaseItemQuantity),void 0!==this.purchaseItemTotal&&(t.purchaseItemTotal=this.purchaseItemTotal),void 0!==this.currency&&(t.currency=this.currency),t},t}(),Yt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.periodStart&&(i.periodStart=new Date(e.periodStart)),e.periodEnd&&(i.periodEnd=new Date(e.periodEnd)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.customerIds&&(t.customerIds=this.customerIds),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.periodStart&&null!==this.periodStart&&(t.periodStart="toApiJson"in this.periodStart?this.periodStart.toApiJson():this.periodStart),void 0!==this.periodEnd&&null!==this.periodEnd&&(t.periodEnd="toApiJson"in this.periodEnd?this.periodEnd.toApiJson():this.periodEnd),t},t}(),qt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.customerSummaries&&(i.customerSummaries=e.customerSummaries.map(Lt.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.customerSummaries&&null!==this.customerSummaries&&(t.customerSummaries="toApiJson"in this.customerSummaries?this.customerSummaries.toApiJson():this.customerSummaries),t},t}();var Gt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.id&&(t.id=this.id),void 0!==this.accountHolderName&&(t.accountHolderName=this.accountHolderName),void 0!==this.bankName&&(t.bankName=this.bankName),void 0!==this.country&&(t.country=this.country),void 0!==this.currency&&(t.currency=this.currency),void 0!==this.routingNumber&&(t.routingNumber=this.routingNumber),void 0!==this.last4&&(t.last4=this.last4),void 0!==this.defaultForCurrency&&(t.defaultForCurrency=this.defaultForCurrency),t},t}(),Wt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.stripeToken&&(t.stripeToken=this.stripeToken),t},t}(),Ht=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.bankAccountId&&(t.bankAccountId=this.bankAccountId),t},t}(),Vt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),zt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.bankAccount&&(i.bankAccount=e.bankAccount.map(Gt.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.bankAccount&&null!==this.bankAccount&&(t.bankAccount="toApiJson"in this.bankAccount?this.bankAccount.toApiJson():this.bankAccount),t},t}(),Kt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.bankAccountId&&(t.bankAccountId=this.bankAccountId),t},t}();function Xt(t,e){return"number"==typeof e?e:t[e]}var Qt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.type&&(i.type=Xt(h,e.type)),e.value&&(i.value=parseInt(e.value,10)),e.totalAmount&&(i.totalAmount=parseInt(e.totalAmount,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.type&&(t.type=this.type),void 0!==this.value&&(t.value=this.value),void 0!==this.totalAmount&&(t.totalAmount=this.totalAmount),void 0!==this.description&&(t.description=this.description),void 0!==this.resetEachPeriod&&(t.resetEachPeriod=this.resetEachPeriod),t},t}(),Zt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.start&&(i.start=new Date(e.start)),e.end&&(i.end=new Date(e.end)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.start&&null!==this.start&&(t.start="toApiJson"in this.start?this.start.toApiJson():this.start),void 0!==this.end&&null!==this.end&&(t.end="toApiJson"in this.end?this.end.toApiJson():this.end),t},t}(),$t=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.startDate&&(i.startDate=new Date(e.startDate)),e.endDate&&(i.endDate=new Date(e.endDate)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.startDate&&null!==this.startDate&&(t.startDate="toApiJson"in this.startDate?this.startDate.toApiJson():this.startDate),void 0!==this.endDate&&null!==this.endDate&&(t.endDate="toApiJson"in this.endDate?this.endDate.toApiJson():this.endDate),t},t}(),te=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.totalAmount&&(i.totalAmount=parseInt(e.totalAmount,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.totalAmount&&(t.totalAmount=this.totalAmount),t},t}(),ee=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.startDate&&(i.startDate=new Date(e.startDate)),e.endDate&&(i.endDate=new Date(e.endDate)),e.pageSize&&(i.pageSize=parseInt(e.pageSize,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.startDate&&null!==this.startDate&&(t.startDate="toApiJson"in this.startDate?this.startDate.toApiJson():this.startDate),void 0!==this.endDate&&null!==this.endDate&&(t.endDate="toApiJson"in this.endDate?this.endDate.toApiJson():this.endDate),void 0!==this.cursor&&(t.cursor=this.cursor),void 0!==this.pageSize&&(t.pageSize=this.pageSize),void 0!==this.skus&&(t.skus=this.skus),t},t}(),ie=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.results&&(i.results=e.results.map(ae.fromProto)),e.totalResults&&(i.totalResults=parseInt(e.totalResults,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.results&&null!==this.results&&(t.results="toApiJson"in this.results?this.results.toApiJson():this.results),void 0!==this.nextCursor&&(t.nextCursor=this.nextCursor),void 0!==this.hasMore&&(t.hasMore=this.hasMore),void 0!==this.totalResults&&(t.totalResults=this.totalResults),t},t}(),ne=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.metricsByGroup&&(i.metricsByGroup=e.metricsByGroup.map(pe.fromProto)),e.pagingMetadata&&(i.pagingMetadata=V.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.metricsByGroup&&null!==this.metricsByGroup&&(t.metricsByGroup="toApiJson"in this.metricsByGroup?this.metricsByGroup.toApiJson():this.metricsByGroup),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),oe=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.subscriptionMetrics&&(i.subscriptionMetrics=e.subscriptionMetrics.map(ce.fromProto)),e.pagingMetadata&&(i.pagingMetadata=V.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.subscriptionMetrics&&null!==this.subscriptionMetrics&&(t.subscriptionMetrics="toApiJson"in this.subscriptionMetrics?this.subscriptionMetrics.toApiJson():this.subscriptionMetrics),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),re=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.filters&&(i.filters=Zt.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=H.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),se=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.type&&(i.type=Xt(m,e.type)),e.rules&&(i.rules=e.rules.map(ue.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.type&&(t.type=this.type),void 0!==this.rules&&null!==this.rules&&(t.rules="toApiJson"in this.rules?this.rules.toApiJson():this.rules),t},t}(),ae=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.totalQuantity&&(n.totalQuantity=parseInt(i.totalQuantity,10)),i.totalAmount&&(n.totalAmount=parseInt(i.totalAmount,10)),i.totalDiscount&&(n.totalDiscount=parseInt(i.totalDiscount,10)),i.pricing&&(n.pricing=se.fromProto(i.pricing)),i.discounts&&(n.discounts=i.discounts.map(Qt.fromProto)),i.billingStrategy&&(n.billingStrategy=Xt(t.ProductSummaryBillingStrategy,i.billingStrategy)),i.productType&&(n.productType=Xt(t.ProductType,i.productType)),i.frequency&&(n.frequency=Xt(t.GeneratedFrequency,i.frequency)),i.volumeCommitment&&(n.volumeCommitment=parseInt(i.volumeCommitment,10)),i.setupFee&&(n.setupFee=parseInt(i.setupFee,10)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.productName&&(t.productName=this.productName),void 0!==this.totalQuantity&&(t.totalQuantity=this.totalQuantity),void 0!==this.totalAmount&&(t.totalAmount=this.totalAmount),void 0!==this.totalDiscount&&(t.totalDiscount=this.totalDiscount),void 0!==this.pricing&&null!==this.pricing&&(t.pricing="toApiJson"in this.pricing?this.pricing.toApiJson():this.pricing),void 0!==this.discounts&&null!==this.discounts&&(t.discounts="toApiJson"in this.discounts?this.discounts.toApiJson():this.discounts),void 0!==this.billingStrategy&&(t.billingStrategy=this.billingStrategy),void 0!==this.productType&&(t.productType=this.productType),void 0!==this.frequency&&(t.frequency=this.frequency),void 0!==this.proratedPercent&&(t.proratedPercent=this.proratedPercent),void 0!==this.volumeCommitment&&(t.volumeCommitment=this.volumeCommitment),void 0!==this.setupFee&&(t.setupFee=this.setupFee),t},e}(),ce=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.startingCount&&(i.startingCount=parseInt(e.startingCount,10)),e.activations&&(i.activations=parseInt(e.activations,10)),e.deactivations&&(i.deactivations=parseInt(e.deactivations,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.productName&&(t.productName=this.productName),void 0!==this.startingCount&&(t.startingCount=this.startingCount),void 0!==this.activations&&(t.activations=this.activations),void 0!==this.deactivations&&(t.deactivations=this.deactivations),void 0!==this.churn&&(t.churn=this.churn),void 0!==this.retention&&(t.retention=this.retention),t},t}(),ue=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.min&&(i.min=parseInt(e.min,10)),e.max&&(i.max=parseInt(e.max,10)),e.units&&(i.units=parseInt(e.units,10)),e.unitPrice&&(i.unitPrice=parseInt(e.unitPrice,10)),e.totalAmount&&(i.totalAmount=parseInt(e.totalAmount,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.min&&(t.min=this.min),void 0!==this.max&&(t.max=this.max),void 0!==this.units&&(t.units=this.units),void 0!==this.unitPrice&&(t.unitPrice=this.unitPrice),void 0!==this.totalAmount&&(t.totalAmount=this.totalAmount),t},t}(),pe=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.subscriptionMetrics&&(i.subscriptionMetrics=e.subscriptionMetrics.map(ce.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.groupId&&(t.groupId=this.groupId),void 0!==this.subscriptionMetrics&&null!==this.subscriptionMetrics&&(t.subscriptionMetrics="toApiJson"in this.subscriptionMetrics?this.subscriptionMetrics.toApiJson():this.subscriptionMetrics),t},t}();function de(t,e){return"number"==typeof e?e:t[e]}var he=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.discountType&&(i.discountType=de(c,e.discountType)),e.amount&&(i.amount=parseInt(e.amount,10)),e.start&&(i.start=new Date(e.start)),e.end&&(i.end=new Date(e.end)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.discountType&&(t.discountType=this.discountType),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.start&&null!==this.start&&(t.start="toApiJson"in this.start?this.start.toApiJson():this.start),void 0!==this.end&&null!==this.end&&(t.end="toApiJson"in this.end?this.end.toApiJson():this.end),void 0!==this.resetEachPeriod&&(t.resetEachPeriod=this.resetEachPeriod),void 0!==this.description&&(t.description=this.description),t},t}(),le=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.discountId&&(i.discountId=parseInt(e.discountId,10)),e.discountType&&(i.discountType=de(c,e.discountType)),e.amount&&(i.amount=parseInt(e.amount,10)),e.start&&(i.start=new Date(e.start)),e.end&&(i.end=new Date(e.end)),e.created&&(i.created=new Date(e.created)),e.updated&&(i.updated=new Date(e.updated)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.discountId&&(t.discountId=this.discountId),void 0!==this.discountType&&(t.discountType=this.discountType),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.start&&null!==this.start&&(t.start="toApiJson"in this.start?this.start.toApiJson():this.start),void 0!==this.end&&null!==this.end&&(t.end="toApiJson"in this.end?this.end.toApiJson():this.end),void 0!==this.resetEachPeriod&&(t.resetEachPeriod=this.resetEachPeriod),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.created&&null!==this.created&&(t.created="toApiJson"in this.created?this.created.toApiJson():this.created),void 0!==this.updated&&null!==this.updated&&(t.updated="toApiJson"in this.updated?this.updated.toApiJson():this.updated),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.id&&(t.id=this.id),void 0!==this.description&&(t.description=this.description),t},t}(),me=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.id&&(t.id=this.id),t},t}(),ve=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.expiry&&(i.expiry=new Date(e.expiry)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.expiry&&null!==this.expiry&&(t.expiry="toApiJson"in this.expiry?this.expiry.toApiJson():this.expiry),void 0!==this.skus&&(t.skus=this.skus),t},t}(),fe=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.filters&&(i.filters=ve.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=H.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),ge=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.discounts&&(i.discounts=e.discounts.map(le.fromProto)),e.pagingMetadata&&(i.pagingMetadata=V.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.discounts&&null!==this.discounts&&(t.discounts="toApiJson"in this.discounts?this.discounts.toApiJson():this.discounts),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),Ie=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.discountType&&(i.discountType=de(c,e.discountType)),e.amount&&(i.amount=parseInt(e.amount,10)),e.start&&(i.start=new Date(e.start)),e.end&&(i.end=new Date(e.end)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.id&&(t.id=this.id),void 0!==this.discountType&&(t.discountType=this.discountType),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.start&&null!==this.start&&(t.start="toApiJson"in this.start?this.start.toApiJson():this.start),void 0!==this.end&&null!==this.end&&(t.end="toApiJson"in this.end?this.end.toApiJson():this.end),void 0!==this.resetEachPeriod&&(t.resetEachPeriod=this.resetEachPeriod),void 0!==this.description&&(t.description=this.description),t},t}();var ye=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.amount&&(i.amount=parseInt(e.amount,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.amount&&(t.amount=this.amount),void 0!==this.taxRateId&&(t.taxRateId=this.taxRateId),void 0!==this.name&&(t.name=this.name),void 0!==this.percentage&&(t.percentage=this.percentage),t},t}();var Ae=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.paths&&(t.paths=this.paths),t},t}();var Se=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.id&&(t.id=this.id),t},t}(),Pe=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.amount&&(i.amount=parseInt(e.amount,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.amount&&(t.amount=this.amount),t},t}(),be=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.taxableAmount&&(i.taxableAmount=parseInt(e.taxableAmount,10)),e.taxRates&&(i.taxRates=e.taxRates.map(_e.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.taxableAmount&&(t.taxableAmount=this.taxableAmount),void 0!==this.taxRates&&null!==this.taxRates&&(t.taxRates="toApiJson"in this.taxRates?this.taxRates.toApiJson():this.taxRates),t},t}(),Te=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.countryCode&&(t.countryCode=this.countryCode),void 0!==this.stateCode&&(t.stateCode=this.stateCode),void 0!==this.name&&(t.name=this.name),void 0!==this.description&&(t.description=this.description),void 0!==this.percentage&&(t.percentage=this.percentage),void 0!==this.accountingSystemId&&(t.accountingSystemId=this.accountingSystemId),t},t}(),Oe=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.includeArchived&&(t.includeArchived=this.includeArchived),t},t}(),Ee=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.ids&&(t.ids=this.ids),t},t}(),Re=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.taxRates&&(i.taxRates=e.taxRates.map(_e.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.taxRates&&null!==this.taxRates&&(t.taxRates="toApiJson"in this.taxRates?this.taxRates.toApiJson():this.taxRates),t},t}(),De=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.filters&&(i.filters=Oe.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=H.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),Ce=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.taxRates&&(i.taxRates=e.taxRates.map(_e.fromProto)),e.pagingMetadata&&(i.pagingMetadata=V.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.taxRates&&null!==this.taxRates&&(t.taxRates="toApiJson"in this.taxRates?this.taxRates.toApiJson():this.taxRates),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),_e=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.archived&&(i.archived=new Date(e.archived)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.id&&(t.id=this.id),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.countryCode&&(t.countryCode=this.countryCode),void 0!==this.stateCode&&(t.stateCode=this.stateCode),void 0!==this.name&&(t.name=this.name),void 0!==this.description&&(t.description=this.description),void 0!==this.percentage&&(t.percentage=this.percentage),void 0!==this.accountingSystemId&&(t.accountingSystemId=this.accountingSystemId),void 0!==this.archived&&null!==this.archived&&(t.archived="toApiJson"in this.archived?this.archived.toApiJson():this.archived),t},t}(),Je=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.id&&(t.id=this.id),void 0!==this.countryCode&&(t.countryCode=this.countryCode),void 0!==this.stateCode&&(t.stateCode=this.stateCode),void 0!==this.name&&(t.name=this.name),void 0!==this.description&&(t.description=this.description),void 0!==this.percentage&&(t.percentage=this.percentage),void 0!==this.accountingSystemId&&(t.accountingSystemId=this.accountingSystemId),t},t}();var we=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.bundleItems&&(i.bundleItems=e.bundleItems.map(je.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.bundleId&&(t.bundleId=this.bundleId),void 0!==this.name&&(t.name=this.name),void 0!==this.bundleItems&&null!==this.bundleItems&&(t.bundleItems="toApiJson"in this.bundleItems?this.bundleItems.toApiJson():this.bundleItems),void 0!==this.hideBundleItems&&(t.hideBundleItems=this.hideBundleItems),void 0!==this.bundleInstanceId&&(t.bundleInstanceId=this.bundleInstanceId),t},t}(),je=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.discountAmount&&(i.discountAmount=parseInt(e.discountAmount,10)),e.quantity&&(i.quantity=parseInt(e.quantity,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.productId&&(t.productId=this.productId),void 0!==this.discountType&&(t.discountType=this.discountType),void 0!==this.discountAmount&&(t.discountAmount=this.discountAmount),void 0!==this.quantity&&(t.quantity=this.quantity),t},t}();function Ne(t,e){return"number"==typeof e?e:t[e]}var Ue=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.bundleId&&(t.bundleId=this.bundleId),t},t}(),Me=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoice&&(i.invoice=Ze.fromProto(e.invoice)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoice&&null!==this.invoice&&(t.invoice="toApiJson"in this.invoice?this.invoice.toApiJson():this.invoice),t},t}(),Be=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.amount&&(i.amount=parseInt(e.amount,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.quantity&&(t.quantity=this.quantity),void 0!==this.description&&(t.description=this.description),void 0!==this.taxRates&&(t.taxRates=this.taxRates),t},t}(),ke=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoice&&(i.invoice=Ze.fromProto(e.invoice)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoice&&null!==this.invoice&&(t.invoice="toApiJson"in this.invoice?this.invoice.toApiJson():this.invoice),t},t}(),Fe=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),void 0!==this.paymentMethodId&&(t.paymentMethodId=this.paymentMethodId),t},t}(),xe=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.currencyCode&&(t.currencyCode=this.currencyCode),void 0!==this.orderId&&(t.orderId=this.orderId),t},t}(),Le=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),t},t}(),Ye=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.address&&(t.address=this.address),void 0!==this.city&&(t.city=this.city),void 0!==this.state&&(t.state=this.state),void 0!==this.zip&&(t.zip=this.zip),void 0!==this.country&&(t.country=this.country),void 0!==this.address2&&(t.address2=this.address2),t},t}(),qe=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.dateField&&(i.dateField=Ne(v,e.dateField)),e.dateLte&&(i.dateLte=new Date(e.dateLte)),e.dateGte&&(i.dateGte=new Date(e.dateGte)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.dateField&&(t.dateField=this.dateField),void 0!==this.dateLte&&null!==this.dateLte&&(t.dateLte="toApiJson"in this.dateLte?this.dateLte.toApiJson():this.dateLte),void 0!==this.dateGte&&null!==this.dateGte&&(t.dateGte="toApiJson"in this.dateGte?this.dateGte.toApiJson():this.dateGte),t},t}(),Ge=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),t},t}(),We=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),void 0!==this.id&&(t.id=this.id),t},t}(),He=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoice&&(i.invoice=Ze.fromProto(e.invoice)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoice&&null!==this.invoice&&(t.invoice="toApiJson"in this.invoice?this.invoice.toApiJson():this.invoice),t},t}(),Ve=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),t},t}(),ze=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),t},t}(),Ke=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.statuses&&(i.statuses=e.statuses.map((function(t){return Ne(f,t)}))),e.dateFilter&&(i.dateFilter=qe.fromProto(e.dateFilter)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.statuses&&(t.statuses=this.statuses),void 0!==this.pastDue&&(t.pastDue=this.pastDue),void 0!==this.number&&(t.number=this.number),void 0!==this.dateFilter&&null!==this.dateFilter&&(t.dateFilter="toApiJson"in this.dateFilter?this.dateFilter.toApiJson():this.dateFilter),t},t}(),Xe=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),t},t}(),Qe=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoice&&(i.invoice=Ze.fromProto(e.invoice)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoice&&null!==this.invoice&&(t.invoice="toApiJson"in this.invoice?this.invoice.toApiJson():this.invoice),t},t}(),Ze=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.status&&(i.status=Ne(f,e.status)),e.subtotal&&(i.subtotal=parseInt(e.subtotal,10)),e.total&&(i.total=parseInt(e.total,10)),e.amountPaid&&(i.amountPaid=parseInt(e.amountPaid,10)),e.issued&&(i.issued=new Date(e.issued)),e.due&&(i.due=new Date(e.due)),e.created&&(i.created=new Date(e.created)),e.updated&&(i.updated=new Date(e.updated)),e.items&&(i.items=e.items.map($e.fromProto)),e.currency&&(i.currency=Ne(u,e.currency)),e.paid&&(i.paid=new Date(e.paid)),e.amountTax&&(i.amountTax=parseInt(e.amountTax,10)),e.appliedTaxes&&(i.appliedTaxes=e.appliedTaxes.map(ye.fromProto)),e.defaultTaxRates&&(i.defaultTaxRates=e.defaultTaxRates.map(_e.fromProto)),e.appliedBundles&&(i.appliedBundles=e.appliedBundles.map(we.fromProto)),e.amountDiscount&&(i.amountDiscount=parseInt(e.amountDiscount,10)),e.voided&&(i.voided=new Date(e.voided)),e.customerAddress&&(i.customerAddress=Ye.fromProto(e.customerAddress)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.id&&(t.id=this.id),void 0!==this.number&&(t.number=this.number),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.status&&(t.status=this.status),void 0!==this.subtotal&&(t.subtotal=this.subtotal),void 0!==this.total&&(t.total=this.total),void 0!==this.amountPaid&&(t.amountPaid=this.amountPaid),void 0!==this.issued&&null!==this.issued&&(t.issued="toApiJson"in this.issued?this.issued.toApiJson():this.issued),void 0!==this.due&&null!==this.due&&(t.due="toApiJson"in this.due?this.due.toApiJson():this.due),void 0!==this.created&&null!==this.created&&(t.created="toApiJson"in this.created?this.created.toApiJson():this.created),void 0!==this.updated&&null!==this.updated&&(t.updated="toApiJson"in this.updated?this.updated.toApiJson():this.updated),void 0!==this.items&&null!==this.items&&(t.items="toApiJson"in this.items?this.items.toApiJson():this.items),void 0!==this.currency&&(t.currency=this.currency),void 0!==this.paid&&null!==this.paid&&(t.paid="toApiJson"in this.paid?this.paid.toApiJson():this.paid),void 0!==this.orderId&&(t.orderId=this.orderId),void 0!==this.amountTax&&(t.amountTax=this.amountTax),void 0!==this.appliedTaxes&&null!==this.appliedTaxes&&(t.appliedTaxes="toApiJson"in this.appliedTaxes?this.appliedTaxes.toApiJson():this.appliedTaxes),void 0!==this.defaultTaxRates&&null!==this.defaultTaxRates&&(t.defaultTaxRates="toApiJson"in this.defaultTaxRates?this.defaultTaxRates.toApiJson():this.defaultTaxRates),void 0!==this.appliedBundles&&null!==this.appliedBundles&&(t.appliedBundles="toApiJson"in this.appliedBundles?this.appliedBundles.toApiJson():this.appliedBundles),void 0!==this.amountDiscount&&(t.amountDiscount=this.amountDiscount),void 0!==this.customerName&&(t.customerName=this.customerName),void 0!==this.origin&&(t.origin=this.origin),void 0!==this.collectionMethod&&(t.collectionMethod=this.collectionMethod),void 0!==this.contactId&&(t.contactId=this.contactId),void 0!==this.memo&&(t.memo=this.memo),void 0!==this.voided&&null!==this.voided&&(t.voided="toApiJson"in this.voided?this.voided.toApiJson():this.voided),void 0!==this.defaultPaymentMethod&&(t.defaultPaymentMethod=this.defaultPaymentMethod),void 0!==this.customerAddress&&null!==this.customerAddress&&(t.customerAddress="toApiJson"in this.customerAddress?this.customerAddress.toApiJson():this.customerAddress),void 0!==this.externalCustomerIdentifier&&(t.externalCustomerIdentifier=this.externalCustomerIdentifier),t},t}(),$e=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.amount&&(i.amount=parseInt(e.amount,10)),e.total&&(i.total=parseInt(e.total,10)),e.appliedTaxes&&(i.appliedTaxes=e.appliedTaxes.map(ye.fromProto)),e.taxRates&&(i.taxRates=e.taxRates.map(_e.fromProto)),e.discounts&&(i.discounts=e.discounts.map(ht.fromProto)),e.subtotal&&(i.subtotal=parseInt(e.subtotal,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.id&&(t.id=this.id),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.quantity&&(t.quantity=this.quantity),void 0!==this.description&&(t.description=this.description),void 0!==this.total&&(t.total=this.total),void 0!==this.appliedTaxes&&null!==this.appliedTaxes&&(t.appliedTaxes="toApiJson"in this.appliedTaxes?this.appliedTaxes.toApiJson():this.appliedTaxes),void 0!==this.taxRates&&null!==this.taxRates&&(t.taxRates="toApiJson"in this.taxRates?this.taxRates.toApiJson():this.taxRates),void 0!==this.bundleId&&(t.bundleId=this.bundleId),void 0!==this.discounts&&null!==this.discounts&&(t.discounts="toApiJson"in this.discounts?this.discounts.toApiJson():this.discounts),void 0!==this.subtotal&&(t.subtotal=this.subtotal),void 0!==this.bundleInstanceId&&(t.bundleInstanceId=this.bundleInstanceId),t},t}(),ti=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.filters&&(i.filters=Ke.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=H.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),ei=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoices&&(i.invoices=e.invoices.map(Ze.fromProto)),e.pagingMetadata&&(i.pagingMetadata=V.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoices&&null!==this.invoices&&(t.invoices="toApiJson"in this.invoices?this.invoices.toApiJson():this.invoices),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),ii=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),t},t}(),ni=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.bundleId&&(t.bundleId=this.bundleId),void 0!==this.bundleInstanceId&&(t.bundleInstanceId=this.bundleInstanceId),t},t}(),oi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoice&&(i.invoice=Ze.fromProto(e.invoice)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoice&&null!==this.invoice&&(t.invoice="toApiJson"in this.invoice?this.invoice.toApiJson():this.invoice),t},t}(),ri=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),void 0!==this.emailAddresses&&(t.emailAddresses=this.emailAddresses),void 0!==this.languageCode&&(t.languageCode=this.languageCode),t},t}(),si=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),void 0!==this.bundleId&&(t.bundleId=this.bundleId),void 0!==this.hideBundleItems&&(t.hideBundleItems=this.hideBundleItems),void 0!==this.bundleInstanceId&&(t.bundleInstanceId=this.bundleInstanceId),t},t}(),ai=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoice&&(i.invoice=Ze.fromProto(e.invoice)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoice&&null!==this.invoice&&(t.invoice="toApiJson"in this.invoice?this.invoice.toApiJson():this.invoice),t},t}(),ci=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.taxRateIds&&(t.taxRateIds=this.taxRateIds),t},t}(),ui=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoice&&(i.invoice=Ze.fromProto(e.invoice)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoice&&null!==this.invoice&&(t.invoice="toApiJson"in this.invoice?this.invoice.toApiJson():this.invoice),t},t}(),pi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoice&&(i.invoice=Ze.fromProto(e.invoice)),e.fieldMask&&(i.fieldMask=Ae.fromProto(e.fieldMask)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoice&&null!==this.invoice&&(t.invoice="toApiJson"in this.invoice?this.invoice.toApiJson():this.invoice),void 0!==this.fieldMask&&null!==this.fieldMask&&(t.fieldMask="toApiJson"in this.fieldMask?this.fieldMask.toApiJson():this.fieldMask),t},t}(),di=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoice&&(i.invoice=Ze.fromProto(e.invoice)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoice&&null!==this.invoice&&(t.invoice="toApiJson"in this.invoice?this.invoice.toApiJson():this.invoice),t},t}(),hi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.amount&&(i.amount=parseInt(e.amount,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),void 0!==this.id&&(t.id=this.id),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.quantity&&(t.quantity=this.quantity),void 0!==this.description&&(t.description=this.description),void 0!==this.taxRates&&(t.taxRates=this.taxRates),t},t}(),li=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoice&&(i.invoice=Ze.fromProto(e.invoice)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoice&&null!==this.invoice&&(t.invoice="toApiJson"in this.invoice?this.invoice.toApiJson():this.invoice),t},t}(),mi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),t},t}();var vi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.amount&&(i.amount=parseInt(e.amount,10)),e.futurePayouts&&(i.futurePayouts=parseInt(e.futurePayouts,10)),e.inTransit&&(i.inTransit=parseInt(e.inTransit,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.currencyCode&&(t.currencyCode=this.currencyCode),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.futurePayouts&&(t.futurePayouts=this.futurePayouts),void 0!==this.inTransit&&(t.inTransit=this.inTransit),t},t}();var fi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.start&&(i.start=new Date(e.start)),e.end&&(i.end=new Date(e.end)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.start&&null!==this.start&&(t.start="toApiJson"in this.start?this.start.toApiJson():this.start),void 0!==this.end&&null!==this.end&&(t.end="toApiJson"in this.end?this.end.toApiJson():this.end),t},t}();function gi(t,e){return"number"==typeof e?e:t[e]}var Ii=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.arrivalDateRange&&(i.arrivalDateRange=fi.fromProto(e.arrivalDateRange)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.arrivalDateRange&&null!==this.arrivalDateRange&&(t.arrivalDateRange="toApiJson"in this.arrivalDateRange?this.arrivalDateRange.toApiJson():this.arrivalDateRange),t},t}(),yi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.filters&&(i.filters=Ii.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=H.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),Ai=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.payouts&&(i.payouts=e.payouts.map(Si.fromProto)),e.pagingMetadata&&(i.pagingMetadata=V.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.payouts&&null!==this.payouts&&(t.payouts="toApiJson"in this.payouts?this.payouts.toApiJson():this.payouts),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),Si=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.arrivalDate&&(n.arrivalDate=new Date(i.arrivalDate)),i.amount&&(n.amount=parseInt(i.amount,10)),i.currency&&(n.currency=gi(u,i.currency)),i.status&&(n.status=gi(t.PayoutStatus,i.status)),i.type&&(n.type=gi(I,i.type)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.id&&(t.id=this.id),void 0!==this.arrivalDate&&null!==this.arrivalDate&&(t.arrivalDate="toApiJson"in this.arrivalDate?this.arrivalDate.toApiJson():this.arrivalDate),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.currency&&(t.currency=this.currency),void 0!==this.status&&(t.status=this.status),void 0!==this.type&&(t.type=this.type),void 0!==this.lastFourDigits&&(t.lastFourDigits=this.lastFourDigits),void 0!==this.bankName&&(t.bankName=this.bankName),void 0!==this.bankId&&(t.bankId=this.bankId),t},e}(),Pi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.bankReconciliationId&&(t.bankReconciliationId=this.bankReconciliationId),void 0!==this.payoutId&&(t.payoutId=this.payoutId),void 0!==this.allowRetries&&(t.allowRetries=this.allowRetries),t},t}(),bi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.pipelineId&&(t.pipelineId=this.pipelineId),t},t}(),Ti=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.arrivalDate&&(n.arrivalDate=new Date(i.arrivalDate)),i.amount&&(n.amount=parseInt(i.amount,10)),i.status&&(n.status=gi(t.PayoutStatus,i.status)),i.type&&(n.type=gi(I,i.type)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.id&&(t.id=this.id),void 0!==this.arrivalDate&&null!==this.arrivalDate&&(t.arrivalDate="toApiJson"in this.arrivalDate?this.arrivalDate.toApiJson():this.arrivalDate),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.currencyCode&&(t.currencyCode=this.currencyCode),void 0!==this.status&&(t.status=this.status),void 0!==this.type&&(t.type=this.type),void 0!==this.lastFourDigits&&(t.lastFourDigits=this.lastFourDigits),void 0!==this.bankName&&(t.bankName=this.bankName),void 0!==this.bankId&&(t.bankId=this.bankId),void 0!==this.failureCode&&(t.failureCode=this.failureCode),void 0!==this.failureMessage&&(t.failureMessage=this.failureMessage),t},e}();function Oi(t,e){return"number"==typeof e?e:t[e]}var Ei=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.amount&&(i.amount=parseInt(e.amount,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),void 0!==this.amount&&(t.amount=this.amount),t},t}(),Ri=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.countryCode&&(t.countryCode=this.countryCode),void 0!==this.failureUrl&&(t.failureUrl=this.failureUrl),void 0!==this.successUrl&&(t.successUrl=this.successUrl),void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),Di=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.stripeUrl&&(t.stripeUrl=this.stripeUrl),void 0!==this.error&&(t.error=this.error),t},t}(),Ci=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.includeInFinancialRecords&&(i.includeInFinancialRecords=Gi.fromProto(e.includeInFinancialRecords)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.address&&(t.address=this.address),void 0!==this.city&&(t.city=this.city),void 0!==this.state&&(t.state=this.state),void 0!==this.country&&(t.country=this.country),void 0!==this.zipCode&&(t.zipCode=this.zipCode),void 0!==this.emailAddress&&(t.emailAddress=this.emailAddress),void 0!==this.phoneNumber&&(t.phoneNumber=this.phoneNumber),void 0!==this.contactName&&(t.contactName=this.contactName),void 0!==this.companyName&&(t.companyName=this.companyName),void 0!==this.additionalEmailAddresses&&(t.additionalEmailAddresses=this.additionalEmailAddresses),void 0!==this.includeInFinancialRecords&&null!==this.includeInFinancialRecords&&(t.includeInFinancialRecords="toApiJson"in this.includeInFinancialRecords?this.includeInFinancialRecords.toApiJson():this.includeInFinancialRecords),void 0!==this.hasAlternativePaymentMethod&&(t.hasAlternativePaymentMethod=this.hasAlternativePaymentMethod),t},t}(),_i=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoiceDay&&(i.invoiceDay=parseInt(e.invoiceDay,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.generateMethod&&(t.generateMethod=this.generateMethod),void 0!==this.collectionMethod&&(t.collectionMethod=this.collectionMethod),void 0!==this.invoiceDay&&(t.invoiceDay=this.invoiceDay),t},t}(),Ji=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),wi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.merchant&&(i.merchant=Vi.fromProto(e.merchant)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchant&&null!==this.merchant&&(t.merchant="toApiJson"in this.merchant?this.merchant.toApiJson():this.merchant),t},t}(),ji=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.retailGroupIds&&(t.retailGroupIds=this.retailGroupIds),t},t}(),Ni=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.retailConfigurations&&(i.retailConfigurations=Object.keys(e.retailConfigurations).reduce((function(t,i){return t[i]=zi.fromProto(e.retailConfigurations[i]),t}),{})),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.retailConfigurations&&null!==this.retailConfigurations&&(t.retailConfigurations="toApiJson"in this.retailConfigurations?this.retailConfigurations.toApiJson():this.retailConfigurations),t},t}(),Ui=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),Mi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.outstandingBalance&&(i.outstandingBalance=parseInt(e.outstandingBalance,10)),e.currency&&(i.currency=Oi(u,e.currency)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.outstandingBalance&&(t.outstandingBalance=this.outstandingBalance),void 0!==this.currency&&(t.currency=this.currency),t},t}(),Bi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),ki=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.balances&&(i.balances=e.balances.map(vi.fromProto)),e.nextInTransitPayoutExpectedDate&&(i.nextInTransitPayoutExpectedDate=new Date(e.nextInTransitPayoutExpectedDate)),e.payoutDelayDays&&(i.payoutDelayDays=parseInt(e.payoutDelayDays,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.balances&&null!==this.balances&&(t.balances="toApiJson"in this.balances?this.balances.toApiJson():this.balances),void 0!==this.nextInTransitPayoutExpectedDate&&null!==this.nextInTransitPayoutExpectedDate&&(t.nextInTransitPayoutExpectedDate="toApiJson"in this.nextInTransitPayoutExpectedDate?this.nextInTransitPayoutExpectedDate.toApiJson():this.nextInTransitPayoutExpectedDate),void 0!==this.payoutInterval&&(t.payoutInterval=this.payoutInterval),void 0!==this.payoutDelayDays&&(t.payoutDelayDays=this.payoutDelayDays),t},t}(),Fi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),xi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.balances&&(i.balances=e.balances.map(vi.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.balances&&null!==this.balances&&(t.balances="toApiJson"in this.balances?this.balances.toApiJson():this.balances),t},t}(),Li=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.payoutId&&(t.payoutId=this.payoutId),t},t}(),Yi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.payout&&(i.payout=Ti.fromProto(e.payout)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.payout&&null!==this.payout&&(t.payout="toApiJson"in this.payout?this.payout.toApiJson():this.payout),t},t}(),qi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.includeInFinancialRecords&&(t.includeInFinancialRecords=this.includeInFinancialRecords),t},t}(),Gi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.includeInFinancialRecords&&(t.includeInFinancialRecords=this.includeInFinancialRecords),t},t}(),Wi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.pagingOptions&&(i.pagingOptions=H.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),Hi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.payouts&&(i.payouts=e.payouts.map(Ti.fromProto)),e.pagingMetadata&&(i.pagingMetadata=V.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.payouts&&null!==this.payouts&&(t.payouts="toApiJson"in this.payouts?this.payouts.toApiJson():this.payouts),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),Vi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.address&&(t.address=this.address),void 0!==this.city&&(t.city=this.city),void 0!==this.state&&(t.state=this.state),void 0!==this.country&&(t.country=this.country),void 0!==this.zipCode&&(t.zipCode=this.zipCode),void 0!==this.emailAddress&&(t.emailAddress=this.emailAddress),void 0!==this.phoneNumber&&(t.phoneNumber=this.phoneNumber),void 0!==this.contactName&&(t.contactName=this.contactName),void 0!==this.companyName&&(t.companyName=this.companyName),void 0!==this.autoPostInvoices&&(t.autoPostInvoices=this.autoPostInvoices),void 0!==this.autoChargeInvoices&&(t.autoChargeInvoices=this.autoChargeInvoices),void 0!==this.includeInFinancialRecords&&(t.includeInFinancialRecords=this.includeInFinancialRecords),void 0!==this.additionalEmailAddresses&&(t.additionalEmailAddresses=this.additionalEmailAddresses),void 0!==this.hasAlternativePaymentMethod&&(t.hasAlternativePaymentMethod=this.hasAlternativePaymentMethod),void 0!==this.stripeAccountId&&(t.stripeAccountId=this.stripeAccountId),t},t}(),zi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.defaultCustomerConfiguration&&(i.defaultCustomerConfiguration=_i.fromProto(e.defaultCustomerConfiguration)),e.currencyConversionRate&&(i.currencyConversionRate=parseInt(e.currencyConversionRate,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.retailGroupId&&(t.retailGroupId=this.retailGroupId),void 0!==this.currencyCode&&(t.currencyCode=this.currencyCode),void 0!==this.defaultCustomerConfiguration&&null!==this.defaultCustomerConfiguration&&(t.defaultCustomerConfiguration="toApiJson"in this.defaultCustomerConfiguration?this.defaultCustomerConfiguration.toApiJson():this.defaultCustomerConfiguration),void 0!==this.currencyConversionRate&&(t.currencyConversionRate=this.currencyConversionRate),t},t}(),Ki=(function(){function t(t){t&&Object.assign(this,t)}t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.value&&(i.value=zi.fromProto(e.value)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.key&&(t.key=this.key),void 0!==this.value&&null!==this.value&&(t.value="toApiJson"in this.value?this.value.toApiJson():this.value),t}}(),function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.sortBy&&(i.sortBy=Oi(A,e.sortBy)),e.sortDirection&&(i.sortDirection=Oi(y,e.sortDirection)),e.pagingOptions&&(i.pagingOptions=H.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.searchTerm&&(t.searchTerm=this.searchTerm),void 0!==this.sortBy&&(t.sortBy=this.sortBy),void 0!==this.sortDirection&&(t.sortDirection=this.sortDirection),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}()),Xi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.merchants&&(i.merchants=e.merchants.map(Vi.fromProto)),e.pagingMetadata&&(i.pagingMetadata=V.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchants&&null!==this.merchants&&(t.merchants="toApiJson"in this.merchants?this.merchants.toApiJson():this.merchants),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),Qi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.autoChargeInvoices&&(t.autoChargeInvoices=this.autoChargeInvoices),t},t}(),Zi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.shouldAutoPostInvoices&&(t.shouldAutoPostInvoices=this.shouldAutoPostInvoices),t},t}(),$i=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.cardId&&(t.cardId=this.cardId),t},t}(),tn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.hasAlternativePaymentMethod&&(t.hasAlternativePaymentMethod=this.hasAlternativePaymentMethod),t},t}(),en=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.includeInFinancialRecords&&(t.includeInFinancialRecords=this.includeInFinancialRecords),t},t}(),nn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.includeInFinancialRecords&&(i.includeInFinancialRecords=qi.fromProto(e.includeInFinancialRecords)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.address&&(t.address=this.address),void 0!==this.city&&(t.city=this.city),void 0!==this.state&&(t.state=this.state),void 0!==this.country&&(t.country=this.country),void 0!==this.zipCode&&(t.zipCode=this.zipCode),void 0!==this.emailAddress&&(t.emailAddress=this.emailAddress),void 0!==this.phoneNumber&&(t.phoneNumber=this.phoneNumber),void 0!==this.contactName&&(t.contactName=this.contactName),void 0!==this.companyName&&(t.companyName=this.companyName),void 0!==this.additionalEmailAddresses&&(t.additionalEmailAddresses=this.additionalEmailAddresses),void 0!==this.includeInFinancialRecords&&null!==this.includeInFinancialRecords&&(t.includeInFinancialRecords="toApiJson"in this.includeInFinancialRecords?this.includeInFinancialRecords.toApiJson():this.includeInFinancialRecords),void 0!==this.hasAlternativePaymentMethod&&(t.hasAlternativePaymentMethod=this.hasAlternativePaymentMethod),t},t}(),on=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.defaultCustomerConfiguration&&(i.defaultCustomerConfiguration=_i.fromProto(e.defaultCustomerConfiguration)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.retailGroupId&&(t.retailGroupId=this.retailGroupId),void 0!==this.defaultCustomerConfiguration&&null!==this.defaultCustomerConfiguration&&(t.defaultCustomerConfiguration="toApiJson"in this.defaultCustomerConfiguration?this.defaultCustomerConfiguration.toApiJson():this.defaultCustomerConfiguration),t},t}(),rn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.currencyConversionRate&&(i.currencyConversionRate=parseInt(e.currencyConversionRate,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.retailGroupId&&(t.retailGroupId=this.retailGroupId),void 0!==this.currencyCode&&(t.currencyCode=this.currencyCode),void 0!==this.currencyConversionRate&&(t.currencyConversionRate=this.currencyConversionRate),t},t}();function sn(t,e){return"number"==typeof e?e:t[e]}var an=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.pagingOptions&&(i.pagingOptions=H.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),cn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.reports&&(i.reports=e.reports.map(un.fromProto)),e.pagingMetadata&&(i.pagingMetadata=V.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.reports&&null!==this.reports&&(t.reports="toApiJson"in this.reports?this.reports.toApiJson():this.reports),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),un=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.year&&(i.year=parseInt(e.year,10)),e.month&&(i.month=sn(S,e.month)),e.created&&(i.created=new Date(e.created)),e.status&&(i.status=sn(P,e.status)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.year&&(t.year=this.year),void 0!==this.month&&(t.month=this.month),void 0!==this.created&&null!==this.created&&(t.created="toApiJson"in this.created?this.created.toApiJson():this.created),void 0!==this.status&&(t.status=this.status),t},t}();var pn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.component&&(i.component=dn.fromProto(e.component)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.component&&null!==this.component&&(t.component="toApiJson"in this.component?this.component.toApiJson():this.component),void 0!==this.sku&&(t.sku=this.sku),t},t}(),dn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.componentId&&(t.componentId=this.componentId),void 0!==this.name&&(t.name=this.name),t},t}(),hn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.quantity&&(i.quantity=parseInt(e.quantity,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.componentId&&(t.componentId=this.componentId),void 0!==this.orderId&&(t.orderId=this.orderId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.quantity&&(t.quantity=this.quantity),void 0!==this.idempotencyKey&&(t.idempotencyKey=this.idempotencyKey),t},t}();function ln(t,e){return"number"==typeof e?e:t[e]}var mn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.cardType&&(i.cardType=ln(b,e.cardType)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.cardType&&(t.cardType=this.cardType),void 0!==this.lastFourDigits&&(t.lastFourDigits=this.lastFourDigits),t},t}(),vn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.disputeId&&(t.disputeId=this.disputeId),t},t}(),fn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.failureUrl&&(t.failureUrl=this.failureUrl),void 0!==this.successUrl&&(t.successUrl=this.successUrl),t},t}(),gn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.stripeUrl&&(t.stripeUrl=this.stripeUrl),void 0!==this.error&&(t.error=this.error),t},t}(),In=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.id&&(t.id=this.id),t},t}(),yn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.status&&(i.status=ln(T,e.status)),e.amount&&(i.amount=parseInt(e.amount,10)),e.created&&(i.created=new Date(e.created)),e.evidence&&(i.evidence=An.fromProto(e.evidence)),e.evidenceDetails&&(i.evidenceDetails=Pn.fromProto(e.evidenceDetails)),e.fee&&(i.fee=parseInt(e.fee,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.paymentId&&(t.paymentId=this.paymentId),void 0!==this.status&&(t.status=this.status),void 0!==this.id&&(t.id=this.id),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.created&&null!==this.created&&(t.created="toApiJson"in this.created?this.created.toApiJson():this.created),void 0!==this.currencyCode&&(t.currencyCode=this.currencyCode),void 0!==this.evidence&&null!==this.evidence&&(t.evidence="toApiJson"in this.evidence?this.evidence.toApiJson():this.evidence),void 0!==this.evidenceDetails&&null!==this.evidenceDetails&&(t.evidenceDetails="toApiJson"in this.evidenceDetails?this.evidenceDetails.toApiJson():this.evidenceDetails),void 0!==this.isChargeRefundable&&(t.isChargeRefundable=this.isChargeRefundable),void 0!==this.reason&&(t.reason=this.reason),void 0!==this.fee&&(t.fee=this.fee),void 0!==this.feeCurrencyCode&&(t.feeCurrencyCode=this.feeCurrencyCode),t},t}(),An=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.customerCommunication&&(i.customerCommunication=bn.fromProto(e.customerCommunication)),e.customerSignature&&(i.customerSignature=bn.fromProto(e.customerSignature)),e.shippingDocumentation&&(i.shippingDocumentation=bn.fromProto(e.shippingDocumentation)),e.receipt&&(i.receipt=bn.fromProto(e.receipt)),e.uncategorizedFile&&(i.uncategorizedFile=bn.fromProto(e.uncategorizedFile)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.customerCommunication&&null!==this.customerCommunication&&(t.customerCommunication="toApiJson"in this.customerCommunication?this.customerCommunication.toApiJson():this.customerCommunication),void 0!==this.customerSignature&&null!==this.customerSignature&&(t.customerSignature="toApiJson"in this.customerSignature?this.customerSignature.toApiJson():this.customerSignature),void 0!==this.shippingDocumentation&&null!==this.shippingDocumentation&&(t.shippingDocumentation="toApiJson"in this.shippingDocumentation?this.shippingDocumentation.toApiJson():this.shippingDocumentation),void 0!==this.receipt&&null!==this.receipt&&(t.receipt="toApiJson"in this.receipt?this.receipt.toApiJson():this.receipt),void 0!==this.uncategorizedFile&&null!==this.uncategorizedFile&&(t.uncategorizedFile="toApiJson"in this.uncategorizedFile?this.uncategorizedFile.toApiJson():this.uncategorizedFile),void 0!==this.billingAddress&&(t.billingAddress=this.billingAddress),void 0!==this.customerEmailAddress&&(t.customerEmailAddress=this.customerEmailAddress),void 0!==this.customerName&&(t.customerName=this.customerName),void 0!==this.productDescription&&(t.productDescription=this.productDescription),t},t}(),Sn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.billingAddress&&(t.billingAddress=this.billingAddress),void 0!==this.customerEmailAddress&&(t.customerEmailAddress=this.customerEmailAddress),void 0!==this.customerName&&(t.customerName=this.customerName),void 0!==this.productDescription&&(t.productDescription=this.productDescription),void 0!==this.customerSignatureFileId&&(t.customerSignatureFileId=this.customerSignatureFileId),void 0!==this.customerCommunicationFileId&&(t.customerCommunicationFileId=this.customerCommunicationFileId),void 0!==this.receiptFileId&&(t.receiptFileId=this.receiptFileId),void 0!==this.shippingDocumentationFileId&&(t.shippingDocumentationFileId=this.shippingDocumentationFileId),void 0!==this.uncategorizedFileId&&(t.uncategorizedFileId=this.uncategorizedFileId),t},t}(),Pn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.dueBy&&(i.dueBy=new Date(e.dueBy)),e.submissionCount&&(i.submissionCount=parseInt(e.submissionCount,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.dueBy&&null!==this.dueBy&&(t.dueBy="toApiJson"in this.dueBy?this.dueBy.toApiJson():this.dueBy),void 0!==this.hasEvidence&&(t.hasEvidence=this.hasEvidence),void 0!==this.pastDue&&(t.pastDue=this.pastDue),void 0!==this.submissionCount&&(t.submissionCount=this.submissionCount),t},t}(),bn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.created&&(i.created=new Date(e.created)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.created&&null!==this.created&&(t.created="toApiJson"in this.created?this.created.toApiJson():this.created),void 0!==this.id&&(t.id=this.id),void 0!==this.filename&&(t.filename=this.filename),void 0!==this.url&&(t.url=this.url),t},t}(),Tn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.disputeId&&(t.disputeId=this.disputeId),t},t}(),On=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.dispute&&(i.dispute=yn.fromProto(e.dispute)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.dispute&&null!==this.dispute&&(t.dispute="toApiJson"in this.dispute?this.dispute.toApiJson():this.dispute),t},t}(),En=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),Rn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.statementDescriptor&&(t.statementDescriptor=this.statementDescriptor),void 0!==this.stripeConnectId&&(t.stripeConnectId=this.stripeConnectId),t},t}(),Dn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.paymentId&&(t.paymentId=this.paymentId),t},t}(),Cn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.payment&&(i.payment=qn.fromProto(e.payment)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.payment&&null!==this.payment&&(t.payment="toApiJson"in this.payment?this.payment.toApiJson():this.payment),t},t}(),_n=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.start&&(i.start=new Date(e.start)),e.end&&(i.end=new Date(e.end)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.allocationIds&&(t.allocationIds=this.allocationIds),void 0!==this.start&&null!==this.start&&(t.start="toApiJson"in this.start?this.start.toApiJson():this.start),void 0!==this.end&&null!==this.end&&(t.end="toApiJson"in this.end?this.end.toApiJson():this.end),t},t}(),Jn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.filters&&(i.filters=_n.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=H.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),wn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.payments&&(i.payments=e.payments.map(Fn.fromProto)),e.pagingMetadata&&(i.pagingMetadata=V.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.payments&&null!==this.payments&&(t.payments="toApiJson"in this.payments?this.payments.toApiJson():this.payments),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),jn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.pagingOptions&&(i.pagingOptions=H.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),Nn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.disputes&&(i.disputes=e.disputes.map(yn.fromProto)),e.pagingMetadata&&(i.pagingMetadata=V.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.disputes&&null!==this.disputes&&(t.disputes="toApiJson"in this.disputes?this.disputes.toApiJson():this.disputes),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),Un=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.createdDateGte&&(i.createdDateGte=new Date(e.createdDateGte)),e.createdDateLte&&(i.createdDateLte=new Date(e.createdDateLte)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.payoutId&&(t.payoutId=this.payoutId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.createdDateGte&&null!==this.createdDateGte&&(t.createdDateGte="toApiJson"in this.createdDateGte?this.createdDateGte.toApiJson():this.createdDateGte),void 0!==this.createdDateLte&&null!==this.createdDateLte&&(t.createdDateLte="toApiJson"in this.createdDateLte?this.createdDateLte.toApiJson():this.createdDateLte),t},t}(),Mn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.pagingOptions&&(i.pagingOptions=H.fromProto(e.pagingOptions)),e.filters&&(i.filters=Un.fromProto(e.filters)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),t},t}(),Bn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.payments&&(i.payments=e.payments.map(qn.fromProto)),e.pagingMetadata&&(i.pagingMetadata=V.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.payments&&null!==this.payments&&(t.payments="toApiJson"in this.payments?this.payments.toApiJson():this.payments),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),kn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.amount&&(i.amount=parseInt(e.amount,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.orderId&&(t.orderId=this.orderId),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.currencyCode&&(t.currencyCode=this.currencyCode),void 0!==this.paymentMethodId&&(t.paymentMethodId=this.paymentMethodId),t},t}(),Fn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.created&&(i.created=new Date(e.created)),e.currency&&(i.currency=ln(u,e.currency)),e.paymentSource&&(i.paymentSource=ln(E,e.paymentSource)),e.allocations&&(i.allocations=e.allocations.map(xn.fromProto)),e.total&&(i.total=parseInt(e.total,10)),e.status&&(i.status=ln(R,e.status)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.created&&null!==this.created&&(t.created="toApiJson"in this.created?this.created.toApiJson():this.created),void 0!==this.currency&&(t.currency=this.currency),void 0!==this.paymentSource&&(t.paymentSource=this.paymentSource),void 0!==this.allocations&&null!==this.allocations&&(t.allocations="toApiJson"in this.allocations?this.allocations.toApiJson():this.allocations),void 0!==this.total&&(t.total=this.total),void 0!==this.description&&(t.description=this.description),void 0!==this.externalReferenceId&&(t.externalReferenceId=this.externalReferenceId),void 0!==this.status&&(t.status=this.status),t},t}(),xn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.amount&&(i.amount=parseInt(e.amount,10)),e.type&&(i.type=ln(O,e.type)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.referenceId&&(t.referenceId=this.referenceId),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.type&&(t.type=this.type),t},t}(),Ln=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.order&&(i.order=kn.fromProto(e.order)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),void 0!==this.order&&null!==this.order&&(t.order="toApiJson"in this.order?this.order.toApiJson():this.order),t},t}(),Yn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.stripeClientSecret&&(t.stripeClientSecret=this.stripeClientSecret),void 0!==this.intentId&&(t.intentId=this.intentId),t},t}(),qn=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.created&&(n.created=new Date(i.created)),i.amount&&(n.amount=parseInt(i.amount,10)),i.referenceType&&(n.referenceType=ln(t.RetailPaymentReferenceTypeEnum,i.referenceType)),i.status&&(n.status=ln(R,i.status)),i.applicationFee&&(n.applicationFee=parseInt(i.applicationFee,10)),i.dispute&&(n.dispute=yn.fromProto(i.dispute)),i.cardDetails&&(n.cardDetails=mn.fromProto(i.cardDetails)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.created&&null!==this.created&&(t.created="toApiJson"in this.created?this.created.toApiJson():this.created),void 0!==this.currencyCode&&(t.currencyCode=this.currencyCode),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.referenceId&&(t.referenceId=this.referenceId),void 0!==this.referenceType&&(t.referenceType=this.referenceType),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.status&&(t.status=this.status),void 0!==this.description&&(t.description=this.description),void 0!==this.failureCode&&(t.failureCode=this.failureCode),void 0!==this.failureMessage&&(t.failureMessage=this.failureMessage),void 0!==this.applicationFee&&(t.applicationFee=this.applicationFee),void 0!==this.disputed&&(t.disputed=this.disputed),void 0!==this.id&&(t.id=this.id),void 0!==this.dispute&&null!==this.dispute&&(t.dispute="toApiJson"in this.dispute?this.dispute.toApiJson():this.dispute),void 0!==this.cardDetails&&null!==this.cardDetails&&(t.cardDetails="toApiJson"in this.cardDetails?this.cardDetails.toApiJson():this.cardDetails),t},e}(),Gn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),Wn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.enabled&&(t.enabled=this.enabled),t},t}(),Hn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),Vn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.requirements&&(i.requirements=Qn.fromProto(e.requirements)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.supportedRegion&&(t.supportedRegion=this.supportedRegion),void 0!==this.canAcceptPayment&&(t.canAcceptPayment=this.canAcceptPayment),void 0!==this.requirements&&null!==this.requirements&&(t.requirements="toApiJson"in this.requirements?this.requirements.toApiJson():this.requirements),void 0!==this.disabledReason&&(t.disabledReason=this.disabledReason),t},t}(),zn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.evidence&&(i.evidence=Sn.fromProto(e.evidence)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.disputeId&&(t.disputeId=this.disputeId),void 0!==this.paymentId&&(t.paymentId=this.paymentId),void 0!==this.evidence&&null!==this.evidence&&(t.evidence="toApiJson"in this.evidence?this.evidence.toApiJson():this.evidence),void 0!==this.submit&&(t.submit=this.submit),t},t}(),Kn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.statementDescriptor&&(t.statementDescriptor=this.statementDescriptor),t},t}(),Xn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.requirement&&(t.requirement=this.requirement),void 0!==this.code&&(t.code=this.code),void 0!==this.reason&&(t.reason=this.reason),t},t}(),Qn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.error&&(i.error=e.error.map(Xn.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.due&&(t.due=this.due),void 0!==this.error&&null!==this.error&&(t.error="toApiJson"in this.error?this.error.toApiJson():this.error),t},t}();function Zn(t,e){return"number"==typeof e?e:t[e]}var $n=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.stripeToken&&(t.stripeToken=this.stripeToken),t},t}(),to=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.cardId&&(t.cardId=this.cardId),t},t}(),eo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),t},t}(),io=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.paymentCard&&(i.paymentCard=e.paymentCard.map(no.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.paymentCard&&null!==this.paymentCard&&(t.paymentCard="toApiJson"in this.paymentCard?this.paymentCard.toApiJson():this.paymentCard),t},t}(),no=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.cardType&&(n.cardType=Zn(t.CARD_TYPE,i.cardType)),i.fundingType&&(n.fundingType=Zn(_,i.fundingType)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.lastFourDigits&&(t.lastFourDigits=this.lastFourDigits),void 0!==this.cardType&&(t.cardType=this.cardType),void 0!==this.address&&(t.address=this.address),void 0!==this.city&&(t.city=this.city),void 0!==this.state&&(t.state=this.state),void 0!==this.country&&(t.country=this.country),void 0!==this.zipCode&&(t.zipCode=this.zipCode),void 0!==this.cardId&&(t.cardId=this.cardId),void 0!==this.cardholderName&&(t.cardholderName=this.cardholderName),void 0!==this.expiryMonth&&(t.expiryMonth=this.expiryMonth),void 0!==this.expiryYear&&(t.expiryYear=this.expiryYear),void 0!==this.fundingType&&(t.fundingType=this.fundingType),void 0!==this.default&&(t.default=this.default),t},e}(),oo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.paymentMethodId&&(t.paymentMethodId=this.paymentMethodId),t},t}(),ro=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.stripeToken&&(t.stripeToken=this.stripeToken),t},t}();function so(t,e){return"number"==typeof e?e:t[e]}var ao=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.unitPrice&&(i.unitPrice=parseInt(e.unitPrice,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.componentId&&(t.componentId=this.componentId),void 0!==this.unitPrice&&(t.unitPrice=this.unitPrice),t},t}(),co=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.defaultBillingStrategy&&(n.defaultBillingStrategy=so(t.PricingPlanBillingStrategy,i.defaultBillingStrategy)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.name&&(t.name=this.name),void 0!==this.defaultBillingStrategy&&(t.defaultBillingStrategy=this.defaultBillingStrategy),t},e}(),uo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.id&&(t.id=this.id),t},t}(),po=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.pricingPlanIds&&(t.pricingPlanIds=this.pricingPlanIds),t},t}(),ho=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.plans&&(i.plans=e.plans.map(lo.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.plans&&null!==this.plans&&(t.plans="toApiJson"in this.plans?this.plans.toApiJson():this.plans),t},t}(),lo=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.defaultBillingStrategy&&(n.defaultBillingStrategy=so(t.PricingPlanBillingStrategy,i.defaultBillingStrategy)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.id&&(t.id=this.id),void 0!==this.name&&(t.name=this.name),void 0!==this.defaultBillingStrategy&&(t.defaultBillingStrategy=this.defaultBillingStrategy),t},e}(),mo=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.type&&(n.type=so(w,i.type)),i.rules&&(n.rules=i.rules.map(vo.fromProto)),i.setupFee&&(n.setupFee=parseInt(i.setupFee,10)),i.frequency&&(n.frequency=so(t.GeneratedFrequency,i.frequency)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.type&&(t.type=this.type),void 0!==this.rules&&null!==this.rules&&(t.rules="toApiJson"in this.rules?this.rules.toApiJson():this.rules),void 0!==this.setupFee&&(t.setupFee=this.setupFee),void 0!==this.frequency&&(t.frequency=this.frequency),void 0!==this.currencyCode&&(t.currencyCode=this.currencyCode),t},e}(),vo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.price&&(i.price=parseInt(e.price,10)),e.minUnits&&(i.minUnits=parseInt(e.minUnits,10)),e.maxUnits&&(i.maxUnits=parseInt(e.maxUnits,10)),e.componentPricing&&(i.componentPricing=e.componentPricing.map(ao.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.price&&(t.price=this.price),void 0!==this.minUnits&&(t.minUnits=this.minUnits),void 0!==this.maxUnits&&(t.maxUnits=this.maxUnits),void 0!==this.componentPricing&&null!==this.componentPricing&&(t.componentPricing="toApiJson"in this.componentPricing?this.componentPricing.toApiJson():this.componentPricing),t},t}(),fo=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.fieldMask&&(n.fieldMask=Ae.fromProto(i.fieldMask)),i.defaultBillingStrategy&&(n.defaultBillingStrategy=so(t.PricingPlanBillingStrategy,i.defaultBillingStrategy)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.id&&(t.id=this.id),void 0!==this.fieldMask&&null!==this.fieldMask&&(t.fieldMask="toApiJson"in this.fieldMask?this.fieldMask.toApiJson():this.fieldMask),void 0!==this.name&&(t.name=this.name),void 0!==this.defaultBillingStrategy&&(t.defaultBillingStrategy=this.defaultBillingStrategy),t},e}(),go=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){return{}},t}();function Io(t,e){return"number"==typeof e?e:t[e]}var yo=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.frequency&&(n.frequency=Io(t.GeneratedFrequency,i.frequency)),i.pricing&&(n.pricing=Object.keys(i.pricing).reduce((function(t,e){return t[e]=mo.fromProto(i.pricing[e]),t}),{})),i.commitment&&(n.commitment=Ot.fromProto(i.commitment)),i.strategy&&(n.strategy=Io(t.PricingPlanBillingStrategy,i.strategy)),i.volumeCommitment&&(n.volumeCommitment=parseInt(i.volumeCommitment,10)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.pricingPlanId&&(t.pricingPlanId=this.pricingPlanId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.frequency&&(t.frequency=this.frequency),void 0!==this.pricing&&null!==this.pricing&&(t.pricing="toApiJson"in this.pricing?this.pricing.toApiJson():this.pricing),void 0!==this.commitment&&null!==this.commitment&&(t.commitment="toApiJson"in this.commitment?this.commitment.toApiJson():this.commitment),void 0!==this.strategy&&(t.strategy=this.strategy),void 0!==this.volumeCommitment&&(t.volumeCommitment=this.volumeCommitment),t},e}(),Ao=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.pricingPlanId&&(t.pricingPlanId=this.pricingPlanId),void 0!==this.sku&&(t.sku=this.sku),t},t}(),So=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.pricingPlanId&&(t.pricingPlanId=this.pricingPlanId),void 0!==this.sku&&(t.sku=this.sku),t},t}(),Po=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.pricingPlanId&&(t.pricingPlanId=this.pricingPlanId),void 0!==this.skus&&(t.skus=this.skus),t},t}(),bo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.pricingPlanProducts&&(i.pricingPlanProducts=e.pricingPlanProducts.map(Co.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.pricingPlanProducts&&null!==this.pricingPlanProducts&&(t.pricingPlanProducts="toApiJson"in this.pricingPlanProducts?this.pricingPlanProducts.toApiJson():this.pricingPlanProducts),t},t}(),To=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.pricingPlanId&&(t.pricingPlanId=this.pricingPlanId),void 0!==this.sku&&(t.sku=this.sku),t},t}(),Oo=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.pricingPlanProduct&&(n.pricingPlanProduct=Co.fromProto(i.pricingPlanProduct)),i.pricingPlanDefaultStrategy&&(n.pricingPlanDefaultStrategy=Io(t.PricingPlanBillingStrategy,i.pricingPlanDefaultStrategy)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.pricingPlanProduct&&null!==this.pricingPlanProduct&&(t.pricingPlanProduct="toApiJson"in this.pricingPlanProduct?this.pricingPlanProduct.toApiJson():this.pricingPlanProduct),void 0!==this.pricingPlanDefaultStrategy&&(t.pricingPlanDefaultStrategy=this.pricingPlanDefaultStrategy),t},e}(),Eo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.pricingPlanIds&&(t.pricingPlanIds=this.pricingPlanIds),t},t}(),Ro=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.pagingOptions&&(i.pagingOptions=H.fromProto(e.pagingOptions)),e.filters&&(i.filters=Eo.fromProto(e.filters)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),t},t}(),Do=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.products&&(i.products=e.products.map(Co.fromProto)),e.pagingMetadata&&(i.pagingMetadata=V.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.products&&null!==this.products&&(t.products="toApiJson"in this.products?this.products.toApiJson():this.products),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),Co=(function(){function t(t){t&&Object.assign(this,t)}t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.value&&(i.value=mo.fromProto(e.value)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.key&&(t.key=this.key),void 0!==this.value&&null!==this.value&&(t.value="toApiJson"in this.value?this.value.toApiJson():this.value),t}}(),function(){function t(t){t&&Object.assign(this,t)}t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.value&&(i.value=mo.fromProto(e.value)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.key&&(t.key=this.key),void 0!==this.value&&null!==this.value&&(t.value="toApiJson"in this.value?this.value.toApiJson():this.value),t}}(),function(){function t(t){t&&Object.assign(this,t)}t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.value&&(i.value=mo.fromProto(e.value)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.key&&(t.key=this.key),void 0!==this.value&&null!==this.value&&(t.value="toApiJson"in this.value?this.value.toApiJson():this.value),t}}(),function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.frequency&&(n.frequency=Io(t.GeneratedFrequency,i.frequency)),i.pricing&&(n.pricing=Object.keys(i.pricing).reduce((function(t,e){return t[e]=mo.fromProto(i.pricing[e]),t}),{})),i.commitment&&(n.commitment=Ot.fromProto(i.commitment)),i.created&&(n.created=new Date(i.created)),i.modified&&(n.modified=new Date(i.modified)),i.strategy&&(n.strategy=Io(t.PricingPlanBillingStrategy,i.strategy)),i.volumeCommitment&&(n.volumeCommitment=parseInt(i.volumeCommitment,10)),i.pricingType&&(n.pricingType=Io(w,i.pricingType)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.pricingPlanId&&(t.pricingPlanId=this.pricingPlanId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.frequency&&(t.frequency=this.frequency),void 0!==this.pricing&&null!==this.pricing&&(t.pricing="toApiJson"in this.pricing?this.pricing.toApiJson():this.pricing),void 0!==this.commitment&&null!==this.commitment&&(t.commitment="toApiJson"in this.commitment?this.commitment.toApiJson():this.commitment),void 0!==this.created&&null!==this.created&&(t.created="toApiJson"in this.created?this.created.toApiJson():this.created),void 0!==this.modified&&null!==this.modified&&(t.modified="toApiJson"in this.modified?this.modified.toApiJson():this.modified),void 0!==this.strategy&&(t.strategy=this.strategy),void 0!==this.volumeCommitment&&(t.volumeCommitment=this.volumeCommitment),void 0!==this.pricingType&&(t.pricingType=this.pricingType),t},e}()),_o=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.frequency&&(n.frequency=Io(t.GeneratedFrequency,i.frequency)),i.pricing&&(n.pricing=Object.keys(i.pricing).reduce((function(t,e){return t[e]=mo.fromProto(i.pricing[e]),t}),{})),i.commitment&&(n.commitment=Ot.fromProto(i.commitment)),i.fieldMask&&(n.fieldMask=Ae.fromProto(i.fieldMask)),i.strategy&&(n.strategy=Io(t.PricingPlanBillingStrategy,i.strategy)),i.volumeCommitment&&(n.volumeCommitment=parseInt(i.volumeCommitment,10)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.pricingPlanId&&(t.pricingPlanId=this.pricingPlanId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.frequency&&(t.frequency=this.frequency),void 0!==this.pricing&&null!==this.pricing&&(t.pricing="toApiJson"in this.pricing?this.pricing.toApiJson():this.pricing),void 0!==this.commitment&&null!==this.commitment&&(t.commitment="toApiJson"in this.commitment?this.commitment.toApiJson():this.commitment),void 0!==this.fieldMask&&null!==this.fieldMask&&(t.fieldMask="toApiJson"in this.fieldMask?this.fieldMask.toApiJson():this.fieldMask),void 0!==this.strategy&&(t.strategy=this.strategy),void 0!==this.volumeCommitment&&(t.volumeCommitment=this.volumeCommitment),t},e}(),Jo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){return{}},t}(),wo=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.pricing&&(n.pricing=i.pricing.map(mo.fromProto)),i.termCommitment&&(n.termCommitment=Ot.fromProto(i.termCommitment)),i.strategy&&(n.strategy=Io(t.PricingPlanBillingStrategy,i.strategy)),i.volumeCommitment&&(n.volumeCommitment=parseInt(i.volumeCommitment,10)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.pricingPlanId&&(t.pricingPlanId=this.pricingPlanId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.pricing&&null!==this.pricing&&(t.pricing="toApiJson"in this.pricing?this.pricing.toApiJson():this.pricing),void 0!==this.termCommitment&&null!==this.termCommitment&&(t.termCommitment="toApiJson"in this.termCommitment?this.termCommitment.toApiJson():this.termCommitment),void 0!==this.strategy&&(t.strategy=this.strategy),void 0!==this.volumeCommitment&&(t.volumeCommitment=this.volumeCommitment),t},e}();function jo(t,e){return"number"==typeof e?e:t[e]}var No=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.productType&&(i.productType=jo(j,e.productType)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.productId&&(t.productId=this.productId),void 0!==this.editionId&&(t.editionId=this.editionId),void 0!==this.name&&(t.name=this.name),void 0!==this.reportingCode&&(t.reportingCode=this.reportingCode),void 0!==this.productType&&(t.productType=this.productType),t},t}(),Uo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),t},t}(),Mo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.skus&&(t.skus=this.skus),t},t}(),Bo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.products&&(i.products=Object.keys(e.products).reduce((function(t,i){return t[i]=Lo.fromProto(e.products[i]),t}),{})),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.products&&null!==this.products&&(t.products="toApiJson"in this.products?this.products.toApiJson():this.products),t},t}(),ko=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.productType&&(i.productType=e.productType.map((function(t){return jo(j,t)}))),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.hasDiscount&&(t.hasDiscount=this.hasDiscount),void 0!==this.hasPricingOverride&&(t.hasPricingOverride=this.hasPricingOverride),void 0!==this.productType&&(t.productType=this.productType),void 0!==this.skus&&(t.skus=this.skus),t},t}(),Fo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.filters&&(i.filters=ko.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=H.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.searchTerm&&(t.searchTerm=this.searchTerm),void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),xo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.products&&(i.products=e.products.map(Lo.fromProto)),e.pagingMetadata&&(i.pagingMetadata=V.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.products&&null!==this.products&&(t.products="toApiJson"in this.products?this.products.toApiJson():this.products),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),Lo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.productType&&(i.productType=jo(j,e.productType)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.name&&(t.name=this.name),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.iconUrl&&(t.iconUrl=this.iconUrl),void 0!==this.hasPricingOverride&&(t.hasPricingOverride=this.hasPricingOverride),void 0!==this.hasDiscount&&(t.hasDiscount=this.hasDiscount),void 0!==this.productType&&(t.productType=this.productType),t},t}(),Yo=(function(){function t(t){t&&Object.assign(this,t)}t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.value&&(i.value=Lo.fromProto(e.value)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.key&&(t.key=this.key),void 0!==this.value&&null!==this.value&&(t.value="toApiJson"in this.value?this.value.toApiJson():this.value),t}}(),function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.productType&&(i.productType=jo(j,e.productType)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.name&&(t.name=this.name),void 0!==this.reportingCode&&(t.reportingCode=this.reportingCode),void 0!==this.productType&&(t.productType=this.productType),t},t}());function qo(t,e){return"number"==typeof e?e:t[e]}var Go=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.prices&&(i.prices=e.prices.map(Wo.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.prices&&null!==this.prices&&(t.prices="toApiJson"in this.prices?this.prices.toApiJson():this.prices),t},t}(),Wo=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.strategy&&(n.strategy=qo(t.PricingPlanBillingStrategy,i.strategy)),i.pricingType&&(n.pricingType=qo(w,i.pricingType)),i.currency&&(n.currency=qo(u,i.currency)),i.frequency&&(n.frequency=qo(t.GeneratedFrequency,i.frequency)),i.pricingRules&&(n.pricingRules=i.pricingRules.map(vo.fromProto)),i.commitment&&(n.commitment=Ot.fromProto(i.commitment)),i.volumeCommitment&&(n.volumeCommitment=parseInt(i.volumeCommitment,10)),i.setupFee&&(n.setupFee=parseInt(i.setupFee,10)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.strategy&&(t.strategy=this.strategy),void 0!==this.pricingType&&(t.pricingType=this.pricingType),void 0!==this.currency&&(t.currency=this.currency),void 0!==this.frequency&&(t.frequency=this.frequency),void 0!==this.pricingRules&&null!==this.pricingRules&&(t.pricingRules="toApiJson"in this.pricingRules?this.pricingRules.toApiJson():this.pricingRules),void 0!==this.commitment&&null!==this.commitment&&(t.commitment="toApiJson"in this.commitment?this.commitment.toApiJson():this.commitment),void 0!==this.isStartingPrice&&(t.isStartingPrice=this.isStartingPrice),void 0!==this.resolvedFrom&&(t.resolvedFrom=this.resolvedFrom),void 0!==this.volumeCommitment&&(t.volumeCommitment=this.volumeCommitment),void 0!==this.setupFee&&(t.setupFee=this.setupFee),t},e}();function Ho(t,e){return"number"==typeof e?e:t[e]}var Vo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.appliedAmount&&(i.appliedAmount=parseInt(e.appliedAmount,10)),e.referenceType&&(i.referenceType=Ho(N,e.referenceType)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.appliedAmount&&(t.appliedAmount=this.appliedAmount),void 0!==this.referenceId&&(t.referenceId=this.referenceId),void 0!==this.referenceType&&(t.referenceType=this.referenceType),t},t}(),zo=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.billingStrategy&&(n.billingStrategy=i.billingStrategy.map((function(e){return Ho(t.PricingPlanBillingStrategy,e)}))),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.billingStrategy&&(t.billingStrategy=this.billingStrategy),t},e}(),Ko=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.start&&(n.start=new Date(i.start)),i.end&&(n.end=new Date(i.end)),i.billingStrategyFilter&&(n.billingStrategyFilter=zo.fromProto(i.billingStrategyFilter)),i.state&&(n.state=Ho(t.State,i.state)),i.minPrice&&(n.minPrice=parseInt(i.minPrice,10)),i.status&&(n.status=Ho(t.PurchaseStatusEnum,i.status)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.purchaseId&&(t.purchaseId=this.purchaseId),void 0!==this.start&&null!==this.start&&(t.start="toApiJson"in this.start?this.start.toApiJson():this.start),void 0!==this.end&&null!==this.end&&(t.end="toApiJson"in this.end?this.end.toApiJson():this.end),void 0!==this.billingStrategyFilter&&null!==this.billingStrategyFilter&&(t.billingStrategyFilter="toApiJson"in this.billingStrategyFilter?this.billingStrategyFilter.toApiJson():this.billingStrategyFilter),void 0!==this.state&&(t.state=this.state),void 0!==this.minPrice&&(t.minPrice=this.minPrice),void 0!==this.status&&(t.status=this.status),void 0!==this.includeVoided&&(t.includeVoided=this.includeVoided),t},e}(),Xo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.start&&(i.start=new Date(e.start)),e.end&&(i.end=new Date(e.end)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.start&&null!==this.start&&(t.start="toApiJson"in this.start?this.start.toApiJson():this.start),void 0!==this.end&&null!==this.end&&(t.end="toApiJson"in this.end?this.end.toApiJson():this.end),t},t}(),Qo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.filters&&(i.filters=Xo.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=H.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),Zo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.purchaseItems&&(i.purchaseItems=e.purchaseItems.map(ir.fromProto)),e.pagingMetadata&&(i.pagingMetadata=V.fromProto(e.pagingMetadata)),e.currency&&(i.currency=Ho(u,e.currency)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.purchaseItems&&null!==this.purchaseItems&&(t.purchaseItems="toApiJson"in this.purchaseItems?this.purchaseItems.toApiJson():this.purchaseItems),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),void 0!==this.currency&&(t.currency=this.currency),t},t}(),$o=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.filters&&(i.filters=Ko.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=H.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),tr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.purchases&&(i.purchases=e.purchases.map(er.fromProto)),e.pagingMetadata&&(i.pagingMetadata=V.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.purchases&&null!==this.purchases&&(t.purchases="toApiJson"in this.purchases?this.purchases.toApiJson():this.purchases),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),er=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.timestamp&&(n.timestamp=new Date(i.timestamp)),i.total&&(n.total=parseInt(i.total,10)),i.currency&&(n.currency=Ho(u,i.currency)),i.items&&(n.items=i.items.map(ir.fromProto)),i.billingStrategy&&(n.billingStrategy=Ho(t.PricingPlanBillingStrategy,i.billingStrategy)),i.dunningAttempt&&(n.dunningAttempt=parseInt(i.dunningAttempt,10)),i.voided&&(n.voided=new Date(i.voided)),i.status&&(n.status=Ho(t.PurchaseStatusEnum,i.status)),i.creditAmount&&(n.creditAmount=parseInt(i.creditAmount,10)),i.appliedCredits&&(n.appliedCredits=i.appliedCredits.map(Vo.fromProto)),i.taxAmount&&(n.taxAmount=parseInt(i.taxAmount,10)),i.appliedTaxRates&&(n.appliedTaxRates=i.appliedTaxRates.map(ye.fromProto)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.timestamp&&null!==this.timestamp&&(t.timestamp="toApiJson"in this.timestamp?this.timestamp.toApiJson():this.timestamp),void 0!==this.purchaseId&&(t.purchaseId=this.purchaseId),void 0!==this.total&&(t.total=this.total),void 0!==this.currency&&(t.currency=this.currency),void 0!==this.renewal&&(t.renewal=this.renewal),void 0!==this.items&&null!==this.items&&(t.items="toApiJson"in this.items?this.items.toApiJson():this.items),void 0!==this.billingStrategy&&(t.billingStrategy=this.billingStrategy),void 0!==this.isDunning&&(t.isDunning=this.isDunning),void 0!==this.dunningAttempt&&(t.dunningAttempt=this.dunningAttempt),void 0!==this.voided&&null!==this.voided&&(t.voided="toApiJson"in this.voided?this.voided.toApiJson():this.voided),void 0!==this.paid&&(t.paid=this.paid),void 0!==this.status&&(t.status=this.status),void 0!==this.creditAmount&&(t.creditAmount=this.creditAmount),void 0!==this.appliedCredits&&null!==this.appliedCredits&&(t.appliedCredits="toApiJson"in this.appliedCredits?this.appliedCredits.toApiJson():this.appliedCredits),void 0!==this.taxAmount&&(t.taxAmount=this.taxAmount),void 0!==this.appliedTaxRates&&null!==this.appliedTaxRates&&(t.appliedTaxRates="toApiJson"in this.appliedTaxRates?this.appliedTaxRates.toApiJson():this.appliedTaxRates),t},e}(),ir=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.amount&&(i.amount=parseInt(e.amount,10)),e.discountAmount&&(i.discountAmount=parseInt(e.discountAmount,10)),e.total&&(i.total=parseInt(e.total,10)),e.appliedDiscounts&&(i.appliedDiscounts=e.appliedDiscounts.map(ht.fromProto)),e.taxAmount&&(i.taxAmount=parseInt(e.taxAmount,10)),e.appliedTaxRates&&(i.appliedTaxRates=e.appliedTaxRates.map(ye.fromProto)),e.setupFee&&(i.setupFee=parseInt(e.setupFee,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.orderId&&(t.orderId=this.orderId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.discountAmount&&(t.discountAmount=this.discountAmount),void 0!==this.total&&(t.total=this.total),void 0!==this.appliedDiscounts&&null!==this.appliedDiscounts&&(t.appliedDiscounts="toApiJson"in this.appliedDiscounts?this.appliedDiscounts.toApiJson():this.appliedDiscounts),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.day&&(t.day=this.day),void 0!==this.purchaseId&&(t.purchaseId=this.purchaseId),void 0!==this.description&&(t.description=this.description),void 0!==this.taxAmount&&(t.taxAmount=this.taxAmount),void 0!==this.appliedTaxRates&&null!==this.appliedTaxRates&&(t.appliedTaxRates="toApiJson"in this.appliedTaxRates?this.appliedTaxRates.toApiJson():this.appliedTaxRates),void 0!==this.setupFee&&(t.setupFee=this.setupFee),t},t}(),nr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.purchaseId&&(t.purchaseId=this.purchaseId),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.day&&(t.day=this.day),void 0!==this.shouldEnterDunning&&(t.shouldEnterDunning=this.shouldEnterDunning),t},t}(),or=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.purchaseId&&(t.purchaseId=this.purchaseId),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.day&&(t.day=this.day),t},t}();function rr(t,e){return"number"==typeof e?e:t[e]}var sr=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.amount&&(n.amount=parseInt(i.amount,10)),i.reason&&(n.reason=rr(t.RefundReasonEnum,i.reason)),i.referenceType&&(n.referenceType=rr(t.ReferenceTypeEnum,i.referenceType)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.paymentId&&(t.paymentId=this.paymentId),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.reason&&(t.reason=this.reason),void 0!==this.referenceType&&(t.referenceType=this.referenceType),void 0!==this.referenceId&&(t.referenceId=this.referenceId),t},e}(),ar=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.pageSize&&(i.pageSize=parseInt(e.pageSize,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.paymentIds&&(t.paymentIds=this.paymentIds),void 0!==this.cursor&&(t.cursor=this.cursor),void 0!==this.pageSize&&(t.pageSize=this.pageSize),void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),cr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.refunds&&(i.refunds=e.refunds.map(ur.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.refunds&&null!==this.refunds&&(t.refunds="toApiJson"in this.refunds?this.refunds.toApiJson():this.refunds),void 0!==this.nextCursor&&(t.nextCursor=this.nextCursor),void 0!==this.hasMore&&(t.hasMore=this.hasMore),t},t}(),ur=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.amount&&(n.amount=parseInt(i.amount,10)),i.reason&&(n.reason=rr(t.RefundReasonEnum,i.reason)),i.status&&(n.status=rr(t.RefundStatusEnum,i.status)),i.created&&(n.created=new Date(i.created)),i.updated&&(n.updated=new Date(i.updated)),i.referenceType&&(n.referenceType=rr(t.ReferenceTypeEnum,i.referenceType)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.chargeId&&(t.chargeId=this.chargeId),void 0!==this.refundId&&(t.refundId=this.refundId),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.email&&(t.email=this.email),void 0!==this.reason&&(t.reason=this.reason),void 0!==this.status&&(t.status=this.status),void 0!==this.created&&null!==this.created&&(t.created="toApiJson"in this.created?this.created.toApiJson():this.created),void 0!==this.updated&&null!==this.updated&&(t.updated="toApiJson"in this.updated?this.updated.toApiJson():this.updated),void 0!==this.referenceType&&(t.referenceType=this.referenceType),void 0!==this.referenceId&&(t.referenceId=this.referenceId),t},e}();function pr(t,e){return"number"==typeof e?e:t[e]}var dr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.creditNoteDate&&(i.creditNoteDate=new Date(e.creditNoteDate)),e.dueDate&&(i.dueDate=new Date(e.dueDate)),e.total&&(i.total=parseInt(e.total,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.creditNoteReason&&(t.creditNoteReason=this.creditNoteReason),void 0!==this.creditNoteDate&&null!==this.creditNoteDate&&(t.creditNoteDate="toApiJson"in this.creditNoteDate?this.creditNoteDate.toApiJson():this.creditNoteDate),void 0!==this.dueDate&&null!==this.dueDate&&(t.dueDate="toApiJson"in this.dueDate?this.dueDate.toApiJson():this.dueDate),void 0!==this.total&&(t.total=this.total),void 0!==this.sku&&(t.sku=this.sku),t},t}(),hr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.statuses&&(i.statuses=e.statuses.map((function(t){return pr(x,t)}))),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.statuses&&(t.statuses=this.statuses),t},t}(),lr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.filters&&(i.filters=hr.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=H.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),mr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.creditNote&&(i.creditNote=e.creditNote.map(vr.fromProto)),e.pagingMetadata&&(i.pagingMetadata=V.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.creditNote&&null!==this.creditNote&&(t.creditNote="toApiJson"in this.creditNote?this.creditNote.toApiJson():this.creditNote),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),vr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.creditNoteDate&&(i.creditNoteDate=new Date(e.creditNoteDate)),e.dueDate&&(i.dueDate=new Date(e.dueDate)),e.currency&&(i.currency=pr(u,e.currency)),e.total&&(i.total=parseInt(e.total,10)),e.outstanding&&(i.outstanding=parseInt(e.outstanding,10)),e.status&&(i.status=pr(x,e.status)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.creditNoteId&&(t.creditNoteId=this.creditNoteId),void 0!==this.creditNoteNumber&&(t.creditNoteNumber=this.creditNoteNumber),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.creditNoteReason&&(t.creditNoteReason=this.creditNoteReason),void 0!==this.creditNoteDate&&null!==this.creditNoteDate&&(t.creditNoteDate="toApiJson"in this.creditNoteDate?this.creditNoteDate.toApiJson():this.creditNoteDate),void 0!==this.dueDate&&null!==this.dueDate&&(t.dueDate="toApiJson"in this.dueDate?this.dueDate.toApiJson():this.dueDate),void 0!==this.currency&&(t.currency=this.currency),void 0!==this.total&&(t.total=this.total),void 0!==this.outstanding&&(t.outstanding=this.outstanding),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),void 0!==this.invoiceNumber&&(t.invoiceNumber=this.invoiceNumber),void 0!==this.status&&(t.status=this.status),void 0!==this.paymentStatus&&(t.paymentStatus=this.paymentStatus),t},t}();function fr(t,e){return"number"==typeof e?e:t[e]}var gr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),Ir=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoice&&(i.invoice=br.fromProto(e.invoice)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoice&&null!==this.invoice&&(t.invoice="toApiJson"in this.invoice?this.invoice.toApiJson():this.invoice),t},t}(),yr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.statuses&&(i.statuses=e.statuses.map((function(t){return fr(Y,t)}))),e.paymentStatuses&&(i.paymentStatuses=e.paymentStatuses.map((function(t){return fr(L,t)}))),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.statuses&&(t.statuses=this.statuses),void 0!==this.paymentStatuses&&(t.paymentStatuses=this.paymentStatuses),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),t},t}(),Ar=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.filters&&(i.filters=yr.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=H.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),void 0!==this.searchTerm&&(t.searchTerm=this.searchTerm),t},t}(),Sr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoice&&(i.invoice=e.invoice.map(br.fromProto)),e.pagingMetadata&&(i.pagingMetadata=V.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoice&&null!==this.invoice&&(t.invoice="toApiJson"in this.invoice?this.invoice.toApiJson():this.invoice),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),Pr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),t},t}(),br=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoiceDate&&(i.invoiceDate=new Date(e.invoiceDate)),e.startDate&&(i.startDate=new Date(e.startDate)),e.endDate&&(i.endDate=new Date(e.endDate)),e.dueDate&&(i.dueDate=new Date(e.dueDate)),e.total&&(i.total=parseInt(e.total,10)),e.currency&&(i.currency=fr(u,e.currency)),e.status&&(i.status=fr(Y,e.status)),e.outstanding&&(i.outstanding=parseInt(e.outstanding,10)),e.type&&(i.type=fr(q,e.type)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),void 0!==this.invoiceNumber&&(t.invoiceNumber=this.invoiceNumber),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceDate&&null!==this.invoiceDate&&(t.invoiceDate="toApiJson"in this.invoiceDate?this.invoiceDate.toApiJson():this.invoiceDate),void 0!==this.startDate&&null!==this.startDate&&(t.startDate="toApiJson"in this.startDate?this.startDate.toApiJson():this.startDate),void 0!==this.endDate&&null!==this.endDate&&(t.endDate="toApiJson"in this.endDate?this.endDate.toApiJson():this.endDate),void 0!==this.dueDate&&null!==this.dueDate&&(t.dueDate="toApiJson"in this.dueDate?this.dueDate.toApiJson():this.dueDate),void 0!==this.total&&(t.total=this.total),void 0!==this.currency&&(t.currency=this.currency),void 0!==this.status&&(t.status=this.status),void 0!==this.paymentStatus&&(t.paymentStatus=this.paymentStatus),void 0!==this.outstanding&&(t.outstanding=this.outstanding),void 0!==this.type&&(t.type=this.type),t},t}(),Tr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),t},t}(),Or=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),t},t}();var Er=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n,o,r=new e;return r=Object.assign(r,i),i.status&&(r.status=(n=t.SubscribeValidationStatus,"number"==typeof(o=i.status)?o:n[o])),r},e.prototype.toApiJson=function(){var t={};return void 0!==this.status&&(t.status=this.status),t},e}();function Rr(t,e){return"number"==typeof e?e:t[e]}var Dr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.orderId&&(t.orderId=this.orderId),t},t}(),Cr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.skus&&(i.skus=Object.keys(e.skus).reduce((function(t,i){return t[i]=parseInt(e.skus[i],10),t}),{})),e.items&&(i.items=e.items.map(xr.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.skus&&null!==this.skus&&(t.skus="toApiJson"in this.skus?this.skus.toApiJson():this.skus),void 0!==this.items&&null!==this.items&&(t.items="toApiJson"in this.items?this.items.toApiJson():this.items),t},t}(),_r=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.validationResponse&&(i.validationResponse=e.validationResponse.map(Lr.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.validationResponse&&null!==this.validationResponse&&(t.validationResponse="toApiJson"in this.validationResponse?this.validationResponse.toApiJson():this.validationResponse),t},t}(),Jr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.customUnitPrice&&(i.customUnitPrice=parseInt(e.customUnitPrice,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.orderId&&(t.orderId=this.orderId),void 0!==this.customUnitPrice&&(t.customUnitPrice=this.customUnitPrice),t},t}(),wr=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.frequency&&(n.frequency=Rr(t.GeneratedFrequency,i.frequency)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.orderId&&(t.orderId=this.orderId),void 0!==this.frequency&&(t.frequency=this.frequency),t},e}(),jr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.nextRenewalDate&&(i.nextRenewalDate=new Date(e.nextRenewalDate)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.orderId&&(t.orderId=this.orderId),void 0!==this.nextRenewalDate&&null!==this.nextRenewalDate&&(t.nextRenewalDate="toApiJson"in this.nextRenewalDate?this.nextRenewalDate.toApiJson():this.nextRenewalDate),t},t}(),Nr=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.billingStart&&(n.billingStart=new Date(i.billingStart)),i.proratedTo&&(n.proratedTo=new Date(i.proratedTo)),i.renewalState&&(n.renewalState=Rr(W,i.renewalState)),i.customUnitPrice&&(n.customUnitPrice=parseInt(i.customUnitPrice,10)),i.alignWith&&(n.alignWith=Dr.fromProto(i.alignWith)),i.frequency&&(n.frequency=Rr(t.GeneratedFrequency,i.frequency)),i.retailAmount&&(n.retailAmount=parseInt(i.retailAmount,10)),i.retailFrequency&&(n.retailFrequency=Rr(t.GeneratedFrequency,i.retailFrequency)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.orderId&&(t.orderId=this.orderId),void 0!==this.billingStart&&null!==this.billingStart&&(t.billingStart="toApiJson"in this.billingStart?this.billingStart.toApiJson():this.billingStart),void 0!==this.proratedTo&&null!==this.proratedTo&&(t.proratedTo="toApiJson"in this.proratedTo?this.proratedTo.toApiJson():this.proratedTo),void 0!==this.renewalState&&(t.renewalState=this.renewalState),void 0!==this.retailBundleId&&(t.retailBundleId=this.retailBundleId),void 0!==this.forResale&&(t.forResale=this.forResale),void 0!==this.customUnitPrice&&(t.customUnitPrice=this.customUnitPrice),void 0!==this.alignWith&&null!==this.alignWith&&(t.alignWith="toApiJson"in this.alignWith?this.alignWith.toApiJson():this.alignWith),void 0!==this.frequency&&(t.frequency=this.frequency),void 0!==this.retailAmount&&(t.retailAmount=this.retailAmount),void 0!==this.retailFrequency&&(t.retailFrequency=this.retailFrequency),t},e}(),Ur=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.subscriptions&&(i.subscriptions=e.subscriptions.map(Fr.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.subscriptions&&null!==this.subscriptions&&(t.subscriptions="toApiJson"in this.subscriptions?this.subscriptions.toApiJson():this.subscriptions),t},t}(),Mr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.id&&(t.id=this.id),t},t}(),Br=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.orderId&&(t.orderId=this.orderId),t},t}(),kr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.renewalStart&&(i.renewalStart=new Date(e.renewalStart)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.orderId&&(t.orderId=this.orderId),void 0!==this.renewalStart&&null!==this.renewalStart&&(t.renewalStart="toApiJson"in this.renewalStart?this.renewalStart.toApiJson():this.renewalStart),t},t}(),Fr=(function(){function t(t){t&&Object.assign(this,t)}t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.value&&(i.value=parseInt(e.value,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.key&&(t.key=this.key),void 0!==this.value&&(t.value=this.value),t}}(),function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.billingStart&&(n.billingStart=new Date(i.billingStart)),i.renewalState&&(n.renewalState=Rr(W,i.renewalState)),i.proratedTo&&(n.proratedTo=new Date(i.proratedTo)),i.customUnitPrice&&(n.customUnitPrice=parseInt(i.customUnitPrice,10)),i.alignWith&&(n.alignWith=Dr.fromProto(i.alignWith)),i.frequency&&(n.frequency=Rr(t.GeneratedFrequency,i.frequency)),i.retailAmount&&(n.retailAmount=parseInt(i.retailAmount,10)),i.retailFrequency&&(n.retailFrequency=Rr(t.GeneratedFrequency,i.retailFrequency)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.orderId&&(t.orderId=this.orderId),void 0!==this.billingStart&&null!==this.billingStart&&(t.billingStart="toApiJson"in this.billingStart?this.billingStart.toApiJson():this.billingStart),void 0!==this.renewalState&&(t.renewalState=this.renewalState),void 0!==this.proratedTo&&null!==this.proratedTo&&(t.proratedTo="toApiJson"in this.proratedTo?this.proratedTo.toApiJson():this.proratedTo),void 0!==this.retailBundleId&&(t.retailBundleId=this.retailBundleId),void 0!==this.forResale&&(t.forResale=this.forResale),void 0!==this.customUnitPrice&&(t.customUnitPrice=this.customUnitPrice),void 0!==this.alignWith&&null!==this.alignWith&&(t.alignWith="toApiJson"in this.alignWith?this.alignWith.toApiJson():this.alignWith),void 0!==this.bundleInstanceId&&(t.bundleInstanceId=this.bundleInstanceId),void 0!==this.frequency&&(t.frequency=this.frequency),void 0!==this.retailAmount&&(t.retailAmount=this.retailAmount),void 0!==this.retailFrequency&&(t.retailFrequency=this.retailFrequency),t},e}()),xr=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.frequency&&(n.frequency=Rr(t.GeneratedFrequency,i.frequency)),i.quantity&&(n.quantity=parseInt(i.quantity,10)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.frequency&&(t.frequency=this.frequency),void 0!==this.quantity&&(t.quantity=this.quantity),t},e}(),Lr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.code&&(i.code=Er.fromProto(e.code)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.code&&null!==this.code&&(t.code="toApiJson"in this.code?this.code.toApiJson():this.code),t},t}();var Yr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.created&&(i.created=new Date(e.created)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.id&&(t.id=this.id),void 0!==this.filename&&(t.filename=this.filename),void 0!==this.created&&null!==this.created&&(t.created="toApiJson"in this.created?this.created.toApiJson():this.created),t},t}(),qr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.id&&(t.id=this.id),t},t}(),Gr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),Wr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.filters&&(i.filters=Gr.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=H.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),Hr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.contractDocuments&&(i.contractDocuments=e.contractDocuments.map(Yr.fromProto)),e.pagingMetadata&&(i.pagingMetadata=V.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.contractDocuments&&null!==this.contractDocuments&&(t.contractDocuments="toApiJson"in this.contractDocuments?this.contractDocuments.toApiJson():this.contractDocuments),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}();var Vr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),zr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.configuration&&(i.configuration=Kr.fromProto(e.configuration)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.configuration&&null!==this.configuration&&(t.configuration="toApiJson"in this.configuration?this.configuration.toApiJson():this.configuration),t},t}(),Kr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoiceDay&&(i.invoiceDay=parseInt(e.invoiceDay,10)),e.nextInvoiceDate&&(i.nextInvoiceDate=new Date(e.nextInvoiceDate)),e.netD&&(i.netD=parseInt(e.netD,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceDay&&(t.invoiceDay=this.invoiceDay),void 0!==this.nextInvoiceDate&&null!==this.nextInvoiceDate&&(t.nextInvoiceDate="toApiJson"in this.nextInvoiceDate?this.nextInvoiceDate.toApiJson():this.nextInvoiceDate),void 0!==this.autoPost&&(t.autoPost=this.autoPost),void 0!==this.collectionMethod&&(t.collectionMethod=this.collectionMethod),void 0!==this.netD&&(t.netD=this.netD),void 0!==this.autoGenerate&&(t.autoGenerate=this.autoGenerate),void 0!==this.contactId&&(t.contactId=this.contactId),void 0!==this.useTemplateInvoice&&(t.useTemplateInvoice=this.useTemplateInvoice),t},t}(),Xr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoiceDay&&(i.invoiceDay=parseInt(e.invoiceDay,10)),e.netD&&(i.netD=parseInt(e.netD,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceDay&&(t.invoiceDay=this.invoiceDay),void 0!==this.autoPost&&(t.autoPost=this.autoPost),void 0!==this.netD&&(t.netD=this.netD),void 0!==this.autoGenerate&&(t.autoGenerate=this.autoGenerate),void 0!==this.contactId&&(t.contactId=this.contactId),void 0!==this.collectionMethod&&(t.collectionMethod=this.collectionMethod),void 0!==this.useTemplateInvoice&&(t.useTemplateInvoice=this.useTemplateInvoice),t},t}();var Qr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.amount&&(i.amount=parseInt(e.amount,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.currency&&(t.currency=this.currency),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.idempotencyKey&&(t.idempotencyKey=this.idempotencyKey),void 0!==this.reason&&(t.reason=this.reason),t},t}(),Zr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.amount&&(i.amount=parseInt(e.amount,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.currency&&(t.currency=this.currency),void 0!==this.amount&&(t.amount=this.amount),t},t}(),$r=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),ts=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.creditBalance&&(i.creditBalance=Zr.fromProto(e.creditBalance)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.creditBalance&&null!==this.creditBalance&&(t.creditBalance="toApiJson"in this.creditBalance?this.creditBalance.toApiJson():this.creditBalance),t},t}();var es=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.bundleId&&(t.bundleId=this.bundleId),t},t}(),is=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoiceTemplate&&(i.invoiceTemplate=hs.fromProto(e.invoiceTemplate)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceTemplate&&null!==this.invoiceTemplate&&(t.invoiceTemplate="toApiJson"in this.invoiceTemplate?this.invoiceTemplate.toApiJson():this.invoiceTemplate),t},t}(),ns=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.unitPrice&&(i.unitPrice=parseInt(e.unitPrice,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.unitPrice&&(t.unitPrice=this.unitPrice),void 0!==this.quantity&&(t.quantity=this.quantity),void 0!==this.description&&(t.description=this.description),void 0!==this.taxRates&&(t.taxRates=this.taxRates),t},t}(),os=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoiceTemplate&&(i.invoiceTemplate=hs.fromProto(e.invoiceTemplate)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceTemplate&&null!==this.invoiceTemplate&&(t.invoiceTemplate="toApiJson"in this.invoiceTemplate?this.invoiceTemplate.toApiJson():this.invoiceTemplate),t},t}(),rs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),t},t}(),ss=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoiceTemplate&&(i.invoiceTemplate=hs.fromProto(e.invoiceTemplate)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceTemplate&&null!==this.invoiceTemplate&&(t.invoiceTemplate="toApiJson"in this.invoiceTemplate?this.invoiceTemplate.toApiJson():this.invoiceTemplate),t},t}(),as=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),t},t}(),cs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.id&&(t.id=this.id),t},t}(),us=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoiceTemplate&&(i.invoiceTemplate=hs.fromProto(e.invoiceTemplate)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceTemplate&&null!==this.invoiceTemplate&&(t.invoiceTemplate="toApiJson"in this.invoiceTemplate?this.invoiceTemplate.toApiJson():this.invoiceTemplate),t},t}(),ps=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),t},t}(),ds=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoiceTemplate&&(i.invoiceTemplate=hs.fromProto(e.invoiceTemplate)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceTemplate&&null!==this.invoiceTemplate&&(t.invoiceTemplate="toApiJson"in this.invoiceTemplate?this.invoiceTemplate.toApiJson():this.invoiceTemplate),t},t}(),hs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i,n,o=new t;return o=Object.assign(o,e),e.appliedTaxes&&(o.appliedTaxes=e.appliedTaxes.map(ye.fromProto)),e.items&&(o.items=e.items.map(ls.fromProto)),e.currency&&(o.currency=(i=u,"number"==typeof(n=e.currency)?n:i[n])),e.total&&(o.total=parseInt(e.total,10)),e.subtotal&&(o.subtotal=parseInt(e.subtotal,10)),e.created&&(o.created=new Date(e.created)),e.updated&&(o.updated=new Date(e.updated)),e.defaultTaxRates&&(o.defaultTaxRates=e.defaultTaxRates.map(_e.fromProto)),e.appliedBundles&&(o.appliedBundles=e.appliedBundles.map(we.fromProto)),e.amountDiscount&&(o.amountDiscount=parseInt(e.amountDiscount,10)),o},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.appliedTaxes&&null!==this.appliedTaxes&&(t.appliedTaxes="toApiJson"in this.appliedTaxes?this.appliedTaxes.toApiJson():this.appliedTaxes),void 0!==this.items&&null!==this.items&&(t.items="toApiJson"in this.items?this.items.toApiJson():this.items),void 0!==this.currency&&(t.currency=this.currency),void 0!==this.total&&(t.total=this.total),void 0!==this.subtotal&&(t.subtotal=this.subtotal),void 0!==this.created&&null!==this.created&&(t.created="toApiJson"in this.created?this.created.toApiJson():this.created),void 0!==this.updated&&null!==this.updated&&(t.updated="toApiJson"in this.updated?this.updated.toApiJson():this.updated),void 0!==this.defaultTaxRates&&null!==this.defaultTaxRates&&(t.defaultTaxRates="toApiJson"in this.defaultTaxRates?this.defaultTaxRates.toApiJson():this.defaultTaxRates),void 0!==this.appliedBundles&&null!==this.appliedBundles&&(t.appliedBundles="toApiJson"in this.appliedBundles?this.appliedBundles.toApiJson():this.appliedBundles),void 0!==this.amountDiscount&&(t.amountDiscount=this.amountDiscount),t},t}(),ls=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.unitPrice&&(i.unitPrice=parseInt(e.unitPrice,10)),e.total&&(i.total=parseInt(e.total,10)),e.appliedTaxes&&(i.appliedTaxes=e.appliedTaxes.map(ye.fromProto)),e.taxRates&&(i.taxRates=e.taxRates.map(_e.fromProto)),e.subtotal&&(i.subtotal=parseInt(e.subtotal,10)),e.discounts&&(i.discounts=e.discounts.map(ht.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.unitPrice&&(t.unitPrice=this.unitPrice),void 0!==this.quantity&&(t.quantity=this.quantity),void 0!==this.description&&(t.description=this.description),void 0!==this.total&&(t.total=this.total),void 0!==this.appliedTaxes&&null!==this.appliedTaxes&&(t.appliedTaxes="toApiJson"in this.appliedTaxes?this.appliedTaxes.toApiJson():this.appliedTaxes),void 0!==this.taxRates&&null!==this.taxRates&&(t.taxRates="toApiJson"in this.taxRates?this.taxRates.toApiJson():this.taxRates),void 0!==this.subtotal&&(t.subtotal=this.subtotal),void 0!==this.bundleId&&(t.bundleId=this.bundleId),void 0!==this.discounts&&null!==this.discounts&&(t.discounts="toApiJson"in this.discounts?this.discounts.toApiJson():this.discounts),t},t}(),ms=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.unitPrice&&(i.unitPrice=parseInt(e.unitPrice,10)),e.appliedDiscounts&&(i.appliedDiscounts=e.appliedDiscounts.map(ht.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.unitPrice&&(t.unitPrice=this.unitPrice),void 0!==this.quantity&&(t.quantity=this.quantity),void 0!==this.description&&(t.description=this.description),void 0!==this.taxRates&&(t.taxRates=this.taxRates),void 0!==this.bundleId&&(t.bundleId=this.bundleId),void 0!==this.appliedDiscounts&&null!==this.appliedDiscounts&&(t.appliedDiscounts="toApiJson"in this.appliedDiscounts?this.appliedDiscounts.toApiJson():this.appliedDiscounts),t},t}(),vs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.bundleId&&(t.bundleId=this.bundleId),void 0!==this.hideBundleItems&&(t.hideBundleItems=this.hideBundleItems),t},t}(),fs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoiceTemplate&&(i.invoiceTemplate=hs.fromProto(e.invoiceTemplate)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceTemplate&&null!==this.invoiceTemplate&&(t.invoiceTemplate="toApiJson"in this.invoiceTemplate?this.invoiceTemplate.toApiJson():this.invoiceTemplate),t},t}(),gs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.taxRateIds&&(t.taxRateIds=this.taxRateIds),t},t}(),Is=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoiceTemplate&&(i.invoiceTemplate=hs.fromProto(e.invoiceTemplate)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceTemplate&&null!==this.invoiceTemplate&&(t.invoiceTemplate="toApiJson"in this.invoiceTemplate?this.invoiceTemplate.toApiJson():this.invoiceTemplate),t},t}(),ys=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.unitPrice&&(i.unitPrice=parseInt(e.unitPrice,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.id&&(t.id=this.id),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.unitPrice&&(t.unitPrice=this.unitPrice),void 0!==this.quantity&&(t.quantity=this.quantity),void 0!==this.description&&(t.description=this.description),void 0!==this.taxRates&&(t.taxRates=this.taxRates),t},t}(),As=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoiceTemplate&&(i.invoiceTemplate=hs.fromProto(e.invoiceTemplate)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceTemplate&&null!==this.invoiceTemplate&&(t.invoiceTemplate="toApiJson"in this.invoiceTemplate?this.invoiceTemplate.toApiJson():this.invoiceTemplate),t},t}(),Ss=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.items&&(i.items=e.items.map(ms.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.items&&null!==this.items&&(t.items="toApiJson"in this.items?this.items.toApiJson():this.items),void 0!==this.defaultTaxRates&&(t.defaultTaxRates=this.defaultTaxRates),void 0!==this.currencyCode&&(t.currencyCode=this.currencyCode),t},t}(),Ps=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoiceTemplate&&(i.invoiceTemplate=hs.fromProto(e.invoiceTemplate)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceTemplate&&null!==this.invoiceTemplate&&(t.invoiceTemplate="toApiJson"in this.invoiceTemplate?this.invoiceTemplate.toApiJson():this.invoiceTemplate),t},t}();function bs(t,e){return"number"==typeof e?e:t[e]}var Ts=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.groupId&&(t.groupId=this.groupId),void 0!==this.sku&&(t.sku=this.sku),t},t}(),Os=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.periodStart&&(i.periodStart=new Date(e.periodStart)),e.periodEnd&&(i.periodEnd=new Date(e.periodEnd)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.periodStart&&null!==this.periodStart&&(t.periodStart="toApiJson"in this.periodStart?this.periodStart.toApiJson():this.periodStart),void 0!==this.periodEnd&&null!==this.periodEnd&&(t.periodEnd="toApiJson"in this.periodEnd?this.periodEnd.toApiJson():this.periodEnd),t},t}(),Es=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.url&&(t.url=this.url),t},t}(),Rs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.periodStart&&(i.periodStart=new Date(e.periodStart)),e.periodEnd&&(i.periodEnd=new Date(e.periodEnd)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.skus&&(t.skus=this.skus),void 0!==this.periodStart&&null!==this.periodStart&&(t.periodStart="toApiJson"in this.periodStart?this.periodStart.toApiJson():this.periodStart),void 0!==this.periodEnd&&null!==this.periodEnd&&(t.periodEnd="toApiJson"in this.periodEnd?this.periodEnd.toApiJson():this.periodEnd),void 0!==this.vendorName&&(t.vendorName=this.vendorName),void 0!==this.markAsApproved&&(t.markAsApproved=this.markAsApproved),t},t}(),Ds=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.url&&(t.url=this.url),void 0!==this.bucket&&(t.bucket=this.bucket),void 0!==this.filename&&(t.filename=this.filename),t},t}(),Cs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.storeId&&(t.storeId=this.storeId),void 0!==this.bundleIds&&(t.bundleIds=this.bundleIds),t},t}(),_s=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.prices&&(i.prices=Object.keys(e.prices).reduce((function(t,i){return t[i]=ft.fromProto(e.prices[i]),t}),{})),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.prices&&null!==this.prices&&(t.prices="toApiJson"in this.prices?this.prices.toApiJson():this.prices),t},t}(),Js=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.skus&&(t.skus=this.skus),void 0!==this.pricingPlanId&&(t.pricingPlanId=this.pricingPlanId),t},t}(),ws=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.productPrices&&(i.productPrices=Object.keys(e.productPrices).reduce((function(t,i){return t[i]=Wo.fromProto(e.productPrices[i]),t}),{})),e.prices&&(i.prices=e.prices.map(Go.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.productPrices&&null!==this.productPrices&&(t.productPrices="toApiJson"in this.productPrices?this.productPrices.toApiJson():this.productPrices),void 0!==this.prices&&null!==this.prices&&(t.prices="toApiJson"in this.prices?this.prices.toApiJson():this.prices),t},t}(),js=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.currency&&(i.currency=bs(u,e.currency)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.currency&&(t.currency=this.currency),void 0!==this.skus&&(t.skus=this.skus),void 0!==this.groupId&&(t.groupId=this.groupId),t},t}(),Ns=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.productPrices&&(i.productPrices=Object.keys(e.productPrices).reduce((function(t,i){return t[i]=Wo.fromProto(e.productPrices[i]),t}),{})),e.prices&&(i.prices=e.prices.map(Go.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.productPrices&&null!==this.productPrices&&(t.productPrices="toApiJson"in this.productPrices?this.productPrices.toApiJson():this.productPrices),void 0!==this.prices&&null!==this.prices&&(t.prices="toApiJson"in this.prices?this.prices.toApiJson():this.prices),t},t}(),Us=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.quantity&&(n.quantity=parseInt(i.quantity,10)),i.frequency&&(n.frequency=bs(t.GeneratedFrequency,i.frequency)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.quantity&&(t.quantity=this.quantity),void 0!==this.frequency&&(t.frequency=this.frequency),t},e}(),Ms=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.totalCost&&(n.totalCost=parseInt(i.totalCost,10)),i.currency&&(n.currency=bs(u,i.currency)),i.strategy&&(n.strategy=bs(t.PricingPlanBillingStrategy,i.strategy)),i.commitment&&(n.commitment=Ot.fromProto(i.commitment)),i.discountAmount&&(n.discountAmount=parseInt(i.discountAmount,10)),i.subtotalCost&&(n.subtotalCost=parseInt(i.subtotalCost,10)),i.setupFee&&(n.setupFee=parseInt(i.setupFee,10)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.billingFrequency&&(t.billingFrequency=this.billingFrequency),void 0!==this.totalCost&&(t.totalCost=this.totalCost),void 0!==this.currency&&(t.currency=this.currency),void 0!==this.strategy&&(t.strategy=this.strategy),void 0!==this.commitment&&null!==this.commitment&&(t.commitment="toApiJson"in this.commitment?this.commitment.toApiJson():this.commitment),void 0!==this.isStartingPrice&&(t.isStartingPrice=this.isStartingPrice),void 0!==this.discountAmount&&(t.discountAmount=this.discountAmount),void 0!==this.subtotalCost&&(t.subtotalCost=this.subtotalCost),void 0!==this.setupFee&&(t.setupFee=this.setupFee),t},e}(),Bs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.periodStart&&(i.periodStart=new Date(e.periodStart)),e.periodEnd&&(i.periodEnd=new Date(e.periodEnd)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.skus&&(t.skus=this.skus),void 0!==this.periodStart&&null!==this.periodStart&&(t.periodStart="toApiJson"in this.periodStart?this.periodStart.toApiJson():this.periodStart),void 0!==this.periodEnd&&null!==this.periodEnd&&(t.periodEnd="toApiJson"in this.periodEnd?this.periodEnd.toApiJson():this.periodEnd),t},t}(),ks=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.totalRevenue&&(i.totalRevenue=parseInt(e.totalRevenue,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.totalRevenue&&(t.totalRevenue=this.totalRevenue),t},t}(),Fs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),xs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.totalBillableCustomers&&(i.totalBillableCustomers=parseInt(e.totalBillableCustomers,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.totalBillableCustomers&&(t.totalBillableCustomers=this.totalBillableCustomers),void 0!==this.currentBasketSize&&(t.currentBasketSize=this.currentBasketSize),void 0!==this.changeInBasketSize30Days&&(t.changeInBasketSize30Days=this.changeInBasketSize30Days),t},t}(),Ls=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.currencyCode&&(t.currencyCode=this.currencyCode),t},t}(),Ys=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.filter&&(i.filter=Ls.fromProto(e.filter)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.pricingPlanId&&(t.pricingPlanId=this.pricingPlanId),void 0!==this.filter&&null!==this.filter&&(t.filter="toApiJson"in this.filter?this.filter.toApiJson():this.filter),t},t}(),qs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.results&&(i.results=e.results.map(Gs.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.results&&null!==this.results&&(t.results="toApiJson"in this.results?this.results.toApiJson():this.results),t},t}(),Gs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.productPricing&&(i.productPricing=Wo.fromProto(e.productPricing)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.pricingPlanId&&(t.pricingPlanId=this.pricingPlanId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.productPricing&&null!==this.productPricing&&(t.productPricing="toApiJson"in this.productPricing?this.productPricing.toApiJson():this.productPricing),t},t}(),Ws=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.value&&(i.value=ft.fromProto(e.value)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.key&&(t.key=this.key),void 0!==this.value&&null!==this.value&&(t.value="toApiJson"in this.value?this.value.toApiJson():this.value),t},t}(),Hs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.value&&(i.value=mo.fromProto(e.value)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.key&&(t.key=this.key),void 0!==this.value&&null!==this.value&&(t.value="toApiJson"in this.value?this.value.toApiJson():this.value),t},t}(),Vs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.value&&(i.value=Wo.fromProto(e.value)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.key&&(t.key=this.key),void 0!==this.value&&null!==this.value&&(t.value="toApiJson"in this.value?this.value.toApiJson():this.value),t},t}(),zs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.value&&(i.value=Wo.fromProto(e.value)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.key&&(t.key=this.key),void 0!==this.value&&null!==this.value&&(t.value="toApiJson"in this.value?this.value.toApiJson():this.value),t},t}(),Ks=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.strategy&&(n.strategy=bs(t.PricingPlanBillingStrategy,i.strategy)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.strategy&&(t.strategy=this.strategy),t},e}(),Xs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.volumeCommitment&&(i.volumeCommitment=parseInt(e.volumeCommitment,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.volumeCommitment&&(t.volumeCommitment=this.volumeCommitment),t},t}(),Qs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){return{}},t}(),Zs=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.frequency&&(n.frequency=bs(t.GeneratedFrequency,i.frequency)),i.pricing&&(n.pricing=Object.keys(i.pricing).reduce((function(t,e){return t[e]=mo.fromProto(i.pricing[e]),t}),{})),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.frequency&&(t.frequency=this.frequency),void 0!==this.pricing&&null!==this.pricing&&(t.pricing="toApiJson"in this.pricing?this.pricing.toApiJson():this.pricing),void 0!==this.groupId&&(t.groupId=this.groupId),t},e}(),$s=function(){function t(t){this.environmentService=t}return t.prototype.host=function(){if(this._host)return this._host;switch(this.environmentService.getEnvironment()){case n.Environment.LOCAL:this._host="billing-api.vendasta-local.com";break;case n.Environment.TEST:this._host="";break;case n.Environment.DEMO:this._host="billing-demo.apigateway.co";break;case n.Environment.PROD:this._host="billing-prod.apigateway.co"}return this._host},t.prototype.httpsHost=function(){if(this._httpsHost)return this._httpsHost;switch(this.environmentService.getEnvironment()){case n.Environment.LOCAL:this._httpsHost="billing.vendasta-local.com";break;case n.Environment.TEST:this._httpsHost="";break;case n.Environment.DEMO:this._httpsHost="billing-api-demo.apigateway.co";break;case n.Environment.PROD:this._httpsHost="billing-api-prod.apigateway.co"}return this._httpsHost},t.prototype.hostWithScheme=function(){return(this.environmentService.getEnvironment()===n.Environment.LOCAL?"http://":"https://")+this.host()},t.prototype.httpsHostWithScheme=function(){return(this.environmentService.getEnvironment()===n.Environment.LOCAL?"http://":"https://")+this.httpsHost()},t}();$s.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new $s(e.ɵɵinject(n.EnvironmentService))},token:$s,providedIn:"root"}),$s.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],$s.ctorParameters=function(){return[{type:n.EnvironmentService}]};var ta=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.listPayouts=function(t){var e=t.toApiJson?t:new yi(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.BankReconciliationService/ListPayouts",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ai.fromProto(t)})),o.share())},t.prototype.reconcilePayout=function(t){var e=t.toApiJson?t:new Pi(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.BankReconciliationService/ReconcilePayout",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return bi.fromProto(t)})),o.share())},t}();ta.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ta(e.ɵɵinject(i.HttpClient),e.ɵɵinject($s))},token:ta,providedIn:"root"}),ta.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ta.ctorParameters=function(){return[{type:i.HttpClient},{type:$s}]};var ea=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.canBillItem=function(t){var e=t.toApiJson?t:new $(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/CanBillItem",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.canCreateSubscriptions=function(t){var e=t.toApiJson?t:new Cr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/CanCreateSubscriptions",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return _r.fromProto(t)})),o.share())},t.prototype.createSubscription=function(t){var e=t.toApiJson?t:new Nr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/CreateSubscription",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.createSubscriptions=function(t){var e=t.toApiJson?t:new Ur(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/CreateSubscriptions",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Mr.fromProto(t)})),o.share())},t.prototype.reverseSubscription=function(t){var e=t.toApiJson?t:new Br(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/ReverseSubscription",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.setRenewalStart=function(t){var e=t.toApiJson?t:new kr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/SetRenewalStart",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.billItem=function(t){var e=t.toApiJson?t:new K(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/BillItem",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.billMultipleItems=function(t){var e=t.toApiJson?t:new X(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/BillMultipleItems",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Q.fromProto(t)})),o.share())},t.prototype.getBillableItem=function(t){var e=t.toApiJson?t:new ot(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GetBillableItem",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return rt.fromProto(t)})),o.share())},t.prototype.getMultiSubscriptions=function(t){var e=t.toApiJson?t:new st(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GetMultiSubscriptions",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return at.fromProto(t)})),o.share())},t.prototype.listBillableItems=function(t){var e=t.toApiJson?t:new pt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/ListBillableItems",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return dt.fromProto(t)})),o.share())},t.prototype.expireBillableItem=function(t){var e=t.toApiJson?t:new it(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/ExpireBillableItem",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.deleteBillableItem=function(t){var e=t.toApiJson?t:new et(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/DeleteBillableItem",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.listMerchantBillingReports=function(t){var e=t.toApiJson?t:new an(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/ListMerchantBillingReports",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return cn.fromProto(t)})),o.share())},t.prototype.listProductSummaries=function(t){var e=t.toApiJson?t:new ee(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/ListProductSummaries",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ie.fromProto(t)})),o.share())},t.prototype.getProductSummariesTotal=function(t){var e=t.toApiJson?t:new $t(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GetProductSummariesTotal",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return te.fromProto(t)})),o.share())},t.prototype.generateBillableItemsCsv=function(t){var e=t.toApiJson?t:new Os(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GenerateBillableItemsCSV",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Es.fromProto(t)})),o.share())},t.prototype.createPricingPlan=function(t){var e=t.toApiJson?t:new co(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/CreatePricingPlan",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return uo.fromProto(t)})),o.share())},t.prototype.updatePricingPlan=function(t){var e=t.toApiJson?t:new fo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/UpdatePricingPlan",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return go.fromProto(t)})),o.share())},t.prototype.getMultiPricingPlan=function(t){var e=t.toApiJson?t:new po(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GetMultiPricingPlan",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ho.fromProto(t)})),o.share())},t.prototype.createPricingPlanProduct=function(t){var e=t.toApiJson?t:new yo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/CreatePricingPlanProduct",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ao.fromProto(t)})),o.share())},t.prototype.updatePricingPlanProduct=function(t){var e=t.toApiJson?t:new _o(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/UpdatePricingPlanProduct",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Jo.fromProto(t)})),o.share())},t.prototype.deletePricingPlanProduct=function(t){var e=t.toApiJson?t:new So(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/DeletePricingPlanProduct",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.listPricingPlanProducts=function(t){var e=t.toApiJson?t:new Ro(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/ListPricingPlanProducts",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Do.fromProto(t)})),o.share())},t.prototype.getPricingPlanProduct=function(t){var e=t.toApiJson?t:new To(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GetPricingPlanProduct",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Oo.fromProto(t)})),o.share())},t.prototype.getMultiPricingPlanProduct=function(t){var e=t.toApiJson?t:new Po(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GetMultiPricingPlanProduct",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return bo.fromProto(t)})),o.share())},t.prototype.getMultiProductPricing=function(t){var e=t.toApiJson?t:new Js(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GetMultiProductPricing",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ws.fromProto(t)})),o.share())},t.prototype.tickComponentUsage=function(t){var e=t.toApiJson?t:new hn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/TickComponentUsage",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.createMeteredComponent=function(t){var e=t.toApiJson?t:new pn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/CreateMeteredComponent",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.listContracts=function(t){var e=t.toApiJson?t:new Nt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/ListContracts",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ut.fromProto(t)})),o.share())},t.prototype.getMultiContract=function(t){var e=t.toApiJson?t:new wt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GetMultiContract",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return jt.fromProto(t)})),o.share())},t.prototype.listProducts=function(t){var e=t.toApiJson?t:new Fo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/ListProducts",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return xo.fromProto(t)})),o.share())},t.prototype.getMultiProduct=function(t){var e=t.toApiJson?t:new Mo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GetMultiProduct",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Bo.fromProto(t)})),o.share())},t.prototype.resetContractPricing=function(t){var e=t.toApiJson?t:new Bt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/ResetContractPricing",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.getPurchaseCost=function(t){var e=t.toApiJson?t:new Us(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GetPurchaseCost",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ms.fromProto(t)})),o.share())},t.prototype.changeFrequency=function(t){var e=t.toApiJson?t:new wr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/ChangeFrequency",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.changeRenewalDate=function(t){var e=t.toApiJson?t:new jr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/ChangeRenewalDate",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.changeCustomUnitPrice=function(t){var e=t.toApiJson?t:new Jr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/ChangeCustomUnitPrice",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.startRevRecTemplateBackfill=function(t){var e=t.toApiJson?t:new Qs(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/StartRevRecTemplateBackfill",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t}();ea.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ea(e.ɵɵinject(i.HttpClient),e.ɵɵinject($s))},token:ea,providedIn:"root"}),ea.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ea.ctorParameters=function(){return[{type:i.HttpClient},{type:$s}]};var ia=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.upsert=function(t){var e=t.toApiJson?t:new Tt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.BundleService/Upsert",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.getMulti=function(t){var e=t.toApiJson?t:new It(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.BundleService/GetMulti",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return yt.fromProto(t)})),o.share())},t.prototype.list=function(t){var e=t.toApiJson?t:new At(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.BundleService/List",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return St.fromProto(t)})),o.share())},t}();ia.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ia(e.ɵɵinject(i.HttpClient),e.ɵɵinject($s))},token:ia,providedIn:"root"}),ia.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ia.ctorParameters=function(){return[{type:i.HttpClient},{type:$s}]};var na=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.list=function(t){var e=t.toApiJson?t:new Wr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.ContractDocumentService/List",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Hr.fromProto(t)})),o.share())},t.prototype.delete=function(t){var e=t.toApiJson?t:new qr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.ContractDocumentService/Delete",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t}();na.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new na(e.ɵɵinject(i.HttpClient),e.ɵɵinject($s))},token:na,providedIn:"root"}),na.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],na.ctorParameters=function(){return[{type:i.HttpClient},{type:$s}]};var oa=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.get=function(t){var e=t.toApiJson?t:new _t(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.ContractService/Get",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Jt.fromProto(t)})),o.share())},t.prototype.updateSubscription=function(t){var e=t.toApiJson?t:new xt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.ContractService/UpdateSubscription",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.create=function(t){var e=t.toApiJson?t:new Dt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.ContractService/Create",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ct.fromProto(t)})),o.share())},t.prototype.update=function(t){var e=t.toApiJson?t:new kt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.ContractService/Update",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ft.fromProto(t)})),o.share())},t}();oa.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new oa(e.ɵɵinject(i.HttpClient),e.ɵɵinject($s))},token:oa,providedIn:"root"}),oa.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],oa.ctorParameters=function(){return[{type:i.HttpClient},{type:$s}]};var ra=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.add=function(t){var e=t.toApiJson?t:new Qr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.CreditService/Add",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.getBalance=function(t){var e=t.toApiJson?t:new $r(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.CreditService/GetBalance",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ts.fromProto(t)})),o.share())},t}();ra.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ra(e.ɵɵinject(i.HttpClient),e.ɵɵinject($s))},token:ra,providedIn:"root"}),ra.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ra.ctorParameters=function(){return[{type:i.HttpClient},{type:$s}]};var sa=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.list=function(t){var e=t.toApiJson?t:new fe(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.DiscountService/List",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ge.fromProto(t)})),o.share())},t.prototype.create=function(t){var e=t.toApiJson?t:new he(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.DiscountService/Create",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.update=function(t){var e=t.toApiJson?t:new Ie(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.DiscountService/Update",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.expire=function(t){var e=t.toApiJson?t:new me(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.DiscountService/Expire",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t}();sa.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new sa(e.ɵɵinject(i.HttpClient),e.ɵɵinject($s))},token:sa,providedIn:"root"}),sa.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],sa.ctorParameters=function(){return[{type:i.HttpClient},{type:$s}]};var aa=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.addBundle=function(t){var e=t.toApiJson?t:new Ue(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/AddBundle",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Me.fromProto(t)})),o.share())},t.prototype.addLineItem=function(t){var e=t.toApiJson?t:new Be(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/AddLineItem",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ke.fromProto(t)})),o.share())},t.prototype.charge=function(t){var e=t.toApiJson?t:new Fe(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/Charge",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.create=function(t){var e=t.toApiJson?t:new xe(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/Create",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Le.fromProto(t)})),o.share())},t.prototype.delete=function(t){var e=t.toApiJson?t:new Ge(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/Delete",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.deleteLineItem=function(t){var e=t.toApiJson?t:new We(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/DeleteLineItem",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return He.fromProto(t)})),o.share())},t.prototype.get=function(t){var e=t.toApiJson?t:new Xe(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/Get",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Qe.fromProto(t)})),o.share())},t.prototype.removeBundle=function(t){var e=t.toApiJson?t:new ni(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/RemoveBundle",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return oi.fromProto(t)})),o.share())},t.prototype.send=function(t){var e=t.toApiJson?t:new ri(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/Send",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.list=function(t){var e=t.toApiJson?t:new ti(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/List",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ei.fromProto(t)})),o.share())},t.prototype.update=function(t){var e=t.toApiJson?t:new pi(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/Update",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return di.fromProto(t)})),o.share())},t.prototype.pay=function(t){var e=t.toApiJson?t:new ii(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/Pay",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.updateDefaultTaxRates=function(t){var e=t.toApiJson?t:new ci(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/UpdateDefaultTaxRates",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ui.fromProto(t)})),o.share())},t.prototype.updateLineItem=function(t){var e=t.toApiJson?t:new hi(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/UpdateLineItem",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return li.fromProto(t)})),o.share())},t.prototype.void=function(t){var e=t.toApiJson?t:new mi(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/Void",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.duplicate=function(t){var e=t.toApiJson?t:new Ve(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/Duplicate",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ze.fromProto(t)})),o.share())},t.prototype.updateBundle=function(t){var e=t.toApiJson?t:new si(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/UpdateBundle",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ai.fromProto(t)})),o.share())},t}();aa.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new aa(e.ɵɵinject(i.HttpClient),e.ɵɵinject($s))},token:aa,providedIn:"root"}),aa.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],aa.ctorParameters=function(){return[{type:i.HttpClient},{type:$s}]};var ca=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.addBundle=function(t){var e=t.toApiJson?t:new es(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceTemplateService/AddBundle",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return is.fromProto(t)})),o.share())},t.prototype.addLineItem=function(t){var e=t.toApiJson?t:new ns(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceTemplateService/AddLineItem",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return os.fromProto(t)})),o.share())},t.prototype.create=function(t){var e=t.toApiJson?t:new rs(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceTemplateService/Create",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ss.fromProto(t)})),o.share())},t.prototype.upsert=function(t){var e=t.toApiJson?t:new Ss(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceTemplateService/Upsert",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ps.fromProto(t)})),o.share())},t.prototype.get=function(t){var e=t.toApiJson?t:new ps(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceTemplateService/Get",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ds.fromProto(t)})),o.share())},t.prototype.delete=function(t){var e=t.toApiJson?t:new as(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceTemplateService/Delete",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.deleteLineItem=function(t){var e=t.toApiJson?t:new cs(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceTemplateService/DeleteLineItem",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return us.fromProto(t)})),o.share())},t.prototype.updateBundle=function(t){var e=t.toApiJson?t:new vs(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceTemplateService/UpdateBundle",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return fs.fromProto(t)})),o.share())},t.prototype.updateLineItem=function(t){var e=t.toApiJson?t:new ys(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceTemplateService/UpdateLineItem",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return As.fromProto(t)})),o.share())},t.prototype.updateTemplateDefaultTaxRates=function(t){var e=t.toApiJson?t:new gs(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceTemplateService/UpdateTemplateDefaultTaxRates",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Is.fromProto(t)})),o.share())},t}();ca.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ca(e.ɵɵinject(i.HttpClient),e.ɵɵinject($s))},token:ca,providedIn:"root"}),ca.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ca.ctorParameters=function(){return[{type:i.HttpClient},{type:$s}]};var ua=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.create=function(t){var e=t.toApiJson?t:new Ci(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/Create",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.get=function(t){var e=t.toApiJson?t:new Ji(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/Get",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return wi.fromProto(t)})),o.share())},t.prototype.getOutstandingBalance=function(t){var e=t.toApiJson?t:new Ui(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/GetOutstandingBalance",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Mi.fromProto(t)})),o.share())},t.prototype.update=function(t){var e=t.toApiJson?t:new nn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/Update",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.createPaymentCard=function(t){var e=t.toApiJson?t:new $n(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/CreatePaymentCard",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.setDefaultPaymentCard=function(t){var e=t.toApiJson?t:new $i(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/SetDefaultPaymentCard",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.listPaymentCards=function(t){var e=t.toApiJson?t:new eo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/ListPaymentCards",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return io.fromProto(t)})),o.share())},t.prototype.updatePaymentCard=function(t){var e=t.toApiJson?t:new ro(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/UpdatePaymentCard",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.getStatistics=function(t){var e=t.toApiJson?t:new Fs(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/GetStatistics",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return xs.fromProto(t)})),o.share())},t.prototype.search=function(t){var e=t.toApiJson?t:new Ki(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/Search",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Xi.fromProto(t)})),o.share())},t.prototype.setAutoPostInvoices=function(t){var e=t.toApiJson?t:new Zi(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/SetAutoPostInvoices",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.setAutoChargeInvoices=function(t){var e=t.toApiJson?t:new Qi(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/SetAutoChargeInvoices",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.setIncludeInFinancialRecords=function(t){var e=t.toApiJson?t:new en(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/SetIncludeInFinancialRecords",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.setHasAlternativePaymentMethod=function(t){var e=t.toApiJson?t:new tn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/SetHasAlternativePaymentMethod",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.sendSalesInvoiceEmail=function(t){var e=t.toApiJson?t:new Tr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/SendSalesInvoiceEmail",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.chargeSalesInvoice=function(t){var e=t.toApiJson?t:new Ei(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/ChargeSalesInvoice",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.sendSalesInvoiceReceiptEmail=function(t){var e=t.toApiJson?t:new Or(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/SendSalesInvoiceReceiptEmail",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.createStripeExternalAccount=function(t){var e=t.toApiJson?t:new Wt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/CreateStripeExternalAccount",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.listBankAccounts=function(t){var e=t.toApiJson?t:new Vt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/ListBankAccounts",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return zt.fromProto(t)})),o.share())},t.prototype.setDefaultBankAccount=function(t){var e=t.toApiJson?t:new Kt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/SetDefaultBankAccount",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.deleteBankAccount=function(t){var e=t.toApiJson?t:new Ht(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/DeleteBankAccount",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.getMultiRetailConfigurations=function(t){var e=t.toApiJson?t:new ji(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/GetMultiRetailConfigurations",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ni.fromProto(t)})),o.share())},t.prototype.upsertRetailConfiguration=function(t){var e=t.toApiJson?t:new rn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/UpsertRetailConfiguration",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.upsertDefaultRetailCustomerConfiguration=function(t){var e=t.toApiJson?t:new on(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/UpsertDefaultRetailCustomerConfiguration",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.getRetailBalance=function(t){var e=t.toApiJson?t:new Fi(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/GetRetailBalance",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return xi.fromProto(t)})),o.share())},t.prototype.getPayoutSummary=function(t){var e=t.toApiJson?t:new Bi(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/GetPayoutSummary",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ki.fromProto(t)})),o.share())},t.prototype.listRetailPayouts=function(t){var e=t.toApiJson?t:new Wi(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/ListRetailPayouts",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Hi.fromProto(t)})),o.share())},t.prototype.getRetailPayout=function(t){var e=t.toApiJson?t:new Li(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/GetRetailPayout",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Yi.fromProto(t)})),o.share())},t}();ua.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ua(e.ɵɵinject(i.HttpClient),e.ɵɵinject($s))},token:ua,providedIn:"root"}),ua.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ua.ctorParameters=function(){return[{type:i.HttpClient},{type:$s}]};var pa=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.listPaymentCards=function(t){var e=t.toApiJson?t:new eo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentMethodService/ListPaymentCards",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return io.fromProto(t)})),o.share())},t.prototype.deletePaymentCard=function(t){var e=t.toApiJson?t:new to(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentMethodService/DeletePaymentCard",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.setDefaultPaymentMethod=function(t){var e=t.toApiJson?t:new oo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentMethodService/SetDefaultPaymentMethod",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t}();pa.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new pa(e.ɵɵinject(i.HttpClient),e.ɵɵinject($s))},token:pa,providedIn:"root"}),pa.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],pa.ctorParameters=function(){return[{type:i.HttpClient},{type:$s}]};var da=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.list=function(t){var e=t.toApiJson?t:new Jn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/List",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return wn.fromProto(t)})),o.share())},t.prototype.getRetail=function(t){var e=t.toApiJson?t:new Dn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/GetRetail",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Cn.fromProto(t)})),o.share())},t.prototype.listRetail=function(t){var e=t.toApiJson?t:new Mn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/ListRetail",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Bn.fromProto(t)})),o.share())},t.prototype.listRetailDisputes=function(t){var e=t.toApiJson?t:new jn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/ListRetailDisputes",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Nn.fromProto(t)})),o.share())},t.prototype.getRetailDispute=function(t){var e=t.toApiJson?t:new Tn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/GetRetailDispute",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return On.fromProto(t)})),o.share())},t.prototype.closeRetailDispute=function(t){var e=t.toApiJson?t:new vn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/CloseRetailDispute",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.prepareRetail=function(t){var e=t.toApiJson?t:new Ln(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/PrepareRetail",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Yn.fromProto(t)})),o.share())},t.prototype.confirmRetail=function(t){var e=t.toApiJson?t:new In(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/ConfirmRetail",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.retailStatus=function(t){var e=t.toApiJson?t:new Hn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/RetailStatus",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Vn.fromProto(t)})),o.share())},t.prototype.retailPaymentsEnabled=function(t){var e=t.toApiJson?t:new Gn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/RetailPaymentsEnabled",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Wn.fromProto(t)})),o.share())},t.prototype.configureRetailProvider=function(t){var e=t.toApiJson?t:new fn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/ConfigureRetailProvider",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return gn.fromProto(t)})),o.share())},t.prototype.updateRetailProvider=function(t){var e=t.toApiJson?t:new Kn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/UpdateRetailProvider",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.getRetailProvider=function(t){var e=t.toApiJson?t:new En(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/GetRetailProvider",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Rn.fromProto(t)})),o.share())},t.prototype.submitEvidence=function(t){var e=t.toApiJson?t:new zn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/SubmitEvidence",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t}();da.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new da(e.ɵɵinject(i.HttpClient),e.ɵɵinject($s))},token:da,providedIn:"root"}),da.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],da.ctorParameters=function(){return[{type:i.HttpClient},{type:$s}]};var ha=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.getMultiRetail=function(t){var e=t.toApiJson?t:new js(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PricingService/GetMultiRetail",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ns.fromProto(t)})),o.share())},t.prototype.upsertRetail=function(t){var e=t.toApiJson?t:new Zs(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PricingService/UpsertRetail",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.deleteRetail=function(t){var e=t.toApiJson?t:new Ts(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PricingService/DeleteRetail",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.getMultiBundleRetail=function(t){var e=t.toApiJson?t:new Cs(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PricingService/GetMultiBundleRetail",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return _s.fromProto(t)})),o.share())},t.prototype.getWholesaleComparison=function(t){var e=t.toApiJson?t:new Ys(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PricingService/GetWholesaleComparison",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return qs.fromProto(t)})),o.share())},t.prototype.setWholesaleProductStrategy=function(t){var e=t.toApiJson?t:new Ks(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PricingService/SetWholesaleProductStrategy",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.setWholesaleProductVolumeCommitment=function(t){var e=t.toApiJson?t:new Xs(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PricingService/SetWholesaleProductVolumeCommitment",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.getPurchaseCost=function(t){var e=t.toApiJson?t:new Us(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PricingService/GetPurchaseCost",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ms.fromProto(t)})),o.share())},t.prototype.upsertWholesale=function(t){var e=t.toApiJson?t:new wo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PricingService/UpsertWholesale",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t}();ha.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ha(e.ɵɵinject(i.HttpClient),e.ɵɵinject($s))},token:ha,providedIn:"root"}),ha.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ha.ctorParameters=function(){return[{type:i.HttpClient},{type:$s}]};var la=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.create=function(t){var e=t.toApiJson?t:new No(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.ProductService/Create",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.update=function(t){var e=t.toApiJson?t:new Yo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.ProductService/Update",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.delete=function(t){var e=t.toApiJson?t:new Uo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.ProductService/Delete",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t}();la.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new la(e.ɵɵinject(i.HttpClient),e.ɵɵinject($s))},token:la,providedIn:"root"}),la.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],la.ctorParameters=function(){return[{type:i.HttpClient},{type:$s}]};var ma=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.listSubscriptionRetentionByGroup=function(t){var e=t.toApiJson?t:new re(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.ProductSummaryService/ListSubscriptionRetentionByGroup",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ne.fromProto(t)})),o.share())},t.prototype.listSubscriptionRetentionBySku=function(t){var e=t.toApiJson?t:new re(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.ProductSummaryService/ListSubscriptionRetentionBySKU",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return oe.fromProto(t)})),o.share())},t}();ma.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ma(e.ɵɵinject(i.HttpClient),e.ɵɵinject($s))},token:ma,providedIn:"root"}),ma.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ma.ctorParameters=function(){return[{type:i.HttpClient},{type:$s}]};var va=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.list=function(t){var e=t.toApiJson?t:new $o(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PurchaseService/List",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return tr.fromProto(t)})),o.share())},t.prototype.getMultiCustomerSummaries=function(t){var e=t.toApiJson?t:new Yt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PurchaseService/GetMultiCustomerSummaries",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return qt.fromProto(t)})),o.share())},t.prototype.listPurchaseItems=function(t){var e=t.toApiJson?t:new Qo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PurchaseService/ListPurchaseItems",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Zo.fromProto(t)})),o.share())},t.prototype.retry=function(t){var e=t.toApiJson?t:new nr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PurchaseService/Retry",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.void=function(t){var e=t.toApiJson?t:new or(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PurchaseService/Void",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t}();va.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new va(e.ɵɵinject(i.HttpClient),e.ɵɵinject($s))},token:va,providedIn:"root"}),va.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],va.ctorParameters=function(){return[{type:i.HttpClient},{type:$s}]};var fa=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.create=function(t){var e=t.toApiJson?t:new sr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.RefundService/Create",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.list=function(t){var e=t.toApiJson?t:new ar(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.RefundService/List",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return cr.fromProto(t)})),o.share())},t}();fa.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new fa(e.ɵɵinject(i.HttpClient),e.ɵɵinject($s))},token:fa,providedIn:"root"}),fa.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],fa.ctorParameters=function(){return[{type:i.HttpClient},{type:$s}]};var ga=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.get=function(t){var e=t.toApiJson?t:new Vr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.RetailCustomerConfigurationService/Get",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return zr.fromProto(t)})),o.share())},t.prototype.upsert=function(t){var e=t.toApiJson?t:new Xr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.RetailCustomerConfigurationService/Upsert",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t}();ga.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ga(e.ɵɵinject(i.HttpClient),e.ɵɵinject($s))},token:ga,providedIn:"root"}),ga.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ga.ctorParameters=function(){return[{type:i.HttpClient},{type:$s}]};var Ia=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.create=function(t){var e=t.toApiJson?t:new dr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.SalesCreditNoteService/Create",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.list=function(t){var e=t.toApiJson?t:new lr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.SalesCreditNoteService/List",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return mr.fromProto(t)})),o.share())},t}();Ia.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Ia(e.ɵɵinject(i.HttpClient),e.ɵɵinject($s))},token:Ia,providedIn:"root"}),Ia.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Ia.ctorParameters=function(){return[{type:i.HttpClient},{type:$s}]};var ya=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.list=function(t){var e=t.toApiJson?t:new Ar(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.SalesInvoiceService/List",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Sr.fromProto(t)})),o.share())},t.prototype.post=function(t){var e=t.toApiJson?t:new Pr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.SalesInvoiceService/Post",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.get=function(t){var e=t.toApiJson?t:new gr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.SalesInvoiceService/Get",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ir.fromProto(t)})),o.share())},t}();ya.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ya(e.ɵɵinject(i.HttpClient),e.ɵɵinject($s))},token:ya,providedIn:"root"}),ya.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ya.ctorParameters=function(){return[{type:i.HttpClient},{type:$s}]};var Aa=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.calculate=function(t){var e=t.toApiJson?t:new Pe(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.TaxService/Calculate",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return be.fromProto(t)})),o.share())},t.prototype.create=function(t){var e=t.toApiJson?t:new Te(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.TaxService/Create",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.getMulti=function(t){var e=t.toApiJson?t:new Ee(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.TaxService/GetMulti",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Re.fromProto(t)})),o.share())},t.prototype.update=function(t){var e=t.toApiJson?t:new Je(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.TaxService/Update",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.list=function(t){var e=t.toApiJson?t:new De(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.TaxService/List",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ce.fromProto(t)})),o.share())},t.prototype.archive=function(t){var e=t.toApiJson?t:new Se(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.TaxService/Archive",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t}();Aa.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Aa(e.ɵɵinject(i.HttpClient),e.ɵɵinject($s))},token:Aa,providedIn:"root"}),Aa.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Aa.ctorParameters=function(){return[{type:i.HttpClient},{type:$s}]};var Sa,Pa=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.generateReport=function(t){var e=t.toApiJson?t:new Rs(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.VendorService/GenerateReport",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ds.fromProto(t)})),o.share())},t.prototype.getRevenueStats=function(t){var e=t.toApiJson?t:new Bs(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.VendorService/GetRevenueStats",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ks.fromProto(t)})),o.share())},t}();function ba(e){switch(e){case c.DISCOUNT_TYPE_FIXED_AMOUNT_PER_UNIT:return t.AppliedDiscountType.FIXED_AMOUNT_PER_UNIT;case c.DISCOUNT_TYPE_FIXED_NUMBER_OF_UNITS:return t.AppliedDiscountType.FIXED_NUMBER_OF_UNITS;case c.DISCOUNT_TYPE_PERCENT_AMOUNT:return t.AppliedDiscountType.PERCENT_AMOUNT}return t.AppliedDiscountType.FIXED_AMOUNT}function Ta(e){switch(e){case t.AppliedDiscountType.FIXED_AMOUNT_PER_UNIT:return c.DISCOUNT_TYPE_FIXED_AMOUNT_PER_UNIT;case t.AppliedDiscountType.FIXED_NUMBER_OF_UNITS:return c.DISCOUNT_TYPE_FIXED_NUMBER_OF_UNITS;case t.AppliedDiscountType.PERCENT_AMOUNT:return c.DISCOUNT_TYPE_PERCENT_AMOUNT}return c.DISCOUNT_TYPE_FIXED_AMOUNT}function Oa(t){return{type:ba(t.type),value:t.value||0,totalAmount:t.totalAmount||0,description:t.description||""}}Pa.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Pa(e.ɵɵinject(i.HttpClient),e.ɵɵinject($s))},token:Pa,providedIn:"root"}),Pa.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Pa.ctorParameters=function(){return[{type:i.HttpClient},{type:$s}]},(Sa=t.AppliedDiscountType||(t.AppliedDiscountType={})).FIXED_AMOUNT="FIXED_AMOUNT",Sa.PERCENT_AMOUNT="PERCENT_AMOUNT",Sa.FIXED_NUMBER_OF_UNITS="FIXED_NUMBER_OF_UNITS",Sa.FIXED_AMOUNT_PER_UNIT="FIXED_AMOUNT_PER_UNIT";var Ea=function(){function t(t){this.merchantApi=t}return t.prototype.listBankAccounts=function(t){return this.merchantApi.listBankAccounts(new Vt({merchantId:t})).pipe(o.map((function(t){return t&&t.bankAccount?t.bankAccount:[]})),o.map((function(t){return t.map((function(t){return{id:(e=t).id,accountHolderName:e.accountHolderName,bankName:e.bankName,country:e.country,currency:e.currency,routingNumber:e.routingNumber,last4:e.last4,defaultForCurrency:e.defaultForCurrency};var e}))})))},t.prototype.setDefaultBankAccount=function(t,e){var i=new Kt({merchantId:t,bankAccountId:e});return this.merchantApi.setDefaultBankAccount(i)},t.prototype.deleteBankAccount=function(t,e){var i=new Ht({merchantId:t,bankAccountId:e});return this.merchantApi.deleteBankAccount(i)},t}();function Ra(e){switch(e){case t.PricingPlanBillingStrategy.BILLING_STRATEGY_END_OF_PERIOD:return t.BillingStrategy.EndOfPeriod;case t.PricingPlanBillingStrategy.BILLING_STRATEGY_START_OF_PERIOD:return t.BillingStrategy.StartOfPeriod;case t.PricingPlanBillingStrategy.BILLING_STRATEGY_INSTANTLY:return t.BillingStrategy.Instantly;case t.PricingPlanBillingStrategy.BILLING_STRATEGY_END_OF_DAY:return t.BillingStrategy.EndOfDay}return t.BillingStrategy.Invalid}function Da(e){switch(e){case t.BillingStrategy.EndOfPeriod:return t.PricingPlanBillingStrategy.BILLING_STRATEGY_END_OF_PERIOD;case t.BillingStrategy.StartOfPeriod:return t.PricingPlanBillingStrategy.BILLING_STRATEGY_START_OF_PERIOD;case t.BillingStrategy.Instantly:return t.PricingPlanBillingStrategy.BILLING_STRATEGY_INSTANTLY;case t.BillingStrategy.EndOfDay:return t.PricingPlanBillingStrategy.BILLING_STRATEGY_END_OF_DAY}return t.PricingPlanBillingStrategy.BILLING_STRATEGY_NONE}function Ca(e){switch(e){case u.USD:return t.Currency.USD;case u.CAD:return t.Currency.CAD;case u.EUR:return t.Currency.EUR;case u.AUD:return t.Currency.AUD;case u.GBP:return t.Currency.GBP;case u.NZD:return t.Currency.NZD;case u.BRL:return t.Currency.BRL;case u.CHF:return t.Currency.CHF;case u.CNY:return t.Currency.CNY;case u.CZK:return t.Currency.CZK;case u.INR:return t.Currency.INR;case u.JPY:return t.Currency.JPY;case u.KHR:return t.Currency.KHR;case u.KRW:return t.Currency.KRW;case u.MXN:return t.Currency.MXN;case u.NOK:return t.Currency.NOK;case u.RUB:return t.Currency.RUB;case u.SEK:return t.Currency.SEK;case u.SGD:return t.Currency.SGD;case u.TRY:return t.Currency.TRY;case u.ZAR:return t.Currency.ZAR;case u.DZD:return t.Currency.DZD;case u.AWG:return t.Currency.AWG;case u.FJD:return t.Currency.FJD;case u.KYD:return t.Currency.KYD;default:return t.Currency.USD}}function _a(e){switch(e){case"monthly":return t.Frequency.Monthly;case"yearly":return t.Frequency.Yearly;case"one_time":return t.Frequency.OneTime}return t.Frequency.Invalid}function Ja(e){switch(e){case t.GeneratedFrequency.MONTHLY:return t.Frequency.Monthly;case t.GeneratedFrequency.YEARLY:return t.Frequency.Yearly;case t.GeneratedFrequency.ONE_TIME:return t.Frequency.OneTime}return t.Frequency.Invalid}function wa(e){switch(e){case t.Frequency.Monthly:return t.GeneratedFrequency.MONTHLY;case t.Frequency.Yearly:return t.GeneratedFrequency.YEARLY;case t.Frequency.OneTime:return t.GeneratedFrequency.ONE_TIME}return t.GeneratedFrequency.INVALID}function ja(t){return t?t.map((function(t){return{price:t.price||0,minUnits:t.minUnits,maxUnits:t.maxUnits}})):null}function Na(e){switch(e){case w.PRODUCT_PRICING_TYPE_STANDARD:return t.ProductPricingType.Standard;case w.PRODUCT_PRICING_TYPE_STAIRSTEP:return t.ProductPricingType.Stairstep;case w.PRODUCT_PRICING_TYPE_TIERED:return t.ProductPricingType.Tiered}return t.ProductPricingType.Invalid}function Ua(e){switch(e){case t.ProductPricingType.Standard:return w.PRODUCT_PRICING_TYPE_STANDARD;case t.ProductPricingType.Stairstep:return w.PRODUCT_PRICING_TYPE_STAIRSTEP;case t.ProductPricingType.Tiered:return w.PRODUCT_PRICING_TYPE_TIERED}return w.PRODUCT_PRICING_TYPE_INVALID}function Ma(t){return{initial:t.initial,recurring:t.recurring}}function Ba(t){var e=t.subtotalCost||0,i=t.discountAmount||0,n=t.totalCost||0,o=t.setupFee||0;return{subtotal:e,discountTotal:i,total:n,billingFrequency:_a(t.billingFrequency),currency:Ca(t.currency),strategy:Ra(t.strategy),commitment:Ma(t.commitment),isStartingPrice:t.isStartingPrice,setupFee:o}}function ka(t){return{strategy:Ra(t.strategy),pricingType:Na(t.pricingType),currency:Ca(t.currency),frequency:Ja(t.frequency),pricingRules:ja(t.pricingRules),commitment:Ma(t.commitment),volumeCommitment:t.volumeCommitment,isStartingPrice:t.isStartingPrice,resolvedFrom:t.resolvedFrom,setupFee:t.setupFee}}function Fa(t){return null==t?void 0:t.map((function(t){return t&&{sku:t.sku,prices:t.prices.map((function(t){return t&&ka(t)}))}}))}function xa(t){var e={};for(var i in t.pricing)if(t.pricing.hasOwnProperty(i)){var n=t.pricing[i];e[i]={type:Na(n.type),rules:ja(n.rules),setupFee:n.setupFee||0}}return{pricingPlanId:t.pricingPlanId,sku:t.sku,frequency:Ja(t.frequency),pricing:e,commitment:Ma(t.commitment),created:t.created,modified:t.modified,strategy:Ra(t.strategy),volumeCommitment:t.volumeCommitment}}function La(e){return Object.keys(e).filter((function(e){return e in t.Currency})).reduce((function(t,i){return t[i]=qa(e[i]),t}),{})}function Ya(t){return t.map((function(t){return new vo(t)}))}function qa(t){return new mo({type:Ua(t.type),rules:Ya(t.rules),setupFee:t.setupFee,frequency:wa(t.frequency),currencyCode:t.currencyCode})}Ea.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Ea(e.ɵɵinject(ua))},token:Ea,providedIn:"root"}),Ea.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Ea.ctorParameters=function(){return[{type:ua}]},function(t){t.Invalid="INVALID",t.EndOfPeriod="END_OF_PERIOD",t.StartOfPeriod="START_OF_PERIOD",t.Instantly="INSTANTLY",t.EndOfDay="END_OF_DAY"}(t.BillingStrategy||(t.BillingStrategy={})),function(t){t.USD="USD",t.CAD="CAD",t.EUR="EUR",t.AUD="AUD",t.GBP="GBP",t.NZD="NZD",t.BRL="BRL",t.CHF="CHF",t.CNY="CNY",t.CZK="CZK",t.INR="INR",t.JPY="JPY",t.KHR="KHR",t.KRW="KRW",t.MXN="MXN",t.NOK="NOK",t.RUB="RUB",t.SEK="SEK",t.SGD="SGD",t.TRY="TRY",t.ZAR="ZAR",t.DZD="DZD",t.AWG="AWG",t.FJD="FJD",t.KYD="KYD"}(t.Currency||(t.Currency={})),function(t){t.Invalid="INVALID",t.Monthly="MONTHLY",t.Yearly="YEARLY",t.OneTime="ONE_TIME"}(t.Frequency||(t.Frequency={})),function(t){t.Invalid="INVALID",t.Standard="STANDARD",t.Stairstep="STAIRSTEP",t.Tiered="TIERED"}(t.ProductPricingType||(t.ProductPricingType={}));var Ga,Wa=function(){function t(t,e,i,n){this.hostService=t,this.http=e,this.pricingService=i,this.billingApi=n}return t.prototype.setProductBillingStrategy=function(t,e,i){var n=Da(i);return this.pricingService.setWholesaleProductStrategy({merchantId:t,sku:e,strategy:n}).pipe(o.map((function(){return null})))},t.prototype.setProductVolumeCommitment=function(t,e,i){return this.pricingService.setWholesaleProductVolumeCommitment({merchantId:t,sku:e,volumeCommitment:i}).pipe(o.map((function(){return null})))},t.prototype.getPurchaseCost=function(t,e,i){return this.pricingService.getPurchaseCost({merchantId:t,sku:e,quantity:i}).pipe(o.map((function(t){return Ba(t)})))},t.prototype.getMultiWholesalePrices=function(t,e,i){return this.billingApi.getMultiProductPricing({merchantId:t,skus:e,pricingPlanId:i}).pipe(o.map((function(t){return Fa(t.prices)})))},t.prototype.upsertPricing=function(t,e,i,n,o,r){var s=new wo({pricingPlanId:t,sku:e,pricing:(i||[]).map((function(t){return qa(t)})),strategy:Da(o),termCommitment:n,volumeCommitment:r});return this.pricingService.upsertWholesale(s)},t}();function Ha(t){return{id:t.id,name:t.name,defaultStrategy:Ra(t.defaultBillingStrategy)}}
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/common/http"),require("@vendasta/core"),require("rxjs/operators"),require("rxjs")):"function"==typeof define&&define.amd?define("@vendasta/billing",["exports","@angular/core","@angular/common/http","@vendasta/core","rxjs/operators","rxjs"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).vendasta=t.vendasta||{},t.vendasta.billing={}),t.ng.core,t.ng.common.http,t.i1,t.rxjs.operators,t.rxjs)}(this,(function(t,e,i,n,o,r){"use strict";function s(t){return t?{bundleId:t.bundleId,bundleInstanceId:t.bundleInstanceId,name:t.name,hideBundleItems:t.hideBundleItems||!1}:null}var a,c,u,p,d,h,l,m,v,f,g,I,A,y,S,P,b,T,O,E,R,C,D,_,J,N,w,j,M,U,B,L,k,x,F,Y,G,q,H,W,V,z,K;(a=t.GeneratedFrequency||(t.GeneratedFrequency={}))[a.INVALID=0]="INVALID",a[a.MONTHLY=1]="MONTHLY",a[a.YEARLY=2]="YEARLY",a[a.ONE_TIME=3]="ONE_TIME",function(t){t[t.DISCOUNT_TYPE_FIXED_AMOUNT=0]="DISCOUNT_TYPE_FIXED_AMOUNT",t[t.DISCOUNT_TYPE_PERCENT_AMOUNT=1]="DISCOUNT_TYPE_PERCENT_AMOUNT",t[t.DISCOUNT_TYPE_FIXED_NUMBER_OF_UNITS=2]="DISCOUNT_TYPE_FIXED_NUMBER_OF_UNITS",t[t.DISCOUNT_TYPE_FIXED_AMOUNT_PER_UNIT=3]="DISCOUNT_TYPE_FIXED_AMOUNT_PER_UNIT"}(c||(c={})),function(t){t[t.USD=0]="USD",t[t.CAD=1]="CAD",t[t.EUR=2]="EUR",t[t.AUD=3]="AUD",t[t.GBP=4]="GBP",t[t.NZD=5]="NZD",t[t.BRL=6]="BRL",t[t.CHF=7]="CHF",t[t.CNY=8]="CNY",t[t.CZK=9]="CZK",t[t.INR=10]="INR",t[t.JPY=11]="JPY",t[t.KHR=12]="KHR",t[t.KRW=13]="KRW",t[t.MXN=14]="MXN",t[t.NOK=15]="NOK",t[t.RUB=16]="RUB",t[t.SEK=17]="SEK",t[t.SGD=18]="SGD",t[t.TRY=19]="TRY",t[t.ZAR=20]="ZAR",t[t.DZD=21]="DZD",t[t.AWG=22]="AWG",t[t.FJD=23]="FJD",t[t.KYD=24]="KYD"}(u||(u={})),function(t){t[t.CONTRACT_SUBSCRIPTION_STATUS_UNSET=0]="CONTRACT_SUBSCRIPTION_STATUS_UNSET",t[t.CONTRACT_SUBSCRIPTION_STATUS_PENDING=1]="CONTRACT_SUBSCRIPTION_STATUS_PENDING",t[t.CONTRACT_SUBSCRIPTION_STATUS_SUCCEEDED=2]="CONTRACT_SUBSCRIPTION_STATUS_SUCCEEDED",t[t.CONTRACT_SUBSCRIPTION_STATUS_FAILED=3]="CONTRACT_SUBSCRIPTION_STATUS_FAILED"}(p||(p={})),(d=t.ProductSummaryBillingStrategy||(t.ProductSummaryBillingStrategy={}))[d.CHARGE_AT_END_OF_BILLING_PERIOD=0]="CHARGE_AT_END_OF_BILLING_PERIOD",d[d.CHARGE_AT_START_OF_BILLING_PERIOD=1]="CHARGE_AT_START_OF_BILLING_PERIOD",d[d.CHARGE_INSTANTLY=2]="CHARGE_INSTANTLY",d[d.CHARGE_AT_END_OF_DAY=3]="CHARGE_AT_END_OF_DAY",function(t){t[t.FIXED_AMOUNT=0]="FIXED_AMOUNT",t[t.PERCENT_AMOUNT=1]="PERCENT_AMOUNT",t[t.FIXED_NUMBER_OF_UNITS=2]="FIXED_NUMBER_OF_UNITS",t[t.FIXED_AMOUNT_PER_UNIT=3]="FIXED_AMOUNT_PER_UNIT"}(h||(h={})),(l=t.ProductType||(t.ProductType={}))[l.BUNDLE=0]="BUNDLE",l[l.FEE=1]="FEE",l[l.PRODUCT=2]="PRODUCT",l[l.SUBSCRIPTION=3]="SUBSCRIPTION",l[l.VENDASTA_PRODUCT=4]="VENDASTA_PRODUCT",function(t){t[t.STANDARD=0]="STANDARD",t[t.STAIRSTEP=1]="STAIRSTEP",t[t.TIERED=2]="TIERED",t[t.CUSTOM=3]="CUSTOM"}(m||(m={})),function(t){t[t.CREATED=0]="CREATED"}(v||(v={})),function(t){t[t.DRAFT=0]="DRAFT",t[t.DUE=1]="DUE",t[t.PAID=2]="PAID",t[t.VOID=3]="VOID"}(f||(f={})),(g=t.PayoutStatus||(t.PayoutStatus={}))[g.PAYOUT_STATUS_NOT_SET=0]="PAYOUT_STATUS_NOT_SET",g[g.PAYOUT_STATUS_PAID=1]="PAYOUT_STATUS_PAID",g[g.PAYOUT_STATUS_PENDING=2]="PAYOUT_STATUS_PENDING",g[g.PAYOUT_STATUS_IN_TRANSIT=3]="PAYOUT_STATUS_IN_TRANSIT",g[g.PAYOUT_STATUS_CANCELED=4]="PAYOUT_STATUS_CANCELED",g[g.PAYOUT_STATUS_FAILED=5]="PAYOUT_STATUS_FAILED",function(t){t[t.PAYOUT_TYPE_NOT_SET=0]="PAYOUT_TYPE_NOT_SET",t[t.PAYOUT_TYPE_BANK_ACCOUNT=1]="PAYOUT_TYPE_BANK_ACCOUNT",t[t.PAYOUT_TYPE_CARD=2]="PAYOUT_TYPE_CARD"}(I||(I={})),function(t){t[t.SORT_DIRECTION_ASCENDING=0]="SORT_DIRECTION_ASCENDING",t[t.SORT_DIRECTION_DESCENDING=1]="SORT_DIRECTION_DESCENDING"}(A||(A={})),function(t){t[t.SEARCH_MERCHANTS_REQUEST_SORT_BY_MERCHANT_ID=0]="SEARCH_MERCHANTS_REQUEST_SORT_BY_MERCHANT_ID",t[t.SEARCH_MERCHANTS_REQUEST_SORT_BY_COMPANY_NAME=1]="SEARCH_MERCHANTS_REQUEST_SORT_BY_COMPANY_NAME",t[t.SEARCH_MERCHANTS_REQUEST_SORT_BY_CONTACT_NAME=2]="SEARCH_MERCHANTS_REQUEST_SORT_BY_CONTACT_NAME",t[t.SEARCH_MERCHANTS_REQUEST_SORT_BY_EMAIL_ADDRESS=3]="SEARCH_MERCHANTS_REQUEST_SORT_BY_EMAIL_ADDRESS",t[t.SEARCH_MERCHANTS_REQUEST_SORT_BY_COUNTRY=4]="SEARCH_MERCHANTS_REQUEST_SORT_BY_COUNTRY",t[t.SEARCH_MERCHANTS_REQUEST_SORT_BY_STATE=5]="SEARCH_MERCHANTS_REQUEST_SORT_BY_STATE",t[t.SEARCH_MERCHANTS_REQUEST_SORT_BY_CREATED=6]="SEARCH_MERCHANTS_REQUEST_SORT_BY_CREATED",t[t.SEARCH_MERCHANTS_REQUEST_SORT_BY_UPDATED=7]="SEARCH_MERCHANTS_REQUEST_SORT_BY_UPDATED"}(y||(y={})),function(t){t[t.INVALID_MONTH=0]="INVALID_MONTH",t[t.JANUARY=1]="JANUARY",t[t.FEBRUARY=2]="FEBRUARY",t[t.MARCH=3]="MARCH",t[t.APRIL=4]="APRIL",t[t.MAY=5]="MAY",t[t.JUNE=6]="JUNE",t[t.JULY=7]="JULY",t[t.AUGUST=8]="AUGUST",t[t.SEPTEMBER=9]="SEPTEMBER",t[t.OCTOBER=10]="OCTOBER",t[t.NOVEMBER=11]="NOVEMBER",t[t.DECEMBER=12]="DECEMBER"}(S||(S={})),function(t){t[t.FAILED=0]="FAILED",t[t.PENDING=1]="PENDING",t[t.COMPLETED=2]="COMPLETED"}(P||(P={})),function(t){t[t.CARD_TYPE_UNKNOWN=0]="CARD_TYPE_UNKNOWN",t[t.CARD_TYPE_VISA=1]="CARD_TYPE_VISA",t[t.CARD_TYPE_MASTERCARD=2]="CARD_TYPE_MASTERCARD",t[t.CARD_TYPE_AMEX=3]="CARD_TYPE_AMEX",t[t.CARD_TYPE_DISCOVER=4]="CARD_TYPE_DISCOVER",t[t.CARD_TYPE_JCB=5]="CARD_TYPE_JCB",t[t.CARD_TYPE_DINERS_CLUB=6]="CARD_TYPE_DINERS_CLUB"}(b||(b={})),function(t){t[t.DISPUTE_STATUS_UNSET=0]="DISPUTE_STATUS_UNSET",t[t.DISPUTE_STATUS_WARNING_NEEDS_RESPONSE=1]="DISPUTE_STATUS_WARNING_NEEDS_RESPONSE",t[t.DISPUTE_STATUS_WARNING_UNDER_REVIEW=2]="DISPUTE_STATUS_WARNING_UNDER_REVIEW",t[t.DISPUTE_STATUS_WARNING_CLOSED=3]="DISPUTE_STATUS_WARNING_CLOSED",t[t.DISPUTE_STATUS_NEEDS_RESPONSE=4]="DISPUTE_STATUS_NEEDS_RESPONSE",t[t.DISPUTE_STATUS_UNDER_REVIEW=5]="DISPUTE_STATUS_UNDER_REVIEW",t[t.DISPUTE_STATUS_CHARGE_REFUNDED=6]="DISPUTE_STATUS_CHARGE_REFUNDED",t[t.DISPUTE_STATUS_WON=7]="DISPUTE_STATUS_WON",t[t.DISPUTE_STATUS_LOST=8]="DISPUTE_STATUS_LOST"}(T||(T={})),function(t){t[t.PAYMENT_ALLOCATION_TYPE_UNSET=0]="PAYMENT_ALLOCATION_TYPE_UNSET",t[t.PAYMENT_ALLOCATION_TYPE_PURCHASE=1]="PAYMENT_ALLOCATION_TYPE_PURCHASE",t[t.PAYMENT_ALLOCATION_TYPE_INVOICE=2]="PAYMENT_ALLOCATION_TYPE_INVOICE"}(O||(O={})),function(t){t[t.PAYMENT_SOURCE_NONE=0]="PAYMENT_SOURCE_NONE",t[t.PAYMENT_SOURCE_STRIPE=1]="PAYMENT_SOURCE_STRIPE",t[t.PAYMENT_SOURCE_VCASH=2]="PAYMENT_SOURCE_VCASH"}(E||(E={})),function(t){t[t.PAYMENT_STATUS_UNSET=0]="PAYMENT_STATUS_UNSET",t[t.PAYMENT_STATUS_SUCCEEDED=1]="PAYMENT_STATUS_SUCCEEDED",t[t.PAYMENT_STATUS_FAILED=2]="PAYMENT_STATUS_FAILED",t[t.PAYMENT_STATUS_REFUNDED=3]="PAYMENT_STATUS_REFUNDED",t[t.PAYMENT_STATUS_PARTIALLY_REFUNDED=4]="PAYMENT_STATUS_PARTIALLY_REFUNDED"}(R||(R={})),(C=t.RetailPaymentReferenceTypeEnum||(t.RetailPaymentReferenceTypeEnum={}))[C.RETAIL_PAYMENT_REFERENCE_TYPE_UNSET=0]="RETAIL_PAYMENT_REFERENCE_TYPE_UNSET",C[C.RETAIL_PAYMENT_REFERENCE_TYPE_INVOICE=1]="RETAIL_PAYMENT_REFERENCE_TYPE_INVOICE",C[C.RETAIL_PAYMENT_REFERENCE_TYPE_SALES_ORDER=2]="RETAIL_PAYMENT_REFERENCE_TYPE_SALES_ORDER",(D=t.CARD_TYPE||(t.CARD_TYPE={}))[D.UNKNOWN=0]="UNKNOWN",D[D.VISA=1]="VISA",D[D.MASTERCARD=2]="MASTERCARD",D[D.AMEX=3]="AMEX",D[D.DISCOVER=4]="DISCOVER",D[D.JCB=5]="JCB",D[D.DINERS_CLUB=6]="DINERS_CLUB",function(t){t[t.FUNDING_TYPE_UNKNOWN=0]="FUNDING_TYPE_UNKNOWN",t[t.FUNDING_TYPE_CREDIT=1]="FUNDING_TYPE_CREDIT",t[t.FUNDING_TYPE_DEBIT=2]="FUNDING_TYPE_DEBIT",t[t.FUNDING_TYPE_PREPAID=3]="FUNDING_TYPE_PREPAID"}(_||(_={})),(J=t.PricingPlanBillingStrategy||(t.PricingPlanBillingStrategy={}))[J.BILLING_STRATEGY_NONE=0]="BILLING_STRATEGY_NONE",J[J.BILLING_STRATEGY_END_OF_PERIOD=1]="BILLING_STRATEGY_END_OF_PERIOD",J[J.BILLING_STRATEGY_START_OF_PERIOD=2]="BILLING_STRATEGY_START_OF_PERIOD",J[J.BILLING_STRATEGY_INSTANTLY=3]="BILLING_STRATEGY_INSTANTLY",J[J.BILLING_STRATEGY_END_OF_DAY=4]="BILLING_STRATEGY_END_OF_DAY",function(t){t[t.PRODUCT_PRICING_TYPE_INVALID=0]="PRODUCT_PRICING_TYPE_INVALID",t[t.PRODUCT_PRICING_TYPE_STANDARD=1]="PRODUCT_PRICING_TYPE_STANDARD",t[t.PRODUCT_PRICING_TYPE_STAIRSTEP=2]="PRODUCT_PRICING_TYPE_STAIRSTEP",t[t.PRODUCT_PRICING_TYPE_TIERED=3]="PRODUCT_PRICING_TYPE_TIERED"}(N||(N={})),function(t){t[t.PRODUCT_TYPE_INVALID=0]="PRODUCT_TYPE_INVALID",t[t.PRODUCT_TYPE_STANDARD_PRODUCT=1]="PRODUCT_TYPE_STANDARD_PRODUCT",t[t.PRODUCT_TYPE_VENDASTA_PRODUCT=2]="PRODUCT_TYPE_VENDASTA_PRODUCT",t[t.PRODUCT_TYPE_SUBSCRIPTION=3]="PRODUCT_TYPE_SUBSCRIPTION",t[t.PRODUCT_TYPE_FEE=4]="PRODUCT_TYPE_FEE",t[t.PRODUCT_TYPE_PRIVATE_PRODUCT=5]="PRODUCT_TYPE_PRIVATE_PRODUCT",t[t.PRODUCT_TYPE_PARTNER_SUPPORT_SALES=6]="PRODUCT_TYPE_PARTNER_SUPPORT_SALES"}(w||(w={})),function(t){t[t.CREDIT_TYPE_UNSET=0]="CREDIT_TYPE_UNSET",t[t.CREDIT_TYPE_CREDIT_NOTE=1]="CREDIT_TYPE_CREDIT_NOTE",t[t.CREDIT_TYPE_PROMOTIONAL=2]="CREDIT_TYPE_PROMOTIONAL"}(j||(j={})),(M=t.PurchaseStatusEnum||(t.PurchaseStatusEnum={}))[M.PURCHASE_STATUS_UNSET=0]="PURCHASE_STATUS_UNSET",M[M.PURCHASE_STATUS_PENDING=1]="PURCHASE_STATUS_PENDING",M[M.PURCHASE_STATUS_DUE=2]="PURCHASE_STATUS_DUE",M[M.PURCHASE_STATUS_SUCCESS=3]="PURCHASE_STATUS_SUCCESS",M[M.PURCHASE_STATUS_DUNNING=4]="PURCHASE_STATUS_DUNNING",M[M.PURCHASE_STATUS_FAILED=5]="PURCHASE_STATUS_FAILED",(U=t.State||(t.State={}))[U.LIST_PURCHASE_REQUEST_STATE_ALL=0]="LIST_PURCHASE_REQUEST_STATE_ALL",U[U.LIST_PURCHASE_REQUEST_STATE_OVERDUE=1]="LIST_PURCHASE_REQUEST_STATE_OVERDUE",(B=t.ReferenceTypeEnum||(t.ReferenceTypeEnum={}))[B.PURCHASE=0]="PURCHASE",B[B.PURCHASE_ITEM=1]="PURCHASE_ITEM",B[B.INVOICE=2]="INVOICE",(L=t.RefundReasonEnum||(t.RefundReasonEnum={}))[L.REQUESTED_BY_CUSTOMER=0]="REQUESTED_BY_CUSTOMER",L[L.DUPLICATE=1]="DUPLICATE",L[L.FRAUDULENT=2]="FRAUDULENT",(k=t.RefundStatusEnum||(t.RefundStatusEnum={}))[k.SUCCEEDED=0]="SUCCEEDED",k[k.FAILED=1]="FAILED",k[k.PENDING=3]="PENDING",function(t){t[t.SALES_CREDIT_NOTE_STATUS_IN_PROGRESS=0]="SALES_CREDIT_NOTE_STATUS_IN_PROGRESS",t[t.SALES_CREDIT_NOTE_STATUS_READY_TO_POST=1]="SALES_CREDIT_NOTE_STATUS_READY_TO_POST",t[t.SALES_CREDIT_NOTE_STATUS_COMPLETE=2]="SALES_CREDIT_NOTE_STATUS_COMPLETE",t[t.SALES_CREDIT_NOTE_STATUS_DISCARDED=3]="SALES_CREDIT_NOTE_STATUS_DISCARDED"}(x||(x={})),function(t){t[t.PAYMENT_STATUSES_NOT_SET=0]="PAYMENT_STATUSES_NOT_SET",t[t.PAYMENT_STATUSES_UNPAID=1]="PAYMENT_STATUSES_UNPAID",t[t.PAYMENT_STATUSES_PAID=2]="PAYMENT_STATUSES_PAID",t[t.PAYMENT_STATUSES_PART_PAID=3]="PAYMENT_STATUSES_PART_PAID",t[t.PAYMENT_STATUSES_NOT_APPLICABLE=4]="PAYMENT_STATUSES_NOT_APPLICABLE"}(F||(F={})),function(t){t[t.SALES_INVOICE_STATUS_IN_PROGRESS=0]="SALES_INVOICE_STATUS_IN_PROGRESS",t[t.SALES_INVOICE_STATUS_READY_TO_POST=1]="SALES_INVOICE_STATUS_READY_TO_POST",t[t.SALES_INVOICE_STATUS_COMPLETE=2]="SALES_INVOICE_STATUS_COMPLETE",t[t.SALES_INVOICE_STATUS_DISCARDED=3]="SALES_INVOICE_STATUS_DISCARDED"}(Y||(Y={})),function(t){t[t.SALES_INVOICE_TYPE_UNSET=0]="SALES_INVOICE_TYPE_UNSET",t[t.SALES_INVOICE_TYPE_INVOICED=1]="SALES_INVOICE_TYPE_INVOICED",t[t.SALES_INVOICE_TYPE_INSTANT=2]="SALES_INVOICE_TYPE_INSTANT"}(G||(G={})),(q=t.SubscribeValidationStatus||(t.SubscribeValidationStatus={}))[q.SUBSCRIBE_VALIDATION_STATUS_UNSET=0]="SUBSCRIBE_VALIDATION_STATUS_UNSET",q[q.SUBSCRIBE_VALIDATION_STATUS_CANNOT_INSTANT_BILL=1]="SUBSCRIBE_VALIDATION_STATUS_CANNOT_INSTANT_BILL",q[q.SUBSCRIBE_VALIDATION_STATUS_MISSING_MERCHANT_INFO=2]="SUBSCRIBE_VALIDATION_STATUS_MISSING_MERCHANT_INFO",q[q.SUBSCRIBE_VALIDATION_STATUS_MISSING_PAYMENT_INFO=3]="SUBSCRIBE_VALIDATION_STATUS_MISSING_PAYMENT_INFO",q[q.SUBSCRIBE_VALIDATION_STATUS_WILL_CAUSE_FUTURE_CHARGES=4]="SUBSCRIBE_VALIDATION_STATUS_WILL_CAUSE_FUTURE_CHARGES",function(t){t[t.RENEWAL_STATE_IMMEDIATE=0]="RENEWAL_STATE_IMMEDIATE",t[t.RENEWAL_STATE_DELAYED=1]="RENEWAL_STATE_DELAYED"}(H||(H={})),function(t){t[t.PAYMENT_PROCESSOR_INVALID=0]="PAYMENT_PROCESSOR_INVALID",t[t.PAYMENT_PROCESSOR_UNSET=1]="PAYMENT_PROCESSOR_UNSET",t[t.PAYMENT_PROCESSOR_STRIPE=2]="PAYMENT_PROCESSOR_STRIPE"}(W||(W={})),function(t){t[t.COLLECTION_METHOD_INVALID=0]="COLLECTION_METHOD_INVALID",t[t.COLLECTION_METHOD_MANUAL=1]="COLLECTION_METHOD_MANUAL",t[t.COLLECTION_METHOD_EMAIL=2]="COLLECTION_METHOD_EMAIL",t[t.COLLECTION_METHOD_CHARGE_AUTOMATICALLY=3]="COLLECTION_METHOD_CHARGE_AUTOMATICALLY"}(V||(V={})),function(t){t[t.INTERVAL_INVALID=0]="INTERVAL_INVALID",t[t.INTERVAL_DAY=1]="INTERVAL_DAY",t[t.INTERVAL_WEEK=2]="INTERVAL_WEEK",t[t.INTERVAL_MONTH=3]="INTERVAL_MONTH",t[t.INTERVAL_YEAR=4]="INTERVAL_YEAR"}(z||(z={})),function(t){t[t.RECURRING_INVOICE_STATUS_INVALID=0]="RECURRING_INVOICE_STATUS_INVALID",t[t.RECURRING_INVOICE_STATUS_INACTIVE=1]="RECURRING_INVOICE_STATUS_INACTIVE",t[t.RECURRING_INVOICE_STATUS_ACTIVE=2]="RECURRING_INVOICE_STATUS_ACTIVE",t[t.RECURRING_INVOICE_STATUS_ARCHIVED=3]="RECURRING_INVOICE_STATUS_ARCHIVED"}(K||(K={}));var X=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.pageSize&&(i.pageSize=parseInt(e.pageSize,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.cursor&&(t.cursor=this.cursor),void 0!==this.pageSize&&(t.pageSize=this.pageSize),t},t}(),Q=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.nextCursor&&(t.nextCursor=this.nextCursor),void 0!==this.hasMore&&(t.hasMore=this.hasMore),t},t}();function Z(t,e){return"number"==typeof e?e:t[e]}var $=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.billingStart&&(i.billingStart=new Date(e.billingStart)),e.proratedTo&&(i.proratedTo=new Date(e.proratedTo)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.orderId&&(t.orderId=this.orderId),void 0!==this.billingStart&&null!==this.billingStart&&(t.billingStart="toApiJson"in this.billingStart?this.billingStart.toApiJson():this.billingStart),void 0!==this.proratedTo&&null!==this.proratedTo&&(t.proratedTo="toApiJson"in this.proratedTo?this.proratedTo.toApiJson():this.proratedTo),t},t}(),tt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.items&&(i.items=e.items.map(ht.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.items&&null!==this.items&&(t.items="toApiJson"in this.items?this.items.toApiJson():this.items),t},t}(),et=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.id&&(t.id=this.id),t},t}(),it=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.expiry&&(n.expiry=new Date(i.expiry)),i.billingStart&&(n.billingStart=new Date(i.billingStart)),i.created&&(n.created=new Date(i.created)),i.updated&&(n.updated=new Date(i.updated)),i.frequency&&(n.frequency=Z(t.GeneratedFrequency,i.frequency)),i.nextRenewal&&(n.nextRenewal=new Date(i.nextRenewal)),i.customerAddress&&(n.customerAddress=ot.fromProto(i.customerAddress)),i.customUnitPrice&&(n.customUnitPrice=parseInt(i.customUnitPrice,10)),i.retailFrequency&&(n.retailFrequency=Z(t.GeneratedFrequency,i.retailFrequency)),i.nextRetailRenewal&&(n.nextRetailRenewal=new Date(i.nextRetailRenewal)),i.retailUnitPrice&&(n.retailUnitPrice=parseInt(i.retailUnitPrice,10)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.orderId&&(t.orderId=this.orderId),void 0!==this.expiry&&null!==this.expiry&&(t.expiry="toApiJson"in this.expiry?this.expiry.toApiJson():this.expiry),void 0!==this.billingStart&&null!==this.billingStart&&(t.billingStart="toApiJson"in this.billingStart?this.billingStart.toApiJson():this.billingStart),void 0!==this.created&&null!==this.created&&(t.created="toApiJson"in this.created?this.created.toApiJson():this.created),void 0!==this.updated&&null!==this.updated&&(t.updated="toApiJson"in this.updated?this.updated.toApiJson():this.updated),void 0!==this.frequency&&(t.frequency=this.frequency),void 0!==this.nextRenewal&&null!==this.nextRenewal&&(t.nextRenewal="toApiJson"in this.nextRenewal?this.nextRenewal.toApiJson():this.nextRenewal),void 0!==this.customerName&&(t.customerName=this.customerName),void 0!==this.productName&&(t.productName=this.productName),void 0!==this.customerAddress&&null!==this.customerAddress&&(t.customerAddress="toApiJson"in this.customerAddress?this.customerAddress.toApiJson():this.customerAddress),void 0!==this.customUnitPrice&&(t.customUnitPrice=this.customUnitPrice),void 0!==this.retailFrequency&&(t.retailFrequency=this.retailFrequency),void 0!==this.nextRetailRenewal&&null!==this.nextRetailRenewal&&(t.nextRetailRenewal="toApiJson"in this.nextRetailRenewal?this.nextRetailRenewal.toApiJson():this.nextRetailRenewal),void 0!==this.retailUnitPrice&&(t.retailUnitPrice=this.retailUnitPrice),t},e}(),nt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),t},t}(),ot=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.address&&(t.address=this.address),void 0!==this.city&&(t.city=this.city),void 0!==this.state&&(t.state=this.state),void 0!==this.zip&&(t.zip=this.zip),void 0!==this.country&&(t.country=this.country),t},t}(),rt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.orderId&&(t.orderId=this.orderId),t},t}(),st=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.expiry&&(i.expiry=new Date(e.expiry)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.orderId&&(t.orderId=this.orderId),void 0!==this.expiry&&null!==this.expiry&&(t.expiry="toApiJson"in this.expiry?this.expiry.toApiJson():this.expiry),t},t}(),at=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.skus&&(t.skus=this.skus),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),t},t}(),ct=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.orderId&&(t.orderId=this.orderId),t},t}(),ut=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.item&&(i.item=it.fromProto(e.item)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.item&&null!==this.item&&(t.item="toApiJson"in this.item?this.item.toApiJson():this.item),t},t}(),pt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.subscriptionKeys&&(i.subscriptionKeys=e.subscriptionKeys.map(lt.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.subscriptionKeys&&null!==this.subscriptionKeys&&(t.subscriptionKeys="toApiJson"in this.subscriptionKeys?this.subscriptionKeys.toApiJson():this.subscriptionKeys),t},t}(),dt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.subscriptions&&(i.subscriptions=e.subscriptions.map(it.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.subscriptions&&null!==this.subscriptions&&(t.subscriptions="toApiJson"in this.subscriptions?this.subscriptions.toApiJson():this.subscriptions),t},t}(),ht=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.billingStart&&(i.billingStart=new Date(e.billingStart)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.orderId&&(t.orderId=this.orderId),void 0!==this.billingStart&&null!==this.billingStart&&(t.billingStart="toApiJson"in this.billingStart?this.billingStart.toApiJson():this.billingStart),t},t}(),lt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.orderId&&(t.orderId=this.orderId),t},t}(),mt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.filters&&(i.filters=at.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=X.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),void 0!==this.searchTerm&&(t.searchTerm=this.searchTerm),t},t}(),vt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.items&&(i.items=e.items.map(it.fromProto)),e.pagingMetadata&&(i.pagingMetadata=Q.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.items&&null!==this.items&&(t.items="toApiJson"in this.items?this.items.toApiJson():this.items),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}();var ft=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i,n,o=new t;return o=Object.assign(o,e),e.type&&(o.type=(i=c,"number"==typeof(n=e.type)?n:i[n])),e.value&&(o.value=parseInt(e.value,10)),e.totalAmount&&(o.totalAmount=parseInt(e.totalAmount,10)),o},t.prototype.toApiJson=function(){var t={};return void 0!==this.type&&(t.type=this.type),void 0!==this.value&&(t.value=this.value),void 0!==this.totalAmount&&(t.totalAmount=this.totalAmount),void 0!==this.description&&(t.description=this.description),t},t}();function gt(t,e){return"number"==typeof e?e:t[e]}var It=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.items&&(i.items=e.items.map(At.fromProto)),e.created&&(i.created=new Date(e.created)),e.updated&&(i.updated=new Date(e.updated)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.bundleId&&(t.bundleId=this.bundleId),void 0!==this.name&&(t.name=this.name),void 0!==this.items&&null!==this.items&&(t.items="toApiJson"in this.items?this.items.toApiJson():this.items),void 0!==this.created&&null!==this.created&&(t.created="toApiJson"in this.created?this.created.toApiJson():this.created),void 0!==this.updated&&null!==this.updated&&(t.updated="toApiJson"in this.updated?this.updated.toApiJson():this.updated),void 0!==this.hideBundleDetails&&(t.hideBundleDetails=this.hideBundleDetails),t},t}(),At=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.discountType&&(i.discountType=gt(c,e.discountType)),e.discountAmount&&(i.discountAmount=parseInt(e.discountAmount,10)),e.quantity&&(i.quantity=parseInt(e.quantity,10)),e.price&&(i.price=Et.fromProto(e.price)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.productId&&(t.productId=this.productId),void 0!==this.discountType&&(t.discountType=this.discountType),void 0!==this.discountAmount&&(t.discountAmount=this.discountAmount),void 0!==this.quantity&&(t.quantity=this.quantity),void 0!==this.defaultSku&&(t.defaultSku=this.defaultSku),void 0!==this.price&&null!==this.price&&(t.price="toApiJson"in this.price?this.price.toApiJson():this.price),t},t}(),yt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.prices&&(i.prices=e.prices.map(Rt.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.bundleId&&(t.bundleId=this.bundleId),void 0!==this.currency&&(t.currency=this.currency),void 0!==this.prices&&null!==this.prices&&(t.prices="toApiJson"in this.prices?this.prices.toApiJson():this.prices),t},t}(),St=(function(){function t(t){t&&Object.assign(this,t)}t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.value&&(i.value=It.fromProto(e.value)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.key&&(t.key=this.key),void 0!==this.value&&null!==this.value&&(t.value="toApiJson"in this.value?this.value.toApiJson():this.value),t}}(),function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}()),Pt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.bundleIds&&(t.bundleIds=this.bundleIds),t},t}(),bt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.bundles&&(i.bundles=Object.keys(e.bundles).reduce((function(t,i){return t[i]=It.fromProto(e.bundles[i]),t}),{})),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.bundles&&null!==this.bundles&&(t.bundles="toApiJson"in this.bundles?this.bundles.toApiJson():this.bundles),t},t}(),Tt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.filters&&(i.filters=St.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=X.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),void 0!==this.searchTerm&&(t.searchTerm=this.searchTerm),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),Ot=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.bundles&&(i.bundles=e.bundles.map(It.fromProto)),e.pagingMetadata&&(i.pagingMetadata=Q.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.bundles&&null!==this.bundles&&(t.bundles="toApiJson"in this.bundles?this.bundles.toApiJson():this.bundles),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),Et=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.amount&&(i.amount=parseInt(e.amount,10)),e.setupFee&&(i.setupFee=parseInt(e.setupFee,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.amount&&(t.amount=this.amount),void 0!==this.setupFee&&(t.setupFee=this.setupFee),t},t}(),Rt=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.frequency&&(n.frequency=gt(t.GeneratedFrequency,i.frequency)),i.effectivePrice&&(n.effectivePrice=parseInt(i.effectivePrice,10)),i.initialPrice&&(n.initialPrice=parseInt(i.initialPrice,10)),i.setupFee&&(n.setupFee=parseInt(i.setupFee,10)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.frequency&&(t.frequency=this.frequency),void 0!==this.effectivePrice&&(t.effectivePrice=this.effectivePrice),void 0!==this.initialPrice&&(t.initialPrice=this.initialPrice),void 0!==this.setupFee&&(t.setupFee=this.setupFee),t},e}(),Ct=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.items&&(i.items=e.items.map(At.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.bundleId&&(t.bundleId=this.bundleId),void 0!==this.name&&(t.name=this.name),void 0!==this.items&&null!==this.items&&(t.items="toApiJson"in this.items?this.items.toApiJson():this.items),void 0!==this.hideBundleDetails&&(t.hideBundleDetails=this.hideBundleDetails),t},t}();var Dt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.initial&&(i.initial=parseInt(e.initial,10)),e.recurring&&(i.recurring=parseInt(e.recurring,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.initial&&(t.initial=this.initial),void 0!==this.recurring&&(t.recurring=this.recurring),t},t}();function _t(t,e){return"number"==typeof e?e:t[e]}var Jt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.netD&&(i.netD=parseInt(e.netD,10)),e.created&&(i.created=new Date(e.created)),e.currency&&(i.currency=_t(u,e.currency)),e.signed&&(i.signed=new Date(e.signed)),e.activated&&(i.activated=new Date(e.activated)),e.modified&&(i.modified=new Date(e.modified)),e.verified&&(i.verified=new Date(e.verified)),e.creditLimit&&(i.creditLimit=parseInt(e.creditLimit,10)),e.end&&(i.end=new Date(e.end)),e.subscriptionUpdateStatus&&(i.subscriptionUpdateStatus=_t(p,e.subscriptionUpdateStatus)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.netD&&(t.netD=this.netD),void 0!==this.created&&null!==this.created&&(t.created="toApiJson"in this.created?this.created.toApiJson():this.created),void 0!==this.subscriptionId&&(t.subscriptionId=this.subscriptionId),void 0!==this.currency&&(t.currency=this.currency),void 0!==this.signed&&null!==this.signed&&(t.signed="toApiJson"in this.signed?this.signed.toApiJson():this.signed),void 0!==this.activated&&null!==this.activated&&(t.activated="toApiJson"in this.activated?this.activated.toApiJson():this.activated),void 0!==this.modified&&null!==this.modified&&(t.modified="toApiJson"in this.modified?this.modified.toApiJson():this.modified),void 0!==this.verified&&null!==this.verified&&(t.verified="toApiJson"in this.verified?this.verified.toApiJson():this.verified),void 0!==this.status&&(t.status=this.status),void 0!==this.creditLimit&&(t.creditLimit=this.creditLimit),void 0!==this.dimension&&(t.dimension=this.dimension),void 0!==this.pricingPlanId&&(t.pricingPlanId=this.pricingPlanId),void 0!==this.end&&null!==this.end&&(t.end="toApiJson"in this.end?this.end.toApiJson():this.end),void 0!==this.subscriptionUpdateStatus&&(t.subscriptionUpdateStatus=this.subscriptionUpdateStatus),t},t}(),Nt=(function(){function t(t){t&&Object.assign(this,t)}t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.value&&(i.value=Jt.fromProto(e.value)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.key&&(t.key=this.key),void 0!==this.value&&null!==this.value&&(t.value="toApiJson"in this.value?this.value.toApiJson():this.value),t}}(),function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.currencyCode&&(t.currencyCode=this.currencyCode),t},t}()),wt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.contract&&(i.contract=Jt.fromProto(e.contract)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.contract&&null!==this.contract&&(t.contract="toApiJson"in this.contract?this.contract.toApiJson():this.contract),t},t}(),jt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),Mt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.contract&&(i.contract=Jt.fromProto(e.contract)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.contract&&null!==this.contract&&(t.contract="toApiJson"in this.contract?this.contract.toApiJson():this.contract),t},t}(),Ut=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantIds&&(t.merchantIds=this.merchantIds),t},t}(),Bt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.contracts&&(i.contracts=Object.keys(e.contracts).reduce((function(t,i){return t[i]=Jt.fromProto(e.contracts[i]),t}),{})),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.contracts&&null!==this.contracts&&(t.contracts="toApiJson"in this.contracts?this.contracts.toApiJson():this.contracts),t},t}(),Lt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.pagingOptions&&(i.pagingOptions=X.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),kt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.contracts&&(i.contracts=e.contracts.map(Jt.fromProto)),e.pagingMetadata&&(i.pagingMetadata=Q.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.contracts&&null!==this.contracts&&(t.contracts="toApiJson"in this.contracts?this.contracts.toApiJson():this.contracts),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),xt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.netD&&(i.netD=parseInt(e.netD,10)),e.signed&&(i.signed=new Date(e.signed)),e.activated&&(i.activated=new Date(e.activated)),e.end&&(i.end=new Date(e.end)),e.modified&&(i.modified=new Date(e.modified)),e.creditLimit&&(i.creditLimit=parseInt(e.creditLimit,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.netD&&(t.netD=this.netD),void 0!==this.currencyCode&&(t.currencyCode=this.currencyCode),void 0!==this.status&&(t.status=this.status),void 0!==this.dimension&&(t.dimension=this.dimension),void 0!==this.signed&&null!==this.signed&&(t.signed="toApiJson"in this.signed?this.signed.toApiJson():this.signed),void 0!==this.activated&&null!==this.activated&&(t.activated="toApiJson"in this.activated?this.activated.toApiJson():this.activated),void 0!==this.end&&null!==this.end&&(t.end="toApiJson"in this.end?this.end.toApiJson():this.end),void 0!==this.modified&&null!==this.modified&&(t.modified="toApiJson"in this.modified?this.modified.toApiJson():this.modified),void 0!==this.creditLimit&&(t.creditLimit=this.creditLimit),void 0!==this.subscriptionId&&(t.subscriptionId=this.subscriptionId),t},t}(),Ft=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),Yt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.mutations&&(i.mutations=e.mutations.map(xt.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.mutations&&null!==this.mutations&&(t.mutations="toApiJson"in this.mutations?this.mutations.toApiJson():this.mutations),t},t}(),Gt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.contract&&(i.contract=Jt.fromProto(e.contract)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.contract&&null!==this.contract&&(t.contract="toApiJson"in this.contract?this.contract.toApiJson():this.contract),t},t}(),qt=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.frequency&&(n.frequency=_t(t.GeneratedFrequency,i.frequency)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.subscriptionId&&(t.subscriptionId=this.subscriptionId),void 0!==this.frequency&&(t.frequency=this.frequency),t},e}();var Ht=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i,n,o=new t;return o=Object.assign(o,e),e.purchaseItemQuantity&&(o.purchaseItemQuantity=parseInt(e.purchaseItemQuantity,10)),e.purchaseItemTotal&&(o.purchaseItemTotal=parseInt(e.purchaseItemTotal,10)),e.currency&&(o.currency=(i=u,"number"==typeof(n=e.currency)?n:i[n])),o},t.prototype.toApiJson=function(){var t={};return void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.purchaseItemQuantity&&(t.purchaseItemQuantity=this.purchaseItemQuantity),void 0!==this.purchaseItemTotal&&(t.purchaseItemTotal=this.purchaseItemTotal),void 0!==this.currency&&(t.currency=this.currency),t},t}(),Wt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.periodStart&&(i.periodStart=new Date(e.periodStart)),e.periodEnd&&(i.periodEnd=new Date(e.periodEnd)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.customerIds&&(t.customerIds=this.customerIds),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.periodStart&&null!==this.periodStart&&(t.periodStart="toApiJson"in this.periodStart?this.periodStart.toApiJson():this.periodStart),void 0!==this.periodEnd&&null!==this.periodEnd&&(t.periodEnd="toApiJson"in this.periodEnd?this.periodEnd.toApiJson():this.periodEnd),t},t}(),Vt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.customerSummaries&&(i.customerSummaries=e.customerSummaries.map(Ht.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.customerSummaries&&null!==this.customerSummaries&&(t.customerSummaries="toApiJson"in this.customerSummaries?this.customerSummaries.toApiJson():this.customerSummaries),t},t}();var zt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.id&&(t.id=this.id),void 0!==this.accountHolderName&&(t.accountHolderName=this.accountHolderName),void 0!==this.bankName&&(t.bankName=this.bankName),void 0!==this.country&&(t.country=this.country),void 0!==this.currency&&(t.currency=this.currency),void 0!==this.routingNumber&&(t.routingNumber=this.routingNumber),void 0!==this.last4&&(t.last4=this.last4),void 0!==this.defaultForCurrency&&(t.defaultForCurrency=this.defaultForCurrency),t},t}(),Kt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.stripeToken&&(t.stripeToken=this.stripeToken),t},t}(),Xt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.bankAccountId&&(t.bankAccountId=this.bankAccountId),t},t}(),Qt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),Zt=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.bankAccount&&(i.bankAccount=e.bankAccount.map(zt.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.bankAccount&&null!==this.bankAccount&&(t.bankAccount="toApiJson"in this.bankAccount?this.bankAccount.toApiJson():this.bankAccount),t},t}(),$t=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.bankAccountId&&(t.bankAccountId=this.bankAccountId),t},t}();function te(t,e){return"number"==typeof e?e:t[e]}var ee=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.type&&(i.type=te(h,e.type)),e.value&&(i.value=parseInt(e.value,10)),e.totalAmount&&(i.totalAmount=parseInt(e.totalAmount,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.type&&(t.type=this.type),void 0!==this.value&&(t.value=this.value),void 0!==this.totalAmount&&(t.totalAmount=this.totalAmount),void 0!==this.description&&(t.description=this.description),void 0!==this.resetEachPeriod&&(t.resetEachPeriod=this.resetEachPeriod),t},t}(),ie=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.start&&(i.start=new Date(e.start)),e.end&&(i.end=new Date(e.end)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.start&&null!==this.start&&(t.start="toApiJson"in this.start?this.start.toApiJson():this.start),void 0!==this.end&&null!==this.end&&(t.end="toApiJson"in this.end?this.end.toApiJson():this.end),t},t}(),ne=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.startDate&&(i.startDate=new Date(e.startDate)),e.endDate&&(i.endDate=new Date(e.endDate)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.startDate&&null!==this.startDate&&(t.startDate="toApiJson"in this.startDate?this.startDate.toApiJson():this.startDate),void 0!==this.endDate&&null!==this.endDate&&(t.endDate="toApiJson"in this.endDate?this.endDate.toApiJson():this.endDate),t},t}(),oe=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.totalAmount&&(i.totalAmount=parseInt(e.totalAmount,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.totalAmount&&(t.totalAmount=this.totalAmount),t},t}(),re=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.startDate&&(i.startDate=new Date(e.startDate)),e.endDate&&(i.endDate=new Date(e.endDate)),e.pageSize&&(i.pageSize=parseInt(e.pageSize,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.startDate&&null!==this.startDate&&(t.startDate="toApiJson"in this.startDate?this.startDate.toApiJson():this.startDate),void 0!==this.endDate&&null!==this.endDate&&(t.endDate="toApiJson"in this.endDate?this.endDate.toApiJson():this.endDate),void 0!==this.cursor&&(t.cursor=this.cursor),void 0!==this.pageSize&&(t.pageSize=this.pageSize),void 0!==this.skus&&(t.skus=this.skus),t},t}(),se=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.results&&(i.results=e.results.map(de.fromProto)),e.totalResults&&(i.totalResults=parseInt(e.totalResults,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.results&&null!==this.results&&(t.results="toApiJson"in this.results?this.results.toApiJson():this.results),void 0!==this.nextCursor&&(t.nextCursor=this.nextCursor),void 0!==this.hasMore&&(t.hasMore=this.hasMore),void 0!==this.totalResults&&(t.totalResults=this.totalResults),t},t}(),ae=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.metricsByGroup&&(i.metricsByGroup=e.metricsByGroup.map(me.fromProto)),e.pagingMetadata&&(i.pagingMetadata=Q.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.metricsByGroup&&null!==this.metricsByGroup&&(t.metricsByGroup="toApiJson"in this.metricsByGroup?this.metricsByGroup.toApiJson():this.metricsByGroup),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),ce=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.subscriptionMetrics&&(i.subscriptionMetrics=e.subscriptionMetrics.map(he.fromProto)),e.pagingMetadata&&(i.pagingMetadata=Q.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.subscriptionMetrics&&null!==this.subscriptionMetrics&&(t.subscriptionMetrics="toApiJson"in this.subscriptionMetrics?this.subscriptionMetrics.toApiJson():this.subscriptionMetrics),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),ue=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.filters&&(i.filters=ie.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=X.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),pe=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.type&&(i.type=te(m,e.type)),e.rules&&(i.rules=e.rules.map(le.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.type&&(t.type=this.type),void 0!==this.rules&&null!==this.rules&&(t.rules="toApiJson"in this.rules?this.rules.toApiJson():this.rules),t},t}(),de=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.totalQuantity&&(n.totalQuantity=parseInt(i.totalQuantity,10)),i.totalAmount&&(n.totalAmount=parseInt(i.totalAmount,10)),i.totalDiscount&&(n.totalDiscount=parseInt(i.totalDiscount,10)),i.pricing&&(n.pricing=pe.fromProto(i.pricing)),i.discounts&&(n.discounts=i.discounts.map(ee.fromProto)),i.billingStrategy&&(n.billingStrategy=te(t.ProductSummaryBillingStrategy,i.billingStrategy)),i.productType&&(n.productType=te(t.ProductType,i.productType)),i.frequency&&(n.frequency=te(t.GeneratedFrequency,i.frequency)),i.volumeCommitment&&(n.volumeCommitment=parseInt(i.volumeCommitment,10)),i.setupFee&&(n.setupFee=parseInt(i.setupFee,10)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.productName&&(t.productName=this.productName),void 0!==this.totalQuantity&&(t.totalQuantity=this.totalQuantity),void 0!==this.totalAmount&&(t.totalAmount=this.totalAmount),void 0!==this.totalDiscount&&(t.totalDiscount=this.totalDiscount),void 0!==this.pricing&&null!==this.pricing&&(t.pricing="toApiJson"in this.pricing?this.pricing.toApiJson():this.pricing),void 0!==this.discounts&&null!==this.discounts&&(t.discounts="toApiJson"in this.discounts?this.discounts.toApiJson():this.discounts),void 0!==this.billingStrategy&&(t.billingStrategy=this.billingStrategy),void 0!==this.productType&&(t.productType=this.productType),void 0!==this.frequency&&(t.frequency=this.frequency),void 0!==this.proratedPercent&&(t.proratedPercent=this.proratedPercent),void 0!==this.volumeCommitment&&(t.volumeCommitment=this.volumeCommitment),void 0!==this.setupFee&&(t.setupFee=this.setupFee),t},e}(),he=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.startingCount&&(i.startingCount=parseInt(e.startingCount,10)),e.activations&&(i.activations=parseInt(e.activations,10)),e.deactivations&&(i.deactivations=parseInt(e.deactivations,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.productName&&(t.productName=this.productName),void 0!==this.startingCount&&(t.startingCount=this.startingCount),void 0!==this.activations&&(t.activations=this.activations),void 0!==this.deactivations&&(t.deactivations=this.deactivations),void 0!==this.churn&&(t.churn=this.churn),void 0!==this.retention&&(t.retention=this.retention),t},t}(),le=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.min&&(i.min=parseInt(e.min,10)),e.max&&(i.max=parseInt(e.max,10)),e.units&&(i.units=parseInt(e.units,10)),e.unitPrice&&(i.unitPrice=parseInt(e.unitPrice,10)),e.totalAmount&&(i.totalAmount=parseInt(e.totalAmount,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.min&&(t.min=this.min),void 0!==this.max&&(t.max=this.max),void 0!==this.units&&(t.units=this.units),void 0!==this.unitPrice&&(t.unitPrice=this.unitPrice),void 0!==this.totalAmount&&(t.totalAmount=this.totalAmount),t},t}(),me=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.subscriptionMetrics&&(i.subscriptionMetrics=e.subscriptionMetrics.map(he.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.groupId&&(t.groupId=this.groupId),void 0!==this.subscriptionMetrics&&null!==this.subscriptionMetrics&&(t.subscriptionMetrics="toApiJson"in this.subscriptionMetrics?this.subscriptionMetrics.toApiJson():this.subscriptionMetrics),t},t}();function ve(t,e){return"number"==typeof e?e:t[e]}var fe=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.discountType&&(i.discountType=ve(c,e.discountType)),e.amount&&(i.amount=parseInt(e.amount,10)),e.start&&(i.start=new Date(e.start)),e.end&&(i.end=new Date(e.end)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.discountType&&(t.discountType=this.discountType),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.start&&null!==this.start&&(t.start="toApiJson"in this.start?this.start.toApiJson():this.start),void 0!==this.end&&null!==this.end&&(t.end="toApiJson"in this.end?this.end.toApiJson():this.end),void 0!==this.resetEachPeriod&&(t.resetEachPeriod=this.resetEachPeriod),void 0!==this.description&&(t.description=this.description),t},t}(),ge=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.discountId&&(i.discountId=parseInt(e.discountId,10)),e.discountType&&(i.discountType=ve(c,e.discountType)),e.amount&&(i.amount=parseInt(e.amount,10)),e.start&&(i.start=new Date(e.start)),e.end&&(i.end=new Date(e.end)),e.created&&(i.created=new Date(e.created)),e.updated&&(i.updated=new Date(e.updated)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.discountId&&(t.discountId=this.discountId),void 0!==this.discountType&&(t.discountType=this.discountType),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.start&&null!==this.start&&(t.start="toApiJson"in this.start?this.start.toApiJson():this.start),void 0!==this.end&&null!==this.end&&(t.end="toApiJson"in this.end?this.end.toApiJson():this.end),void 0!==this.resetEachPeriod&&(t.resetEachPeriod=this.resetEachPeriod),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.created&&null!==this.created&&(t.created="toApiJson"in this.created?this.created.toApiJson():this.created),void 0!==this.updated&&null!==this.updated&&(t.updated="toApiJson"in this.updated?this.updated.toApiJson():this.updated),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.id&&(t.id=this.id),void 0!==this.description&&(t.description=this.description),t},t}(),Ie=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.id&&(t.id=this.id),t},t}(),Ae=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.expiry&&(i.expiry=new Date(e.expiry)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.expiry&&null!==this.expiry&&(t.expiry="toApiJson"in this.expiry?this.expiry.toApiJson():this.expiry),void 0!==this.skus&&(t.skus=this.skus),t},t}(),ye=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.filters&&(i.filters=Ae.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=X.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),Se=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.discounts&&(i.discounts=e.discounts.map(ge.fromProto)),e.pagingMetadata&&(i.pagingMetadata=Q.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.discounts&&null!==this.discounts&&(t.discounts="toApiJson"in this.discounts?this.discounts.toApiJson():this.discounts),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),Pe=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.discountType&&(i.discountType=ve(c,e.discountType)),e.amount&&(i.amount=parseInt(e.amount,10)),e.start&&(i.start=new Date(e.start)),e.end&&(i.end=new Date(e.end)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.id&&(t.id=this.id),void 0!==this.discountType&&(t.discountType=this.discountType),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.start&&null!==this.start&&(t.start="toApiJson"in this.start?this.start.toApiJson():this.start),void 0!==this.end&&null!==this.end&&(t.end="toApiJson"in this.end?this.end.toApiJson():this.end),void 0!==this.resetEachPeriod&&(t.resetEachPeriod=this.resetEachPeriod),void 0!==this.description&&(t.description=this.description),t},t}();var be=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.amount&&(i.amount=parseInt(e.amount,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.amount&&(t.amount=this.amount),void 0!==this.taxRateId&&(t.taxRateId=this.taxRateId),void 0!==this.name&&(t.name=this.name),void 0!==this.percentage&&(t.percentage=this.percentage),t},t}();var Te=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.paths&&(t.paths=this.paths),t},t}();var Oe=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.id&&(t.id=this.id),t},t}(),Ee=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.amount&&(i.amount=parseInt(e.amount,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.amount&&(t.amount=this.amount),t},t}(),Re=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.taxableAmount&&(i.taxableAmount=parseInt(e.taxableAmount,10)),e.taxRates&&(i.taxRates=e.taxRates.map(je.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.taxableAmount&&(t.taxableAmount=this.taxableAmount),void 0!==this.taxRates&&null!==this.taxRates&&(t.taxRates="toApiJson"in this.taxRates?this.taxRates.toApiJson():this.taxRates),t},t}(),Ce=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.countryCode&&(t.countryCode=this.countryCode),void 0!==this.stateCode&&(t.stateCode=this.stateCode),void 0!==this.name&&(t.name=this.name),void 0!==this.description&&(t.description=this.description),void 0!==this.percentage&&(t.percentage=this.percentage),void 0!==this.accountingSystemId&&(t.accountingSystemId=this.accountingSystemId),t},t}(),De=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.includeArchived&&(t.includeArchived=this.includeArchived),t},t}(),_e=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.ids&&(t.ids=this.ids),t},t}(),Je=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.taxRates&&(i.taxRates=e.taxRates.map(je.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.taxRates&&null!==this.taxRates&&(t.taxRates="toApiJson"in this.taxRates?this.taxRates.toApiJson():this.taxRates),t},t}(),Ne=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.filters&&(i.filters=De.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=X.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),we=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.taxRates&&(i.taxRates=e.taxRates.map(je.fromProto)),e.pagingMetadata&&(i.pagingMetadata=Q.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.taxRates&&null!==this.taxRates&&(t.taxRates="toApiJson"in this.taxRates?this.taxRates.toApiJson():this.taxRates),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),je=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.archived&&(i.archived=new Date(e.archived)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.id&&(t.id=this.id),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.countryCode&&(t.countryCode=this.countryCode),void 0!==this.stateCode&&(t.stateCode=this.stateCode),void 0!==this.name&&(t.name=this.name),void 0!==this.description&&(t.description=this.description),void 0!==this.percentage&&(t.percentage=this.percentage),void 0!==this.accountingSystemId&&(t.accountingSystemId=this.accountingSystemId),void 0!==this.archived&&null!==this.archived&&(t.archived="toApiJson"in this.archived?this.archived.toApiJson():this.archived),t},t}(),Me=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.id&&(t.id=this.id),void 0!==this.countryCode&&(t.countryCode=this.countryCode),void 0!==this.stateCode&&(t.stateCode=this.stateCode),void 0!==this.name&&(t.name=this.name),void 0!==this.description&&(t.description=this.description),void 0!==this.percentage&&(t.percentage=this.percentage),void 0!==this.accountingSystemId&&(t.accountingSystemId=this.accountingSystemId),t},t}();var Ue=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.bundleItems&&(i.bundleItems=e.bundleItems.map(Be.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.bundleId&&(t.bundleId=this.bundleId),void 0!==this.name&&(t.name=this.name),void 0!==this.bundleItems&&null!==this.bundleItems&&(t.bundleItems="toApiJson"in this.bundleItems?this.bundleItems.toApiJson():this.bundleItems),void 0!==this.hideBundleItems&&(t.hideBundleItems=this.hideBundleItems),void 0!==this.bundleInstanceId&&(t.bundleInstanceId=this.bundleInstanceId),t},t}(),Be=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.discountAmount&&(i.discountAmount=parseInt(e.discountAmount,10)),e.quantity&&(i.quantity=parseInt(e.quantity,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.productId&&(t.productId=this.productId),void 0!==this.discountType&&(t.discountType=this.discountType),void 0!==this.discountAmount&&(t.discountAmount=this.discountAmount),void 0!==this.quantity&&(t.quantity=this.quantity),t},t}();function Le(t,e){return"number"==typeof e?e:t[e]}var ke=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.bundleId&&(t.bundleId=this.bundleId),t},t}(),xe=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoice&&(i.invoice=ii.fromProto(e.invoice)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoice&&null!==this.invoice&&(t.invoice="toApiJson"in this.invoice?this.invoice.toApiJson():this.invoice),t},t}(),Fe=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.amount&&(i.amount=parseInt(e.amount,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.quantity&&(t.quantity=this.quantity),void 0!==this.description&&(t.description=this.description),void 0!==this.taxRates&&(t.taxRates=this.taxRates),t},t}(),Ye=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoice&&(i.invoice=ii.fromProto(e.invoice)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoice&&null!==this.invoice&&(t.invoice="toApiJson"in this.invoice?this.invoice.toApiJson():this.invoice),t},t}(),Ge=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),void 0!==this.paymentMethodId&&(t.paymentMethodId=this.paymentMethodId),t},t}(),qe=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.currencyCode&&(t.currencyCode=this.currencyCode),void 0!==this.orderId&&(t.orderId=this.orderId),t},t}(),He=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),t},t}(),We=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.address&&(t.address=this.address),void 0!==this.city&&(t.city=this.city),void 0!==this.state&&(t.state=this.state),void 0!==this.zip&&(t.zip=this.zip),void 0!==this.country&&(t.country=this.country),void 0!==this.address2&&(t.address2=this.address2),t},t}(),Ve=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.dateField&&(i.dateField=Le(v,e.dateField)),e.dateLte&&(i.dateLte=new Date(e.dateLte)),e.dateGte&&(i.dateGte=new Date(e.dateGte)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.dateField&&(t.dateField=this.dateField),void 0!==this.dateLte&&null!==this.dateLte&&(t.dateLte="toApiJson"in this.dateLte?this.dateLte.toApiJson():this.dateLte),void 0!==this.dateGte&&null!==this.dateGte&&(t.dateGte="toApiJson"in this.dateGte?this.dateGte.toApiJson():this.dateGte),t},t}(),ze=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),t},t}(),Ke=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),void 0!==this.id&&(t.id=this.id),t},t}(),Xe=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoice&&(i.invoice=ii.fromProto(e.invoice)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoice&&null!==this.invoice&&(t.invoice="toApiJson"in this.invoice?this.invoice.toApiJson():this.invoice),t},t}(),Qe=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),t},t}(),Ze=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),t},t}(),$e=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.statuses&&(i.statuses=e.statuses.map((function(t){return Le(f,t)}))),e.dateFilter&&(i.dateFilter=Ve.fromProto(e.dateFilter)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.statuses&&(t.statuses=this.statuses),void 0!==this.pastDue&&(t.pastDue=this.pastDue),void 0!==this.number&&(t.number=this.number),void 0!==this.dateFilter&&null!==this.dateFilter&&(t.dateFilter="toApiJson"in this.dateFilter?this.dateFilter.toApiJson():this.dateFilter),t},t}(),ti=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),t},t}(),ei=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoice&&(i.invoice=ii.fromProto(e.invoice)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoice&&null!==this.invoice&&(t.invoice="toApiJson"in this.invoice?this.invoice.toApiJson():this.invoice),t},t}(),ii=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.status&&(i.status=Le(f,e.status)),e.subtotal&&(i.subtotal=parseInt(e.subtotal,10)),e.total&&(i.total=parseInt(e.total,10)),e.amountPaid&&(i.amountPaid=parseInt(e.amountPaid,10)),e.issued&&(i.issued=new Date(e.issued)),e.due&&(i.due=new Date(e.due)),e.created&&(i.created=new Date(e.created)),e.updated&&(i.updated=new Date(e.updated)),e.items&&(i.items=e.items.map(ni.fromProto)),e.currency&&(i.currency=Le(u,e.currency)),e.paid&&(i.paid=new Date(e.paid)),e.amountTax&&(i.amountTax=parseInt(e.amountTax,10)),e.appliedTaxes&&(i.appliedTaxes=e.appliedTaxes.map(be.fromProto)),e.defaultTaxRates&&(i.defaultTaxRates=e.defaultTaxRates.map(je.fromProto)),e.appliedBundles&&(i.appliedBundles=e.appliedBundles.map(Ue.fromProto)),e.amountDiscount&&(i.amountDiscount=parseInt(e.amountDiscount,10)),e.voided&&(i.voided=new Date(e.voided)),e.customerAddress&&(i.customerAddress=We.fromProto(e.customerAddress)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.id&&(t.id=this.id),void 0!==this.number&&(t.number=this.number),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.status&&(t.status=this.status),void 0!==this.subtotal&&(t.subtotal=this.subtotal),void 0!==this.total&&(t.total=this.total),void 0!==this.amountPaid&&(t.amountPaid=this.amountPaid),void 0!==this.issued&&null!==this.issued&&(t.issued="toApiJson"in this.issued?this.issued.toApiJson():this.issued),void 0!==this.due&&null!==this.due&&(t.due="toApiJson"in this.due?this.due.toApiJson():this.due),void 0!==this.created&&null!==this.created&&(t.created="toApiJson"in this.created?this.created.toApiJson():this.created),void 0!==this.updated&&null!==this.updated&&(t.updated="toApiJson"in this.updated?this.updated.toApiJson():this.updated),void 0!==this.items&&null!==this.items&&(t.items="toApiJson"in this.items?this.items.toApiJson():this.items),void 0!==this.currency&&(t.currency=this.currency),void 0!==this.paid&&null!==this.paid&&(t.paid="toApiJson"in this.paid?this.paid.toApiJson():this.paid),void 0!==this.orderId&&(t.orderId=this.orderId),void 0!==this.amountTax&&(t.amountTax=this.amountTax),void 0!==this.appliedTaxes&&null!==this.appliedTaxes&&(t.appliedTaxes="toApiJson"in this.appliedTaxes?this.appliedTaxes.toApiJson():this.appliedTaxes),void 0!==this.defaultTaxRates&&null!==this.defaultTaxRates&&(t.defaultTaxRates="toApiJson"in this.defaultTaxRates?this.defaultTaxRates.toApiJson():this.defaultTaxRates),void 0!==this.appliedBundles&&null!==this.appliedBundles&&(t.appliedBundles="toApiJson"in this.appliedBundles?this.appliedBundles.toApiJson():this.appliedBundles),void 0!==this.amountDiscount&&(t.amountDiscount=this.amountDiscount),void 0!==this.customerName&&(t.customerName=this.customerName),void 0!==this.origin&&(t.origin=this.origin),void 0!==this.collectionMethod&&(t.collectionMethod=this.collectionMethod),void 0!==this.contactId&&(t.contactId=this.contactId),void 0!==this.memo&&(t.memo=this.memo),void 0!==this.voided&&null!==this.voided&&(t.voided="toApiJson"in this.voided?this.voided.toApiJson():this.voided),void 0!==this.defaultPaymentMethod&&(t.defaultPaymentMethod=this.defaultPaymentMethod),void 0!==this.customerAddress&&null!==this.customerAddress&&(t.customerAddress="toApiJson"in this.customerAddress?this.customerAddress.toApiJson():this.customerAddress),void 0!==this.externalCustomerIdentifier&&(t.externalCustomerIdentifier=this.externalCustomerIdentifier),t},t}(),ni=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.amount&&(i.amount=parseInt(e.amount,10)),e.total&&(i.total=parseInt(e.total,10)),e.appliedTaxes&&(i.appliedTaxes=e.appliedTaxes.map(be.fromProto)),e.taxRates&&(i.taxRates=e.taxRates.map(je.fromProto)),e.discounts&&(i.discounts=e.discounts.map(ft.fromProto)),e.subtotal&&(i.subtotal=parseInt(e.subtotal,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.id&&(t.id=this.id),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.quantity&&(t.quantity=this.quantity),void 0!==this.description&&(t.description=this.description),void 0!==this.total&&(t.total=this.total),void 0!==this.appliedTaxes&&null!==this.appliedTaxes&&(t.appliedTaxes="toApiJson"in this.appliedTaxes?this.appliedTaxes.toApiJson():this.appliedTaxes),void 0!==this.taxRates&&null!==this.taxRates&&(t.taxRates="toApiJson"in this.taxRates?this.taxRates.toApiJson():this.taxRates),void 0!==this.bundleId&&(t.bundleId=this.bundleId),void 0!==this.discounts&&null!==this.discounts&&(t.discounts="toApiJson"in this.discounts?this.discounts.toApiJson():this.discounts),void 0!==this.subtotal&&(t.subtotal=this.subtotal),void 0!==this.bundleInstanceId&&(t.bundleInstanceId=this.bundleInstanceId),t},t}(),oi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.filters&&(i.filters=$e.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=X.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),ri=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoices&&(i.invoices=e.invoices.map(ii.fromProto)),e.pagingMetadata&&(i.pagingMetadata=Q.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoices&&null!==this.invoices&&(t.invoices="toApiJson"in this.invoices?this.invoices.toApiJson():this.invoices),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),si=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),t},t}(),ai=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.bundleId&&(t.bundleId=this.bundleId),void 0!==this.bundleInstanceId&&(t.bundleInstanceId=this.bundleInstanceId),t},t}(),ci=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoice&&(i.invoice=ii.fromProto(e.invoice)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoice&&null!==this.invoice&&(t.invoice="toApiJson"in this.invoice?this.invoice.toApiJson():this.invoice),t},t}(),ui=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),void 0!==this.emailAddresses&&(t.emailAddresses=this.emailAddresses),void 0!==this.languageCode&&(t.languageCode=this.languageCode),t},t}(),pi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),void 0!==this.bundleId&&(t.bundleId=this.bundleId),void 0!==this.hideBundleItems&&(t.hideBundleItems=this.hideBundleItems),void 0!==this.bundleInstanceId&&(t.bundleInstanceId=this.bundleInstanceId),t},t}(),di=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoice&&(i.invoice=ii.fromProto(e.invoice)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoice&&null!==this.invoice&&(t.invoice="toApiJson"in this.invoice?this.invoice.toApiJson():this.invoice),t},t}(),hi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.taxRateIds&&(t.taxRateIds=this.taxRateIds),t},t}(),li=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoice&&(i.invoice=ii.fromProto(e.invoice)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoice&&null!==this.invoice&&(t.invoice="toApiJson"in this.invoice?this.invoice.toApiJson():this.invoice),t},t}(),mi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoice&&(i.invoice=ii.fromProto(e.invoice)),e.fieldMask&&(i.fieldMask=Te.fromProto(e.fieldMask)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoice&&null!==this.invoice&&(t.invoice="toApiJson"in this.invoice?this.invoice.toApiJson():this.invoice),void 0!==this.fieldMask&&null!==this.fieldMask&&(t.fieldMask="toApiJson"in this.fieldMask?this.fieldMask.toApiJson():this.fieldMask),t},t}(),vi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoice&&(i.invoice=ii.fromProto(e.invoice)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoice&&null!==this.invoice&&(t.invoice="toApiJson"in this.invoice?this.invoice.toApiJson():this.invoice),t},t}(),fi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.amount&&(i.amount=parseInt(e.amount,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),void 0!==this.id&&(t.id=this.id),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.quantity&&(t.quantity=this.quantity),void 0!==this.description&&(t.description=this.description),void 0!==this.taxRates&&(t.taxRates=this.taxRates),t},t}(),gi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoice&&(i.invoice=ii.fromProto(e.invoice)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoice&&null!==this.invoice&&(t.invoice="toApiJson"in this.invoice?this.invoice.toApiJson():this.invoice),t},t}(),Ii=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),t},t}();var Ai=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.amount&&(i.amount=parseInt(e.amount,10)),e.futurePayouts&&(i.futurePayouts=parseInt(e.futurePayouts,10)),e.inTransit&&(i.inTransit=parseInt(e.inTransit,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.currencyCode&&(t.currencyCode=this.currencyCode),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.futurePayouts&&(t.futurePayouts=this.futurePayouts),void 0!==this.inTransit&&(t.inTransit=this.inTransit),t},t}();var yi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.start&&(i.start=new Date(e.start)),e.end&&(i.end=new Date(e.end)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.start&&null!==this.start&&(t.start="toApiJson"in this.start?this.start.toApiJson():this.start),void 0!==this.end&&null!==this.end&&(t.end="toApiJson"in this.end?this.end.toApiJson():this.end),t},t}();function Si(t,e){return"number"==typeof e?e:t[e]}var Pi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.arrivalDateRange&&(i.arrivalDateRange=yi.fromProto(e.arrivalDateRange)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.arrivalDateRange&&null!==this.arrivalDateRange&&(t.arrivalDateRange="toApiJson"in this.arrivalDateRange?this.arrivalDateRange.toApiJson():this.arrivalDateRange),t},t}(),bi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.filters&&(i.filters=Pi.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=X.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),Ti=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.payouts&&(i.payouts=e.payouts.map(Oi.fromProto)),e.pagingMetadata&&(i.pagingMetadata=Q.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.payouts&&null!==this.payouts&&(t.payouts="toApiJson"in this.payouts?this.payouts.toApiJson():this.payouts),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),Oi=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.arrivalDate&&(n.arrivalDate=new Date(i.arrivalDate)),i.amount&&(n.amount=parseInt(i.amount,10)),i.currency&&(n.currency=Si(u,i.currency)),i.status&&(n.status=Si(t.PayoutStatus,i.status)),i.type&&(n.type=Si(I,i.type)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.id&&(t.id=this.id),void 0!==this.arrivalDate&&null!==this.arrivalDate&&(t.arrivalDate="toApiJson"in this.arrivalDate?this.arrivalDate.toApiJson():this.arrivalDate),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.currency&&(t.currency=this.currency),void 0!==this.status&&(t.status=this.status),void 0!==this.type&&(t.type=this.type),void 0!==this.lastFourDigits&&(t.lastFourDigits=this.lastFourDigits),void 0!==this.bankName&&(t.bankName=this.bankName),void 0!==this.bankId&&(t.bankId=this.bankId),t},e}(),Ei=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.bankReconciliationId&&(t.bankReconciliationId=this.bankReconciliationId),void 0!==this.payoutId&&(t.payoutId=this.payoutId),void 0!==this.allowRetries&&(t.allowRetries=this.allowRetries),t},t}(),Ri=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.pipelineId&&(t.pipelineId=this.pipelineId),t},t}(),Ci=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.arrivalDate&&(n.arrivalDate=new Date(i.arrivalDate)),i.amount&&(n.amount=parseInt(i.amount,10)),i.status&&(n.status=Si(t.PayoutStatus,i.status)),i.type&&(n.type=Si(I,i.type)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.id&&(t.id=this.id),void 0!==this.arrivalDate&&null!==this.arrivalDate&&(t.arrivalDate="toApiJson"in this.arrivalDate?this.arrivalDate.toApiJson():this.arrivalDate),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.currencyCode&&(t.currencyCode=this.currencyCode),void 0!==this.status&&(t.status=this.status),void 0!==this.type&&(t.type=this.type),void 0!==this.lastFourDigits&&(t.lastFourDigits=this.lastFourDigits),void 0!==this.bankName&&(t.bankName=this.bankName),void 0!==this.bankId&&(t.bankId=this.bankId),void 0!==this.failureCode&&(t.failureCode=this.failureCode),void 0!==this.failureMessage&&(t.failureMessage=this.failureMessage),t},e}();function Di(t,e){return"number"==typeof e?e:t[e]}var _i=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.amount&&(i.amount=parseInt(e.amount,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),void 0!==this.amount&&(t.amount=this.amount),t},t}(),Ji=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.countryCode&&(t.countryCode=this.countryCode),void 0!==this.failureUrl&&(t.failureUrl=this.failureUrl),void 0!==this.successUrl&&(t.successUrl=this.successUrl),void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),Ni=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.stripeUrl&&(t.stripeUrl=this.stripeUrl),void 0!==this.error&&(t.error=this.error),t},t}(),wi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.includeInFinancialRecords&&(i.includeInFinancialRecords=zi.fromProto(e.includeInFinancialRecords)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.address&&(t.address=this.address),void 0!==this.city&&(t.city=this.city),void 0!==this.state&&(t.state=this.state),void 0!==this.country&&(t.country=this.country),void 0!==this.zipCode&&(t.zipCode=this.zipCode),void 0!==this.emailAddress&&(t.emailAddress=this.emailAddress),void 0!==this.phoneNumber&&(t.phoneNumber=this.phoneNumber),void 0!==this.contactName&&(t.contactName=this.contactName),void 0!==this.companyName&&(t.companyName=this.companyName),void 0!==this.additionalEmailAddresses&&(t.additionalEmailAddresses=this.additionalEmailAddresses),void 0!==this.includeInFinancialRecords&&null!==this.includeInFinancialRecords&&(t.includeInFinancialRecords="toApiJson"in this.includeInFinancialRecords?this.includeInFinancialRecords.toApiJson():this.includeInFinancialRecords),void 0!==this.hasAlternativePaymentMethod&&(t.hasAlternativePaymentMethod=this.hasAlternativePaymentMethod),t},t}(),ji=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoiceDay&&(i.invoiceDay=parseInt(e.invoiceDay,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.generateMethod&&(t.generateMethod=this.generateMethod),void 0!==this.collectionMethod&&(t.collectionMethod=this.collectionMethod),void 0!==this.invoiceDay&&(t.invoiceDay=this.invoiceDay),t},t}(),Mi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),Ui=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.merchant&&(i.merchant=Qi.fromProto(e.merchant)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchant&&null!==this.merchant&&(t.merchant="toApiJson"in this.merchant?this.merchant.toApiJson():this.merchant),t},t}(),Bi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.retailGroupIds&&(t.retailGroupIds=this.retailGroupIds),t},t}(),Li=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.retailConfigurations&&(i.retailConfigurations=Object.keys(e.retailConfigurations).reduce((function(t,i){return t[i]=Zi.fromProto(e.retailConfigurations[i]),t}),{})),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.retailConfigurations&&null!==this.retailConfigurations&&(t.retailConfigurations="toApiJson"in this.retailConfigurations?this.retailConfigurations.toApiJson():this.retailConfigurations),t},t}(),ki=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),xi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.outstandingBalance&&(i.outstandingBalance=parseInt(e.outstandingBalance,10)),e.currency&&(i.currency=Di(u,e.currency)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.outstandingBalance&&(t.outstandingBalance=this.outstandingBalance),void 0!==this.currency&&(t.currency=this.currency),t},t}(),Fi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),Yi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.balances&&(i.balances=e.balances.map(Ai.fromProto)),e.nextInTransitPayoutExpectedDate&&(i.nextInTransitPayoutExpectedDate=new Date(e.nextInTransitPayoutExpectedDate)),e.payoutDelayDays&&(i.payoutDelayDays=parseInt(e.payoutDelayDays,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.balances&&null!==this.balances&&(t.balances="toApiJson"in this.balances?this.balances.toApiJson():this.balances),void 0!==this.nextInTransitPayoutExpectedDate&&null!==this.nextInTransitPayoutExpectedDate&&(t.nextInTransitPayoutExpectedDate="toApiJson"in this.nextInTransitPayoutExpectedDate?this.nextInTransitPayoutExpectedDate.toApiJson():this.nextInTransitPayoutExpectedDate),void 0!==this.payoutInterval&&(t.payoutInterval=this.payoutInterval),void 0!==this.payoutDelayDays&&(t.payoutDelayDays=this.payoutDelayDays),t},t}(),Gi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),qi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.balances&&(i.balances=e.balances.map(Ai.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.balances&&null!==this.balances&&(t.balances="toApiJson"in this.balances?this.balances.toApiJson():this.balances),t},t}(),Hi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.payoutId&&(t.payoutId=this.payoutId),t},t}(),Wi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.payout&&(i.payout=Ci.fromProto(e.payout)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.payout&&null!==this.payout&&(t.payout="toApiJson"in this.payout?this.payout.toApiJson():this.payout),t},t}(),Vi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.includeInFinancialRecords&&(t.includeInFinancialRecords=this.includeInFinancialRecords),t},t}(),zi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.includeInFinancialRecords&&(t.includeInFinancialRecords=this.includeInFinancialRecords),t},t}(),Ki=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.pagingOptions&&(i.pagingOptions=X.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),Xi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.payouts&&(i.payouts=e.payouts.map(Ci.fromProto)),e.pagingMetadata&&(i.pagingMetadata=Q.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.payouts&&null!==this.payouts&&(t.payouts="toApiJson"in this.payouts?this.payouts.toApiJson():this.payouts),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),Qi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.address&&(t.address=this.address),void 0!==this.city&&(t.city=this.city),void 0!==this.state&&(t.state=this.state),void 0!==this.country&&(t.country=this.country),void 0!==this.zipCode&&(t.zipCode=this.zipCode),void 0!==this.emailAddress&&(t.emailAddress=this.emailAddress),void 0!==this.phoneNumber&&(t.phoneNumber=this.phoneNumber),void 0!==this.contactName&&(t.contactName=this.contactName),void 0!==this.companyName&&(t.companyName=this.companyName),void 0!==this.autoPostInvoices&&(t.autoPostInvoices=this.autoPostInvoices),void 0!==this.autoChargeInvoices&&(t.autoChargeInvoices=this.autoChargeInvoices),void 0!==this.includeInFinancialRecords&&(t.includeInFinancialRecords=this.includeInFinancialRecords),void 0!==this.additionalEmailAddresses&&(t.additionalEmailAddresses=this.additionalEmailAddresses),void 0!==this.hasAlternativePaymentMethod&&(t.hasAlternativePaymentMethod=this.hasAlternativePaymentMethod),void 0!==this.stripeAccountId&&(t.stripeAccountId=this.stripeAccountId),t},t}(),Zi=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.defaultCustomerConfiguration&&(i.defaultCustomerConfiguration=ji.fromProto(e.defaultCustomerConfiguration)),e.currencyConversionRate&&(i.currencyConversionRate=parseInt(e.currencyConversionRate,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.retailGroupId&&(t.retailGroupId=this.retailGroupId),void 0!==this.currencyCode&&(t.currencyCode=this.currencyCode),void 0!==this.defaultCustomerConfiguration&&null!==this.defaultCustomerConfiguration&&(t.defaultCustomerConfiguration="toApiJson"in this.defaultCustomerConfiguration?this.defaultCustomerConfiguration.toApiJson():this.defaultCustomerConfiguration),void 0!==this.currencyConversionRate&&(t.currencyConversionRate=this.currencyConversionRate),t},t}(),$i=(function(){function t(t){t&&Object.assign(this,t)}t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.value&&(i.value=Zi.fromProto(e.value)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.key&&(t.key=this.key),void 0!==this.value&&null!==this.value&&(t.value="toApiJson"in this.value?this.value.toApiJson():this.value),t}}(),function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.sortBy&&(i.sortBy=Di(y,e.sortBy)),e.sortDirection&&(i.sortDirection=Di(A,e.sortDirection)),e.pagingOptions&&(i.pagingOptions=X.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.searchTerm&&(t.searchTerm=this.searchTerm),void 0!==this.sortBy&&(t.sortBy=this.sortBy),void 0!==this.sortDirection&&(t.sortDirection=this.sortDirection),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}()),tn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.merchants&&(i.merchants=e.merchants.map(Qi.fromProto)),e.pagingMetadata&&(i.pagingMetadata=Q.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchants&&null!==this.merchants&&(t.merchants="toApiJson"in this.merchants?this.merchants.toApiJson():this.merchants),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),en=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.autoChargeInvoices&&(t.autoChargeInvoices=this.autoChargeInvoices),t},t}(),nn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.shouldAutoPostInvoices&&(t.shouldAutoPostInvoices=this.shouldAutoPostInvoices),t},t}(),on=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.cardId&&(t.cardId=this.cardId),t},t}(),rn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.hasAlternativePaymentMethod&&(t.hasAlternativePaymentMethod=this.hasAlternativePaymentMethod),t},t}(),sn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.includeInFinancialRecords&&(t.includeInFinancialRecords=this.includeInFinancialRecords),t},t}(),an=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.includeInFinancialRecords&&(i.includeInFinancialRecords=Vi.fromProto(e.includeInFinancialRecords)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.address&&(t.address=this.address),void 0!==this.city&&(t.city=this.city),void 0!==this.state&&(t.state=this.state),void 0!==this.country&&(t.country=this.country),void 0!==this.zipCode&&(t.zipCode=this.zipCode),void 0!==this.emailAddress&&(t.emailAddress=this.emailAddress),void 0!==this.phoneNumber&&(t.phoneNumber=this.phoneNumber),void 0!==this.contactName&&(t.contactName=this.contactName),void 0!==this.companyName&&(t.companyName=this.companyName),void 0!==this.additionalEmailAddresses&&(t.additionalEmailAddresses=this.additionalEmailAddresses),void 0!==this.includeInFinancialRecords&&null!==this.includeInFinancialRecords&&(t.includeInFinancialRecords="toApiJson"in this.includeInFinancialRecords?this.includeInFinancialRecords.toApiJson():this.includeInFinancialRecords),void 0!==this.hasAlternativePaymentMethod&&(t.hasAlternativePaymentMethod=this.hasAlternativePaymentMethod),t},t}(),cn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.defaultCustomerConfiguration&&(i.defaultCustomerConfiguration=ji.fromProto(e.defaultCustomerConfiguration)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.retailGroupId&&(t.retailGroupId=this.retailGroupId),void 0!==this.defaultCustomerConfiguration&&null!==this.defaultCustomerConfiguration&&(t.defaultCustomerConfiguration="toApiJson"in this.defaultCustomerConfiguration?this.defaultCustomerConfiguration.toApiJson():this.defaultCustomerConfiguration),t},t}(),un=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.currencyConversionRate&&(i.currencyConversionRate=parseInt(e.currencyConversionRate,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.retailGroupId&&(t.retailGroupId=this.retailGroupId),void 0!==this.currencyCode&&(t.currencyCode=this.currencyCode),void 0!==this.currencyConversionRate&&(t.currencyConversionRate=this.currencyConversionRate),t},t}();function pn(t,e){return"number"==typeof e?e:t[e]}var dn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.pagingOptions&&(i.pagingOptions=X.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),hn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.reports&&(i.reports=e.reports.map(ln.fromProto)),e.pagingMetadata&&(i.pagingMetadata=Q.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.reports&&null!==this.reports&&(t.reports="toApiJson"in this.reports?this.reports.toApiJson():this.reports),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),ln=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.year&&(i.year=parseInt(e.year,10)),e.month&&(i.month=pn(S,e.month)),e.created&&(i.created=new Date(e.created)),e.status&&(i.status=pn(P,e.status)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.year&&(t.year=this.year),void 0!==this.month&&(t.month=this.month),void 0!==this.created&&null!==this.created&&(t.created="toApiJson"in this.created?this.created.toApiJson():this.created),void 0!==this.status&&(t.status=this.status),t},t}();var mn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.component&&(i.component=vn.fromProto(e.component)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.component&&null!==this.component&&(t.component="toApiJson"in this.component?this.component.toApiJson():this.component),void 0!==this.sku&&(t.sku=this.sku),t},t}(),vn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.componentId&&(t.componentId=this.componentId),void 0!==this.name&&(t.name=this.name),t},t}(),fn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.quantity&&(i.quantity=parseInt(e.quantity,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.componentId&&(t.componentId=this.componentId),void 0!==this.orderId&&(t.orderId=this.orderId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.quantity&&(t.quantity=this.quantity),void 0!==this.idempotencyKey&&(t.idempotencyKey=this.idempotencyKey),t},t}();function gn(t,e){return"number"==typeof e?e:t[e]}var In=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.cardType&&(i.cardType=gn(b,e.cardType)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.cardType&&(t.cardType=this.cardType),void 0!==this.lastFourDigits&&(t.lastFourDigits=this.lastFourDigits),t},t}(),An=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.disputeId&&(t.disputeId=this.disputeId),t},t}(),yn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.failureUrl&&(t.failureUrl=this.failureUrl),void 0!==this.successUrl&&(t.successUrl=this.successUrl),t},t}(),Sn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.stripeUrl&&(t.stripeUrl=this.stripeUrl),void 0!==this.error&&(t.error=this.error),t},t}(),Pn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.id&&(t.id=this.id),t},t}(),bn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.status&&(i.status=gn(T,e.status)),e.amount&&(i.amount=parseInt(e.amount,10)),e.created&&(i.created=new Date(e.created)),e.evidence&&(i.evidence=Tn.fromProto(e.evidence)),e.evidenceDetails&&(i.evidenceDetails=En.fromProto(e.evidenceDetails)),e.fee&&(i.fee=parseInt(e.fee,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.paymentId&&(t.paymentId=this.paymentId),void 0!==this.status&&(t.status=this.status),void 0!==this.id&&(t.id=this.id),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.created&&null!==this.created&&(t.created="toApiJson"in this.created?this.created.toApiJson():this.created),void 0!==this.currencyCode&&(t.currencyCode=this.currencyCode),void 0!==this.evidence&&null!==this.evidence&&(t.evidence="toApiJson"in this.evidence?this.evidence.toApiJson():this.evidence),void 0!==this.evidenceDetails&&null!==this.evidenceDetails&&(t.evidenceDetails="toApiJson"in this.evidenceDetails?this.evidenceDetails.toApiJson():this.evidenceDetails),void 0!==this.isChargeRefundable&&(t.isChargeRefundable=this.isChargeRefundable),void 0!==this.reason&&(t.reason=this.reason),void 0!==this.fee&&(t.fee=this.fee),void 0!==this.feeCurrencyCode&&(t.feeCurrencyCode=this.feeCurrencyCode),t},t}(),Tn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.customerCommunication&&(i.customerCommunication=Rn.fromProto(e.customerCommunication)),e.customerSignature&&(i.customerSignature=Rn.fromProto(e.customerSignature)),e.shippingDocumentation&&(i.shippingDocumentation=Rn.fromProto(e.shippingDocumentation)),e.receipt&&(i.receipt=Rn.fromProto(e.receipt)),e.uncategorizedFile&&(i.uncategorizedFile=Rn.fromProto(e.uncategorizedFile)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.customerCommunication&&null!==this.customerCommunication&&(t.customerCommunication="toApiJson"in this.customerCommunication?this.customerCommunication.toApiJson():this.customerCommunication),void 0!==this.customerSignature&&null!==this.customerSignature&&(t.customerSignature="toApiJson"in this.customerSignature?this.customerSignature.toApiJson():this.customerSignature),void 0!==this.shippingDocumentation&&null!==this.shippingDocumentation&&(t.shippingDocumentation="toApiJson"in this.shippingDocumentation?this.shippingDocumentation.toApiJson():this.shippingDocumentation),void 0!==this.receipt&&null!==this.receipt&&(t.receipt="toApiJson"in this.receipt?this.receipt.toApiJson():this.receipt),void 0!==this.uncategorizedFile&&null!==this.uncategorizedFile&&(t.uncategorizedFile="toApiJson"in this.uncategorizedFile?this.uncategorizedFile.toApiJson():this.uncategorizedFile),void 0!==this.billingAddress&&(t.billingAddress=this.billingAddress),void 0!==this.customerEmailAddress&&(t.customerEmailAddress=this.customerEmailAddress),void 0!==this.customerName&&(t.customerName=this.customerName),void 0!==this.productDescription&&(t.productDescription=this.productDescription),t},t}(),On=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.billingAddress&&(t.billingAddress=this.billingAddress),void 0!==this.customerEmailAddress&&(t.customerEmailAddress=this.customerEmailAddress),void 0!==this.customerName&&(t.customerName=this.customerName),void 0!==this.productDescription&&(t.productDescription=this.productDescription),void 0!==this.customerSignatureFileId&&(t.customerSignatureFileId=this.customerSignatureFileId),void 0!==this.customerCommunicationFileId&&(t.customerCommunicationFileId=this.customerCommunicationFileId),void 0!==this.receiptFileId&&(t.receiptFileId=this.receiptFileId),void 0!==this.shippingDocumentationFileId&&(t.shippingDocumentationFileId=this.shippingDocumentationFileId),void 0!==this.uncategorizedFileId&&(t.uncategorizedFileId=this.uncategorizedFileId),t},t}(),En=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.dueBy&&(i.dueBy=new Date(e.dueBy)),e.submissionCount&&(i.submissionCount=parseInt(e.submissionCount,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.dueBy&&null!==this.dueBy&&(t.dueBy="toApiJson"in this.dueBy?this.dueBy.toApiJson():this.dueBy),void 0!==this.hasEvidence&&(t.hasEvidence=this.hasEvidence),void 0!==this.pastDue&&(t.pastDue=this.pastDue),void 0!==this.submissionCount&&(t.submissionCount=this.submissionCount),t},t}(),Rn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.created&&(i.created=new Date(e.created)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.created&&null!==this.created&&(t.created="toApiJson"in this.created?this.created.toApiJson():this.created),void 0!==this.id&&(t.id=this.id),void 0!==this.filename&&(t.filename=this.filename),void 0!==this.url&&(t.url=this.url),t},t}(),Cn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.disputeId&&(t.disputeId=this.disputeId),t},t}(),Dn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.dispute&&(i.dispute=bn.fromProto(e.dispute)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.dispute&&null!==this.dispute&&(t.dispute="toApiJson"in this.dispute?this.dispute.toApiJson():this.dispute),t},t}(),_n=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),Jn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.statementDescriptor&&(t.statementDescriptor=this.statementDescriptor),void 0!==this.stripeConnectId&&(t.stripeConnectId=this.stripeConnectId),t},t}(),Nn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.paymentId&&(t.paymentId=this.paymentId),t},t}(),wn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.payment&&(i.payment=Vn.fromProto(e.payment)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.payment&&null!==this.payment&&(t.payment="toApiJson"in this.payment?this.payment.toApiJson():this.payment),t},t}(),jn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.start&&(i.start=new Date(e.start)),e.end&&(i.end=new Date(e.end)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.allocationIds&&(t.allocationIds=this.allocationIds),void 0!==this.start&&null!==this.start&&(t.start="toApiJson"in this.start?this.start.toApiJson():this.start),void 0!==this.end&&null!==this.end&&(t.end="toApiJson"in this.end?this.end.toApiJson():this.end),t},t}(),Mn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.filters&&(i.filters=jn.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=X.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),Un=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.payments&&(i.payments=e.payments.map(Gn.fromProto)),e.pagingMetadata&&(i.pagingMetadata=Q.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.payments&&null!==this.payments&&(t.payments="toApiJson"in this.payments?this.payments.toApiJson():this.payments),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),Bn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.pagingOptions&&(i.pagingOptions=X.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),Ln=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.disputes&&(i.disputes=e.disputes.map(bn.fromProto)),e.pagingMetadata&&(i.pagingMetadata=Q.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.disputes&&null!==this.disputes&&(t.disputes="toApiJson"in this.disputes?this.disputes.toApiJson():this.disputes),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),kn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.createdDateGte&&(i.createdDateGte=new Date(e.createdDateGte)),e.createdDateLte&&(i.createdDateLte=new Date(e.createdDateLte)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.payoutId&&(t.payoutId=this.payoutId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.createdDateGte&&null!==this.createdDateGte&&(t.createdDateGte="toApiJson"in this.createdDateGte?this.createdDateGte.toApiJson():this.createdDateGte),void 0!==this.createdDateLte&&null!==this.createdDateLte&&(t.createdDateLte="toApiJson"in this.createdDateLte?this.createdDateLte.toApiJson():this.createdDateLte),t},t}(),xn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.pagingOptions&&(i.pagingOptions=X.fromProto(e.pagingOptions)),e.filters&&(i.filters=kn.fromProto(e.filters)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),t},t}(),Fn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.payments&&(i.payments=e.payments.map(Vn.fromProto)),e.pagingMetadata&&(i.pagingMetadata=Q.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.payments&&null!==this.payments&&(t.payments="toApiJson"in this.payments?this.payments.toApiJson():this.payments),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),Yn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.amount&&(i.amount=parseInt(e.amount,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.orderId&&(t.orderId=this.orderId),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.currencyCode&&(t.currencyCode=this.currencyCode),void 0!==this.paymentMethodId&&(t.paymentMethodId=this.paymentMethodId),t},t}(),Gn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.created&&(i.created=new Date(e.created)),e.currency&&(i.currency=gn(u,e.currency)),e.paymentSource&&(i.paymentSource=gn(E,e.paymentSource)),e.allocations&&(i.allocations=e.allocations.map(qn.fromProto)),e.total&&(i.total=parseInt(e.total,10)),e.status&&(i.status=gn(R,e.status)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.created&&null!==this.created&&(t.created="toApiJson"in this.created?this.created.toApiJson():this.created),void 0!==this.currency&&(t.currency=this.currency),void 0!==this.paymentSource&&(t.paymentSource=this.paymentSource),void 0!==this.allocations&&null!==this.allocations&&(t.allocations="toApiJson"in this.allocations?this.allocations.toApiJson():this.allocations),void 0!==this.total&&(t.total=this.total),void 0!==this.description&&(t.description=this.description),void 0!==this.externalReferenceId&&(t.externalReferenceId=this.externalReferenceId),void 0!==this.status&&(t.status=this.status),t},t}(),qn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.amount&&(i.amount=parseInt(e.amount,10)),e.type&&(i.type=gn(O,e.type)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.referenceId&&(t.referenceId=this.referenceId),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.type&&(t.type=this.type),t},t}(),Hn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.order&&(i.order=Yn.fromProto(e.order)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),void 0!==this.order&&null!==this.order&&(t.order="toApiJson"in this.order?this.order.toApiJson():this.order),t},t}(),Wn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.stripeClientSecret&&(t.stripeClientSecret=this.stripeClientSecret),void 0!==this.intentId&&(t.intentId=this.intentId),t},t}(),Vn=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.created&&(n.created=new Date(i.created)),i.amount&&(n.amount=parseInt(i.amount,10)),i.referenceType&&(n.referenceType=gn(t.RetailPaymentReferenceTypeEnum,i.referenceType)),i.status&&(n.status=gn(R,i.status)),i.applicationFee&&(n.applicationFee=parseInt(i.applicationFee,10)),i.dispute&&(n.dispute=bn.fromProto(i.dispute)),i.cardDetails&&(n.cardDetails=In.fromProto(i.cardDetails)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.created&&null!==this.created&&(t.created="toApiJson"in this.created?this.created.toApiJson():this.created),void 0!==this.currencyCode&&(t.currencyCode=this.currencyCode),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.referenceId&&(t.referenceId=this.referenceId),void 0!==this.referenceType&&(t.referenceType=this.referenceType),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.status&&(t.status=this.status),void 0!==this.description&&(t.description=this.description),void 0!==this.failureCode&&(t.failureCode=this.failureCode),void 0!==this.failureMessage&&(t.failureMessage=this.failureMessage),void 0!==this.applicationFee&&(t.applicationFee=this.applicationFee),void 0!==this.disputed&&(t.disputed=this.disputed),void 0!==this.id&&(t.id=this.id),void 0!==this.dispute&&null!==this.dispute&&(t.dispute="toApiJson"in this.dispute?this.dispute.toApiJson():this.dispute),void 0!==this.cardDetails&&null!==this.cardDetails&&(t.cardDetails="toApiJson"in this.cardDetails?this.cardDetails.toApiJson():this.cardDetails),t},e}(),zn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),Kn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.enabled&&(t.enabled=this.enabled),t},t}(),Xn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),Qn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.requirements&&(i.requirements=eo.fromProto(e.requirements)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.supportedRegion&&(t.supportedRegion=this.supportedRegion),void 0!==this.canAcceptPayment&&(t.canAcceptPayment=this.canAcceptPayment),void 0!==this.requirements&&null!==this.requirements&&(t.requirements="toApiJson"in this.requirements?this.requirements.toApiJson():this.requirements),void 0!==this.disabledReason&&(t.disabledReason=this.disabledReason),t},t}(),Zn=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.evidence&&(i.evidence=On.fromProto(e.evidence)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.disputeId&&(t.disputeId=this.disputeId),void 0!==this.paymentId&&(t.paymentId=this.paymentId),void 0!==this.evidence&&null!==this.evidence&&(t.evidence="toApiJson"in this.evidence?this.evidence.toApiJson():this.evidence),void 0!==this.submit&&(t.submit=this.submit),t},t}(),$n=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.statementDescriptor&&(t.statementDescriptor=this.statementDescriptor),t},t}(),to=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.requirement&&(t.requirement=this.requirement),void 0!==this.code&&(t.code=this.code),void 0!==this.reason&&(t.reason=this.reason),t},t}(),eo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.error&&(i.error=e.error.map(to.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.due&&(t.due=this.due),void 0!==this.error&&null!==this.error&&(t.error="toApiJson"in this.error?this.error.toApiJson():this.error),t},t}();function io(t,e){return"number"==typeof e?e:t[e]}var no=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.stripeToken&&(t.stripeToken=this.stripeToken),t},t}(),oo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.cardId&&(t.cardId=this.cardId),t},t}(),ro=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),t},t}(),so=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.paymentCard&&(i.paymentCard=e.paymentCard.map(ao.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.paymentCard&&null!==this.paymentCard&&(t.paymentCard="toApiJson"in this.paymentCard?this.paymentCard.toApiJson():this.paymentCard),t},t}(),ao=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.cardType&&(n.cardType=io(t.CARD_TYPE,i.cardType)),i.fundingType&&(n.fundingType=io(_,i.fundingType)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.lastFourDigits&&(t.lastFourDigits=this.lastFourDigits),void 0!==this.cardType&&(t.cardType=this.cardType),void 0!==this.address&&(t.address=this.address),void 0!==this.city&&(t.city=this.city),void 0!==this.state&&(t.state=this.state),void 0!==this.country&&(t.country=this.country),void 0!==this.zipCode&&(t.zipCode=this.zipCode),void 0!==this.cardId&&(t.cardId=this.cardId),void 0!==this.cardholderName&&(t.cardholderName=this.cardholderName),void 0!==this.expiryMonth&&(t.expiryMonth=this.expiryMonth),void 0!==this.expiryYear&&(t.expiryYear=this.expiryYear),void 0!==this.fundingType&&(t.fundingType=this.fundingType),void 0!==this.default&&(t.default=this.default),t},e}(),co=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.paymentMethodId&&(t.paymentMethodId=this.paymentMethodId),t},t}(),uo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.stripeToken&&(t.stripeToken=this.stripeToken),t},t}();function po(t,e){return"number"==typeof e?e:t[e]}var ho=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.unitPrice&&(i.unitPrice=parseInt(e.unitPrice,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.componentId&&(t.componentId=this.componentId),void 0!==this.unitPrice&&(t.unitPrice=this.unitPrice),t},t}(),lo=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.defaultBillingStrategy&&(n.defaultBillingStrategy=po(t.PricingPlanBillingStrategy,i.defaultBillingStrategy)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.name&&(t.name=this.name),void 0!==this.defaultBillingStrategy&&(t.defaultBillingStrategy=this.defaultBillingStrategy),t},e}(),mo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.id&&(t.id=this.id),t},t}(),vo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.pricingPlanIds&&(t.pricingPlanIds=this.pricingPlanIds),t},t}(),fo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.plans&&(i.plans=e.plans.map(go.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.plans&&null!==this.plans&&(t.plans="toApiJson"in this.plans?this.plans.toApiJson():this.plans),t},t}(),go=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.defaultBillingStrategy&&(n.defaultBillingStrategy=po(t.PricingPlanBillingStrategy,i.defaultBillingStrategy)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.id&&(t.id=this.id),void 0!==this.name&&(t.name=this.name),void 0!==this.defaultBillingStrategy&&(t.defaultBillingStrategy=this.defaultBillingStrategy),t},e}(),Io=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.type&&(n.type=po(N,i.type)),i.rules&&(n.rules=i.rules.map(Ao.fromProto)),i.setupFee&&(n.setupFee=parseInt(i.setupFee,10)),i.frequency&&(n.frequency=po(t.GeneratedFrequency,i.frequency)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.type&&(t.type=this.type),void 0!==this.rules&&null!==this.rules&&(t.rules="toApiJson"in this.rules?this.rules.toApiJson():this.rules),void 0!==this.setupFee&&(t.setupFee=this.setupFee),void 0!==this.frequency&&(t.frequency=this.frequency),void 0!==this.currencyCode&&(t.currencyCode=this.currencyCode),t},e}(),Ao=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.price&&(i.price=parseInt(e.price,10)),e.minUnits&&(i.minUnits=parseInt(e.minUnits,10)),e.maxUnits&&(i.maxUnits=parseInt(e.maxUnits,10)),e.componentPricing&&(i.componentPricing=e.componentPricing.map(ho.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.price&&(t.price=this.price),void 0!==this.minUnits&&(t.minUnits=this.minUnits),void 0!==this.maxUnits&&(t.maxUnits=this.maxUnits),void 0!==this.componentPricing&&null!==this.componentPricing&&(t.componentPricing="toApiJson"in this.componentPricing?this.componentPricing.toApiJson():this.componentPricing),t},t}(),yo=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.fieldMask&&(n.fieldMask=Te.fromProto(i.fieldMask)),i.defaultBillingStrategy&&(n.defaultBillingStrategy=po(t.PricingPlanBillingStrategy,i.defaultBillingStrategy)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.id&&(t.id=this.id),void 0!==this.fieldMask&&null!==this.fieldMask&&(t.fieldMask="toApiJson"in this.fieldMask?this.fieldMask.toApiJson():this.fieldMask),void 0!==this.name&&(t.name=this.name),void 0!==this.defaultBillingStrategy&&(t.defaultBillingStrategy=this.defaultBillingStrategy),t},e}(),So=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){return{}},t}();function Po(t,e){return"number"==typeof e?e:t[e]}var bo=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.frequency&&(n.frequency=Po(t.GeneratedFrequency,i.frequency)),i.pricing&&(n.pricing=Object.keys(i.pricing).reduce((function(t,e){return t[e]=Io.fromProto(i.pricing[e]),t}),{})),i.commitment&&(n.commitment=Dt.fromProto(i.commitment)),i.strategy&&(n.strategy=Po(t.PricingPlanBillingStrategy,i.strategy)),i.volumeCommitment&&(n.volumeCommitment=parseInt(i.volumeCommitment,10)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.pricingPlanId&&(t.pricingPlanId=this.pricingPlanId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.frequency&&(t.frequency=this.frequency),void 0!==this.pricing&&null!==this.pricing&&(t.pricing="toApiJson"in this.pricing?this.pricing.toApiJson():this.pricing),void 0!==this.commitment&&null!==this.commitment&&(t.commitment="toApiJson"in this.commitment?this.commitment.toApiJson():this.commitment),void 0!==this.strategy&&(t.strategy=this.strategy),void 0!==this.volumeCommitment&&(t.volumeCommitment=this.volumeCommitment),t},e}(),To=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.pricingPlanId&&(t.pricingPlanId=this.pricingPlanId),void 0!==this.sku&&(t.sku=this.sku),t},t}(),Oo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.pricingPlanId&&(t.pricingPlanId=this.pricingPlanId),void 0!==this.sku&&(t.sku=this.sku),t},t}(),Eo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.pricingPlanId&&(t.pricingPlanId=this.pricingPlanId),void 0!==this.skus&&(t.skus=this.skus),t},t}(),Ro=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.pricingPlanProducts&&(i.pricingPlanProducts=e.pricingPlanProducts.map(wo.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.pricingPlanProducts&&null!==this.pricingPlanProducts&&(t.pricingPlanProducts="toApiJson"in this.pricingPlanProducts?this.pricingPlanProducts.toApiJson():this.pricingPlanProducts),t},t}(),Co=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.pricingPlanId&&(t.pricingPlanId=this.pricingPlanId),void 0!==this.sku&&(t.sku=this.sku),t},t}(),Do=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.pricingPlanProduct&&(n.pricingPlanProduct=wo.fromProto(i.pricingPlanProduct)),i.pricingPlanDefaultStrategy&&(n.pricingPlanDefaultStrategy=Po(t.PricingPlanBillingStrategy,i.pricingPlanDefaultStrategy)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.pricingPlanProduct&&null!==this.pricingPlanProduct&&(t.pricingPlanProduct="toApiJson"in this.pricingPlanProduct?this.pricingPlanProduct.toApiJson():this.pricingPlanProduct),void 0!==this.pricingPlanDefaultStrategy&&(t.pricingPlanDefaultStrategy=this.pricingPlanDefaultStrategy),t},e}(),_o=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.pricingPlanIds&&(t.pricingPlanIds=this.pricingPlanIds),t},t}(),Jo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.pagingOptions&&(i.pagingOptions=X.fromProto(e.pagingOptions)),e.filters&&(i.filters=_o.fromProto(e.filters)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),t},t}(),No=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.products&&(i.products=e.products.map(wo.fromProto)),e.pagingMetadata&&(i.pagingMetadata=Q.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.products&&null!==this.products&&(t.products="toApiJson"in this.products?this.products.toApiJson():this.products),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),wo=(function(){function t(t){t&&Object.assign(this,t)}t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.value&&(i.value=Io.fromProto(e.value)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.key&&(t.key=this.key),void 0!==this.value&&null!==this.value&&(t.value="toApiJson"in this.value?this.value.toApiJson():this.value),t}}(),function(){function t(t){t&&Object.assign(this,t)}t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.value&&(i.value=Io.fromProto(e.value)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.key&&(t.key=this.key),void 0!==this.value&&null!==this.value&&(t.value="toApiJson"in this.value?this.value.toApiJson():this.value),t}}(),function(){function t(t){t&&Object.assign(this,t)}t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.value&&(i.value=Io.fromProto(e.value)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.key&&(t.key=this.key),void 0!==this.value&&null!==this.value&&(t.value="toApiJson"in this.value?this.value.toApiJson():this.value),t}}(),function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.frequency&&(n.frequency=Po(t.GeneratedFrequency,i.frequency)),i.pricing&&(n.pricing=Object.keys(i.pricing).reduce((function(t,e){return t[e]=Io.fromProto(i.pricing[e]),t}),{})),i.commitment&&(n.commitment=Dt.fromProto(i.commitment)),i.created&&(n.created=new Date(i.created)),i.modified&&(n.modified=new Date(i.modified)),i.strategy&&(n.strategy=Po(t.PricingPlanBillingStrategy,i.strategy)),i.volumeCommitment&&(n.volumeCommitment=parseInt(i.volumeCommitment,10)),i.pricingType&&(n.pricingType=Po(N,i.pricingType)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.pricingPlanId&&(t.pricingPlanId=this.pricingPlanId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.frequency&&(t.frequency=this.frequency),void 0!==this.pricing&&null!==this.pricing&&(t.pricing="toApiJson"in this.pricing?this.pricing.toApiJson():this.pricing),void 0!==this.commitment&&null!==this.commitment&&(t.commitment="toApiJson"in this.commitment?this.commitment.toApiJson():this.commitment),void 0!==this.created&&null!==this.created&&(t.created="toApiJson"in this.created?this.created.toApiJson():this.created),void 0!==this.modified&&null!==this.modified&&(t.modified="toApiJson"in this.modified?this.modified.toApiJson():this.modified),void 0!==this.strategy&&(t.strategy=this.strategy),void 0!==this.volumeCommitment&&(t.volumeCommitment=this.volumeCommitment),void 0!==this.pricingType&&(t.pricingType=this.pricingType),t},e}()),jo=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.frequency&&(n.frequency=Po(t.GeneratedFrequency,i.frequency)),i.pricing&&(n.pricing=Object.keys(i.pricing).reduce((function(t,e){return t[e]=Io.fromProto(i.pricing[e]),t}),{})),i.commitment&&(n.commitment=Dt.fromProto(i.commitment)),i.fieldMask&&(n.fieldMask=Te.fromProto(i.fieldMask)),i.strategy&&(n.strategy=Po(t.PricingPlanBillingStrategy,i.strategy)),i.volumeCommitment&&(n.volumeCommitment=parseInt(i.volumeCommitment,10)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.pricingPlanId&&(t.pricingPlanId=this.pricingPlanId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.frequency&&(t.frequency=this.frequency),void 0!==this.pricing&&null!==this.pricing&&(t.pricing="toApiJson"in this.pricing?this.pricing.toApiJson():this.pricing),void 0!==this.commitment&&null!==this.commitment&&(t.commitment="toApiJson"in this.commitment?this.commitment.toApiJson():this.commitment),void 0!==this.fieldMask&&null!==this.fieldMask&&(t.fieldMask="toApiJson"in this.fieldMask?this.fieldMask.toApiJson():this.fieldMask),void 0!==this.strategy&&(t.strategy=this.strategy),void 0!==this.volumeCommitment&&(t.volumeCommitment=this.volumeCommitment),t},e}(),Mo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){return{}},t}(),Uo=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.pricing&&(n.pricing=i.pricing.map(Io.fromProto)),i.termCommitment&&(n.termCommitment=Dt.fromProto(i.termCommitment)),i.strategy&&(n.strategy=Po(t.PricingPlanBillingStrategy,i.strategy)),i.volumeCommitment&&(n.volumeCommitment=parseInt(i.volumeCommitment,10)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.pricingPlanId&&(t.pricingPlanId=this.pricingPlanId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.pricing&&null!==this.pricing&&(t.pricing="toApiJson"in this.pricing?this.pricing.toApiJson():this.pricing),void 0!==this.termCommitment&&null!==this.termCommitment&&(t.termCommitment="toApiJson"in this.termCommitment?this.termCommitment.toApiJson():this.termCommitment),void 0!==this.strategy&&(t.strategy=this.strategy),void 0!==this.volumeCommitment&&(t.volumeCommitment=this.volumeCommitment),t},e}();function Bo(t,e){return"number"==typeof e?e:t[e]}var Lo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.productType&&(i.productType=Bo(w,e.productType)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.productId&&(t.productId=this.productId),void 0!==this.editionId&&(t.editionId=this.editionId),void 0!==this.name&&(t.name=this.name),void 0!==this.reportingCode&&(t.reportingCode=this.reportingCode),void 0!==this.productType&&(t.productType=this.productType),t},t}(),ko=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),t},t}(),xo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.skus&&(t.skus=this.skus),t},t}(),Fo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.products&&(i.products=Object.keys(e.products).reduce((function(t,i){return t[i]=Ho.fromProto(e.products[i]),t}),{})),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.products&&null!==this.products&&(t.products="toApiJson"in this.products?this.products.toApiJson():this.products),t},t}(),Yo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.productType&&(i.productType=e.productType.map((function(t){return Bo(w,t)}))),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.hasDiscount&&(t.hasDiscount=this.hasDiscount),void 0!==this.hasPricingOverride&&(t.hasPricingOverride=this.hasPricingOverride),void 0!==this.productType&&(t.productType=this.productType),void 0!==this.skus&&(t.skus=this.skus),t},t}(),Go=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.filters&&(i.filters=Yo.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=X.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.searchTerm&&(t.searchTerm=this.searchTerm),void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),qo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.products&&(i.products=e.products.map(Ho.fromProto)),e.pagingMetadata&&(i.pagingMetadata=Q.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.products&&null!==this.products&&(t.products="toApiJson"in this.products?this.products.toApiJson():this.products),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),Ho=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.productType&&(i.productType=Bo(w,e.productType)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.name&&(t.name=this.name),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.iconUrl&&(t.iconUrl=this.iconUrl),void 0!==this.hasPricingOverride&&(t.hasPricingOverride=this.hasPricingOverride),void 0!==this.hasDiscount&&(t.hasDiscount=this.hasDiscount),void 0!==this.productType&&(t.productType=this.productType),t},t}(),Wo=(function(){function t(t){t&&Object.assign(this,t)}t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.value&&(i.value=Ho.fromProto(e.value)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.key&&(t.key=this.key),void 0!==this.value&&null!==this.value&&(t.value="toApiJson"in this.value?this.value.toApiJson():this.value),t}}(),function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.productType&&(i.productType=Bo(w,e.productType)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.name&&(t.name=this.name),void 0!==this.reportingCode&&(t.reportingCode=this.reportingCode),void 0!==this.productType&&(t.productType=this.productType),t},t}());function Vo(t,e){return"number"==typeof e?e:t[e]}var zo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.prices&&(i.prices=e.prices.map(Ko.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.prices&&null!==this.prices&&(t.prices="toApiJson"in this.prices?this.prices.toApiJson():this.prices),t},t}(),Ko=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.strategy&&(n.strategy=Vo(t.PricingPlanBillingStrategy,i.strategy)),i.pricingType&&(n.pricingType=Vo(N,i.pricingType)),i.currency&&(n.currency=Vo(u,i.currency)),i.frequency&&(n.frequency=Vo(t.GeneratedFrequency,i.frequency)),i.pricingRules&&(n.pricingRules=i.pricingRules.map(Ao.fromProto)),i.commitment&&(n.commitment=Dt.fromProto(i.commitment)),i.volumeCommitment&&(n.volumeCommitment=parseInt(i.volumeCommitment,10)),i.setupFee&&(n.setupFee=parseInt(i.setupFee,10)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.strategy&&(t.strategy=this.strategy),void 0!==this.pricingType&&(t.pricingType=this.pricingType),void 0!==this.currency&&(t.currency=this.currency),void 0!==this.frequency&&(t.frequency=this.frequency),void 0!==this.pricingRules&&null!==this.pricingRules&&(t.pricingRules="toApiJson"in this.pricingRules?this.pricingRules.toApiJson():this.pricingRules),void 0!==this.commitment&&null!==this.commitment&&(t.commitment="toApiJson"in this.commitment?this.commitment.toApiJson():this.commitment),void 0!==this.isStartingPrice&&(t.isStartingPrice=this.isStartingPrice),void 0!==this.resolvedFrom&&(t.resolvedFrom=this.resolvedFrom),void 0!==this.volumeCommitment&&(t.volumeCommitment=this.volumeCommitment),void 0!==this.setupFee&&(t.setupFee=this.setupFee),t},e}();function Xo(t,e){return"number"==typeof e?e:t[e]}var Qo=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.appliedAmount&&(i.appliedAmount=parseInt(e.appliedAmount,10)),e.referenceType&&(i.referenceType=Xo(j,e.referenceType)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.appliedAmount&&(t.appliedAmount=this.appliedAmount),void 0!==this.referenceId&&(t.referenceId=this.referenceId),void 0!==this.referenceType&&(t.referenceType=this.referenceType),t},t}(),Zo=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.billingStrategy&&(n.billingStrategy=i.billingStrategy.map((function(e){return Xo(t.PricingPlanBillingStrategy,e)}))),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.billingStrategy&&(t.billingStrategy=this.billingStrategy),t},e}(),$o=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.start&&(n.start=new Date(i.start)),i.end&&(n.end=new Date(i.end)),i.billingStrategyFilter&&(n.billingStrategyFilter=Zo.fromProto(i.billingStrategyFilter)),i.state&&(n.state=Xo(t.State,i.state)),i.minPrice&&(n.minPrice=parseInt(i.minPrice,10)),i.status&&(n.status=Xo(t.PurchaseStatusEnum,i.status)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.purchaseId&&(t.purchaseId=this.purchaseId),void 0!==this.start&&null!==this.start&&(t.start="toApiJson"in this.start?this.start.toApiJson():this.start),void 0!==this.end&&null!==this.end&&(t.end="toApiJson"in this.end?this.end.toApiJson():this.end),void 0!==this.billingStrategyFilter&&null!==this.billingStrategyFilter&&(t.billingStrategyFilter="toApiJson"in this.billingStrategyFilter?this.billingStrategyFilter.toApiJson():this.billingStrategyFilter),void 0!==this.state&&(t.state=this.state),void 0!==this.minPrice&&(t.minPrice=this.minPrice),void 0!==this.status&&(t.status=this.status),void 0!==this.includeVoided&&(t.includeVoided=this.includeVoided),t},e}(),tr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.start&&(i.start=new Date(e.start)),e.end&&(i.end=new Date(e.end)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.start&&null!==this.start&&(t.start="toApiJson"in this.start?this.start.toApiJson():this.start),void 0!==this.end&&null!==this.end&&(t.end="toApiJson"in this.end?this.end.toApiJson():this.end),t},t}(),er=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.filters&&(i.filters=tr.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=X.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),ir=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.purchaseItems&&(i.purchaseItems=e.purchaseItems.map(sr.fromProto)),e.pagingMetadata&&(i.pagingMetadata=Q.fromProto(e.pagingMetadata)),e.currency&&(i.currency=Xo(u,e.currency)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.purchaseItems&&null!==this.purchaseItems&&(t.purchaseItems="toApiJson"in this.purchaseItems?this.purchaseItems.toApiJson():this.purchaseItems),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),void 0!==this.currency&&(t.currency=this.currency),t},t}(),nr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.filters&&(i.filters=$o.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=X.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),or=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.purchases&&(i.purchases=e.purchases.map(rr.fromProto)),e.pagingMetadata&&(i.pagingMetadata=Q.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.purchases&&null!==this.purchases&&(t.purchases="toApiJson"in this.purchases?this.purchases.toApiJson():this.purchases),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),rr=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.timestamp&&(n.timestamp=new Date(i.timestamp)),i.total&&(n.total=parseInt(i.total,10)),i.currency&&(n.currency=Xo(u,i.currency)),i.items&&(n.items=i.items.map(sr.fromProto)),i.billingStrategy&&(n.billingStrategy=Xo(t.PricingPlanBillingStrategy,i.billingStrategy)),i.dunningAttempt&&(n.dunningAttempt=parseInt(i.dunningAttempt,10)),i.voided&&(n.voided=new Date(i.voided)),i.status&&(n.status=Xo(t.PurchaseStatusEnum,i.status)),i.creditAmount&&(n.creditAmount=parseInt(i.creditAmount,10)),i.appliedCredits&&(n.appliedCredits=i.appliedCredits.map(Qo.fromProto)),i.taxAmount&&(n.taxAmount=parseInt(i.taxAmount,10)),i.appliedTaxRates&&(n.appliedTaxRates=i.appliedTaxRates.map(be.fromProto)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.timestamp&&null!==this.timestamp&&(t.timestamp="toApiJson"in this.timestamp?this.timestamp.toApiJson():this.timestamp),void 0!==this.purchaseId&&(t.purchaseId=this.purchaseId),void 0!==this.total&&(t.total=this.total),void 0!==this.currency&&(t.currency=this.currency),void 0!==this.renewal&&(t.renewal=this.renewal),void 0!==this.items&&null!==this.items&&(t.items="toApiJson"in this.items?this.items.toApiJson():this.items),void 0!==this.billingStrategy&&(t.billingStrategy=this.billingStrategy),void 0!==this.isDunning&&(t.isDunning=this.isDunning),void 0!==this.dunningAttempt&&(t.dunningAttempt=this.dunningAttempt),void 0!==this.voided&&null!==this.voided&&(t.voided="toApiJson"in this.voided?this.voided.toApiJson():this.voided),void 0!==this.paid&&(t.paid=this.paid),void 0!==this.status&&(t.status=this.status),void 0!==this.creditAmount&&(t.creditAmount=this.creditAmount),void 0!==this.appliedCredits&&null!==this.appliedCredits&&(t.appliedCredits="toApiJson"in this.appliedCredits?this.appliedCredits.toApiJson():this.appliedCredits),void 0!==this.taxAmount&&(t.taxAmount=this.taxAmount),void 0!==this.appliedTaxRates&&null!==this.appliedTaxRates&&(t.appliedTaxRates="toApiJson"in this.appliedTaxRates?this.appliedTaxRates.toApiJson():this.appliedTaxRates),t},e}(),sr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.amount&&(i.amount=parseInt(e.amount,10)),e.discountAmount&&(i.discountAmount=parseInt(e.discountAmount,10)),e.total&&(i.total=parseInt(e.total,10)),e.appliedDiscounts&&(i.appliedDiscounts=e.appliedDiscounts.map(ft.fromProto)),e.taxAmount&&(i.taxAmount=parseInt(e.taxAmount,10)),e.appliedTaxRates&&(i.appliedTaxRates=e.appliedTaxRates.map(be.fromProto)),e.setupFee&&(i.setupFee=parseInt(e.setupFee,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.orderId&&(t.orderId=this.orderId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.discountAmount&&(t.discountAmount=this.discountAmount),void 0!==this.total&&(t.total=this.total),void 0!==this.appliedDiscounts&&null!==this.appliedDiscounts&&(t.appliedDiscounts="toApiJson"in this.appliedDiscounts?this.appliedDiscounts.toApiJson():this.appliedDiscounts),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.day&&(t.day=this.day),void 0!==this.purchaseId&&(t.purchaseId=this.purchaseId),void 0!==this.description&&(t.description=this.description),void 0!==this.taxAmount&&(t.taxAmount=this.taxAmount),void 0!==this.appliedTaxRates&&null!==this.appliedTaxRates&&(t.appliedTaxRates="toApiJson"in this.appliedTaxRates?this.appliedTaxRates.toApiJson():this.appliedTaxRates),void 0!==this.setupFee&&(t.setupFee=this.setupFee),t},t}(),ar=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.purchaseId&&(t.purchaseId=this.purchaseId),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.day&&(t.day=this.day),void 0!==this.shouldEnterDunning&&(t.shouldEnterDunning=this.shouldEnterDunning),t},t}(),cr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.purchaseId&&(t.purchaseId=this.purchaseId),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.day&&(t.day=this.day),t},t}();function ur(t,e){return"number"==typeof e?e:t[e]}var pr=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.amount&&(n.amount=parseInt(i.amount,10)),i.reason&&(n.reason=ur(t.RefundReasonEnum,i.reason)),i.referenceType&&(n.referenceType=ur(t.ReferenceTypeEnum,i.referenceType)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.paymentId&&(t.paymentId=this.paymentId),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.reason&&(t.reason=this.reason),void 0!==this.referenceType&&(t.referenceType=this.referenceType),void 0!==this.referenceId&&(t.referenceId=this.referenceId),t},e}(),dr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.pageSize&&(i.pageSize=parseInt(e.pageSize,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.paymentIds&&(t.paymentIds=this.paymentIds),void 0!==this.cursor&&(t.cursor=this.cursor),void 0!==this.pageSize&&(t.pageSize=this.pageSize),void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),hr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.refunds&&(i.refunds=e.refunds.map(lr.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.refunds&&null!==this.refunds&&(t.refunds="toApiJson"in this.refunds?this.refunds.toApiJson():this.refunds),void 0!==this.nextCursor&&(t.nextCursor=this.nextCursor),void 0!==this.hasMore&&(t.hasMore=this.hasMore),t},t}(),lr=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.amount&&(n.amount=parseInt(i.amount,10)),i.reason&&(n.reason=ur(t.RefundReasonEnum,i.reason)),i.status&&(n.status=ur(t.RefundStatusEnum,i.status)),i.created&&(n.created=new Date(i.created)),i.updated&&(n.updated=new Date(i.updated)),i.referenceType&&(n.referenceType=ur(t.ReferenceTypeEnum,i.referenceType)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.chargeId&&(t.chargeId=this.chargeId),void 0!==this.refundId&&(t.refundId=this.refundId),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.email&&(t.email=this.email),void 0!==this.reason&&(t.reason=this.reason),void 0!==this.status&&(t.status=this.status),void 0!==this.created&&null!==this.created&&(t.created="toApiJson"in this.created?this.created.toApiJson():this.created),void 0!==this.updated&&null!==this.updated&&(t.updated="toApiJson"in this.updated?this.updated.toApiJson():this.updated),void 0!==this.referenceType&&(t.referenceType=this.referenceType),void 0!==this.referenceId&&(t.referenceId=this.referenceId),t},e}();function mr(t,e){return"number"==typeof e?e:t[e]}var vr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.creditNoteDate&&(i.creditNoteDate=new Date(e.creditNoteDate)),e.dueDate&&(i.dueDate=new Date(e.dueDate)),e.total&&(i.total=parseInt(e.total,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.creditNoteReason&&(t.creditNoteReason=this.creditNoteReason),void 0!==this.creditNoteDate&&null!==this.creditNoteDate&&(t.creditNoteDate="toApiJson"in this.creditNoteDate?this.creditNoteDate.toApiJson():this.creditNoteDate),void 0!==this.dueDate&&null!==this.dueDate&&(t.dueDate="toApiJson"in this.dueDate?this.dueDate.toApiJson():this.dueDate),void 0!==this.total&&(t.total=this.total),void 0!==this.sku&&(t.sku=this.sku),t},t}(),fr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.statuses&&(i.statuses=e.statuses.map((function(t){return mr(x,t)}))),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.statuses&&(t.statuses=this.statuses),t},t}(),gr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.filters&&(i.filters=fr.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=X.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),Ir=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.creditNote&&(i.creditNote=e.creditNote.map(Ar.fromProto)),e.pagingMetadata&&(i.pagingMetadata=Q.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.creditNote&&null!==this.creditNote&&(t.creditNote="toApiJson"in this.creditNote?this.creditNote.toApiJson():this.creditNote),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),Ar=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.creditNoteDate&&(i.creditNoteDate=new Date(e.creditNoteDate)),e.dueDate&&(i.dueDate=new Date(e.dueDate)),e.currency&&(i.currency=mr(u,e.currency)),e.total&&(i.total=parseInt(e.total,10)),e.outstanding&&(i.outstanding=parseInt(e.outstanding,10)),e.status&&(i.status=mr(x,e.status)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.creditNoteId&&(t.creditNoteId=this.creditNoteId),void 0!==this.creditNoteNumber&&(t.creditNoteNumber=this.creditNoteNumber),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.creditNoteReason&&(t.creditNoteReason=this.creditNoteReason),void 0!==this.creditNoteDate&&null!==this.creditNoteDate&&(t.creditNoteDate="toApiJson"in this.creditNoteDate?this.creditNoteDate.toApiJson():this.creditNoteDate),void 0!==this.dueDate&&null!==this.dueDate&&(t.dueDate="toApiJson"in this.dueDate?this.dueDate.toApiJson():this.dueDate),void 0!==this.currency&&(t.currency=this.currency),void 0!==this.total&&(t.total=this.total),void 0!==this.outstanding&&(t.outstanding=this.outstanding),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),void 0!==this.invoiceNumber&&(t.invoiceNumber=this.invoiceNumber),void 0!==this.status&&(t.status=this.status),void 0!==this.paymentStatus&&(t.paymentStatus=this.paymentStatus),t},t}();function yr(t,e){return"number"==typeof e?e:t[e]}var Sr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),Pr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoice&&(i.invoice=Rr.fromProto(e.invoice)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoice&&null!==this.invoice&&(t.invoice="toApiJson"in this.invoice?this.invoice.toApiJson():this.invoice),t},t}(),br=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.statuses&&(i.statuses=e.statuses.map((function(t){return yr(Y,t)}))),e.paymentStatuses&&(i.paymentStatuses=e.paymentStatuses.map((function(t){return yr(F,t)}))),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.statuses&&(t.statuses=this.statuses),void 0!==this.paymentStatuses&&(t.paymentStatuses=this.paymentStatuses),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),t},t}(),Tr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.filters&&(i.filters=br.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=X.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),void 0!==this.searchTerm&&(t.searchTerm=this.searchTerm),t},t}(),Or=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoice&&(i.invoice=e.invoice.map(Rr.fromProto)),e.pagingMetadata&&(i.pagingMetadata=Q.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoice&&null!==this.invoice&&(t.invoice="toApiJson"in this.invoice?this.invoice.toApiJson():this.invoice),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),Er=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),t},t}(),Rr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoiceDate&&(i.invoiceDate=new Date(e.invoiceDate)),e.startDate&&(i.startDate=new Date(e.startDate)),e.endDate&&(i.endDate=new Date(e.endDate)),e.dueDate&&(i.dueDate=new Date(e.dueDate)),e.total&&(i.total=parseInt(e.total,10)),e.currency&&(i.currency=yr(u,e.currency)),e.status&&(i.status=yr(Y,e.status)),e.outstanding&&(i.outstanding=parseInt(e.outstanding,10)),e.type&&(i.type=yr(G,e.type)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),void 0!==this.invoiceNumber&&(t.invoiceNumber=this.invoiceNumber),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceDate&&null!==this.invoiceDate&&(t.invoiceDate="toApiJson"in this.invoiceDate?this.invoiceDate.toApiJson():this.invoiceDate),void 0!==this.startDate&&null!==this.startDate&&(t.startDate="toApiJson"in this.startDate?this.startDate.toApiJson():this.startDate),void 0!==this.endDate&&null!==this.endDate&&(t.endDate="toApiJson"in this.endDate?this.endDate.toApiJson():this.endDate),void 0!==this.dueDate&&null!==this.dueDate&&(t.dueDate="toApiJson"in this.dueDate?this.dueDate.toApiJson():this.dueDate),void 0!==this.total&&(t.total=this.total),void 0!==this.currency&&(t.currency=this.currency),void 0!==this.status&&(t.status=this.status),void 0!==this.paymentStatus&&(t.paymentStatus=this.paymentStatus),void 0!==this.outstanding&&(t.outstanding=this.outstanding),void 0!==this.type&&(t.type=this.type),t},t}(),Cr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),t},t}(),Dr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),t},t}();var _r=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n,o,r=new e;return r=Object.assign(r,i),i.status&&(r.status=(n=t.SubscribeValidationStatus,"number"==typeof(o=i.status)?o:n[o])),r},e.prototype.toApiJson=function(){var t={};return void 0!==this.status&&(t.status=this.status),t},e}();function Jr(t,e){return"number"==typeof e?e:t[e]}var Nr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.orderId&&(t.orderId=this.orderId),t},t}(),wr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.skus&&(i.skus=Object.keys(e.skus).reduce((function(t,i){return t[i]=parseInt(e.skus[i],10),t}),{})),e.items&&(i.items=e.items.map(qr.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.skus&&null!==this.skus&&(t.skus="toApiJson"in this.skus?this.skus.toApiJson():this.skus),void 0!==this.items&&null!==this.items&&(t.items="toApiJson"in this.items?this.items.toApiJson():this.items),t},t}(),jr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.validationResponse&&(i.validationResponse=e.validationResponse.map(Hr.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.validationResponse&&null!==this.validationResponse&&(t.validationResponse="toApiJson"in this.validationResponse?this.validationResponse.toApiJson():this.validationResponse),t},t}(),Mr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.customUnitPrice&&(i.customUnitPrice=parseInt(e.customUnitPrice,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.orderId&&(t.orderId=this.orderId),void 0!==this.customUnitPrice&&(t.customUnitPrice=this.customUnitPrice),t},t}(),Ur=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.frequency&&(n.frequency=Jr(t.GeneratedFrequency,i.frequency)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.orderId&&(t.orderId=this.orderId),void 0!==this.frequency&&(t.frequency=this.frequency),t},e}(),Br=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.nextRenewalDate&&(i.nextRenewalDate=new Date(e.nextRenewalDate)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.orderId&&(t.orderId=this.orderId),void 0!==this.nextRenewalDate&&null!==this.nextRenewalDate&&(t.nextRenewalDate="toApiJson"in this.nextRenewalDate?this.nextRenewalDate.toApiJson():this.nextRenewalDate),t},t}(),Lr=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.billingStart&&(n.billingStart=new Date(i.billingStart)),i.proratedTo&&(n.proratedTo=new Date(i.proratedTo)),i.renewalState&&(n.renewalState=Jr(H,i.renewalState)),i.customUnitPrice&&(n.customUnitPrice=parseInt(i.customUnitPrice,10)),i.alignWith&&(n.alignWith=Nr.fromProto(i.alignWith)),i.frequency&&(n.frequency=Jr(t.GeneratedFrequency,i.frequency)),i.retailAmount&&(n.retailAmount=parseInt(i.retailAmount,10)),i.retailFrequency&&(n.retailFrequency=Jr(t.GeneratedFrequency,i.retailFrequency)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.orderId&&(t.orderId=this.orderId),void 0!==this.billingStart&&null!==this.billingStart&&(t.billingStart="toApiJson"in this.billingStart?this.billingStart.toApiJson():this.billingStart),void 0!==this.proratedTo&&null!==this.proratedTo&&(t.proratedTo="toApiJson"in this.proratedTo?this.proratedTo.toApiJson():this.proratedTo),void 0!==this.renewalState&&(t.renewalState=this.renewalState),void 0!==this.retailBundleId&&(t.retailBundleId=this.retailBundleId),void 0!==this.forResale&&(t.forResale=this.forResale),void 0!==this.customUnitPrice&&(t.customUnitPrice=this.customUnitPrice),void 0!==this.alignWith&&null!==this.alignWith&&(t.alignWith="toApiJson"in this.alignWith?this.alignWith.toApiJson():this.alignWith),void 0!==this.frequency&&(t.frequency=this.frequency),void 0!==this.retailAmount&&(t.retailAmount=this.retailAmount),void 0!==this.retailFrequency&&(t.retailFrequency=this.retailFrequency),t},e}(),kr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.subscriptions&&(i.subscriptions=e.subscriptions.map(Gr.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.subscriptions&&null!==this.subscriptions&&(t.subscriptions="toApiJson"in this.subscriptions?this.subscriptions.toApiJson():this.subscriptions),t},t}(),xr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.id&&(t.id=this.id),t},t}(),Fr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.orderId&&(t.orderId=this.orderId),t},t}(),Yr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.renewalStart&&(i.renewalStart=new Date(e.renewalStart)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.orderId&&(t.orderId=this.orderId),void 0!==this.renewalStart&&null!==this.renewalStart&&(t.renewalStart="toApiJson"in this.renewalStart?this.renewalStart.toApiJson():this.renewalStart),t},t}(),Gr=(function(){function t(t){t&&Object.assign(this,t)}t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.value&&(i.value=parseInt(e.value,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.key&&(t.key=this.key),void 0!==this.value&&(t.value=this.value),t}}(),function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.billingStart&&(n.billingStart=new Date(i.billingStart)),i.renewalState&&(n.renewalState=Jr(H,i.renewalState)),i.proratedTo&&(n.proratedTo=new Date(i.proratedTo)),i.customUnitPrice&&(n.customUnitPrice=parseInt(i.customUnitPrice,10)),i.alignWith&&(n.alignWith=Nr.fromProto(i.alignWith)),i.frequency&&(n.frequency=Jr(t.GeneratedFrequency,i.frequency)),i.retailAmount&&(n.retailAmount=parseInt(i.retailAmount,10)),i.retailFrequency&&(n.retailFrequency=Jr(t.GeneratedFrequency,i.retailFrequency)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.orderId&&(t.orderId=this.orderId),void 0!==this.billingStart&&null!==this.billingStart&&(t.billingStart="toApiJson"in this.billingStart?this.billingStart.toApiJson():this.billingStart),void 0!==this.renewalState&&(t.renewalState=this.renewalState),void 0!==this.proratedTo&&null!==this.proratedTo&&(t.proratedTo="toApiJson"in this.proratedTo?this.proratedTo.toApiJson():this.proratedTo),void 0!==this.retailBundleId&&(t.retailBundleId=this.retailBundleId),void 0!==this.forResale&&(t.forResale=this.forResale),void 0!==this.customUnitPrice&&(t.customUnitPrice=this.customUnitPrice),void 0!==this.alignWith&&null!==this.alignWith&&(t.alignWith="toApiJson"in this.alignWith?this.alignWith.toApiJson():this.alignWith),void 0!==this.bundleInstanceId&&(t.bundleInstanceId=this.bundleInstanceId),void 0!==this.frequency&&(t.frequency=this.frequency),void 0!==this.retailAmount&&(t.retailAmount=this.retailAmount),void 0!==this.retailFrequency&&(t.retailFrequency=this.retailFrequency),t},e}()),qr=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.frequency&&(n.frequency=Jr(t.GeneratedFrequency,i.frequency)),i.quantity&&(n.quantity=parseInt(i.quantity,10)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.frequency&&(t.frequency=this.frequency),void 0!==this.quantity&&(t.quantity=this.quantity),t},e}(),Hr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.code&&(i.code=_r.fromProto(e.code)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.code&&null!==this.code&&(t.code="toApiJson"in this.code?this.code.toApiJson():this.code),t},t}();var Wr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.created&&(i.created=new Date(e.created)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.id&&(t.id=this.id),void 0!==this.filename&&(t.filename=this.filename),void 0!==this.created&&null!==this.created&&(t.created="toApiJson"in this.created?this.created.toApiJson():this.created),t},t}(),Vr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.id&&(t.id=this.id),t},t}(),zr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),Kr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.filters&&(i.filters=zr.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=X.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.filters&&null!==this.filters&&(t.filters="toApiJson"in this.filters?this.filters.toApiJson():this.filters),void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),t},t}(),Xr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.contractDocuments&&(i.contractDocuments=e.contractDocuments.map(Wr.fromProto)),e.pagingMetadata&&(i.pagingMetadata=Q.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.contractDocuments&&null!==this.contractDocuments&&(t.contractDocuments="toApiJson"in this.contractDocuments?this.contractDocuments.toApiJson():this.contractDocuments),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}();var Qr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),Zr=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.configuration&&(i.configuration=$r.fromProto(e.configuration)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.configuration&&null!==this.configuration&&(t.configuration="toApiJson"in this.configuration?this.configuration.toApiJson():this.configuration),t},t}(),$r=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoiceDay&&(i.invoiceDay=parseInt(e.invoiceDay,10)),e.nextInvoiceDate&&(i.nextInvoiceDate=new Date(e.nextInvoiceDate)),e.netD&&(i.netD=parseInt(e.netD,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceDay&&(t.invoiceDay=this.invoiceDay),void 0!==this.nextInvoiceDate&&null!==this.nextInvoiceDate&&(t.nextInvoiceDate="toApiJson"in this.nextInvoiceDate?this.nextInvoiceDate.toApiJson():this.nextInvoiceDate),void 0!==this.autoPost&&(t.autoPost=this.autoPost),void 0!==this.collectionMethod&&(t.collectionMethod=this.collectionMethod),void 0!==this.netD&&(t.netD=this.netD),void 0!==this.autoGenerate&&(t.autoGenerate=this.autoGenerate),void 0!==this.contactId&&(t.contactId=this.contactId),void 0!==this.useTemplateInvoice&&(t.useTemplateInvoice=this.useTemplateInvoice),t},t}(),ts=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoiceDay&&(i.invoiceDay=parseInt(e.invoiceDay,10)),e.netD&&(i.netD=parseInt(e.netD,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceDay&&(t.invoiceDay=this.invoiceDay),void 0!==this.autoPost&&(t.autoPost=this.autoPost),void 0!==this.netD&&(t.netD=this.netD),void 0!==this.autoGenerate&&(t.autoGenerate=this.autoGenerate),void 0!==this.contactId&&(t.contactId=this.contactId),void 0!==this.collectionMethod&&(t.collectionMethod=this.collectionMethod),void 0!==this.useTemplateInvoice&&(t.useTemplateInvoice=this.useTemplateInvoice),t},t}();var es=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.amount&&(i.amount=parseInt(e.amount,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.currency&&(t.currency=this.currency),void 0!==this.amount&&(t.amount=this.amount),void 0!==this.idempotencyKey&&(t.idempotencyKey=this.idempotencyKey),void 0!==this.reason&&(t.reason=this.reason),t},t}(),is=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.amount&&(i.amount=parseInt(e.amount,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.currency&&(t.currency=this.currency),void 0!==this.amount&&(t.amount=this.amount),t},t}(),ns=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),os=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.creditBalance&&(i.creditBalance=is.fromProto(e.creditBalance)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.creditBalance&&null!==this.creditBalance&&(t.creditBalance="toApiJson"in this.creditBalance?this.creditBalance.toApiJson():this.creditBalance),t},t}();var rs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.bundleId&&(t.bundleId=this.bundleId),t},t}(),ss=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoiceTemplate&&(i.invoiceTemplate=fs.fromProto(e.invoiceTemplate)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceTemplate&&null!==this.invoiceTemplate&&(t.invoiceTemplate="toApiJson"in this.invoiceTemplate?this.invoiceTemplate.toApiJson():this.invoiceTemplate),t},t}(),as=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.unitPrice&&(i.unitPrice=parseInt(e.unitPrice,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.unitPrice&&(t.unitPrice=this.unitPrice),void 0!==this.quantity&&(t.quantity=this.quantity),void 0!==this.description&&(t.description=this.description),void 0!==this.taxRates&&(t.taxRates=this.taxRates),t},t}(),cs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoiceTemplate&&(i.invoiceTemplate=fs.fromProto(e.invoiceTemplate)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceTemplate&&null!==this.invoiceTemplate&&(t.invoiceTemplate="toApiJson"in this.invoiceTemplate?this.invoiceTemplate.toApiJson():this.invoiceTemplate),t},t}(),us=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),t},t}(),ps=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoiceTemplate&&(i.invoiceTemplate=fs.fromProto(e.invoiceTemplate)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceTemplate&&null!==this.invoiceTemplate&&(t.invoiceTemplate="toApiJson"in this.invoiceTemplate?this.invoiceTemplate.toApiJson():this.invoiceTemplate),t},t}(),ds=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),t},t}(),hs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.id&&(t.id=this.id),t},t}(),ls=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoiceTemplate&&(i.invoiceTemplate=fs.fromProto(e.invoiceTemplate)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceTemplate&&null!==this.invoiceTemplate&&(t.invoiceTemplate="toApiJson"in this.invoiceTemplate?this.invoiceTemplate.toApiJson():this.invoiceTemplate),t},t}(),ms=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),t},t}(),vs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoiceTemplate&&(i.invoiceTemplate=fs.fromProto(e.invoiceTemplate)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceTemplate&&null!==this.invoiceTemplate&&(t.invoiceTemplate="toApiJson"in this.invoiceTemplate?this.invoiceTemplate.toApiJson():this.invoiceTemplate),t},t}(),fs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i,n,o=new t;return o=Object.assign(o,e),e.appliedTaxes&&(o.appliedTaxes=e.appliedTaxes.map(be.fromProto)),e.items&&(o.items=e.items.map(gs.fromProto)),e.currency&&(o.currency=(i=u,"number"==typeof(n=e.currency)?n:i[n])),e.total&&(o.total=parseInt(e.total,10)),e.subtotal&&(o.subtotal=parseInt(e.subtotal,10)),e.created&&(o.created=new Date(e.created)),e.updated&&(o.updated=new Date(e.updated)),e.defaultTaxRates&&(o.defaultTaxRates=e.defaultTaxRates.map(je.fromProto)),e.appliedBundles&&(o.appliedBundles=e.appliedBundles.map(Ue.fromProto)),e.amountDiscount&&(o.amountDiscount=parseInt(e.amountDiscount,10)),o},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.appliedTaxes&&null!==this.appliedTaxes&&(t.appliedTaxes="toApiJson"in this.appliedTaxes?this.appliedTaxes.toApiJson():this.appliedTaxes),void 0!==this.items&&null!==this.items&&(t.items="toApiJson"in this.items?this.items.toApiJson():this.items),void 0!==this.currency&&(t.currency=this.currency),void 0!==this.total&&(t.total=this.total),void 0!==this.subtotal&&(t.subtotal=this.subtotal),void 0!==this.created&&null!==this.created&&(t.created="toApiJson"in this.created?this.created.toApiJson():this.created),void 0!==this.updated&&null!==this.updated&&(t.updated="toApiJson"in this.updated?this.updated.toApiJson():this.updated),void 0!==this.defaultTaxRates&&null!==this.defaultTaxRates&&(t.defaultTaxRates="toApiJson"in this.defaultTaxRates?this.defaultTaxRates.toApiJson():this.defaultTaxRates),void 0!==this.appliedBundles&&null!==this.appliedBundles&&(t.appliedBundles="toApiJson"in this.appliedBundles?this.appliedBundles.toApiJson():this.appliedBundles),void 0!==this.amountDiscount&&(t.amountDiscount=this.amountDiscount),t},t}(),gs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.unitPrice&&(i.unitPrice=parseInt(e.unitPrice,10)),e.total&&(i.total=parseInt(e.total,10)),e.appliedTaxes&&(i.appliedTaxes=e.appliedTaxes.map(be.fromProto)),e.taxRates&&(i.taxRates=e.taxRates.map(je.fromProto)),e.subtotal&&(i.subtotal=parseInt(e.subtotal,10)),e.discounts&&(i.discounts=e.discounts.map(ft.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.unitPrice&&(t.unitPrice=this.unitPrice),void 0!==this.quantity&&(t.quantity=this.quantity),void 0!==this.description&&(t.description=this.description),void 0!==this.total&&(t.total=this.total),void 0!==this.appliedTaxes&&null!==this.appliedTaxes&&(t.appliedTaxes="toApiJson"in this.appliedTaxes?this.appliedTaxes.toApiJson():this.appliedTaxes),void 0!==this.taxRates&&null!==this.taxRates&&(t.taxRates="toApiJson"in this.taxRates?this.taxRates.toApiJson():this.taxRates),void 0!==this.subtotal&&(t.subtotal=this.subtotal),void 0!==this.bundleId&&(t.bundleId=this.bundleId),void 0!==this.discounts&&null!==this.discounts&&(t.discounts="toApiJson"in this.discounts?this.discounts.toApiJson():this.discounts),t},t}(),Is=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.unitPrice&&(i.unitPrice=parseInt(e.unitPrice,10)),e.appliedDiscounts&&(i.appliedDiscounts=e.appliedDiscounts.map(ft.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.unitPrice&&(t.unitPrice=this.unitPrice),void 0!==this.quantity&&(t.quantity=this.quantity),void 0!==this.description&&(t.description=this.description),void 0!==this.taxRates&&(t.taxRates=this.taxRates),void 0!==this.bundleId&&(t.bundleId=this.bundleId),void 0!==this.appliedDiscounts&&null!==this.appliedDiscounts&&(t.appliedDiscounts="toApiJson"in this.appliedDiscounts?this.appliedDiscounts.toApiJson():this.appliedDiscounts),t},t}(),As=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.bundleId&&(t.bundleId=this.bundleId),void 0!==this.hideBundleItems&&(t.hideBundleItems=this.hideBundleItems),t},t}(),ys=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoiceTemplate&&(i.invoiceTemplate=fs.fromProto(e.invoiceTemplate)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceTemplate&&null!==this.invoiceTemplate&&(t.invoiceTemplate="toApiJson"in this.invoiceTemplate?this.invoiceTemplate.toApiJson():this.invoiceTemplate),t},t}(),Ss=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.taxRateIds&&(t.taxRateIds=this.taxRateIds),t},t}(),Ps=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoiceTemplate&&(i.invoiceTemplate=fs.fromProto(e.invoiceTemplate)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceTemplate&&null!==this.invoiceTemplate&&(t.invoiceTemplate="toApiJson"in this.invoiceTemplate?this.invoiceTemplate.toApiJson():this.invoiceTemplate),t},t}(),bs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.unitPrice&&(i.unitPrice=parseInt(e.unitPrice,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.id&&(t.id=this.id),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.unitPrice&&(t.unitPrice=this.unitPrice),void 0!==this.quantity&&(t.quantity=this.quantity),void 0!==this.description&&(t.description=this.description),void 0!==this.taxRates&&(t.taxRates=this.taxRates),t},t}(),Ts=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoiceTemplate&&(i.invoiceTemplate=fs.fromProto(e.invoiceTemplate)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceTemplate&&null!==this.invoiceTemplate&&(t.invoiceTemplate="toApiJson"in this.invoiceTemplate?this.invoiceTemplate.toApiJson():this.invoiceTemplate),t},t}(),Os=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.items&&(i.items=e.items.map(Is.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.items&&null!==this.items&&(t.items="toApiJson"in this.items?this.items.toApiJson():this.items),void 0!==this.defaultTaxRates&&(t.defaultTaxRates=this.defaultTaxRates),void 0!==this.currencyCode&&(t.currencyCode=this.currencyCode),t},t}(),Es=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.invoiceTemplate&&(i.invoiceTemplate=fs.fromProto(e.invoiceTemplate)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.invoiceTemplate&&null!==this.invoiceTemplate&&(t.invoiceTemplate="toApiJson"in this.invoiceTemplate?this.invoiceTemplate.toApiJson():this.invoiceTemplate),t},t}();function Rs(t,e){return"number"==typeof e?e:t[e]}var Cs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.id&&(t.id=this.id),t},t}(),Ds=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.id&&(t.id=this.id),t},t}(),_s=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.pagingOptions&&(i.pagingOptions=X.fromProto(e.pagingOptions)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.pagingOptions&&null!==this.pagingOptions&&(t.pagingOptions="toApiJson"in this.pagingOptions?this.pagingOptions.toApiJson():this.pagingOptions),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),t},t}(),Js=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.recurringInvoices&&(i.recurringInvoices=e.recurringInvoices.map(Ns.fromProto)),e.pagingMetadata&&(i.pagingMetadata=Q.fromProto(e.pagingMetadata)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.recurringInvoices&&null!==this.recurringInvoices&&(t.recurringInvoices="toApiJson"in this.recurringInvoices?this.recurringInvoices.toApiJson():this.recurringInvoices),void 0!==this.pagingMetadata&&null!==this.pagingMetadata&&(t.pagingMetadata="toApiJson"in this.pagingMetadata?this.pagingMetadata.toApiJson():this.pagingMetadata),t},t}(),Ns=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.created&&(i.created=new Date(e.created)),e.updated&&(i.updated=new Date(e.updated)),e.status&&(i.status=Rs(K,e.status)),e.issuedAt&&(i.issuedAt=new Date(e.issuedAt)),e.nextIssue&&(i.nextIssue=new Date(e.nextIssue)),e.intervalCount&&(i.intervalCount=parseInt(e.intervalCount,10)),e.interval&&(i.interval=Rs(z,e.interval)),e.collectionMethod&&(i.collectionMethod=Rs(V,e.collectionMethod)),e.paymentProcessor&&(i.paymentProcessor=Rs(W,e.paymentProcessor)),e.items&&(i.items=e.items.map(js.fromProto)),e.totalAmount&&(i.totalAmount=parseInt(e.totalAmount,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.id&&(t.id=this.id),void 0!==this.created&&null!==this.created&&(t.created="toApiJson"in this.created?this.created.toApiJson():this.created),void 0!==this.updated&&null!==this.updated&&(t.updated="toApiJson"in this.updated?this.updated.toApiJson():this.updated),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.status&&(t.status=this.status),void 0!==this.issuedAt&&null!==this.issuedAt&&(t.issuedAt="toApiJson"in this.issuedAt?this.issuedAt.toApiJson():this.issuedAt),void 0!==this.nextIssue&&null!==this.nextIssue&&(t.nextIssue="toApiJson"in this.nextIssue?this.nextIssue.toApiJson():this.nextIssue),void 0!==this.intervalCount&&(t.intervalCount=this.intervalCount),void 0!==this.interval&&(t.interval=this.interval),void 0!==this.collectionMethod&&(t.collectionMethod=this.collectionMethod),void 0!==this.recipientUserId&&(t.recipientUserId=this.recipientUserId),void 0!==this.paymentProcessor&&(t.paymentProcessor=this.paymentProcessor),void 0!==this.paymentProcessorId&&(t.paymentProcessorId=this.paymentProcessorId),void 0!==this.items&&null!==this.items&&(t.items="toApiJson"in this.items?this.items.toApiJson():this.items),void 0!==this.totalAmount&&(t.totalAmount=this.totalAmount),void 0!==this.currencyCode&&(t.currencyCode=this.currencyCode),t},t}(),ws=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.lineItems&&(i.lineItems=e.lineItems.map(Ms.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.name&&(t.name=this.name),void 0!==this.hideLineItems&&(t.hideLineItems=this.hideLineItems),void 0!==this.lineItems&&null!==this.lineItems&&(t.lineItems="toApiJson"in this.lineItems?this.lineItems.toApiJson():this.lineItems),t},t}(),js=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.lineItem&&(i.lineItem=Ms.fromProto(e.lineItem)),e.bundle&&(i.bundle=ws.fromProto(e.bundle)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.lineItem&&null!==this.lineItem&&(t.lineItem="toApiJson"in this.lineItem?this.lineItem.toApiJson():this.lineItem),void 0!==this.bundle&&null!==this.bundle&&(t.bundle="toApiJson"in this.bundle?this.bundle.toApiJson():this.bundle),t},t}(),Ms=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.unitPrice&&(i.unitPrice=parseInt(e.unitPrice,10)),e.quantity&&(i.quantity=parseInt(e.quantity,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.unitPrice&&(t.unitPrice=this.unitPrice),void 0!==this.quantity&&(t.quantity=this.quantity),void 0!==this.name&&(t.name=this.name),void 0!==this.taxRateIds&&(t.taxRateIds=this.taxRateIds),t},t}(),Us=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.recurringInvoice&&(i.recurringInvoice=Ns.fromProto(e.recurringInvoice)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.recurringInvoice&&null!==this.recurringInvoice&&(t.recurringInvoice="toApiJson"in this.recurringInvoice?this.recurringInvoice.toApiJson():this.recurringInvoice),t},t}();function Bs(t,e){return"number"==typeof e?e:t[e]}var Ls=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.groupId&&(t.groupId=this.groupId),void 0!==this.sku&&(t.sku=this.sku),t},t}(),ks=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.periodStart&&(i.periodStart=new Date(e.periodStart)),e.periodEnd&&(i.periodEnd=new Date(e.periodEnd)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.periodStart&&null!==this.periodStart&&(t.periodStart="toApiJson"in this.periodStart?this.periodStart.toApiJson():this.periodStart),void 0!==this.periodEnd&&null!==this.periodEnd&&(t.periodEnd="toApiJson"in this.periodEnd?this.periodEnd.toApiJson():this.periodEnd),t},t}(),xs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.url&&(t.url=this.url),t},t}(),Fs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.periodStart&&(i.periodStart=new Date(e.periodStart)),e.periodEnd&&(i.periodEnd=new Date(e.periodEnd)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.skus&&(t.skus=this.skus),void 0!==this.periodStart&&null!==this.periodStart&&(t.periodStart="toApiJson"in this.periodStart?this.periodStart.toApiJson():this.periodStart),void 0!==this.periodEnd&&null!==this.periodEnd&&(t.periodEnd="toApiJson"in this.periodEnd?this.periodEnd.toApiJson():this.periodEnd),void 0!==this.vendorName&&(t.vendorName=this.vendorName),void 0!==this.markAsApproved&&(t.markAsApproved=this.markAsApproved),t},t}(),Ys=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.url&&(t.url=this.url),void 0!==this.bucket&&(t.bucket=this.bucket),void 0!==this.filename&&(t.filename=this.filename),t},t}(),Gs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.storeId&&(t.storeId=this.storeId),void 0!==this.bundleIds&&(t.bundleIds=this.bundleIds),t},t}(),qs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.prices&&(i.prices=Object.keys(e.prices).reduce((function(t,i){return t[i]=yt.fromProto(e.prices[i]),t}),{})),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.prices&&null!==this.prices&&(t.prices="toApiJson"in this.prices?this.prices.toApiJson():this.prices),t},t}(),Hs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.skus&&(t.skus=this.skus),void 0!==this.pricingPlanId&&(t.pricingPlanId=this.pricingPlanId),t},t}(),Ws=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.productPrices&&(i.productPrices=Object.keys(e.productPrices).reduce((function(t,i){return t[i]=Ko.fromProto(e.productPrices[i]),t}),{})),e.prices&&(i.prices=e.prices.map(zo.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.productPrices&&null!==this.productPrices&&(t.productPrices="toApiJson"in this.productPrices?this.productPrices.toApiJson():this.productPrices),void 0!==this.prices&&null!==this.prices&&(t.prices="toApiJson"in this.prices?this.prices.toApiJson():this.prices),t},t}(),Vs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.currency&&(i.currency=Bs(u,e.currency)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.currency&&(t.currency=this.currency),void 0!==this.skus&&(t.skus=this.skus),void 0!==this.groupId&&(t.groupId=this.groupId),t},t}(),zs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.productPrices&&(i.productPrices=Object.keys(e.productPrices).reduce((function(t,i){return t[i]=Ko.fromProto(e.productPrices[i]),t}),{})),e.prices&&(i.prices=e.prices.map(zo.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.productPrices&&null!==this.productPrices&&(t.productPrices="toApiJson"in this.productPrices?this.productPrices.toApiJson():this.productPrices),void 0!==this.prices&&null!==this.prices&&(t.prices="toApiJson"in this.prices?this.prices.toApiJson():this.prices),t},t}(),Ks=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.quantity&&(n.quantity=parseInt(i.quantity,10)),i.frequency&&(n.frequency=Bs(t.GeneratedFrequency,i.frequency)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.quantity&&(t.quantity=this.quantity),void 0!==this.frequency&&(t.frequency=this.frequency),t},e}(),Xs=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.totalCost&&(n.totalCost=parseInt(i.totalCost,10)),i.currency&&(n.currency=Bs(u,i.currency)),i.strategy&&(n.strategy=Bs(t.PricingPlanBillingStrategy,i.strategy)),i.commitment&&(n.commitment=Dt.fromProto(i.commitment)),i.discountAmount&&(n.discountAmount=parseInt(i.discountAmount,10)),i.subtotalCost&&(n.subtotalCost=parseInt(i.subtotalCost,10)),i.setupFee&&(n.setupFee=parseInt(i.setupFee,10)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.billingFrequency&&(t.billingFrequency=this.billingFrequency),void 0!==this.totalCost&&(t.totalCost=this.totalCost),void 0!==this.currency&&(t.currency=this.currency),void 0!==this.strategy&&(t.strategy=this.strategy),void 0!==this.commitment&&null!==this.commitment&&(t.commitment="toApiJson"in this.commitment?this.commitment.toApiJson():this.commitment),void 0!==this.isStartingPrice&&(t.isStartingPrice=this.isStartingPrice),void 0!==this.discountAmount&&(t.discountAmount=this.discountAmount),void 0!==this.subtotalCost&&(t.subtotalCost=this.subtotalCost),void 0!==this.setupFee&&(t.setupFee=this.setupFee),t},e}(),Qs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.periodStart&&(i.periodStart=new Date(e.periodStart)),e.periodEnd&&(i.periodEnd=new Date(e.periodEnd)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.skus&&(t.skus=this.skus),void 0!==this.periodStart&&null!==this.periodStart&&(t.periodStart="toApiJson"in this.periodStart?this.periodStart.toApiJson():this.periodStart),void 0!==this.periodEnd&&null!==this.periodEnd&&(t.periodEnd="toApiJson"in this.periodEnd?this.periodEnd.toApiJson():this.periodEnd),t},t}(),Zs=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.totalRevenue&&(i.totalRevenue=parseInt(e.totalRevenue,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.totalRevenue&&(t.totalRevenue=this.totalRevenue),t},t}(),$s=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),t},t}(),ta=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.totalBillableCustomers&&(i.totalBillableCustomers=parseInt(e.totalBillableCustomers,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.totalBillableCustomers&&(t.totalBillableCustomers=this.totalBillableCustomers),void 0!==this.currentBasketSize&&(t.currentBasketSize=this.currentBasketSize),void 0!==this.changeInBasketSize30Days&&(t.changeInBasketSize30Days=this.changeInBasketSize30Days),t},t}(),ea=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){var t={};return void 0!==this.sku&&(t.sku=this.sku),void 0!==this.currencyCode&&(t.currencyCode=this.currencyCode),t},t}(),ia=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.filter&&(i.filter=ea.fromProto(e.filter)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.pricingPlanId&&(t.pricingPlanId=this.pricingPlanId),void 0!==this.filter&&null!==this.filter&&(t.filter="toApiJson"in this.filter?this.filter.toApiJson():this.filter),t},t}(),na=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.results&&(i.results=e.results.map(oa.fromProto)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.results&&null!==this.results&&(t.results="toApiJson"in this.results?this.results.toApiJson():this.results),t},t}(),oa=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.productPricing&&(i.productPricing=Ko.fromProto(e.productPricing)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.pricingPlanId&&(t.pricingPlanId=this.pricingPlanId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.productPricing&&null!==this.productPricing&&(t.productPricing="toApiJson"in this.productPricing?this.productPricing.toApiJson():this.productPricing),t},t}(),ra=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.value&&(i.value=yt.fromProto(e.value)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.key&&(t.key=this.key),void 0!==this.value&&null!==this.value&&(t.value="toApiJson"in this.value?this.value.toApiJson():this.value),t},t}(),sa=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.value&&(i.value=Io.fromProto(e.value)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.key&&(t.key=this.key),void 0!==this.value&&null!==this.value&&(t.value="toApiJson"in this.value?this.value.toApiJson():this.value),t},t}(),aa=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.value&&(i.value=Ko.fromProto(e.value)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.key&&(t.key=this.key),void 0!==this.value&&null!==this.value&&(t.value="toApiJson"in this.value?this.value.toApiJson():this.value),t},t}(),ca=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.value&&(i.value=Ko.fromProto(e.value)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.key&&(t.key=this.key),void 0!==this.value&&null!==this.value&&(t.value="toApiJson"in this.value?this.value.toApiJson():this.value),t},t}(),ua=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.strategy&&(n.strategy=Bs(t.PricingPlanBillingStrategy,i.strategy)),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.strategy&&(t.strategy=this.strategy),t},e}(),pa=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e),e.volumeCommitment&&(i.volumeCommitment=parseInt(e.volumeCommitment,10)),i},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.volumeCommitment&&(t.volumeCommitment=this.volumeCommitment),t},t}(),da=function(){function t(t){t&&Object.assign(this,t)}return t.fromProto=function(e){var i=new t;return i=Object.assign(i,e)},t.prototype.toApiJson=function(){return{}},t}(),ha=function(){function e(t){t&&Object.assign(this,t)}return e.fromProto=function(i){var n=new e;return n=Object.assign(n,i),i.frequency&&(n.frequency=Bs(t.GeneratedFrequency,i.frequency)),i.pricing&&(n.pricing=Object.keys(i.pricing).reduce((function(t,e){return t[e]=Io.fromProto(i.pricing[e]),t}),{})),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.sku&&(t.sku=this.sku),void 0!==this.frequency&&(t.frequency=this.frequency),void 0!==this.pricing&&null!==this.pricing&&(t.pricing="toApiJson"in this.pricing?this.pricing.toApiJson():this.pricing),void 0!==this.groupId&&(t.groupId=this.groupId),t},e}(),la=function(){function t(t){this.environmentService=t}return t.prototype.host=function(){if(this._host)return this._host;switch(this.environmentService.getEnvironment()){case n.Environment.LOCAL:this._host="billing-api.vendasta-local.com";break;case n.Environment.TEST:this._host="";break;case n.Environment.DEMO:this._host="billing-demo.apigateway.co";break;case n.Environment.PROD:this._host="billing-prod.apigateway.co"}return this._host},t.prototype.httpsHost=function(){if(this._httpsHost)return this._httpsHost;switch(this.environmentService.getEnvironment()){case n.Environment.LOCAL:this._httpsHost="billing.vendasta-local.com";break;case n.Environment.TEST:this._httpsHost="";break;case n.Environment.DEMO:this._httpsHost="billing-api-demo.apigateway.co";break;case n.Environment.PROD:this._httpsHost="billing-api-prod.apigateway.co"}return this._httpsHost},t.prototype.hostWithScheme=function(){return(this.environmentService.getEnvironment()===n.Environment.LOCAL?"http://":"https://")+this.host()},t.prototype.httpsHostWithScheme=function(){return(this.environmentService.getEnvironment()===n.Environment.LOCAL?"http://":"https://")+this.httpsHost()},t}();la.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new la(e.ɵɵinject(n.EnvironmentService))},token:la,providedIn:"root"}),la.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],la.ctorParameters=function(){return[{type:n.EnvironmentService}]};var ma=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.listPayouts=function(t){var e=t.toApiJson?t:new bi(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.BankReconciliationService/ListPayouts",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ti.fromProto(t)})),o.share())},t.prototype.reconcilePayout=function(t){var e=t.toApiJson?t:new Ei(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.BankReconciliationService/ReconcilePayout",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ri.fromProto(t)})),o.share())},t}();ma.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ma(e.ɵɵinject(i.HttpClient),e.ɵɵinject(la))},token:ma,providedIn:"root"}),ma.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ma.ctorParameters=function(){return[{type:i.HttpClient},{type:la}]};var va=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.canBillItem=function(t){var e=t.toApiJson?t:new nt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/CanBillItem",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.canCreateSubscriptions=function(t){var e=t.toApiJson?t:new wr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/CanCreateSubscriptions",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return jr.fromProto(t)})),o.share())},t.prototype.createSubscription=function(t){var e=t.toApiJson?t:new Lr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/CreateSubscription",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.createSubscriptions=function(t){var e=t.toApiJson?t:new kr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/CreateSubscriptions",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return xr.fromProto(t)})),o.share())},t.prototype.reverseSubscription=function(t){var e=t.toApiJson?t:new Fr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/ReverseSubscription",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.setRenewalStart=function(t){var e=t.toApiJson?t:new Yr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/SetRenewalStart",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.billItem=function(t){var e=t.toApiJson?t:new $(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/BillItem",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.billMultipleItems=function(t){var e=t.toApiJson?t:new tt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/BillMultipleItems",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return et.fromProto(t)})),o.share())},t.prototype.getBillableItem=function(t){var e=t.toApiJson?t:new ct(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GetBillableItem",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ut.fromProto(t)})),o.share())},t.prototype.getMultiSubscriptions=function(t){var e=t.toApiJson?t:new pt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GetMultiSubscriptions",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return dt.fromProto(t)})),o.share())},t.prototype.listBillableItems=function(t){var e=t.toApiJson?t:new mt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/ListBillableItems",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return vt.fromProto(t)})),o.share())},t.prototype.expireBillableItem=function(t){var e=t.toApiJson?t:new st(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/ExpireBillableItem",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.deleteBillableItem=function(t){var e=t.toApiJson?t:new rt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/DeleteBillableItem",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.listMerchantBillingReports=function(t){var e=t.toApiJson?t:new dn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/ListMerchantBillingReports",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return hn.fromProto(t)})),o.share())},t.prototype.listProductSummaries=function(t){var e=t.toApiJson?t:new re(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/ListProductSummaries",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return se.fromProto(t)})),o.share())},t.prototype.getProductSummariesTotal=function(t){var e=t.toApiJson?t:new ne(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GetProductSummariesTotal",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return oe.fromProto(t)})),o.share())},t.prototype.generateBillableItemsCsv=function(t){var e=t.toApiJson?t:new ks(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GenerateBillableItemsCSV",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return xs.fromProto(t)})),o.share())},t.prototype.createPricingPlan=function(t){var e=t.toApiJson?t:new lo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/CreatePricingPlan",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return mo.fromProto(t)})),o.share())},t.prototype.updatePricingPlan=function(t){var e=t.toApiJson?t:new yo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/UpdatePricingPlan",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return So.fromProto(t)})),o.share())},t.prototype.getMultiPricingPlan=function(t){var e=t.toApiJson?t:new vo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GetMultiPricingPlan",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return fo.fromProto(t)})),o.share())},t.prototype.createPricingPlanProduct=function(t){var e=t.toApiJson?t:new bo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/CreatePricingPlanProduct",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return To.fromProto(t)})),o.share())},t.prototype.updatePricingPlanProduct=function(t){var e=t.toApiJson?t:new jo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/UpdatePricingPlanProduct",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Mo.fromProto(t)})),o.share())},t.prototype.deletePricingPlanProduct=function(t){var e=t.toApiJson?t:new Oo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/DeletePricingPlanProduct",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.listPricingPlanProducts=function(t){var e=t.toApiJson?t:new Jo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/ListPricingPlanProducts",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return No.fromProto(t)})),o.share())},t.prototype.getPricingPlanProduct=function(t){var e=t.toApiJson?t:new Co(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GetPricingPlanProduct",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Do.fromProto(t)})),o.share())},t.prototype.getMultiPricingPlanProduct=function(t){var e=t.toApiJson?t:new Eo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GetMultiPricingPlanProduct",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ro.fromProto(t)})),o.share())},t.prototype.getMultiProductPricing=function(t){var e=t.toApiJson?t:new Hs(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GetMultiProductPricing",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ws.fromProto(t)})),o.share())},t.prototype.tickComponentUsage=function(t){var e=t.toApiJson?t:new fn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/TickComponentUsage",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.createMeteredComponent=function(t){var e=t.toApiJson?t:new mn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/CreateMeteredComponent",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.listContracts=function(t){var e=t.toApiJson?t:new Lt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/ListContracts",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return kt.fromProto(t)})),o.share())},t.prototype.getMultiContract=function(t){var e=t.toApiJson?t:new Ut(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GetMultiContract",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Bt.fromProto(t)})),o.share())},t.prototype.listProducts=function(t){var e=t.toApiJson?t:new Go(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/ListProducts",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return qo.fromProto(t)})),o.share())},t.prototype.getMultiProduct=function(t){var e=t.toApiJson?t:new xo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GetMultiProduct",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Fo.fromProto(t)})),o.share())},t.prototype.resetContractPricing=function(t){var e=t.toApiJson?t:new Ft(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/ResetContractPricing",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.getPurchaseCost=function(t){var e=t.toApiJson?t:new Ks(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GetPurchaseCost",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Xs.fromProto(t)})),o.share())},t.prototype.changeFrequency=function(t){var e=t.toApiJson?t:new Ur(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/ChangeFrequency",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.changeRenewalDate=function(t){var e=t.toApiJson?t:new Br(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/ChangeRenewalDate",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.changeCustomUnitPrice=function(t){var e=t.toApiJson?t:new Mr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/ChangeCustomUnitPrice",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.startRevRecTemplateBackfill=function(t){var e=t.toApiJson?t:new da(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/StartRevRecTemplateBackfill",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t}();va.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new va(e.ɵɵinject(i.HttpClient),e.ɵɵinject(la))},token:va,providedIn:"root"}),va.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],va.ctorParameters=function(){return[{type:i.HttpClient},{type:la}]};var fa=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.upsert=function(t){var e=t.toApiJson?t:new Ct(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.BundleService/Upsert",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.getMulti=function(t){var e=t.toApiJson?t:new Pt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.BundleService/GetMulti",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return bt.fromProto(t)})),o.share())},t.prototype.list=function(t){var e=t.toApiJson?t:new Tt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.BundleService/List",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ot.fromProto(t)})),o.share())},t}();fa.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new fa(e.ɵɵinject(i.HttpClient),e.ɵɵinject(la))},token:fa,providedIn:"root"}),fa.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],fa.ctorParameters=function(){return[{type:i.HttpClient},{type:la}]};var ga=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.list=function(t){var e=t.toApiJson?t:new Kr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.ContractDocumentService/List",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Xr.fromProto(t)})),o.share())},t.prototype.delete=function(t){var e=t.toApiJson?t:new Vr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.ContractDocumentService/Delete",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t}();ga.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ga(e.ɵɵinject(i.HttpClient),e.ɵɵinject(la))},token:ga,providedIn:"root"}),ga.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ga.ctorParameters=function(){return[{type:i.HttpClient},{type:la}]};var Ia=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.get=function(t){var e=t.toApiJson?t:new jt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.ContractService/Get",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Mt.fromProto(t)})),o.share())},t.prototype.updateSubscription=function(t){var e=t.toApiJson?t:new qt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.ContractService/UpdateSubscription",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.create=function(t){var e=t.toApiJson?t:new Nt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.ContractService/Create",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return wt.fromProto(t)})),o.share())},t.prototype.update=function(t){var e=t.toApiJson?t:new Yt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.ContractService/Update",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Gt.fromProto(t)})),o.share())},t}();Ia.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Ia(e.ɵɵinject(i.HttpClient),e.ɵɵinject(la))},token:Ia,providedIn:"root"}),Ia.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Ia.ctorParameters=function(){return[{type:i.HttpClient},{type:la}]};var Aa=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.add=function(t){var e=t.toApiJson?t:new es(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.CreditService/Add",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.getBalance=function(t){var e=t.toApiJson?t:new ns(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.CreditService/GetBalance",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return os.fromProto(t)})),o.share())},t}();Aa.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Aa(e.ɵɵinject(i.HttpClient),e.ɵɵinject(la))},token:Aa,providedIn:"root"}),Aa.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Aa.ctorParameters=function(){return[{type:i.HttpClient},{type:la}]};var ya=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.list=function(t){var e=t.toApiJson?t:new ye(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.DiscountService/List",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Se.fromProto(t)})),o.share())},t.prototype.create=function(t){var e=t.toApiJson?t:new fe(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.DiscountService/Create",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.update=function(t){var e=t.toApiJson?t:new Pe(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.DiscountService/Update",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.expire=function(t){var e=t.toApiJson?t:new Ie(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.DiscountService/Expire",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t}();ya.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ya(e.ɵɵinject(i.HttpClient),e.ɵɵinject(la))},token:ya,providedIn:"root"}),ya.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ya.ctorParameters=function(){return[{type:i.HttpClient},{type:la}]};var Sa=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.addBundle=function(t){var e=t.toApiJson?t:new ke(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/AddBundle",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return xe.fromProto(t)})),o.share())},t.prototype.addLineItem=function(t){var e=t.toApiJson?t:new Fe(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/AddLineItem",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ye.fromProto(t)})),o.share())},t.prototype.charge=function(t){var e=t.toApiJson?t:new Ge(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/Charge",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.create=function(t){var e=t.toApiJson?t:new qe(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/Create",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return He.fromProto(t)})),o.share())},t.prototype.delete=function(t){var e=t.toApiJson?t:new ze(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/Delete",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.deleteLineItem=function(t){var e=t.toApiJson?t:new Ke(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/DeleteLineItem",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Xe.fromProto(t)})),o.share())},t.prototype.get=function(t){var e=t.toApiJson?t:new ti(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/Get",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ei.fromProto(t)})),o.share())},t.prototype.removeBundle=function(t){var e=t.toApiJson?t:new ai(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/RemoveBundle",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ci.fromProto(t)})),o.share())},t.prototype.send=function(t){var e=t.toApiJson?t:new ui(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/Send",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.list=function(t){var e=t.toApiJson?t:new oi(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/List",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ri.fromProto(t)})),o.share())},t.prototype.update=function(t){var e=t.toApiJson?t:new mi(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/Update",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return vi.fromProto(t)})),o.share())},t.prototype.pay=function(t){var e=t.toApiJson?t:new si(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/Pay",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.updateDefaultTaxRates=function(t){var e=t.toApiJson?t:new hi(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/UpdateDefaultTaxRates",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return li.fromProto(t)})),o.share())},t.prototype.updateLineItem=function(t){var e=t.toApiJson?t:new fi(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/UpdateLineItem",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return gi.fromProto(t)})),o.share())},t.prototype.void=function(t){var e=t.toApiJson?t:new Ii(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/Void",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.duplicate=function(t){var e=t.toApiJson?t:new Qe(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/Duplicate",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ze.fromProto(t)})),o.share())},t.prototype.updateBundle=function(t){var e=t.toApiJson?t:new pi(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/UpdateBundle",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return di.fromProto(t)})),o.share())},t}();Sa.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Sa(e.ɵɵinject(i.HttpClient),e.ɵɵinject(la))},token:Sa,providedIn:"root"}),Sa.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Sa.ctorParameters=function(){return[{type:i.HttpClient},{type:la}]};var Pa=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.addBundle=function(t){var e=t.toApiJson?t:new rs(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceTemplateService/AddBundle",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ss.fromProto(t)})),o.share())},t.prototype.addLineItem=function(t){var e=t.toApiJson?t:new as(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceTemplateService/AddLineItem",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return cs.fromProto(t)})),o.share())},t.prototype.create=function(t){var e=t.toApiJson?t:new us(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceTemplateService/Create",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ps.fromProto(t)})),o.share())},t.prototype.upsert=function(t){var e=t.toApiJson?t:new Os(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceTemplateService/Upsert",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Es.fromProto(t)})),o.share())},t.prototype.get=function(t){var e=t.toApiJson?t:new ms(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceTemplateService/Get",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return vs.fromProto(t)})),o.share())},t.prototype.delete=function(t){var e=t.toApiJson?t:new ds(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceTemplateService/Delete",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.deleteLineItem=function(t){var e=t.toApiJson?t:new hs(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceTemplateService/DeleteLineItem",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ls.fromProto(t)})),o.share())},t.prototype.updateBundle=function(t){var e=t.toApiJson?t:new As(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceTemplateService/UpdateBundle",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ys.fromProto(t)})),o.share())},t.prototype.updateLineItem=function(t){var e=t.toApiJson?t:new bs(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceTemplateService/UpdateLineItem",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ts.fromProto(t)})),o.share())},t.prototype.updateTemplateDefaultTaxRates=function(t){var e=t.toApiJson?t:new Ss(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceTemplateService/UpdateTemplateDefaultTaxRates",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ps.fromProto(t)})),o.share())},t}();Pa.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Pa(e.ɵɵinject(i.HttpClient),e.ɵɵinject(la))},token:Pa,providedIn:"root"}),Pa.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Pa.ctorParameters=function(){return[{type:i.HttpClient},{type:la}]};var ba=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.create=function(t){var e=t.toApiJson?t:new wi(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/Create",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.get=function(t){var e=t.toApiJson?t:new Mi(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/Get",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ui.fromProto(t)})),o.share())},t.prototype.getOutstandingBalance=function(t){var e=t.toApiJson?t:new ki(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/GetOutstandingBalance",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return xi.fromProto(t)})),o.share())},t.prototype.update=function(t){var e=t.toApiJson?t:new an(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/Update",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.createPaymentCard=function(t){var e=t.toApiJson?t:new no(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/CreatePaymentCard",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.setDefaultPaymentCard=function(t){var e=t.toApiJson?t:new on(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/SetDefaultPaymentCard",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.listPaymentCards=function(t){var e=t.toApiJson?t:new ro(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/ListPaymentCards",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return so.fromProto(t)})),o.share())},t.prototype.updatePaymentCard=function(t){var e=t.toApiJson?t:new uo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/UpdatePaymentCard",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.getStatistics=function(t){var e=t.toApiJson?t:new $s(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/GetStatistics",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ta.fromProto(t)})),o.share())},t.prototype.search=function(t){var e=t.toApiJson?t:new $i(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/Search",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return tn.fromProto(t)})),o.share())},t.prototype.setAutoPostInvoices=function(t){var e=t.toApiJson?t:new nn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/SetAutoPostInvoices",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.setAutoChargeInvoices=function(t){var e=t.toApiJson?t:new en(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/SetAutoChargeInvoices",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.setIncludeInFinancialRecords=function(t){var e=t.toApiJson?t:new sn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/SetIncludeInFinancialRecords",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.setHasAlternativePaymentMethod=function(t){var e=t.toApiJson?t:new rn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/SetHasAlternativePaymentMethod",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.sendSalesInvoiceEmail=function(t){var e=t.toApiJson?t:new Cr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/SendSalesInvoiceEmail",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.chargeSalesInvoice=function(t){var e=t.toApiJson?t:new _i(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/ChargeSalesInvoice",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.sendSalesInvoiceReceiptEmail=function(t){var e=t.toApiJson?t:new Dr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/SendSalesInvoiceReceiptEmail",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.createStripeExternalAccount=function(t){var e=t.toApiJson?t:new Kt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/CreateStripeExternalAccount",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.listBankAccounts=function(t){var e=t.toApiJson?t:new Qt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/ListBankAccounts",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Zt.fromProto(t)})),o.share())},t.prototype.setDefaultBankAccount=function(t){var e=t.toApiJson?t:new $t(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/SetDefaultBankAccount",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.deleteBankAccount=function(t){var e=t.toApiJson?t:new Xt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/DeleteBankAccount",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.getMultiRetailConfigurations=function(t){var e=t.toApiJson?t:new Bi(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/GetMultiRetailConfigurations",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Li.fromProto(t)})),o.share())},t.prototype.upsertRetailConfiguration=function(t){var e=t.toApiJson?t:new un(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/UpsertRetailConfiguration",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.upsertDefaultRetailCustomerConfiguration=function(t){var e=t.toApiJson?t:new cn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/UpsertDefaultRetailCustomerConfiguration",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.getRetailBalance=function(t){var e=t.toApiJson?t:new Gi(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/GetRetailBalance",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return qi.fromProto(t)})),o.share())},t.prototype.getPayoutSummary=function(t){var e=t.toApiJson?t:new Fi(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/GetPayoutSummary",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Yi.fromProto(t)})),o.share())},t.prototype.listRetailPayouts=function(t){var e=t.toApiJson?t:new Ki(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/ListRetailPayouts",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Xi.fromProto(t)})),o.share())},t.prototype.getRetailPayout=function(t){var e=t.toApiJson?t:new Hi(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/GetRetailPayout",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Wi.fromProto(t)})),o.share())},t}();ba.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ba(e.ɵɵinject(i.HttpClient),e.ɵɵinject(la))},token:ba,providedIn:"root"}),ba.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ba.ctorParameters=function(){return[{type:i.HttpClient},{type:la}]};var Ta=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.listPaymentCards=function(t){var e=t.toApiJson?t:new ro(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentMethodService/ListPaymentCards",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return so.fromProto(t)})),o.share())},t.prototype.deletePaymentCard=function(t){var e=t.toApiJson?t:new oo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentMethodService/DeletePaymentCard",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.setDefaultPaymentMethod=function(t){var e=t.toApiJson?t:new co(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentMethodService/SetDefaultPaymentMethod",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t}();Ta.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Ta(e.ɵɵinject(i.HttpClient),e.ɵɵinject(la))},token:Ta,providedIn:"root"}),Ta.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Ta.ctorParameters=function(){return[{type:i.HttpClient},{type:la}]};var Oa=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.list=function(t){var e=t.toApiJson?t:new Mn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/List",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Un.fromProto(t)})),o.share())},t.prototype.getRetail=function(t){var e=t.toApiJson?t:new Nn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/GetRetail",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return wn.fromProto(t)})),o.share())},t.prototype.listRetail=function(t){var e=t.toApiJson?t:new xn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/ListRetail",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Fn.fromProto(t)})),o.share())},t.prototype.listRetailDisputes=function(t){var e=t.toApiJson?t:new Bn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/ListRetailDisputes",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ln.fromProto(t)})),o.share())},t.prototype.getRetailDispute=function(t){var e=t.toApiJson?t:new Cn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/GetRetailDispute",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Dn.fromProto(t)})),o.share())},t.prototype.closeRetailDispute=function(t){var e=t.toApiJson?t:new An(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/CloseRetailDispute",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.prepareRetail=function(t){var e=t.toApiJson?t:new Hn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/PrepareRetail",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Wn.fromProto(t)})),o.share())},t.prototype.confirmRetail=function(t){var e=t.toApiJson?t:new Pn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/ConfirmRetail",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.retailStatus=function(t){var e=t.toApiJson?t:new Xn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/RetailStatus",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Qn.fromProto(t)})),o.share())},t.prototype.retailPaymentsEnabled=function(t){var e=t.toApiJson?t:new zn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/RetailPaymentsEnabled",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Kn.fromProto(t)})),o.share())},t.prototype.configureRetailProvider=function(t){var e=t.toApiJson?t:new yn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/ConfigureRetailProvider",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Sn.fromProto(t)})),o.share())},t.prototype.updateRetailProvider=function(t){var e=t.toApiJson?t:new $n(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/UpdateRetailProvider",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.getRetailProvider=function(t){var e=t.toApiJson?t:new _n(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/GetRetailProvider",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Jn.fromProto(t)})),o.share())},t.prototype.submitEvidence=function(t){var e=t.toApiJson?t:new Zn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/SubmitEvidence",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t}();Oa.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Oa(e.ɵɵinject(i.HttpClient),e.ɵɵinject(la))},token:Oa,providedIn:"root"}),Oa.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Oa.ctorParameters=function(){return[{type:i.HttpClient},{type:la}]};var Ea=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.getMultiRetail=function(t){var e=t.toApiJson?t:new Vs(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PricingService/GetMultiRetail",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return zs.fromProto(t)})),o.share())},t.prototype.upsertRetail=function(t){var e=t.toApiJson?t:new ha(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PricingService/UpsertRetail",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.deleteRetail=function(t){var e=t.toApiJson?t:new Ls(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PricingService/DeleteRetail",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.getMultiBundleRetail=function(t){var e=t.toApiJson?t:new Gs(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PricingService/GetMultiBundleRetail",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return qs.fromProto(t)})),o.share())},t.prototype.getWholesaleComparison=function(t){var e=t.toApiJson?t:new ia(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PricingService/GetWholesaleComparison",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return na.fromProto(t)})),o.share())},t.prototype.setWholesaleProductStrategy=function(t){var e=t.toApiJson?t:new ua(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PricingService/SetWholesaleProductStrategy",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.setWholesaleProductVolumeCommitment=function(t){var e=t.toApiJson?t:new pa(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PricingService/SetWholesaleProductVolumeCommitment",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.getPurchaseCost=function(t){var e=t.toApiJson?t:new Ks(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PricingService/GetPurchaseCost",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Xs.fromProto(t)})),o.share())},t.prototype.upsertWholesale=function(t){var e=t.toApiJson?t:new Uo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PricingService/UpsertWholesale",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t}();Ea.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Ea(e.ɵɵinject(i.HttpClient),e.ɵɵinject(la))},token:Ea,providedIn:"root"}),Ea.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Ea.ctorParameters=function(){return[{type:i.HttpClient},{type:la}]};var Ra=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.create=function(t){var e=t.toApiJson?t:new Lo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.ProductService/Create",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.update=function(t){var e=t.toApiJson?t:new Wo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.ProductService/Update",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.delete=function(t){var e=t.toApiJson?t:new ko(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.ProductService/Delete",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t}();Ra.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Ra(e.ɵɵinject(i.HttpClient),e.ɵɵinject(la))},token:Ra,providedIn:"root"}),Ra.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Ra.ctorParameters=function(){return[{type:i.HttpClient},{type:la}]};var Ca=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.listSubscriptionRetentionByGroup=function(t){var e=t.toApiJson?t:new ue(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.ProductSummaryService/ListSubscriptionRetentionByGroup",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ae.fromProto(t)})),o.share())},t.prototype.listSubscriptionRetentionBySku=function(t){var e=t.toApiJson?t:new ue(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.ProductSummaryService/ListSubscriptionRetentionBySKU",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ce.fromProto(t)})),o.share())},t}();Ca.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Ca(e.ɵɵinject(i.HttpClient),e.ɵɵinject(la))},token:Ca,providedIn:"root"}),Ca.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Ca.ctorParameters=function(){return[{type:i.HttpClient},{type:la}]};var Da=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.list=function(t){var e=t.toApiJson?t:new nr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PurchaseService/List",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return or.fromProto(t)})),o.share())},t.prototype.getMultiCustomerSummaries=function(t){var e=t.toApiJson?t:new Wt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PurchaseService/GetMultiCustomerSummaries",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Vt.fromProto(t)})),o.share())},t.prototype.listPurchaseItems=function(t){var e=t.toApiJson?t:new er(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PurchaseService/ListPurchaseItems",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ir.fromProto(t)})),o.share())},t.prototype.retry=function(t){var e=t.toApiJson?t:new ar(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PurchaseService/Retry",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.void=function(t){var e=t.toApiJson?t:new cr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PurchaseService/Void",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t}();Da.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Da(e.ɵɵinject(i.HttpClient),e.ɵɵinject(la))},token:Da,providedIn:"root"}),Da.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Da.ctorParameters=function(){return[{type:i.HttpClient},{type:la}]};var _a=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.createRecurringInvoice=function(t){var e=t.toApiJson?t:new Ns(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.RecurringInvoiceService/CreateRecurringInvoice",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ns.fromProto(t)})),o.share())},t.prototype.updateRecurringInvoice=function(t){var e=t.toApiJson?t:new Us(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.RecurringInvoiceService/UpdateRecurringInvoice",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ns.fromProto(t)})),o.share())},t.prototype.getRecurringInvoice=function(t){var e=t.toApiJson?t:new Ds(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.RecurringInvoiceService/GetRecurringInvoice",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ns.fromProto(t)})),o.share())},t.prototype.listRecurringInvoices=function(t){var e=t.toApiJson?t:new _s(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.RecurringInvoiceService/ListRecurringInvoices",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Js.fromProto(t)})),o.share())},t.prototype.deleteRecurringInvoice=function(t){var e=t.toApiJson?t:new Cs(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.RecurringInvoiceService/DeleteRecurringInvoice",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t}();_a.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new _a(e.ɵɵinject(i.HttpClient),e.ɵɵinject(la))},token:_a,providedIn:"root"}),_a.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],_a.ctorParameters=function(){return[{type:i.HttpClient},{type:la}]};var Ja=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.create=function(t){var e=t.toApiJson?t:new pr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.RefundService/Create",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.list=function(t){var e=t.toApiJson?t:new dr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.RefundService/List",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return hr.fromProto(t)})),o.share())},t}();Ja.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Ja(e.ɵɵinject(i.HttpClient),e.ɵɵinject(la))},token:Ja,providedIn:"root"}),Ja.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Ja.ctorParameters=function(){return[{type:i.HttpClient},{type:la}]};var Na=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.get=function(t){var e=t.toApiJson?t:new Qr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.RetailCustomerConfigurationService/Get",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Zr.fromProto(t)})),o.share())},t.prototype.upsert=function(t){var e=t.toApiJson?t:new ts(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.RetailCustomerConfigurationService/Upsert",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t}();Na.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Na(e.ɵɵinject(i.HttpClient),e.ɵɵinject(la))},token:Na,providedIn:"root"}),Na.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Na.ctorParameters=function(){return[{type:i.HttpClient},{type:la}]};var wa=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.create=function(t){var e=t.toApiJson?t:new vr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.SalesCreditNoteService/Create",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.list=function(t){var e=t.toApiJson?t:new gr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.SalesCreditNoteService/List",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ir.fromProto(t)})),o.share())},t}();wa.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new wa(e.ɵɵinject(i.HttpClient),e.ɵɵinject(la))},token:wa,providedIn:"root"}),wa.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],wa.ctorParameters=function(){return[{type:i.HttpClient},{type:la}]};var ja=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.list=function(t){var e=t.toApiJson?t:new Tr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.SalesInvoiceService/List",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Or.fromProto(t)})),o.share())},t.prototype.post=function(t){var e=t.toApiJson?t:new Er(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.SalesInvoiceService/Post",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.get=function(t){var e=t.toApiJson?t:new Sr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.SalesInvoiceService/Get",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Pr.fromProto(t)})),o.share())},t}();ja.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ja(e.ɵɵinject(i.HttpClient),e.ɵɵinject(la))},token:ja,providedIn:"root"}),ja.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ja.ctorParameters=function(){return[{type:i.HttpClient},{type:la}]};var Ma=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.calculate=function(t){var e=t.toApiJson?t:new Ee(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.TaxService/Calculate",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Re.fromProto(t)})),o.share())},t.prototype.create=function(t){var e=t.toApiJson?t:new Ce(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.TaxService/Create",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.getMulti=function(t){var e=t.toApiJson?t:new _e(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.TaxService/GetMulti",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Je.fromProto(t)})),o.share())},t.prototype.update=function(t){var e=t.toApiJson?t:new Me(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.TaxService/Update",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t.prototype.list=function(t){var e=t.toApiJson?t:new Ne(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.TaxService/List",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return we.fromProto(t)})),o.share())},t.prototype.archive=function(t){var e=t.toApiJson?t:new Oe(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.TaxService/Archive",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t}();Ma.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Ma(e.ɵɵinject(i.HttpClient),e.ɵɵinject(la))},token:Ma,providedIn:"root"}),Ma.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Ma.ctorParameters=function(){return[{type:i.HttpClient},{type:la}]};var Ua,Ba=function(){function t(t,e){this.http=t,this.hostService=e}return t.prototype.apiOptions=function(){return{headers:new i.HttpHeaders({"Content-Type":"application/json"}),withCredentials:!0}},t.prototype.generateReport=function(t){var e=t.toApiJson?t:new Fs(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.VendorService/GenerateReport",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ys.fromProto(t)})),o.share())},t.prototype.getRevenueStats=function(t){var e=t.toApiJson?t:new Qs(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.VendorService/GetRevenueStats",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Zs.fromProto(t)})),o.share())},t}();function La(e){switch(e){case c.DISCOUNT_TYPE_FIXED_AMOUNT_PER_UNIT:return t.AppliedDiscountType.FIXED_AMOUNT_PER_UNIT;case c.DISCOUNT_TYPE_FIXED_NUMBER_OF_UNITS:return t.AppliedDiscountType.FIXED_NUMBER_OF_UNITS;case c.DISCOUNT_TYPE_PERCENT_AMOUNT:return t.AppliedDiscountType.PERCENT_AMOUNT}return t.AppliedDiscountType.FIXED_AMOUNT}function ka(e){switch(e){case t.AppliedDiscountType.FIXED_AMOUNT_PER_UNIT:return c.DISCOUNT_TYPE_FIXED_AMOUNT_PER_UNIT;case t.AppliedDiscountType.FIXED_NUMBER_OF_UNITS:return c.DISCOUNT_TYPE_FIXED_NUMBER_OF_UNITS;case t.AppliedDiscountType.PERCENT_AMOUNT:return c.DISCOUNT_TYPE_PERCENT_AMOUNT}return c.DISCOUNT_TYPE_FIXED_AMOUNT}function xa(t){return{type:La(t.type),value:t.value||0,totalAmount:t.totalAmount||0,description:t.description||""}}Ba.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Ba(e.ɵɵinject(i.HttpClient),e.ɵɵinject(la))},token:Ba,providedIn:"root"}),Ba.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Ba.ctorParameters=function(){return[{type:i.HttpClient},{type:la}]},(Ua=t.AppliedDiscountType||(t.AppliedDiscountType={})).FIXED_AMOUNT="FIXED_AMOUNT",Ua.PERCENT_AMOUNT="PERCENT_AMOUNT",Ua.FIXED_NUMBER_OF_UNITS="FIXED_NUMBER_OF_UNITS",Ua.FIXED_AMOUNT_PER_UNIT="FIXED_AMOUNT_PER_UNIT";var Fa=function(){function t(t){this.merchantApi=t}return t.prototype.listBankAccounts=function(t){return this.merchantApi.listBankAccounts(new Qt({merchantId:t})).pipe(o.map((function(t){return t&&t.bankAccount?t.bankAccount:[]})),o.map((function(t){return t.map((function(t){return{id:(e=t).id,accountHolderName:e.accountHolderName,bankName:e.bankName,country:e.country,currency:e.currency,routingNumber:e.routingNumber,last4:e.last4,defaultForCurrency:e.defaultForCurrency};var e}))})))},t.prototype.setDefaultBankAccount=function(t,e){var i=new $t({merchantId:t,bankAccountId:e});return this.merchantApi.setDefaultBankAccount(i)},t.prototype.deleteBankAccount=function(t,e){var i=new Xt({merchantId:t,bankAccountId:e});return this.merchantApi.deleteBankAccount(i)},t}();function Ya(e){switch(e){case t.PricingPlanBillingStrategy.BILLING_STRATEGY_END_OF_PERIOD:return t.BillingStrategy.EndOfPeriod;case t.PricingPlanBillingStrategy.BILLING_STRATEGY_START_OF_PERIOD:return t.BillingStrategy.StartOfPeriod;case t.PricingPlanBillingStrategy.BILLING_STRATEGY_INSTANTLY:return t.BillingStrategy.Instantly;case t.PricingPlanBillingStrategy.BILLING_STRATEGY_END_OF_DAY:return t.BillingStrategy.EndOfDay}return t.BillingStrategy.Invalid}function Ga(e){switch(e){case t.BillingStrategy.EndOfPeriod:return t.PricingPlanBillingStrategy.BILLING_STRATEGY_END_OF_PERIOD;case t.BillingStrategy.StartOfPeriod:return t.PricingPlanBillingStrategy.BILLING_STRATEGY_START_OF_PERIOD;case t.BillingStrategy.Instantly:return t.PricingPlanBillingStrategy.BILLING_STRATEGY_INSTANTLY;case t.BillingStrategy.EndOfDay:return t.PricingPlanBillingStrategy.BILLING_STRATEGY_END_OF_DAY}return t.PricingPlanBillingStrategy.BILLING_STRATEGY_NONE}function qa(e){switch(e){case u.USD:return t.Currency.USD;case u.CAD:return t.Currency.CAD;case u.EUR:return t.Currency.EUR;case u.AUD:return t.Currency.AUD;case u.GBP:return t.Currency.GBP;case u.NZD:return t.Currency.NZD;case u.BRL:return t.Currency.BRL;case u.CHF:return t.Currency.CHF;case u.CNY:return t.Currency.CNY;case u.CZK:return t.Currency.CZK;case u.INR:return t.Currency.INR;case u.JPY:return t.Currency.JPY;case u.KHR:return t.Currency.KHR;case u.KRW:return t.Currency.KRW;case u.MXN:return t.Currency.MXN;case u.NOK:return t.Currency.NOK;case u.RUB:return t.Currency.RUB;case u.SEK:return t.Currency.SEK;case u.SGD:return t.Currency.SGD;case u.TRY:return t.Currency.TRY;case u.ZAR:return t.Currency.ZAR;case u.DZD:return t.Currency.DZD;case u.AWG:return t.Currency.AWG;case u.FJD:return t.Currency.FJD;case u.KYD:return t.Currency.KYD;default:return t.Currency.USD}}function Ha(e){switch(e){case"monthly":return t.Frequency.Monthly;case"yearly":return t.Frequency.Yearly;case"one_time":return t.Frequency.OneTime}return t.Frequency.Invalid}function Wa(e){switch(e){case t.GeneratedFrequency.MONTHLY:return t.Frequency.Monthly;case t.GeneratedFrequency.YEARLY:return t.Frequency.Yearly;case t.GeneratedFrequency.ONE_TIME:return t.Frequency.OneTime}return t.Frequency.Invalid}function Va(e){switch(e){case t.Frequency.Monthly:return t.GeneratedFrequency.MONTHLY;case t.Frequency.Yearly:return t.GeneratedFrequency.YEARLY;case t.Frequency.OneTime:return t.GeneratedFrequency.ONE_TIME}return t.GeneratedFrequency.INVALID}function za(t){return t?t.map((function(t){return{price:t.price||0,minUnits:t.minUnits,maxUnits:t.maxUnits}})):null}function Ka(e){switch(e){case N.PRODUCT_PRICING_TYPE_STANDARD:return t.ProductPricingType.Standard;case N.PRODUCT_PRICING_TYPE_STAIRSTEP:return t.ProductPricingType.Stairstep;case N.PRODUCT_PRICING_TYPE_TIERED:return t.ProductPricingType.Tiered}return t.ProductPricingType.Invalid}function Xa(e){switch(e){case t.ProductPricingType.Standard:return N.PRODUCT_PRICING_TYPE_STANDARD;case t.ProductPricingType.Stairstep:return N.PRODUCT_PRICING_TYPE_STAIRSTEP;case t.ProductPricingType.Tiered:return N.PRODUCT_PRICING_TYPE_TIERED}return N.PRODUCT_PRICING_TYPE_INVALID}function Qa(t){return{initial:t.initial,recurring:t.recurring}}function Za(t){var e=t.subtotalCost||0,i=t.discountAmount||0,n=t.totalCost||0,o=t.setupFee||0;return{subtotal:e,discountTotal:i,total:n,billingFrequency:Ha(t.billingFrequency),currency:qa(t.currency),strategy:Ya(t.strategy),commitment:Qa(t.commitment),isStartingPrice:t.isStartingPrice,setupFee:o}}function $a(t){return{strategy:Ya(t.strategy),pricingType:Ka(t.pricingType),currency:qa(t.currency),frequency:Wa(t.frequency),pricingRules:za(t.pricingRules),commitment:Qa(t.commitment),volumeCommitment:t.volumeCommitment,isStartingPrice:t.isStartingPrice,resolvedFrom:t.resolvedFrom,setupFee:t.setupFee}}function tc(t){return null==t?void 0:t.map((function(t){return t&&{sku:t.sku,prices:t.prices.map((function(t){return t&&$a(t)}))}}))}function ec(t){var e={};for(var i in t.pricing)if(t.pricing.hasOwnProperty(i)){var n=t.pricing[i];e[i]={type:Ka(n.type),rules:za(n.rules),setupFee:n.setupFee||0}}return{pricingPlanId:t.pricingPlanId,sku:t.sku,frequency:Wa(t.frequency),pricing:e,commitment:Qa(t.commitment),created:t.created,modified:t.modified,strategy:Ya(t.strategy),volumeCommitment:t.volumeCommitment}}function ic(e){return Object.keys(e).filter((function(e){return e in t.Currency})).reduce((function(t,i){return t[i]=oc(e[i]),t}),{})}function nc(t){return t.map((function(t){return new Ao(t)}))}function oc(t){return new Io({type:Xa(t.type),rules:nc(t.rules),setupFee:t.setupFee,frequency:Va(t.frequency),currencyCode:t.currencyCode})}Fa.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Fa(e.ɵɵinject(ba))},token:Fa,providedIn:"root"}),Fa.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Fa.ctorParameters=function(){return[{type:ba}]},function(t){t.Invalid="INVALID",t.EndOfPeriod="END_OF_PERIOD",t.StartOfPeriod="START_OF_PERIOD",t.Instantly="INSTANTLY",t.EndOfDay="END_OF_DAY"}(t.BillingStrategy||(t.BillingStrategy={})),function(t){t.USD="USD",t.CAD="CAD",t.EUR="EUR",t.AUD="AUD",t.GBP="GBP",t.NZD="NZD",t.BRL="BRL",t.CHF="CHF",t.CNY="CNY",t.CZK="CZK",t.INR="INR",t.JPY="JPY",t.KHR="KHR",t.KRW="KRW",t.MXN="MXN",t.NOK="NOK",t.RUB="RUB",t.SEK="SEK",t.SGD="SGD",t.TRY="TRY",t.ZAR="ZAR",t.DZD="DZD",t.AWG="AWG",t.FJD="FJD",t.KYD="KYD"}(t.Currency||(t.Currency={})),function(t){t.Invalid="INVALID",t.Monthly="MONTHLY",t.Yearly="YEARLY",t.OneTime="ONE_TIME"}(t.Frequency||(t.Frequency={})),function(t){t.Invalid="INVALID",t.Standard="STANDARD",t.Stairstep="STAIRSTEP",t.Tiered="TIERED"}(t.ProductPricingType||(t.ProductPricingType={}));var rc,sc=function(){function t(t,e,i,n){this.hostService=t,this.http=e,this.pricingService=i,this.billingApi=n}return t.prototype.setProductBillingStrategy=function(t,e,i){var n=Ga(i);return this.pricingService.setWholesaleProductStrategy({merchantId:t,sku:e,strategy:n}).pipe(o.map((function(){return null})))},t.prototype.setProductVolumeCommitment=function(t,e,i){return this.pricingService.setWholesaleProductVolumeCommitment({merchantId:t,sku:e,volumeCommitment:i}).pipe(o.map((function(){return null})))},t.prototype.getPurchaseCost=function(t,e,i){return this.pricingService.getPurchaseCost({merchantId:t,sku:e,quantity:i}).pipe(o.map((function(t){return Za(t)})))},t.prototype.getMultiWholesalePrices=function(t,e,i){return this.billingApi.getMultiProductPricing({merchantId:t,skus:e,pricingPlanId:i}).pipe(o.map((function(t){return tc(t.prices)})))},t.prototype.upsertPricing=function(t,e,i,n,o,r){var s=new Uo({pricingPlanId:t,sku:e,pricing:(i||[]).map((function(t){return oc(t)})),strategy:Ga(o),termCommitment:n,volumeCommitment:r});return this.pricingService.upsertWholesale(s)},t}();function ac(t){return{id:t.id,name:t.name,defaultStrategy:Ya(t.defaultBillingStrategy)}}
2
2
  /*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -12,5 +12,5 @@
12
12
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
13
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
14
  PERFORMANCE OF THIS SOFTWARE.
15
- ***************************************************************************** */Wa.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Wa(e.ɵɵinject($s),e.ɵɵinject(i.HttpClient),e.ɵɵinject(ha),e.ɵɵinject(ea))},token:Wa,providedIn:"root"}),Wa.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Wa.ctorParameters=function(){return[{type:$s},{type:i.HttpClient},{type:ha},{type:ea}]},(Ga=t.Distribution||(t.Distribution={})).Retail="Retail",Ga.Wholesale="Wholesale";Object.create;function Va(t){var e="function"==typeof Symbol&&Symbol.iterator,i=e&&t[e],n=0;if(i)return i.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function za(t,e){var i="function"==typeof Symbol&&t[Symbol.iterator];if(!i)return t;var n,o,r=i.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(n=r.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(i=r.return)&&i.call(r)}finally{if(o)throw o.error}}return s}function Ka(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(za(arguments[e]));return t}Object.create;var Xa,Qa=function(){function e(t,e){this.environmentService=t,this.billingService=e}return e.prototype.list=function(e){var i=this.environmentService.getEnvironment();switch(e){case t.Distribution.Retail:return sc.get(i);case t.Distribution.Wholesale:return rc.get(i)}return oc.get(i)||[]},e.prototype.isDefault=function(t){return t===this.list().find((function(t){return t.name===Za.Default})).id},e.prototype.nameForId=function(t){return this.list().find((function(e){return e.id===t})).name||null},e.prototype.idForName=function(t){var e=this.list().find((function(e){return e.name===t}));return e?e.id:null},e.prototype.idForSubscriptionName=function(t){var e=this.list().find((function(e){return e.subscriptionName===t}));return e?e.id:null},e.prototype.setDefaultStrategy=function(t,e){var i={id:t,fieldMask:{paths:["default_billing_strategy"]},defaultBillingStrategy:Da(e)};return this.billingService.updatePricingPlan(i)},e.prototype.getMulti=function(t){return this.billingService.getMultiPricingPlan({pricingPlanIds:t}).pipe(o.map((function(t){return t.plans.map((function(t){return Ha(t)}))})))},e}();Qa.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Qa(e.ɵɵinject(n.EnvironmentService),e.ɵɵinject(ea))},token:Qa,providedIn:"root"}),Qa.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Qa.ctorParameters=function(){return[{type:n.EnvironmentService},{type:ea}]},function(t){t.MSRP="MSRP"}(Xa||(Xa={}));var Za,$a=[{id:"PP-5049b4b2-fe28-473f-96d6-84d4ea91ada9",name:Xa.MSRP,subscriptionName:"msrp",defaultStrategy:t.BillingStrategy.Invalid}],tc=[{id:"PP-148b6d8c-6222-4fce-9cd2-f0587f0db563",name:Xa.MSRP,subscriptionName:"msrp",defaultStrategy:t.BillingStrategy.Invalid}];!function(t){t.VBPFree="Free",t.VBPStarter="Starter",t.VBPBasic="Basic+",t.VBPProfessional="Professional+",t.VBPEnterprise="Enterprise+",t.VBPEnterprisePilot="Enterprise+ Pilot",t.VBP2Startup="Startup+",t.VBP2Essentials="Essentials+",t.VBP2Growth="Growth+",t.VBP2Scale="Scale+",t.BasicSubscription="Basic",t.ProfessionalSubscription="Professional",t.EnterpriseSubscription="Enterprise",t.EliteSubscription="Elite",t.PremiumSubscription="Premium (Legacy)",t.VBP2Premium="Premium",t.Default="Default"}(Za||(Za={}));var ec,ic=[{id:"PP-587f8f25-b278-4727-b7c4-3ce60e542c8b",name:Za.VBPFree,subscriptionName:"free_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-a5ad2825-8225-4bbe-a868-c1b2a7d2a2e3",name:Za.VBPStarter,subscriptionName:"starter_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-438ccc87-eaff-4180-ad79-f5d3d51e1bc0",name:Za.VBPBasic,subscriptionName:"vbp_basic_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-7201f892-3d44-44b8-b9db-4b23dd34d112",name:Za.VBPProfessional,subscriptionName:"vbp_professional_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-3cc1ec9f-17a8-46c8-9e79-b337e4ea651b",name:Za.VBPEnterprise,subscriptionName:"vbp_enterprise_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-7ffa4745-4ea1-4603-983b-81a1404faa3b",name:Za.VBPEnterprisePilot,subscriptionName:"vbp_enterprise_pilot_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-02895bb5-ff6b-4f37-ae1e-8473b895a59d",name:Za.VBP2Startup,subscriptionName:"vbp2_startup_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-c69f1724-d380-432f-8f50-5778da6ea250",name:Za.VBP2Essentials,subscriptionName:"vbp2_essentials_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-8abe2c53-be4a-43d5-bd2c-a8d9be1c82db",name:Za.VBP2Growth,subscriptionName:"vbp2_growth_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-0a872f89-e582-420a-90b0-c98e19b174a4",name:Za.VBP2Scale,subscriptionName:"vbp2_scale_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-7abd1cb2-317b-40d2-9fdc-d2b365d645b7",name:Za.VBP2Premium,subscriptionName:"vbp2_premium_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-a7eca7c3-84fd-4fc2-86a5-87a743f6c3d1",name:Za.BasicSubscription,subscriptionName:"basic_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-7d0053b8-fab4-407d-ae69-33c67d5314eb",name:Za.ProfessionalSubscription,subscriptionName:"professional_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-e85cdb56-2944-4fe0-9e78-a98520eb1489",name:Za.EnterpriseSubscription,subscriptionName:"enterprise_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-9a0d6430-5e73-41d2-bd3d-dc3645664bb9",name:Za.EliteSubscription,subscriptionName:"elite_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-a03a1c1e-d03e-4c77-8132-34908012a65c",name:Za.PremiumSubscription,subscriptionName:"premium_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-cf943a15-3eea-40cf-8d3e-e7ea5a5a9817",name:Za.Default,subscriptionName:null,defaultStrategy:t.BillingStrategy.Invalid}],nc=[{id:"PP-77912c15-00af-4a56-bfc0-e8e6c27c7a53",name:Za.VBPFree,subscriptionName:"free_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-1cc75309-ddff-4d8b-aedf-88a7472e2b4e",name:Za.VBPStarter,subscriptionName:"starter_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-52f98211-bd1e-4112-88cd-e78040173198",name:Za.VBPBasic,subscriptionName:"vbp_basic_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-c278bcc6-bd5d-43e5-9ff5-a27e70b48ba9",name:Za.VBPProfessional,subscriptionName:"vbp_professional_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-4133fc94-a58a-4fcd-91cd-9ed111182e77",name:Za.VBPEnterprise,subscriptionName:"vbp_enterprise_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-dbbac61e-132f-468f-aa62-7a691b59bb74",name:Za.VBPEnterprisePilot,subscriptionName:"vbp_enterprise_pilot_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-45f8099f-d3f3-4302-83bf-bbf64f431e31",name:Za.VBP2Startup,subscriptionName:"vbp2_startup_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-d44c5a8b-f3b6-4b63-b203-8b7253060984",name:Za.VBP2Essentials,subscriptionName:"vbp2_essentials_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-c1761320-62df-41d7-8df3-008554a4b592",name:Za.VBP2Growth,subscriptionName:"vbp2_growth_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-b6607aae-606f-4fd5-84e4-c48f38b59892",name:Za.VBP2Scale,subscriptionName:"vbp2_scale_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-7375d567-8890-4cb1-930c-5673ea89acba",name:Za.VBP2Premium,subscriptionName:"vbp2_premium_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-38a06671-526b-4d28-b425-bbce3be34699",name:Za.BasicSubscription,subscriptionName:"basic_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-d9717300-f1c3-4471-8433-c3ac7baf003d",name:Za.ProfessionalSubscription,subscriptionName:"professional_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-f6a60130-878b-4a33-9a10-d5bdeac0cdef",name:Za.EnterpriseSubscription,subscriptionName:"enterprise_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-dff68124-2223-4c88-91dc-b638a3135fc5",name:Za.EliteSubscription,subscriptionName:"elite_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-15641015-560e-4cd7-977b-b1fc627b18d1",name:Za.PremiumSubscription,subscriptionName:"premium_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-0e9ac148-a2d0-42d0-9250-8c42189bf432",name:Za.Default,subscriptionName:null,defaultStrategy:t.BillingStrategy.Invalid}],oc=new Map([[n.Environment.DEMO,Ka(ic,$a)],[n.Environment.PROD,Ka(nc,tc)]]),rc=new Map([[n.Environment.DEMO,Ka(ic)],[n.Environment.PROD,Ka(nc)]]),sc=new Map([[n.Environment.DEMO,Ka($a)],[n.Environment.PROD,Ka(tc)]]);(ec=t.PayoutStatusType||(t.PayoutStatusType={}))[ec.NOT_SET=0]="NOT_SET",ec[ec.PAID=1]="PAID",ec[ec.PENDING=2]="PENDING",ec[ec.IN_TRANSIT=3]="IN_TRANSIT",ec[ec.CANCELED=4]="CANCELED",ec[ec.FAILED=5]="FAILED";var ac,cc=t.PayoutStatusType.NOT_SET,uc=t.PayoutStatusType.PAID,pc=t.PayoutStatusType.PENDING,dc=t.PayoutStatusType.IN_TRANSIT,hc=t.PayoutStatusType.CANCELED,lc=t.PayoutStatusType.FAILED,mc=new Map([[t.PayoutStatus.PAYOUT_STATUS_NOT_SET,{id:cc,value:"Unknown"}],[t.PayoutStatus.PAYOUT_STATUS_PAID,{id:uc,value:"Paid"}],[t.PayoutStatus.PAYOUT_STATUS_PENDING,{id:pc,value:"Pending"}],[t.PayoutStatus.PAYOUT_STATUS_IN_TRANSIT,{id:dc,value:"In Transit"}],[t.PayoutStatus.PAYOUT_STATUS_CANCELED,{id:hc,value:"Canceled"}],[t.PayoutStatus.PAYOUT_STATUS_FAILED,{id:lc,value:"Failed"}]]);function vc(t){return mc.get(t)}(ac=t.PayoutTypeType||(t.PayoutTypeType={}))[ac.NOT_SET=0]="NOT_SET",ac[ac.BANK_ACCOUNT=1]="BANK_ACCOUNT",ac[ac.CARD=2]="CARD";var fc=t.PayoutTypeType.NOT_SET,gc=t.PayoutTypeType.BANK_ACCOUNT,Ic=t.PayoutTypeType.CARD,yc=new Map([[I.PAYOUT_TYPE_NOT_SET,{id:fc,value:"Unknown"}],[I.PAYOUT_TYPE_BANK_ACCOUNT,{id:gc,value:"Bank Account"}],[I.PAYOUT_TYPE_CARD,{id:Ic,value:"Card"}]]);!function(t){t[t.Ascending=0]="Ascending",t[t.Descending=1]="Descending"}(t.SortDirection||(t.SortDirection={}));var Ac=function(t,e,i){this.results=t,this.nextCursor=e,this.hasMore=i},Sc=function(){function t(t){this.apiService=t}return t.prototype.reconcilePayout=function(t,e){return this.apiService.reconcilePayout(new Pi({payoutId:e,bankReconciliationId:t})).pipe(o.map((function(t){return t?t.pipelineId:""})))},t.prototype.listPayouts=function(t,e,i,n){return this.apiService.listPayouts(new yi({filters:new Ii({arrivalDateRange:new fi({start:t,end:e})}),pagingOptions:new H({cursor:n,pageSize:i})})).pipe(o.map((function(t){if(!t)return new Ac([],"",!1);var e=(t.payouts||[]).map((function(t){return{id:(e=t).id,arrivalDate:e.arrivalDate?new Date(e.arrivalDate):null,amount:e.amount,type:(i=e.type,yc.get(i)),status:vc(e.status),currency:Ca(e.currency),lastFourDigits:e.lastFourDigits,bankName:e.bankName,bankId:e.bankId};var e,i})),i="",n=!1;return t.pagingMetadata&&(i=t.pagingMetadata.nextCursor,n=t.pagingMetadata.hasMore),new Ac(e,i,n)})))},t}();function Pc(t){var e,i=new Date("0001-01-01T00:00:00Z").valueOf();return{merchantId:t.merchantId||"",sku:t.sku||"",productName:t.productName||"",customerId:t.customerId||"",customerName:t.customerName||"",orderId:t.orderId||"",expiry:t.expiry.valueOf()!==i?new Date(t.expiry):null,billingStart:t.billingStart.valueOf()!==i?new Date(t.billingStart):null,created:t.created.valueOf()!==i?new Date(t.created):null,updated:t.updated.valueOf()!==i?new Date(t.updated):null,frequency:Ja(t.frequency),retailFrequency:Ja(t.retailFrequency),nextRenewal:t.nextRenewal.valueOf()!==i?new Date(t.nextRenewal):null,nextRetailRenewal:t.nextRetailRenewal.valueOf()!==i?new Date(t.nextRetailRenewal):null,customerAddress:(e=t.customerAddress,{address:e&&e.address||"",city:e&&e.city||"",state:e&&e.state||"",zip:e&&e.zip||"",country:e&&e.country||""}),customUnitPrice:t.customUnitPrice||0,retailUnitPrice:t.retailUnitPrice||0}}Sc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Sc(e.ɵɵinject(ta))},token:Sc,providedIn:"root"}),Sc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Sc.ctorParameters=function(){return[{type:ta}]};var bc=function(){function t(t,e){this.hostService=t,this.http=e}return t.prototype.exportCSV=function(t){var e=function(t){return{merchantId:t.merchantId,customerId:t.customerId,skus:t.skus}}(t);return this.http.post(this.hostService.httpsHostWithScheme()+"/subscription/export-csv",{filters:e},{observe:"body",responseType:"blob",withCredentials:!0}).pipe(o.share())},t}();bc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new bc(e.ɵɵinject($s),e.ɵɵinject(i.HttpClient))},token:bc,providedIn:"root"}),bc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],bc.ctorParameters=function(){return[{type:$s},{type:i.HttpClient}]};var Tc=function(){function t(t){this.environment=t,this.billingHosts=new Map([[n.Environment.LOCAL,"http://localhost:8088"],[n.Environment.DEMO,"https://vbilling-demo.appspot.com"],[n.Environment.PROD,"https://vbilling-prod.appspot.com"]]),this.microserviceHosts=new Map([[n.Environment.DEMO,"https://billing-api-demo.vendasta-internal.com"],[n.Environment.PROD,"https://billing-api-prod.vendasta-internal.com"]])}return Object.defineProperty(t.prototype,"billingHost",{get:function(){return this.env||(this.env=this.environment.getEnvironment()),this.billingHosts.get(this.env)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"microserviceHost",{get:function(){return this.env||(this.env=this.environment.getEnvironment()),this.microserviceHosts.get(this.env)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"constructInvoiceRoute",{get:function(){return this.billingHost+"/internalApi/v1/invoice/construct/"},enumerable:!1,configurable:!0}),t}();function Oc(t){return t.error instanceof ErrorEvent?console.error("An error occurred:",t.error.message):console.error("Server returned "+t.message),r.throwError("Unable to download csv")}function Ec(t){return t.error instanceof ErrorEvent?console.error("An error occurred:",t.error.message):console.error("Server returned "+t.message),r.throwError("Unable to upload file")}Tc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Tc(e.ɵɵinject(n.EnvironmentService))},token:Tc,providedIn:"root"}),Tc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Tc.ctorParameters=function(){return[{type:n.EnvironmentService}]};var Rc=function(){function t(t,e){this.hostService=t,this.http=e}return t.prototype.downloadCsv=function(t){var e="?filename="+t.filename;return this.http.get(this.hostService.httpsHostWithScheme()+"/revenue-csv"+e,this.apiOptions()).pipe(o.share(),o.catchError(Oc))},t.prototype.apiOptions=function(){return{responseType:"blob",withCredentials:!0}},t}();Rc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Rc(e.ɵɵinject($s),e.ɵɵinject(i.HttpClient))},token:Rc,providedIn:"root"}),Rc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Rc.ctorParameters=function(){return[{type:$s},{type:i.HttpClient}]};var Dc,Cc=function(){function t(t,e){this.hostService=t,this.http=e}return t.prototype.downloadCsv=function(t){var e="?merchantID="+t.merchantId+"&year="+t.year+"&month="+t.month;return this.http.get(this.hostService.httpsHostWithScheme()+"/billing-report/get"+e,this.apiOptions()).pipe(o.share(),o.catchError(Oc))},t.prototype.generateCsv=function(t){var e="?merchantID="+t.merchantId+"&year="+t.year+"&month="+t.month;return this.http.get(this.hostService.httpsHostWithScheme()+"/billing-report/generate"+e,this.apiOptions()).pipe(o.share(),o.catchError(Oc))},t.prototype.apiOptions=function(){return{responseType:"blob",withCredentials:!0}},t}();function _c(e){switch(e){case t.PurchaseStatusEnum.PURCHASE_STATUS_PENDING:return t.PurchaseStatus.Pending;case t.PurchaseStatusEnum.PURCHASE_STATUS_DUE:return t.PurchaseStatus.Due;case t.PurchaseStatusEnum.PURCHASE_STATUS_SUCCESS:return t.PurchaseStatus.Success;case t.PurchaseStatusEnum.PURCHASE_STATUS_DUNNING:return t.PurchaseStatus.Dunning;case t.PurchaseStatusEnum.PURCHASE_STATUS_FAILED:return t.PurchaseStatus.Failed}return t.PurchaseStatus.Unset}function Jc(e){return{merchantId:e.merchantId||"",timestamp:e.timestamp?new Date(e.timestamp):null,purchaseId:e.purchaseId||"",total:e.total||0,currency:e.currency?Ca(e.currency):t.Currency.USD,renewal:e.renewal||!1,items:e.items?e.items.map((function(t){return wc(t)})):[],billingStrategy:Ra(e.billingStrategy),isDunning:e.isDunning||!1,dunningAttempt:e.dunningAttempt||0,voided:e.voided?new Date(e.voided):null,paid:e.paid||!1,status:_c(e.status),creditAmount:e.creditAmount||0,appliedCredits:e.appliedCredits?e.appliedCredits.map((function(t){return jc(t)})):[],taxAmount:e.taxAmount||0,appliedTaxRates:(e.appliedTaxRates||[]).map((function(t){return Uc(t)}))}}function wc(e,i){var n;return void 0!==i&&(n=Ca(i)),{sku:e.sku||"",description:e.description||null,amount:e.amount||0,orderId:e.orderId||"",customerId:e.customerId||"",discountAmount:e.discountAmount||0,total:e.total||0,currency:n||t.Currency.USD,appliedDiscounts:e.appliedDiscounts?e.appliedDiscounts.map((function(t){return Oa(t)})):[],merchantId:e.merchantId,purchaseDay:e.day,purchaseId:e.purchaseId,taxAmount:e.taxAmount||0,appliedTaxRates:(e.appliedTaxRates||[]).map((function(t){return Uc(t)})),setupFee:e.setupFee||0}}function jc(t){return{appliedAmount:t.appliedAmount,referenceId:t.referenceId,referenceType:Nc(t.referenceType)}}function Nc(e){switch(e){case N.CREDIT_TYPE_CREDIT_NOTE:return t.AppliedCreditType.CREDIT_TYPE_CREDIT_NOTE;case N.CREDIT_TYPE_PROMOTIONAL:return t.AppliedCreditType.CREDIT_TYPE_PROMOTIONAL}return t.AppliedCreditType.CREDIT_TYPE_UNSET}function Uc(t){return{amount:t.amount||0,name:t.name||"",percentage:t.percentage||0,taxRateId:t.taxRateId||""}}Cc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Cc(e.ɵɵinject($s),e.ɵɵinject(i.HttpClient))},token:Cc,providedIn:"root"}),Cc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Cc.ctorParameters=function(){return[{type:$s},{type:i.HttpClient}]},function(t){t.Unset="UNSET",t.Pending="PENDING",t.Due="DUE",t.Success="SUCCESS",t.Dunning="DUNNING",t.Failed="FAILED"}(t.PurchaseStatus||(t.PurchaseStatus={})),(Dc=t.AppliedCreditType||(t.AppliedCreditType={})).CREDIT_TYPE_CREDIT_NOTE="Credit note",Dc.CREDIT_TYPE_PROMOTIONAL="Promotional",Dc.CREDIT_TYPE_UNSET="";var Mc=function(t){this.dimensionId=t,this.name=Bc[t]||""},Bc={existing_enterprise:"Existing Enterprise",new_enterprise:"New Enterprise",agency:"Agency",CP_unassisted:"Channel Partners, Unassisted (PLG)",CP_growth_MT:"Channel Partners, Growth (Medium-Touch)",CP_growth_HT:"Channel Partners, Growth (High-Touch)"},kc=new Mc("agency"),Fc=new Mc("new_enterprise"),xc=new Mc("existing_enterprise"),Lc=new Mc("CP_unassisted"),Yc=new Mc("CP_growth_MT"),qc=new Mc("CP_growth_HT");function Gc(t){return{merchantId:t.merchantId||"",netD:t.netD||0,created:t.created||null,subscriptionId:t.subscriptionId||"",dimension:new Mc(t.dimension),currency:Ca(t.currency),signed:t.signed||null,end:t.end||null,activated:t.activated||null,modified:t.modified||null,verified:t.verified||null,status:t.status||"",creditLimit:t.creditLimit||0,pricingPlanId:t.pricingPlanId||""}}var Wc=function(){function t(t){this.api=t}return t.prototype.get=function(t){return this.api.get({merchantId:t}).pipe(o.map((function(t){return Gc(t.contract)})))},t.prototype.update=function(t,e){return this.api.update({merchantId:t,mutations:e}).pipe(o.map((function(t){return Gc(t.contract)})))},t}();Wc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Wc(e.ɵɵinject(oa))},token:Wc,providedIn:"root"}),Wc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Wc.ctorParameters=function(){return[{type:oa}]};var Hc;function Vc(t){return{name:t.name||"",sku:t.sku||"",iconUrl:t.iconUrl||"",hasPricingOverride:t.hasPricingOverride||!1,hasDiscount:t.hasDiscount||!1}}function zc(t){return Object.assign(Object.assign({},t),{productType:(t.productType||[]).map((function(t){return function(t){switch(t){case Hc.Standard:return j.PRODUCT_TYPE_STANDARD_PRODUCT;case Hc.Vendasta:return j.PRODUCT_TYPE_VENDASTA_PRODUCT;case Hc.Subscription:return j.PRODUCT_TYPE_SUBSCRIPTION;case Hc.Fee:return j.PRODUCT_TYPE_FEE;case Hc.PartnerSupportSales:return j.PRODUCT_TYPE_PARTNER_SUPPORT_SALES}return j.PRODUCT_TYPE_INVALID}(t)}))})}!function(t){t[t.Invalid=0]="Invalid",t[t.Standard=1]="Standard",t[t.Vendasta=2]="Vendasta",t[t.Subscription=3]="Subscription",t[t.Fee=4]="Fee",t[t.PartnerSupportSales=5]="PartnerSupportSales"}(Hc||(Hc={}));var Kc=function(){function e(t,e,i,n,o,r){this.billingApi=t,this.revenueApi=e,this.merchantReportApi=i,this.pricingApi=n,this.purchaseApi=o,this.vendorApi=r}return e.prototype.getPurchaseCost=function(t,e,i){var n=new Us({merchantId:t,sku:e,quantity:i});return this.billingApi.getPurchaseCost(n).pipe(o.map((function(t){return t.currency||(t.currency=u.USD),t})))},e.prototype.canCreateSubscriptions=function(t,e){var i=new Cr({merchantId:t,skus:e});return this.billingApi.canCreateSubscriptions(i)},e.prototype.canCreateSubscriptionsWithFrequencies=function(t,e){var i=new Cr({merchantId:t,items:e&&e.map((function(t){return t?{sku:t.sku,frequency:wa(t.frequency),quantity:t.quantity||0}:null}))});return this.billingApi.canCreateSubscriptions(i)},e.prototype.downloadRevenueCsv=function(t){return this.revenueApi.downloadCsv({filename:t})},e.prototype.downloadBillingReportCsv=function(t,e,i){return this.merchantReportApi.downloadCsv({merchantId:t,year:e,month:i})},e.prototype.generateBillingReportCsv=function(t,e,i){return this.merchantReportApi.generateCsv({merchantId:t,year:e,month:i})},e.prototype.listMerchantBillingReports=function(t,e,i){var n=new an({merchantId:t,pagingOptions:new H({cursor:e,pageSize:i})});return this.billingApi.listMerchantBillingReports(n).pipe(o.map((function(t){var e=(t.reports||[]).map((function(t){return{merchantId:t.merchantId,year:t.year,month:t.month,created:t.created,status:P[t.status||0]}}));return new Ac(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},e.prototype.canBillCreateSnapshot=function(t){return this.billingApi.canBillItem({merchantId:t,sku:"ST"})},e.prototype.canBillRefreshSnapshot=function(t){return this.billingApi.canBillItem({merchantId:t,sku:"snapshotreportrefresh"})},e.prototype.canBillItem=function(t,e){return this.billingApi.canBillItem({merchantId:t,sku:e}).pipe(o.map((function(t){return t.ok})))},e.prototype.createPricingPlanProduct=function(t,e,i,n,r,s,a){var c=new yo({pricingPlanId:t,sku:e,volumeCommitment:a});return c.frequency=wa(i),c.pricing=La(n),c.commitment=new Ot(r),c.strategy=Da(s),this.billingApi.createPricingPlanProduct(c).pipe(o.mapTo(!0))},e.prototype.updatePricingPlanProduct=function(t,e,i){var n=i.frequency,r=i.pricing,s=i.commitment,a=i.strategy,c=i.volumeCommitment,u=new Ae({paths:[]}),p=new _o({pricingPlanId:t,sku:e});return null!==n&&(p.frequency=wa(n),u.paths.push("frequency")),null!==r&&(p.pricing=La(r),u.paths.push("pricing")),null!==s&&(p.commitment=new Ot(s),u.paths.push("commitment")),null!==a&&(p.strategy=Da(a),u.paths.push("strategy")),null!==c&&(p.volumeCommitment=c,u.paths.push("volumeCommitment")),this.billingApi.updatePricingPlanProduct(p).pipe(o.mapTo(!0))},e.prototype.deletePricingPlanProduct=function(t,e){var i=new So({pricingPlanId:t,sku:e});return this.billingApi.deletePricingPlanProduct(i).pipe(o.mapTo(!0))},e.prototype.getMultiProductPricing=function(t,e,i){return this.billingApi.getMultiProductPricing({merchantId:t,skus:e,pricingPlanId:i}).pipe(o.map((function(t){var e,i,n=t.productPrices||{},o={};try{for(var r=Va(Object.keys(n)),s=r.next();!s.done;s=r.next()){var a=s.value,c=n[a];o[a]=ka(c)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(e)throw e.error}}return o})))},e.prototype.getMultiRetailPricing=function(t,e,i,n){var r=void 0===n?"":n;return this.pricingApi.getMultiRetail({merchantId:t,currency:e,skus:i,groupId:r}).pipe(o.map((function(t){var e,i,n=t.productPrices||{},o={};try{for(var r=Va(Object.keys(n)),s=r.next();!s.done;s=r.next()){var a=s.value,c=n[a];o[a]=ka(c)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(e)throw e.error}}return o})))},e.prototype.listPricingPlanProducts=function(t,e,i){var n=new Ro({filters:t,pagingOptions:new H({cursor:e,pageSize:i})});return this.billingApi.listPricingPlanProducts(n).pipe(o.map((function(t){var e=(t.products||[]).map((function(t){return xa(t)}));return new Ac(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},e.prototype.getPricingPlanProduct=function(t,e){var i=new To({pricingPlanId:t,sku:e});return this.billingApi.getPricingPlanProduct(i).pipe(o.map((function(t){var e=xa(t.pricingPlanProduct);return e.defaultStrategy=Ra(t.pricingPlanDefaultStrategy),e})))},e.prototype.listPurchases=function(t,e,i){var n=new $o({filters:t,pagingOptions:new H({cursor:e,pageSize:i})});return this.purchaseApi.list(n).pipe(o.map((function(t){var e=(t.purchases||[]).map((function(t){return Jc(t)}));return new Ac(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},e.prototype.voidPurchase=function(t,e,i){var n=new or({purchaseId:e,merchantId:t,day:i});return this.purchaseApi.void(n).pipe(o.mapTo(!0))},e.prototype.listPurchaseItems=function(t,e,i){var n=new $o({filters:t,pagingOptions:new H({cursor:e,pageSize:i})});return this.purchaseApi.listPurchaseItems(n).pipe(o.map((function(t){var e=(t.purchaseItems||[]).map((function(e){return wc(e,t.currency)}));return new Ac(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},e.prototype.retryPurchase=function(t,e,i){var n=new nr({merchantId:t,day:e,purchaseId:i});return this.purchaseApi.retry(n).pipe(o.map((function(){return!0})))},e.prototype.getMultiCustomerSummaries=function(e,i,n,r){var s=new Yt({customerIds:i,merchantId:e,periodStart:n,periodEnd:r});return this.purchaseApi.getMultiCustomerSummaries(s).pipe(o.map((function(e){return(e.customerSummaries||[]).map((function(e){return void 0!==(i=e).currency&&(n=Ca(i.currency)),{customerId:i.customerId||"",purchaseItemQuantity:i.purchaseItemQuantity||0,purchaseItemTotal:i.purchaseItemTotal||0,currency:n||t.Currency.USD};var i,n}))})))},e.prototype.getMultiContract=function(t){return this.billingApi.getMultiContract({merchantIds:t}).pipe(o.map((function(t){var e,i,n=t.contracts||{},o={};try{for(var r=Va(Object.keys(n)),s=r.next();!s.done;s=r.next()){var a=s.value,c=n[a];o[a]=Gc(c)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(e)throw e.error}}return o})))},e.prototype.generateVendorReport=function(t,e,i,n,r){var s=new Rs({skus:t,periodStart:e,periodEnd:i,vendorName:n,markAsApproved:r});return this.vendorApi.generateReport(s).pipe(o.map((function(t){return t.url})))},e.prototype.getVendorStats=function(t,e,i){var n=new Bs({skus:t,periodStart:e,periodEnd:i});return this.vendorApi.getRevenueStats(n).pipe(o.map((function(t){return t.totalRevenue||0})))},e.prototype.listContracts=function(t,e){var i=new Nt({pagingOptions:new H({cursor:t,pageSize:e})});return this.billingApi.listContracts(i).pipe(o.map((function(t){var e=(t.contracts||[]).map((function(t){return Gc(t)}));return new Ac(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},e.prototype.listProducts=function(t,e,i,n,r){var s=zc(i),a=new Fo({merchantId:t,searchTerm:e,filters:s,pagingOptions:new H({cursor:n,pageSize:r})});return this.billingApi.listProducts(a).pipe(o.map((function(t){var e=(t.products||[]).map((function(t){return Vc(t)}));return new Ac(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},e.prototype.getMultiProduct=function(t){var e=new Mo({skus:t});return this.billingApi.getMultiProduct(e).pipe(o.map((function(e){var i=new Map;return t.forEach((function(t){i[t]=Vc(e.products[t])})),i})))},e.prototype.getBillableItem=function(t,e,i,n){var r=new ot({merchantId:t,sku:e,customerId:i,orderId:n});return this.billingApi.getBillableItem(r).pipe(o.map((function(t){return Pc(t.item)})))},e.prototype.changeBillableItemFrequency=function(t,e,i,n,o){var r=new wr({merchantId:t,sku:e,customerId:i,orderId:n,frequency:wa(o)});return this.billingApi.changeFrequency(r)},e.prototype.changeBillableItemNextRenewalDate=function(t,e,i,n,o){var r=new jr({merchantId:t,sku:e,customerId:i,orderId:n,nextRenewalDate:o});return this.billingApi.changeRenewalDate(r)},e.prototype.changeBillableItemCustomUnitPrice=function(t,e,i,n,o){var r=new Jr({merchantId:t,sku:e,customerId:i,orderId:n,customUnitPrice:o});return this.billingApi.changeCustomUnitPrice(r)},e.prototype.listBillableItems=function(t,e,i,n){var r=new pt({searchTerm:t,filters:e,pagingOptions:new H({cursor:i,pageSize:n})});return this.billingApi.listBillableItems(r).pipe(o.map((function(t){var e=(t.items||[]).map((function(t){return Pc(t)}));return new Ac(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},e.prototype.startRevRecBackfillWorkflow=function(){return this.billingApi.startRevRecTemplateBackfill({})},e}();function Xc(e){switch(e){case c.DISCOUNT_TYPE_FIXED_AMOUNT_PER_UNIT:return t.DiscountType.FIXED_AMOUNT_PER_UNIT;case c.DISCOUNT_TYPE_FIXED_NUMBER_OF_UNITS:return t.DiscountType.FIXED_NUMBER_OF_UNITS;case c.DISCOUNT_TYPE_PERCENT_AMOUNT:return t.DiscountType.PERCENT_AMOUNT}return t.DiscountType.FIXED_AMOUNT}function Qc(e){switch(e){case t.DiscountType.FIXED_AMOUNT_PER_UNIT:return c.DISCOUNT_TYPE_FIXED_AMOUNT_PER_UNIT;case t.DiscountType.FIXED_NUMBER_OF_UNITS:return c.DISCOUNT_TYPE_FIXED_NUMBER_OF_UNITS;case t.DiscountType.PERCENT_AMOUNT:return c.DISCOUNT_TYPE_PERCENT_AMOUNT}return c.DISCOUNT_TYPE_FIXED_AMOUNT}function Zc(t){if(!t)return null;var e=(t.items||[]).map((function(t){return{productId:(e=t).productId,discountType:Xc(e.discountType),discountAmount:e.discountAmount,quantity:e.quantity,defaultSku:e.defaultSku,price:e.price};var e}));return{merchantId:t.merchantId,bundleId:t.bundleId,name:t.name,hideBundleDetails:t.hideBundleDetails,items:e,created:t.created,updated:t.updated}}Kc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Kc(e.ɵɵinject(ea),e.ɵɵinject(Rc),e.ɵɵinject(Cc),e.ɵɵinject(ha),e.ɵɵinject(va),e.ɵɵinject(Pa))},token:Kc,providedIn:"root"}),Kc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Kc.ctorParameters=function(){return[{type:ea},{type:Rc},{type:Cc},{type:ha},{type:va},{type:Pa}]},function(t){t.FIXED_AMOUNT="FIXED_AMOUNT",t.PERCENT_AMOUNT="PERCENT_AMOUNT",t.FIXED_NUMBER_OF_UNITS="FIXED_NUMBER_OF_UNITS",t.FIXED_AMOUNT_PER_UNIT="FIXED_AMOUNT_PER_UNIT"}(t.DiscountType||(t.DiscountType={}));var $c=function(){function t(t){this.bundleApiService=t}return t.prototype.upsert=function(t,e,i,n,r){var s=new Tt({merchantId:t,bundleId:e,name:i,hideBundleDetails:n,items:(r||[]).map((function(t){return{productId:(e=t).productId,discountType:Qc(e.discountType),discountAmount:e.discountAmount,quantity:e.quantity,defaultSku:e.defaultSku,price:e.price};var e}))});return this.bundleApiService.upsert(s).pipe(o.mapTo(!0))},t.prototype.getMulti=function(t,e){var i=new It({merchantId:t,bundleIds:e});return this.bundleApiService.getMulti(i).pipe(o.map((function(t){var i=new Map;return t&&t.bundles&&e.forEach((function(e){i.set(e,Zc(t.bundles[e]))})),i})))},t.prototype.list=function(t,e,i,n){var r=new At({filters:t,searchTerm:e,pagingOptions:new H({cursor:i,pageSize:n})});return this.bundleApiService.list(r).pipe(o.map((function(t){var e=(t.bundles||[]).map((function(t){return Zc(t)}));return new Ac(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t}();$c.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new $c(e.ɵɵinject(ia))},token:$c,providedIn:"root"}),$c.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],$c.ctorParameters=function(){return[{type:ia}]};var tu=function(){function t(t,e,i){this.contractDocumentApi=t,this.hostService=e,this.http=i}return t.prototype.upload=function(t,e){var n=this.hostService.httpsHostWithScheme()+"/contract-document/upload";return this.http.post(n,e,{headers:new i.HttpHeaders({"Content-Type":"application/pdf","Content-Disposition":"attachment; filename="+e.name}),observe:"body",responseType:"blob",withCredentials:!0,params:{merchantId:t}}).pipe(o.share(),o.mapTo(!0))},t.prototype.list=function(t,e,i){var n=new Wr({filters:t,pagingOptions:new H({cursor:e,pageSize:i})});return this.contractDocumentApi.list(n).pipe(o.map((function(t){var e=(t.contractDocuments||[]).map((function(t){return{id:(e=t).id||"",merchantId:e.merchantId||"",filename:e.filename||"",created:e.created||null};var e}));return new Ac(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.download=function(t,e,i){var n={merchant_id:t,id:e,filename:i};return this.http.get(this.hostService.httpsHostWithScheme()+"/contract-document/download",{observe:"body",params:n,responseType:"blob",withCredentials:!0}).pipe(o.share())},t.prototype.delete=function(t,e){var i=new qr({merchantId:t,id:e});return this.contractDocumentApi.delete(i).pipe(o.mapTo(!0))},t}();tu.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new tu(e.ɵɵinject(na),e.ɵɵinject($s),e.ɵɵinject(i.HttpClient))},token:tu,providedIn:"root"}),tu.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],tu.ctorParameters=function(){return[{type:na},{type:$s},{type:i.HttpClient}]};var eu=function(){function t(t){this.creditApi=t}return t.prototype.getBalance=function(t){return this.creditApi.getBalance(new $r({merchantId:t})).pipe(o.map((function(t){return{merchantId:(e=t.creditBalance).merchantId||"",currency:e.currency||"",amount:e.amount||0};var e})))},t.prototype.add=function(t,e,i,n,r){return this.creditApi.add(new Qr({merchantId:t,currency:e,amount:i,idempotencyKey:n,reason:r})).pipe(o.map((function(){return null})))},t}();eu.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new eu(e.ɵɵinject(ra))},token:eu,providedIn:"root"}),eu.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],eu.ctorParameters=function(){return[{type:ra}]};var iu,nu=function(){function t(t){this.discountApi=t}return t.prototype.list=function(t,e,i){var n=new fe({filters:t,pagingOptions:new H({cursor:e,pageSize:i})});return this.discountApi.list(n).pipe(o.map((function(t){var e=(t.discounts||[]).map((function(t){return{merchantId:(e=t).merchantId||"",discountId:e.discountId||0,id:e.id||"",discountType:Xc(e.discountType),amount:e.amount||0,start:e.start?new Date(e.start):null,end:e.end?new Date(e.end):null,resetEachPeriod:e.resetEachPeriod||!1,created:e.created?new Date(e.created):null,updated:e.updated?new Date(e.updated):null,SKU:e.sku||"",description:e.description||""};var e}));return new Ac(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.create=function(t,e,i,n,o,r,s,a){var c,u;c=new Date(o),u=Qc(i);var p=new he({merchantId:t,sku:e,discountType:u,amount:n,start:c,resetEachPeriod:s,description:a});return r&&""!==r&&(p.end=new Date(r)),this.discountApi.create(p)},t.prototype.update=function(t,e,i,n,o,r,s,a){var c,u;c=new Date(o),u=Qc(i);var p=new Ie({merchantId:t,id:e,discountType:u,amount:n,start:c,resetEachPeriod:s,description:a});return r&&""!==r&&(p.end=new Date(r)),this.discountApi.update(p)},t.prototype.expire=function(t,e){return this.discountApi.expire(new me({merchantId:t,id:e}))},t}();function ou(e){switch(e){case t.CollectionMethod.MANUAL_COLLECTION:return"manual-collection";case t.CollectionMethod.CHARGE_AUTOMATICALLY:return"charge-automatically";case t.CollectionMethod.SEND_EMAIL:return"send-email";default:return""}}function ru(e){switch(e){case"manual-collection":return t.CollectionMethod.MANUAL_COLLECTION;case"charge-automatically":return t.CollectionMethod.CHARGE_AUTOMATICALLY;case"send-email":return t.CollectionMethod.SEND_EMAIL;default:return t.CollectionMethod.UNSET}}function su(t){return{merchantId:t.merchantId||"",customerId:t.customerId||"",contactId:t.contactId||"",autoPost:t.autoPost||!1,autoGenerate:t.autoGenerate||!1,useTemplateInvoice:t.useTemplateInvoice||!1,collectionMethod:ru(t.collectionMethod),invoiceDay:t.invoiceDay||0}}nu.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new nu(e.ɵɵinject(sa))},token:nu,providedIn:"root"}),nu.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],nu.ctorParameters=function(){return[{type:sa}]},(iu=t.CollectionMethod||(t.CollectionMethod={})).UNSET="Unset",iu.MANUAL_COLLECTION="Manual Collection",iu.CHARGE_AUTOMATICALLY="Charge Automatically",iu.SEND_EMAIL="Send Email";var au,cu=function(){function t(t){this.configApiService=t}return t.prototype.get=function(t,e){var i=new Vr({merchantId:t,customerId:e});return this.configApiService.get(i).pipe(o.map((function(t){return su(t.configuration)})))},t.prototype.upsert=function(t,e,i,n,r,s,a,c){var u=new Xr({merchantId:t,customerId:e,contactId:i,autoPost:n,autoGenerate:r,collectionMethod:ou(s),invoiceDay:a,useTemplateInvoice:c});return this.configApiService.upsert(u).pipe(o.mapTo(null))},t}();function uu(e){switch(e){case f.DUE:return t.InvoiceStatus.DUE;case f.PAID:return t.InvoiceStatus.PAID;case f.VOID:return t.InvoiceStatus.VOID;default:return t.InvoiceStatus.DRAFT}}function pu(e){switch(e){case"manual":return t.InvoiceOrigin.MANUAL;case"sales-order":return t.InvoiceOrigin.SALES_ORDER;case"renewal":return t.InvoiceOrigin.RENEWAL;default:return t.InvoiceOrigin.UNSET}}function du(t){return t?{amount:t.amount||0,taxRateId:t.taxRateId||"",percentage:t.percentage||0,name:t.name||""}:null}function hu(t){return t?{id:t.id||"",name:t.name||"",description:t.description||"",percentage:t.percentage||0}:null}function lu(t){if(!t)return null;var e,i=new Date("0001-01-01T00:00:00Z").valueOf(),n=(t.items||[]).map((function(t){return function(t){if(!t)return null;var e=(t.appliedTaxes||[]).map((function(t){return du(t)})),i=(t.taxRates||[]).map((function(t){return hu(t)})),n=(t.discounts||[]).map((function(t){return Oa(t)}));return{id:t.id||"",sku:t.sku||"",amount:t.amount||0,quantity:t.quantity||0,description:t.description||"",subtotal:t.subtotal||0,total:t.total||0,appliedDiscounts:n||[],appliedTaxes:e||[],taxRates:i||[],bundleId:t.bundleId||"",bundleInstanceId:t.bundleInstanceId||""}}(t)})),o=(t.appliedTaxes||[]).map((function(t){return du(t)})),r=(t.defaultTaxRates||[]).map((function(t){return hu(t)})),a=(t.appliedBundles||[]).map((function(t){return s(t)}));return{id:t.id||"",number:t.number||"",customerId:t.customerId||"",customerName:t.customerName||"",contactId:t.contactId||"",status:uu(t.status),subtotal:t.subtotal||0,total:t.total||0,discountTotal:t.amountDiscount||0,paid:t.paid.valueOf()!==i?t.paid:null,issued:t.issued.valueOf()!==i?t.issued:null,due:t.due.valueOf()!==i?t.due:null,created:t.created.valueOf()!==i?t.created:null,updated:t.updated.valueOf()!==i?t.updated:null,items:n||[],currency:Ca(t.currency),orderId:t.orderId||"",appliedTaxes:o||[],defaultTaxRates:r||[],appliedBundles:a||[],origin:pu(t.origin),collectionMethod:ru(t.collectionMethod),memo:t.memo||"",defaultPaymentMethod:t.defaultPaymentMethod||"",customerAddress:(e=t.customerAddress,{address:(null==e?void 0:e.address)||"",address2:(null==e?void 0:e.address2)||"",city:(null==e?void 0:e.city)||"",state:(null==e?void 0:e.state)||"",zip:(null==e?void 0:e.zip)||"",country:(null==e?void 0:e.country)||""}),externalCustomerIdentifier:t.externalCustomerIdentifier||""}}function mu(e){var i,n,o;return new Ke(Object.assign(Object.assign({},e),{statuses:(e.statuses||[]).map((function(e){return function(e){switch(e){case t.InvoiceStatus.DUE:return f.DUE;case t.InvoiceStatus.PAID:return f.PAID;case t.InvoiceStatus.VOID:return f.VOID;default:return f.DRAFT}}(e)})),dateFilter:{dateGte:null===(i=e.dateFilter)||void 0===i?void 0:i.dateGte,dateLte:null===(n=e.dateFilter)||void 0===n?void 0:n.dateLte,dateField:(null===(o=e.dateFilter)||void 0===o||o.dateField,v.CREATED)}}))}cu.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new cu(e.ɵɵinject(ga))},token:cu,providedIn:"root"}),cu.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],cu.ctorParameters=function(){return[{type:ga}]},function(t){t.DRAFT="Draft",t.DUE="Due",t.PAID="Paid",t.VOID="Void"}(t.InvoiceStatus||(t.InvoiceStatus={})),(t.InvoiceDateField||(t.InvoiceDateField={})).CREATED="Created",(au=t.InvoiceOrigin||(t.InvoiceOrigin={})).MANUAL="Manual",au.SALES_ORDER="Sales Order",au.RENEWAL="Renewal",au.UNSET="Unset";var vu=function(){function t(t,e,i){this.hostService=t,this.http=e,this.invoiceApiService=i}return t.prototype.addBundle=function(t,e,i){return this.invoiceApiService.addBundle(new Ue({merchantId:t,invoiceId:e,bundleId:i})).pipe(o.map((function(t){return lu(t.invoice)})))},t.prototype.addLineItem=function(t,e,i,n,r,s,a){return this.invoiceApiService.addLineItem(new Be({merchantId:t,invoiceId:e,sku:i,amount:n,quantity:r,description:s,taxRates:a})).pipe(o.map((function(t){return lu(t.invoice)})))},t.prototype.charge=function(t,e,i,n){return this.invoiceApiService.charge(new Fe({merchantId:t,customerId:e,invoiceId:i,paymentMethodId:n}))},t.prototype.create=function(t,e,i,n){return this.invoiceApiService.create(new xe({merchantId:t,customerId:e,orderId:i,currencyCode:n})).pipe(o.map((function(t){return t?t.invoiceId:""})))},t.prototype.delete=function(t,e){return this.invoiceApiService.delete(new Ge({merchantId:t,invoiceId:e}))},t.prototype.deleteLineItem=function(t,e,i){return this.invoiceApiService.deleteLineItem(new We({merchantId:t,invoiceId:e,id:i})).pipe(o.map((function(t){return lu(t.invoice)})))},t.prototype.exportCSV=function(t,e){var i=this.hostService.httpsHostWithScheme()+"/invoice/export";return this.http.post(i,{merchant_id:t,filters:e},{observe:"body",responseType:"blob",withCredentials:!0}).pipe(o.share())},t.prototype.generatePDF=function(t,e,i){var n=this.hostService.httpsHostWithScheme()+"/invoice/generate-pdf";return this.http.post(n,{merchant_id:t,invoice_id:e,document_type:i},{observe:"body",responseType:"blob"}).pipe(o.share())},t.prototype.get=function(t,e){return this.invoiceApiService.get(new Xe({merchantId:t,invoiceId:e})).pipe(o.map((function(t){return lu(t.invoice)})))},t.prototype.list=function(t,e,i){var n=new ti({filters:mu(t),pagingOptions:new H({cursor:e,pageSize:i})});return this.invoiceApiService.list(n).pipe(o.map((function(t){var e=(t.invoices||[]).map((function(t){return lu(t)}));return new Ac(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.pay=function(t,e){return this.invoiceApiService.pay(new ii({merchantId:t,invoiceId:e}))},t.prototype.preview=function(t,e){var i=this.hostService.httpsHostWithScheme()+"/retail-invoice/preview";return this.http.post(i,{merchant_id:t,invoice_id:e},{responseType:"text",withCredentials:!0})},t.prototype.removeBundle=function(t,e,i,n){return this.invoiceApiService.removeBundle(new ni({merchantId:t,invoiceId:e,bundleId:i,bundleInstanceId:n})).pipe(o.map((function(t){return lu(t.invoice)})))},t.prototype.send=function(t,e,i){return this.invoiceApiService.send(new ri({merchantId:t,invoiceId:e,emailAddresses:i}))},t.prototype.updateBundle=function(t,e,i,n,r){return this.invoiceApiService.updateBundle(new si({merchantId:t,invoiceId:e,bundleId:i,hideBundleItems:n,bundleInstanceId:r})).pipe(o.map((function(t){return lu(t.invoice)})))},t.prototype.updateCurrency=function(t,e,i){var n=new Ze({merchantId:t,id:e,currency:Ca(i)}),o=new Ae({paths:["currency"]});return this.update(n,o)},t.prototype.updateDueDate=function(t,e,i){var n=new Ze({merchantId:t,id:e,due:i}),o=new Ae({paths:["due"]});return this.update(n,o)},t.prototype.updateContact=function(t,e,i){var n=new Ze({merchantId:t,id:e,contactId:i}),o=new Ae({paths:["contactId"]});return this.update(n,o)},t.prototype.updateCollectionMethod=function(t,e,i){var n=ou(i),o=new Ze({merchantId:t,id:e,collectionMethod:n}),r=new Ae({paths:["collectionMethod"]});return this.update(o,r)},t.prototype.updateMemo=function(t,e,i){var n=new Ze({merchantId:t,id:e,memo:i}),o=new Ae({paths:["memo"]});return this.update(n,o)},t.prototype.updateDefaultPaymentMethod=function(t,e,i){var n=new Ze({merchantId:t,id:e,defaultPaymentMethod:i}),o=new Ae({paths:["defaultPaymentMethod"]});return this.update(n,o)},t.prototype.updateDefaultTaxes=function(t,e,i){return this.invoiceApiService.updateDefaultTaxRates(new ci({merchantId:t,invoiceId:e,taxRateIds:i})).pipe(o.map((function(t){return lu(t.invoice)})))},t.prototype.updateLineItem=function(t,e,i,n,r,s,a,c){return this.invoiceApiService.updateLineItem(new hi({merchantId:t,invoiceId:e,id:i,sku:n,amount:r,quantity:s,description:a,taxRates:c})).pipe(o.map((function(t){return lu(t.invoice)})))},t.prototype.update=function(t,e){return this.invoiceApiService.update(new pi({invoice:t,fieldMask:e})).pipe(o.map((function(t){return lu(t.invoice)})))},t.prototype.void=function(t,e){return this.invoiceApiService.void(new mi({merchantId:t,invoiceId:e}))},t.prototype.duplicate=function(t,e){return this.invoiceApiService.duplicate(new Ve({merchantId:t,invoiceId:e})).pipe(o.map((function(t){return t?t.invoiceId:""})))},t}();function fu(t){var e=new Date("0001-01-01T00:00:00Z").valueOf(),i=((null==t?void 0:t.appliedBundles)||[]).map((function(t){return s(t)}));return{merchantId:t.merchantId,customerId:t.customerId,currency:Ca(t.currency),items:(t.items||[]).map((function(t){return function(t){var e=((null==t?void 0:t.discounts)||[]).map((function(t){return Oa(t)}));return{sku:null==t?void 0:t.sku,unitPrice:(null==t?void 0:t.unitPrice)||0,quantity:(null==t?void 0:t.quantity)||0,description:null==t?void 0:t.description,total:(null==t?void 0:t.total)||0,appliedTaxes:(null==t?void 0:t.appliedTaxes)||[],taxRates:(null==t?void 0:t.taxRates)||[],subtotal:(null==t?void 0:t.subtotal)||0,bundleId:(null==t?void 0:t.bundleId)||"",appliedDiscounts:e||[]}}(t)})),appliedTaxes:(t.appliedTaxes||[]).map((function(t){return du(t)})),total:t.total||0,subtotal:t.subtotal||0,created:t.created.valueOf()!==e?t.created:null,updated:t.updated.valueOf()!==e?t.updated:null,defaultTaxRates:(t.defaultTaxRates||[]).map((function(t){return hu(t)})),appliedBundles:i||[],discountTotal:t.amountDiscount||0}}vu.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new vu(e.ɵɵinject($s),e.ɵɵinject(i.HttpClient),e.ɵɵinject(aa))},token:vu,providedIn:"root"}),vu.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],vu.ctorParameters=function(){return[{type:$s},{type:i.HttpClient},{type:aa}]};var gu,Iu,yu,Au=function(){function t(t){this.invoiceTemplateApiService=t}return t.prototype.upsert=function(t,e,i,n){var r=(i||[]).map((function(t){var e=(t.appliedDiscounts||[]).map((function(t){return function(t){return{type:Ta(t.type),value:t.value||0,totalAmount:t.totalAmount||0,description:t.description||""}}(t)}));return new ms({sku:t.sku,unitPrice:t.unitPrice,quantity:t.quantity,description:t.description,taxRates:(t.taxRates||[]).map((function(t){return t.id})),bundleId:t.bundleId,appliedDiscounts:e})})),s=new Ss({merchantId:t,customerId:e,items:r||[],defaultTaxRates:n});return this.invoiceTemplateApiService.upsert(s).pipe(o.map((function(t){return fu(null==t?void 0:t.invoiceTemplate)})))},t.prototype.get=function(t,e){var i=new ps({merchantId:t,customerId:e});return this.invoiceTemplateApiService.get(i).pipe(o.map((function(t){return fu(null==t?void 0:t.invoiceTemplate)})))},t.prototype.delete=function(t,e){var i=new as({merchantId:t,customerId:e});return this.invoiceTemplateApiService.delete(i)},t.prototype.updateDefaultTaxRates=function(t,e,i){var n=new gs({customerId:e,merchantId:t,taxRateIds:i});return this.invoiceTemplateApiService.updateTemplateDefaultTaxRates(n).pipe(o.map((function(t){return fu(null==t?void 0:t.invoiceTemplate)})))},t.prototype.addBundle=function(t,e,i){return this.invoiceTemplateApiService.addBundle(new es({merchantId:t,customerId:e,bundleId:i})).pipe(o.map((function(t){return fu(null==t?void 0:t.invoiceTemplate)})))},t.prototype.updateBundle=function(t,e,i,n){return this.invoiceTemplateApiService.updateBundle(new vs({merchantId:t,customerId:e,bundleId:i,hideBundleItems:n})).pipe(o.map((function(t){return fu(null==t?void 0:t.invoiceTemplate)})))},t}();function Su(t){return{merchantId:t.merchantId,address:t.address,city:t.city,state:t.state,country:t.country,zipCode:t.zipCode,emailAddress:t.emailAddress,phoneNumber:t.phoneNumber,contactName:t.contactName,companyName:t.companyName,autoPostInvoices:t.autoPostInvoices,autoChargeInvoices:t.autoChargeInvoices,includeInFinancialRecords:t.includeInFinancialRecords,additionalEmailAddresses:t.additionalEmailAddresses||[],stripeConnectId:t.stripeAccountId}}function Pu(e){switch(e){case"daily":return t.PayoutInterval.Daily;case"weekly":return t.PayoutInterval.Weekly;case"monthly":return t.PayoutInterval.Monthly}return null}function bu(e){switch(e){case t.GenerateMethod.SUBSCRIPTION:return"subscription";case t.GenerateMethod.TEMPLATE:return"template";default:return""}}function Tu(e){switch(e){case"subscription":return t.GenerateMethod.SUBSCRIPTION;case"template":return t.GenerateMethod.TEMPLATE;default:return t.GenerateMethod.UNSET}}function Ou(t){return t?{generateMethod:Tu(t.generateMethod),collectionMethod:ru(t.collectionMethod),invoiceDay:t.invoiceDay}:null}Au.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Au(e.ɵɵinject(ca))},token:Au,providedIn:"root"}),Au.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Au.ctorParameters=function(){return[{type:ca}]},(gu=t.PayoutInterval||(t.PayoutInterval={})).Daily="daily",gu.Weekly="weekly",gu.Monthly="monthly",(Iu=t.GenerateMethod||(t.GenerateMethod={})).UNSET="Unset",Iu.SUBSCRIPTION="Subscription",Iu.TEMPLATE="Template",(yu=t.SortMerchantsBy||(t.SortMerchantsBy={}))[yu.merchantId=0]="merchantId",yu[yu.companyName=1]="companyName",yu[yu.contactName=2]="contactName",yu[yu.emailAddress=3]="emailAddress",yu[yu.country=4]="country",yu[yu.state=5]="state",yu[yu.created=6]="created",yu[yu.updated=7]="updated";var Eu=function(){function t(t,e,i){this.merchantApi=t,this.hostService=e,this.http=i}return t.prototype.get=function(t){var e=new Ji({merchantId:t});return this.merchantApi.get(e).pipe(o.map((function(t){return Su(t.merchant)})))},t.prototype.create=function(t,e,i,n,r,s,a,c,u,p,d){return this.merchantApi.create({merchantId:t,address:e,city:i,state:n,country:r,zipCode:s,emailAddress:a,phoneNumber:c,contactName:u,companyName:p,additionalEmailAddresses:d}).pipe(o.mapTo(!0))},t.prototype.update=function(t,e,i,n,r,s,a,c,u,p,d){return this.merchantApi.update({merchantId:t,address:e,city:i,state:n,country:r,zipCode:s,emailAddress:a,phoneNumber:c,contactName:u,companyName:p,additionalEmailAddresses:d}).pipe(o.mapTo(!0))},t.prototype.getOutstandingBalance=function(t){var e=new Ui({merchantId:t});return this.merchantApi.getOutstandingBalance(e).pipe(o.map((function(t){return{outstanding:t.outstandingBalance||0,currency:Ca(t.currency)}})))},t.prototype.getStatistics=function(t){var e=new Fs({merchantId:t});return this.merchantApi.getStatistics(e)},t.prototype.search=function(t,e,i,n){return this.merchantApi.search({searchTerm:t,sortBy:A[A[e]],sortDirection:y[y[i]],pagingOptions:new H(n)}).pipe(o.map((function(t){return new Ac(t.merchants.map((function(t){return Su(t)})),t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.setAutoPostInvoices=function(t,e){return this.merchantApi.setAutoPostInvoices({merchantId:t,shouldAutoPostInvoices:e}).pipe(o.mapTo(!0))},t.prototype.setAutoChargeInvoices=function(t,e){return this.merchantApi.setAutoChargeInvoices({merchantId:t,autoChargeInvoices:e}).pipe(o.mapTo(!0))},t.prototype.downloadCsv=function(t){var e="?filename="+t.filename;return this.http.get(this.hostService.httpsHostWithScheme()+"/merchants-csv"+e,this.apiOptions()).pipe(o.catchError(Oc))},t.prototype.setIncludeInFinancialRecords=function(t,e){return this.merchantApi.setIncludeInFinancialRecords({merchantId:t,includeInFinancialRecords:e}).pipe(o.mapTo(!0))},t.prototype.sendSalesInvoiceEmail=function(t,e){return this.merchantApi.sendSalesInvoiceEmail({merchantId:t,invoiceId:e}).pipe(o.mapTo(!0))},t.prototype.chargeSalesInvoice=function(t,e,i){return this.merchantApi.chargeSalesInvoice({merchantId:t,invoiceId:e,amount:i}).pipe(o.mapTo(!0))},t.prototype.sendSalesInvoiceReceiptEmail=function(t,e){return this.merchantApi.sendSalesInvoiceReceiptEmail({merchantId:t,invoiceId:e}).pipe(o.mapTo(!0))},t.prototype.apiOptions=function(){return{responseType:"blob",withCredentials:!0}},t.prototype.createExternalAccount=function(t,e){return this.merchantApi.createStripeExternalAccount(new Wt({merchantId:t,stripeToken:e})).pipe(o.mapTo(!0))},t.prototype.generateAccountBalanceReport=function(t){var e="?merchantID="+t;return this.http.get(this.hostService.httpsHostWithScheme()+"/merchant-balance-details-report"+e,this.apiOptions()).pipe(o.share(),o.catchError(Oc))},t.prototype.getMultiRetailConfigurations=function(t,e){var i=new ji({merchantId:t,retailGroupIds:e});return this.merchantApi.getMultiRetailConfigurations(i).pipe(o.map((function(t){var i=new Map;return e.forEach((function(e){var n;i.set(e,{merchantId:(n=t.retailConfigurations[e]).merchantId,retailGroupId:n.retailGroupId,currencyCode:n.currencyCode,currencyConversionRate:n.currencyConversionRate||0,defaultCustomerConfiguration:Ou(n.defaultCustomerConfiguration)})})),i})))},t.prototype.upsertRetailConfiguration=function(t,e,i,n){var r=new rn({merchantId:t,retailGroupId:e,currencyCode:i,currencyConversionRate:n});return this.merchantApi.upsertRetailConfiguration(r).pipe(o.mapTo(null))},t.prototype.getPayoutSummary=function(t){return this.merchantApi.getPayoutSummary(new Bi({merchantId:t})).pipe(o.map((function(t){return e=t,i=new Date("0001-01-01T00:00:00Z").valueOf(),{nextInTransitPayout:e.nextInTransitPayoutExpectedDate.valueOf()!==i?e.nextInTransitPayoutExpectedDate:null,payoutInterval:Pu(e.payoutInterval),payoutDelayDays:e.payoutDelayDays,balances:(e.balances||[]).map((function(t){return{currencyCode:t.currencyCode,amount:t.amount||0,futurePayouts:t.futurePayouts||0,inTransit:t.inTransit||0}}))};var e,i})))},t.prototype.getRetailPayout=function(t,e){return this.merchantApi.getRetailPayout(new Li({merchantId:t,payoutId:e})).pipe(o.map((function(t){return t.payout})))},t.prototype.listRetailPayouts=function(t,e,i){return void 0===e&&(e=""),void 0===i&&(i=10),this.merchantApi.listRetailPayouts(new Wi({merchantId:t,pagingOptions:new H({cursor:e,pageSize:i})})).pipe(o.map((function(t){var e=t.payouts||[];return new Ac(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.upsertDefaultRetailCustomerConfiguration=function(t,e,i){return this.merchantApi.upsertDefaultRetailCustomerConfiguration(new on({merchantId:t,retailGroupId:e,defaultCustomerConfiguration:(n=i,n?{generateMethod:bu(n.generateMethod),collectionMethod:ou(n.collectionMethod),invoiceDay:n.invoiceDay}:null)}));var n},t}();function Ru(t){return t?{id:t.id||"",paymentId:t.paymentId||"",status:Ju(t.status),amount:t.amount||0,created:t.created,currencyCode:t.currencyCode,evidence:Du(t.evidence),evidenceDetails:_u(t.evidenceDetails),isChargeRefundable:t.isChargeRefundable||!1,reason:t.reason||"",fee:t.fee,feeCurrencyCode:t.feeCurrencyCode}:null}function Du(t){return t?{customerCommunication:Cu(t.customerCommunication),customerSignature:Cu(t.customerSignature),shippingDocumentation:Cu(t.shippingDocumentation),receipt:Cu(t.receipt),uncategorizedFile:Cu(t.uncategorizedFile),billingAddress:t.billingAddress||"",customerEmailAddress:t.customerEmailAddress||"",customerName:t.customerName||"",productDescription:t.productDescription||""}:null}function Cu(t){return t?{id:t.id||"",created:t.created,filename:t.filename||"",url:t.url||""}:null}function _u(t){return t?{dueBy:t.dueBy,hasEvidence:t.hasEvidence,pastDue:t.pastDue,submissionCount:t.submissionCount}:null}function Ju(e){switch(e){case T.DISPUTE_STATUS_WARNING_NEEDS_RESPONSE:return t.DisputeStatus.WARNING_NEEDS_RESPONSE;case T.DISPUTE_STATUS_WARNING_UNDER_REVIEW:return t.DisputeStatus.WARNING_UNDER_REVIEW;case T.DISPUTE_STATUS_WARNING_CLOSED:return t.DisputeStatus.WARNING_CLOSED;case T.DISPUTE_STATUS_NEEDS_RESPONSE:return t.DisputeStatus.NEEDS_RESPONSE;case T.DISPUTE_STATUS_UNDER_REVIEW:return t.DisputeStatus.UNDER_REVIEW;case T.DISPUTE_STATUS_CHARGE_REFUNDED:return t.DisputeStatus.CHARGE_REFUNDED;case T.DISPUTE_STATUS_LOST:return t.DisputeStatus.LOST;case T.DISPUTE_STATUS_WON:return t.DisputeStatus.WON;default:return null}}function wu(e){switch(e){case E.PAYMENT_SOURCE_STRIPE:return t.PaymentSource.STRIPE;case E.PAYMENT_SOURCE_VCASH:return t.PaymentSource.VCASH;default:return t.PaymentSource.UNSET}}function ju(e){switch(e){case R.PAYMENT_STATUS_FAILED:return t.PaymentStatus.Failed;case R.PAYMENT_STATUS_SUCCEEDED:return t.PaymentStatus.Succeeded}return t.PaymentStatus.Unset}function Nu(e){switch(e){case O.PAYMENT_ALLOCATION_TYPE_INVOICE:return t.PaymentAllocationType.INVOICE;case O.PAYMENT_ALLOCATION_TYPE_PURCHASE:return t.PaymentAllocationType.PURCHASE;default:return t.PaymentAllocationType.UNSET}}function Uu(e){return{merchantId:e.merchantId||"",created:e.created?new Date(e.created):null,currency:e.currency?Ca(e.currency):t.Currency.USD,paymentSource:wu(e.paymentSource),allocations:e.allocations?e.allocations.map((function(t){return Mu(t)})):[],total:e.total||0,description:e.description||"",externalReferenceId:e.externalReferenceId||"",status:ju(e.status)}}function Mu(e){return{referenceId:e.referenceId||"",amount:e.amount||0,type:e.type?Nu(e.type):t.PaymentAllocationType.UNSET}}Eu.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Eu(e.ɵɵinject(ua),e.ɵɵinject($s),e.ɵɵinject(i.HttpClient))},token:Eu,providedIn:"root"}),Eu.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Eu.ctorParameters=function(){return[{type:ua},{type:$s},{type:i.HttpClient}]},function(t){t.WARNING_NEEDS_RESPONSE="Warning Needs Response",t.WARNING_UNDER_REVIEW="Warning Under Review",t.WARNING_CLOSED="Warning Closed",t.NEEDS_RESPONSE="Needs Response",t.UNDER_REVIEW="Under Review",t.CHARGE_REFUNDED="Charge Refunded",t.LOST="Lost",t.WON="Won"}(t.DisputeStatus||(t.DisputeStatus={})),function(t){t.UNSET="Unset",t.STRIPE="Stripe",t.VCASH="vCash"}(t.PaymentSource||(t.PaymentSource={})),function(t){t.Unset="UNSET",t.Failed="FAILED",t.Succeeded="SUCCEEDED"}(t.PaymentStatus||(t.PaymentStatus={})),function(t){t.UNSET="UNSET",t.PURCHASE="PURCHASE",t.INVOICE="INVOICE"}(t.PaymentAllocationType||(t.PaymentAllocationType={}));var Bu,ku,Fu=new Map([["authentication_required",{description:"The card was declined as the transaction requires authentication.",nextSteps:"The customer should try again and authenticate their card when prompted during the transaction."}],["approve_with_id",{description:"The payment cannot be authorized.",nextSteps:"The payment should be attempted again. If it still cannot be processed, the customer needs to contact their card issuer."}],["call_issuer",{description:"The card has been declined for an unknown reason.",nextSteps:"The customer needs to contact their card issuer for more information."}],["card_not_supported",{description:"The card does not support the specified currency.",nextSteps:"The customer needs to check with the issuer whether the card can be used for the type of currency specified."}],["do_not_honor",{description:"The card has been declined for an unknown reason.",nextSteps:"The customer needs to contact their card issuer for more information."}],["do_not_try_again",{description:"The card has been declined for an unknown reason.",nextSteps:"The customer should contact their card issuer for more information."}],["duplicate_transaction",{description:"A transaction with identical amount and credit card information was submitted very recently.",nextSteps:"Check to see if a recent payment already exists."}],["expired_card",{description:"The card has expired.",nextSteps:"The customer should use another card."}],["fraudulent",{description:"The payment has been declined as Stripe suspects it is fraudulent.",nextSteps:"Do not report more detailed information to your customer. Instead, present as you would the generic_decline described below."}],["generic_decline",{description:"The card has been declined for an unknown reason.",nextSteps:"The customer needs to contact their card issuer for more information."}],["incorrect_number",{description:"The card number is incorrect.",nextSteps:"The customer should try again using the correct card number."}],["incorrect_cvc",{description:"The CVC number is incorrect.",nextSteps:"The customer should try again using the correct CVC."}],["incorrect_pin",{description:"The PIN entered is incorrect. This decline code only applies to payments made with a card reader.",nextSteps:"The customer should try again using the correct PIN."}],["incorrect_zip",{description:"The ZIP/postal code is incorrect.",nextSteps:"The customer should try again using the correct billing ZIP/postal code."}],["insufficient_funds",{description:"The card has insufficient funds to complete the purchase.",nextSteps:"The customer should use an alternative payment method."}],["invalid_account",{description:"The card, or account the card is connected to, is invalid.",nextSteps:"The customer needs to contact their card issuer to check that the card is working correctly."}],["invalid_amount",{description:"The payment amount is invalid, or exceeds the amount that is allowed.",nextSteps:"If the amount appears to be correct, the customer needs to check with their card issuer that they can make purchases of that amount."}],["invalid_cvc",{description:"The CVC number is incorrect.",nextSteps:"The customer should try again using the correct CVC."}],["invalid_expiry_year",{description:"The expiration year invalid.",nextSteps:"The customer should try again using the correct expiration date."}],["invalid_number",{description:"The card number is incorrect.",nextSteps:"The customer should try again using the correct card number."}],["invalid_pin",{description:"The PIN entered is incorrect. This decline code only applies to payments made with a card reader.",nextSteps:"The customer should try again using the correct PIN."}],["issuer_not_available",{description:"The card issuer could not be reached, so the payment could not be authorized.",nextSteps:"The payment should be attempted again. If it still cannot be processed, the customer needs to contact their card issuer."}],["lost_card",{description:"The payment has been declined because the card is reported lost.",nextSteps:"The specific reason for the decline should not be reported to the customer. Instead, it needs to be presented as a generic decline."}],["merchant_blacklist",{description:"The payment has been declined because it matches a value on the Stripe user's block list.",nextSteps:"Do not report more detailed information to your customer. Instead, present as you would the generic_decline described above."}],["new_account_information_available",{description:"The card, or account the card is connected to, is invalid.",nextSteps:"The customer needs to contact their card issuer for more information."}],["no_action_taken",{description:"The card has been declined for an unknown reason.",nextSteps:"The customer should contact their card issuer for more information."}],["not_permitted",{description:"The payment is not permitted.",nextSteps:"The customer needs to contact their card issuer for more information."}],["offline_pin_required",{description:"The card has been declined as it requires a PIN.",nextSteps:"The customer should try again by inserting their card and entering a PIN."}],["online_or_offline_pin_required",{description:"The card has been declined as it requires a PIN.",nextSteps:"If the card reader supports Online PIN, the customer should be prompted for a PIN without a new transaction being created. If the card reader does not support Online PIN, the customer should try again by inserting their card and entering a PIN."}],["pickup_card",{description:"The card cannot be used to make this payment (it is possible it has been reported lost or stolen).",nextSteps:"The customer needs to contact their card issuer for more information."}],["pin_try_exceeded",{description:"The allowable number of PIN tries has been exceeded.",nextSteps:"The customer must use another card or method of payment."}],["processing_error",{description:"An error occurred while processing the card.",nextSteps:"The payment should be attempted again. If it still cannot be processed, try again later."}],["reenter_transaction",{description:"The payment could not be processed by the issuer for an unknown reason.",nextSteps:"The payment should be attempted again. If it still cannot be processed, the customer needs to contact their card issuer."}],["restricted_card",{description:"The card cannot be used to make this payment (it is possible it has been reported lost or stolen).",nextSteps:"The customer needs to contact their card issuer for more information."}],["revocation_of_all_authorizations",{description:"The card has been declined for an unknown reason.",nextSteps:"The customer should contact their card issuer for more information."}],["revocation_of_authorization",{description:"The card has been declined for an unknown reason.",nextSteps:"The customer should contact their card issuer for more information."}],["security_violation",{description:"The card has been declined for an unknown reason.",nextSteps:"The customer needs to contact their card issuer for more information."}],["service_not_allowed",{description:"The card has been declined for an unknown reason.",nextSteps:"The customer should contact their card issuer for more information."}],["stolen_card",{description:"The payment has been declined because the card is reported stolen.",nextSteps:"The specific reason for the decline should not be reported to the customer. Instead, it needs to be presented as a generic decline."}],["stop_payment_order",{description:"The card has been declined for an unknown reason.",nextSteps:"The customer should contact their card issuer for more information."}],["testmode_decline",{description:"A Stripe test card number was used.",nextSteps:"A genuine card must be used to make a payment."}],["transaction_not_allowed",{description:"The card has been declined for an unknown reason.",nextSteps:"The customer needs to contact their card issuer for more information."}],["try_again_later",{description:"The card has been declined for an unknown reason.",nextSteps:"Ask the customer to attempt the payment again. If subsequent payments are declined, the customer should contact their card issuer for more information."}],["withdrawal_count_limit_exceeded",{description:"The customer has exceeded the balance or credit limit available on their card.",nextSteps:"The customer should use an alternative payment method."}]]);(Bu=t.FundingType||(t.FundingType={})).PREPAID="Pre-paid",Bu.DEBIT="Debit",Bu.CREDIT="Credit",Bu.UNKNOWN="Unknown",(ku=t.PaymentCardType||(t.PaymentCardType={})).AMEX="American Express",ku.VISA="Visa",ku.MASTERCARD="Mastercard",ku.JCB="JCB",ku.DINERS_CLUB="Diners Club",ku.DISCOVER="Discover",ku.UNKNOWN="Unknown";var xu=t.PaymentCardType.AMEX,Lu=t.PaymentCardType.VISA,Yu=t.PaymentCardType.MASTERCARD,qu=t.PaymentCardType.JCB,Gu=t.PaymentCardType.DINERS_CLUB,Wu=t.PaymentCardType.DISCOVER,Hu=t.PaymentCardType.UNKNOWN,Vu=new Map([[t.CARD_TYPE.AMEX,{id:xu,value:"American Express"}],[t.CARD_TYPE.VISA,{id:Lu,value:"Visa"}],[t.CARD_TYPE.MASTERCARD,{id:Yu,value:"Mastercard"}],[t.CARD_TYPE.JCB,{id:qu,value:"JCB"}],[t.CARD_TYPE.DINERS_CLUB,{id:Gu,value:"Diners Club"}],[t.CARD_TYPE.DISCOVER,{id:Wu,value:"Discover"}],[t.CARD_TYPE.UNKNOWN,{id:Hu,value:"Unknown"}]]);var zu=t.FundingType.DEBIT,Ku=t.FundingType.CREDIT,Xu=t.FundingType.PREPAID,Qu=t.FundingType.UNKNOWN,Zu=new Map([[_.FUNDING_TYPE_DEBIT,{id:zu,value:"Debit"}],[_.FUNDING_TYPE_CREDIT,{id:Ku,value:"Credit"}],[_.FUNDING_TYPE_PREPAID,{id:Xu,value:"Pre-paid"}],[_.FUNDING_TYPE_UNKNOWN,{id:Qu,value:"Unknown"}]]);function $u(t){return Zu.get(t)}function tp(t){return{cardType:(e=t.cardType,Vu.get(e)),fundingType:$u(t.fundingType),cardId:t.cardId,lastFourDigits:t.lastFourDigits,expiryMonth:t.expiryMonth,expiryYear:t.expiryYear,cardholderName:t.cardholderName,address:t.address,city:t.city,state:t.state,country:t.country,zipCode:t.zipCode,default:t.default};var e}var ep,ip,np=function(){function t(t){this.apiService=t}return t.prototype.setDefaultCard=function(t,e){var i=new $i({merchantId:t,cardId:e});return this.apiService.setDefaultPaymentCard(i)},t.prototype.getFirstPaymentCard=function(t){return this.getAll(t).pipe(o.map((function(t){return t&&t.length?t[0]:null})))},t.prototype.getAll=function(t){var e=new eo({merchantId:t});return this.apiService.listPaymentCards(e).pipe(o.map((function(t){return t&&t.paymentCard?t.paymentCard:[]})),o.map((function(t){return t.map((function(t){return tp(t)}))})))},t.prototype.update=function(t,e){var i=new ro({merchantId:t,stripeToken:e});return this.apiService.updatePaymentCard(new ro(i))},t.prototype.create=function(t,e){var i=new $n({merchantId:t,stripeToken:e});return this.apiService.createPaymentCard(new $n(i))},t}();function op(t){return{id:t.id||"",merchantId:t.merchantId||"",created:t.created||null,currencyCode:t.currencyCode||"",amount:t.amount||0,referenceId:t.referenceId||"",referenceType:t.referenceType,description:t.description||"",customerId:t.customerId||"",status:sp(t.status,t.disputed),failureCode:t.failureCode,failureMessage:t.failureMessage,applicationFee:t.applicationFee,dispute:Ru(t.dispute),cardDetails:(e=t.cardDetails,{lastFourDigits:e.lastFourDigits,cardType:rp(e.cardType)})};var e}function rp(e){switch(e){case b.CARD_TYPE_VISA:return t.PaymentCardType.VISA;case b.CARD_TYPE_MASTERCARD:return t.PaymentCardType.MASTERCARD;case b.CARD_TYPE_AMEX:return t.PaymentCardType.AMEX;case b.CARD_TYPE_DISCOVER:return t.PaymentCardType.DISCOVER;case b.CARD_TYPE_JCB:return t.PaymentCardType.JCB;case b.CARD_TYPE_DINERS_CLUB:return t.PaymentCardType.UNKNOWN}}function sp(e,i){if(i)return t.RetailPaymentStatus.Disputed;switch(e){case R.PAYMENT_STATUS_SUCCEEDED:return t.RetailPaymentStatus.Succeeded;case R.PAYMENT_STATUS_FAILED:return t.RetailPaymentStatus.Failed;case R.PAYMENT_STATUS_REFUNDED:return t.RetailPaymentStatus.Refunded;case R.PAYMENT_STATUS_PARTIALLY_REFUNDED:return t.RetailPaymentStatus.PartialyRefunded;default:return null}}function ap(e){switch(e){case"rejected.fraud":case"rejected.listed":case"rejected.other":case"rejected.terms_of_service":return t.DisabledReason.REJECTED;case"other":return t.DisabledReason.OTHER;case"listed":return t.DisabledReason.LISTED;case"under_review":return t.DisabledReason.UNDER_REVIEW;default:return null}}function cp(t){return{supportedRegion:t.supportedRegion||!1,canAcceptPayment:t.canAcceptPayment||!1,disabledReason:ap(t.disabledReason),requirements:(e=t.requirements,e?{due:e.due,errors:(e.error||[]).map((function(t){return function(t){return{requirement:t.requirement,code:t.code,reason:t.reason}}(t)}))}:{due:[],errors:[]})};var e}np.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new np(e.ɵɵinject(ua))},token:np,providedIn:"root"}),np.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],np.ctorParameters=function(){return[{type:ua}]},(ep=t.RetailPaymentStatus||(t.RetailPaymentStatus={})).Failed="Failed",ep.Succeeded="Succeeded",ep.Refunded="Refunded",ep.PartialyRefunded="Partially refunded",ep.Disputed="Disputed",(ip=t.DisabledReason||(t.DisabledReason={})).FIELDS_NEEDED="fields needed",ip.LISTED="listed",ip.REJECTED="rejected",ip.UNDER_REVIEW="under review",ip.OTHER="other";var up=function(){function t(t){this.paymentApi=t}return t.prototype.listPayments=function(t,e,i){var n=new Jn({filters:t,pagingOptions:new H({cursor:e,pageSize:i})});return this.paymentApi.list(n).pipe(o.map((function(t){var e=(t.payments||[]).map((function(t){return Uu(t)}));return new Ac(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.prepareRetailPayment=function(t,e){var i=new Ln({merchantId:t,customerId:e});return this.paymentApi.prepareRetail(i).pipe(o.map((function(t){return{stripeClientSecret:t.stripeClientSecret,intentId:t.intentId}})))},t.prototype.getRetail=function(t,e){return this.paymentApi.getRetail({merchantId:t,paymentId:e}).pipe(o.map((function(t){return op(t.payment)})))},t.prototype.listRetail=function(t,e,i,n,r,s,a){void 0===e&&(e=""),void 0===i&&(i=10);var c=new Date("0001-01-01T00:00:00Z").valueOf(),u=new Un({payoutId:n||"",customerId:r||""});return s&&s.valueOf()!==c&&(u.createdDateGte=s),a&&a.valueOf()!==c&&(u.createdDateLte=a),this.paymentApi.listRetail(new Mn({merchantId:t,filters:u,pagingOptions:new H({cursor:e,pageSize:i})})).pipe(o.map((function(t){var e=(t.payments||[]).map((function(t){return op(t)}));return new Ac(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.getRetailDispute=function(t,e){return this.paymentApi.getRetailDispute({merchantId:t,disputeId:e}).pipe(o.map((function(t){return Ru(t.dispute)})))},t.prototype.listRetailDisputes=function(t,e,i){return void 0===e&&(e=""),void 0===i&&(i=10),this.paymentApi.listRetailDisputes(new jn({merchantId:t,pagingOptions:new H({cursor:e,pageSize:i})})).pipe(o.map((function(t){var e=(t.disputes||[]).map((function(t){return Ru(t)}));return new Ac(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.retailStatus=function(t){var e=new Hn({merchantId:t});return this.paymentApi.retailStatus(e).pipe(o.map((function(t){return cp(t)})))},t.prototype.retailPaymentsEnabled=function(t){var e=new Gn({merchantId:t});return this.paymentApi.retailPaymentsEnabled(e).pipe(o.map((function(t){return t.enabled})))},t.prototype.configureRetailProvider=function(t,e,i){return this.paymentApi.configureRetailProvider({merchantId:t,successUrl:e,failureUrl:i}).pipe(o.map((function(t){return t.stripeUrl})))},t.prototype.getRetailProvider=function(t){return this.paymentApi.getRetailProvider({merchantId:t}).pipe(o.map((function(t){return{statementDescriptor:t.statementDescriptor,stripeConnectId:t.stripeConnectId}})))},t.prototype.updateRetailProvider=function(t,e){return this.paymentApi.updateRetailProvider({merchantId:t,statementDescriptor:e}).pipe(o.mapTo(null))},t.prototype.submitEvidence=function(t,e,i,n,r){return this.paymentApi.submitEvidence({merchantId:t,disputeId:e,paymentId:i,evidence:{billingAddress:(null==r?void 0:r.billingAddress)||null,customerEmailAddress:(null==r?void 0:r.customerEmailAddress)||null,customerName:(null==r?void 0:r.customerName)||null,productDescription:(null==r?void 0:r.productDescription)||null,customerSignatureFileId:(null==r?void 0:r.customerSignatureFileId)||null,customerCommunicationFileId:(null==r?void 0:r.customerCommunicationFileId)||null,receiptFileId:(null==r?void 0:r.receiptFileId)||null,shippingDocumentationFileId:(null==r?void 0:r.shippingDocumentationFileId)||null,uncategorizedFileId:(null==r?void 0:r.uncategorizedFileId)||null},submit:n}).pipe(o.mapTo(null))},t.prototype.closeDispute=function(t,e){return this.paymentApi.closeRetailDispute({merchantId:t,disputeId:e}).pipe(o.mapTo(null))},t}();up.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new up(e.ɵɵinject(da))},token:up,providedIn:"root"}),up.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],up.ctorParameters=function(){return[{type:da}]};var pp=function(){function t(t){this.apiService=t}return t.prototype.listPaymentCards=function(t,e){var i=new eo({merchantId:t,customerId:e});return this.apiService.listPaymentCards(i).pipe(o.map((function(t){return(t&&t.paymentCard?t.paymentCard:[]).map((function(t){return tp(t)}))})))},t.prototype.deletePaymentCard=function(t,e){var i=new to({merchantId:t,cardId:e});return this.apiService.deletePaymentCard(i).pipe(o.mapTo(!0))},t.prototype.setDefaultPaymentCard=function(t,e,i){var n=new oo({merchantId:t,customerId:e,paymentMethodId:i});return this.apiService.setDefaultPaymentMethod(n).pipe(o.mapTo(!0))},t}();function dp(t){return{sku:t.sku||"",productName:t.productName||"",startingCount:t.startingCount||0,activations:t.activations||0,deactivations:t.deactivations||0,churn:t.churn||0,retention:t.retention||0}}function hp(t){var e=(t.subscriptionMetrics||[]).map((function(t){return dp(t)}));return{groupID:t.groupId||"",metrics:e||[]}}pp.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new pp(e.ɵɵinject(pa))},token:pp,providedIn:"root"}),pp.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],pp.ctorParameters=function(){return[{type:pa}]};var lp=function(){function t(t){this.productSummaryApi=t}return t.prototype.listSubscriptionRetentionBySKU=function(t,e,i,n){var r=new re({merchantId:t,filters:e,pagingOptions:new H({cursor:i,pageSize:n})});return this.productSummaryApi.listSubscriptionRetentionBySku(r).pipe(o.map((function(t){var e=(t.subscriptionMetrics||[]).map((function(t){return dp(t)}));return new Ac(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.listSubscriptionRetentionByGroup=function(t,e,i,n){var r=new re({merchantId:t,filters:e,pagingOptions:new H({cursor:i,pageSize:n})});return this.productSummaryApi.listSubscriptionRetentionByGroup(r).pipe(o.map((function(t){var e=(t.metricsByGroup||[]).map((function(t){return hp(t)}));return new Ac(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t}();lp.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new lp(e.ɵɵinject(ma))},token:lp,providedIn:"root"}),lp.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],lp.ctorParameters=function(){return[{type:ma}]};var mp=function(){function t(t,e){this.hostService=t,this.http=e}return t.prototype.exportCSV=function(t){var e=function(t){return{merchantId:t.merchantId,purchaseId:t.purchaseId,start:t.start?t.start.toISOString():void 0,end:t.end?t.end.toISOString():void 0,billingStrategyFilter:t.billingStrategyFilter?{billingStrategy:t.billingStrategyFilter.billingStrategy?t.billingStrategyFilter.billingStrategy.map((function(t){return t.valueOf()})):[]}:void 0,state:t.state?t.state.valueOf():void 0,minPrice:t.minPrice,status:t.status,includeVoided:t.includeVoided}}(t);return this.http.post(this.hostService.httpsHostWithScheme()+"/purchase/export-csv",{filters:e},{observe:"body",responseType:"blob",withCredentials:!0}).pipe(o.share())},t}();function vp(e){switch(e){case t.RefundReason.REQUESTED_BY_CUSTOMER:return t.RefundReasonEnum.REQUESTED_BY_CUSTOMER;case t.RefundReason.FRAUDULENT:return t.RefundReasonEnum.FRAUDULENT;case t.RefundReason.DUPLICATE:return t.RefundReasonEnum.DUPLICATE}return t.RefundReasonEnum.DUPLICATE}function fp(e){switch(e){case t.RefundReasonEnum.DUPLICATE:return t.RefundReason.DUPLICATE;case t.RefundReasonEnum.REQUESTED_BY_CUSTOMER:return t.RefundReason.REQUESTED_BY_CUSTOMER;case t.RefundReasonEnum.FRAUDULENT:return t.RefundReason.FRAUDULENT}return t.RefundReason.REQUESTED_BY_CUSTOMER}function gp(e){switch(e){case t.RefundStatusEnum.SUCCEEDED:return t.RefundStatus.SUCCEEDED;case t.RefundStatusEnum.FAILED:return t.RefundStatus.FAILED;case t.RefundStatusEnum.PENDING:return t.RefundStatus.PENDING}return t.RefundStatus.SUCCEEDED}function Ip(e){switch(e){case t.ReferenceTypeEnum.PURCHASE:return t.ReferenceType.PURCHASE;case t.ReferenceTypeEnum.PURCHASE_ITEM:return t.ReferenceType.PURCHASE_ITEM;case t.ReferenceTypeEnum.INVOICE:return t.ReferenceType.INVOICE}return t.ReferenceType.PURCHASE}function yp(t){return{merchantId:t.merchantId||"",chargeId:t.chargeId||"",refundId:t.refundId||"",amount:t.amount||0,reason:fp(t.reason),status:gp(t.status),created:t.created?new Date(t.created):null,updated:t.updated?new Date(t.updated):null,referenceType:Ip(t.referenceType),referenceId:t.referenceId||""}}mp.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new mp(e.ɵɵinject($s),e.ɵɵinject(i.HttpClient))},token:mp,providedIn:"root"}),mp.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],mp.ctorParameters=function(){return[{type:$s},{type:i.HttpClient}]},function(t){t.REQUESTED_BY_CUSTOMER="Requested by Customer",t.DUPLICATE="Duplicate",t.FRAUDULENT="Fraudulent",t.UNKNOWN="Unknown"}(t.RefundReason||(t.RefundReason={})),function(t){t.SUCCEEDED="Succeeded",t.FAILED="Failed",t.PENDING="Pending",t.UNKNOWN="Unknown"}(t.RefundStatus||(t.RefundStatus={})),function(t){t.PURCHASE="Purchase",t.PURCHASE_ITEM="Purchase Item",t.INVOICE="Invoice",t.UNKNOWN="Unknown"}(t.ReferenceType||(t.ReferenceType={}));var Ap=function(){function t(t){this.refundApiService=t}return t.prototype.create=function(t,e,i,n){var r=new sr({merchantId:t,paymentId:e,amount:i,reason:vp(n)});return this.refundApiService.create(r).pipe(o.catchError(this.handleError),o.mapTo(null))},t.prototype.list=function(t,e,i,n){var r=new ar({paymentIds:e,cursor:i,pageSize:n,merchantId:t});return this.refundApiService.list(r).pipe(o.map((function(t){var e=(t.refunds||[]).map((function(t){return yp(t)}));return new Ac(e,t.nextCursor,t.hasMore)})))},t.prototype.handleError=function(t){return t.error instanceof ErrorEvent?console.error("An error occurred:",t.error.message):console.error("Server returned "+t.message),r.throwError("Unable to issue a refund")},t}();function Sp(e){return new hr(Object.assign(Object.assign({},e),{statuses:(e.statuses||[]).map((function(e){return function(e){switch(e){case t.SalesCreditNoteStatus.ReadyToPost:return x.SALES_CREDIT_NOTE_STATUS_READY_TO_POST;case t.SalesCreditNoteStatus.Complete:return x.SALES_CREDIT_NOTE_STATUS_COMPLETE;case t.SalesCreditNoteStatus.Discarded:return x.SALES_CREDIT_NOTE_STATUS_DISCARDED}return x.SALES_CREDIT_NOTE_STATUS_IN_PROGRESS}(e)}))}))}function Pp(e){switch(e){case x.SALES_CREDIT_NOTE_STATUS_READY_TO_POST:return t.SalesCreditNoteStatus.ReadyToPost;case x.SALES_CREDIT_NOTE_STATUS_COMPLETE:return t.SalesCreditNoteStatus.Complete;case x.SALES_CREDIT_NOTE_STATUS_DISCARDED:return t.SalesCreditNoteStatus.Discarded}return t.SalesCreditNoteStatus.InProgress}Ap.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Ap(e.ɵɵinject(fa))},token:Ap,providedIn:"root"}),Ap.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Ap.ctorParameters=function(){return[{type:fa}]},function(t){t.InProgress="IN_PROGRESS",t.ReadyToPost="READY_TO_POST",t.Complete="COMPLETE",t.Discarded="DISCARDED"}(t.SalesCreditNoteStatus||(t.SalesCreditNoteStatus={}));var bp,Tp=function(){function t(t,e,i){this.hostService=t,this.http=e,this.salesCreditNoteApi=i}return t.prototype.downloadPdf=function(t,e){var i;return i=e?{salesCreditNoteId:t,merchantId:e}:{salesCreditNoteId:t},this.http.get(this.hostService.httpsHostWithScheme()+"/sales-credit-note-pdf",{observe:"body",params:i,responseType:"blob",withCredentials:!0}).pipe(o.share(),o.catchError(this.handleDownloadPDFError.bind(this)))},t.prototype.createAutomatedCreditNote=function(t,e,i,n){var r=new dr({merchantId:t,creditNoteReason:e,total:i,sku:n});return this.salesCreditNoteApi.create(r).pipe(o.map((function(){return null})))},t.prototype.list=function(t,e,i){var n=new lr({filters:Sp(t),pagingOptions:new H({cursor:e,pageSize:i})});return this.salesCreditNoteApi.list(n).pipe(o.map((function(t){var e=(t.creditNote||[]).map((function(t){return{creditNoteId:(e=t).creditNoteId,creditNoteNumber:e.creditNoteNumber,merchantId:e.merchantId,creditNoteReason:e.creditNoteReason,creditNoteDate:e.creditNoteDate?new Date(e.creditNoteDate):null,dueDate:e.dueDate?new Date(e.dueDate):null,currency:Ca(e.currency),total:e.total||0,outstanding:e.outstanding||0,invoiceId:e.invoiceId,invoiceNumber:e.invoiceNumber,status:Pp(e.status),paymentStatus:e.paymentStatus};var e}));return new Ac(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.handleDownloadPDFError=function(t){return t.error instanceof ErrorEvent?console.error("An error occurred:",t.error.message):console.error("Server returned "+t.message),r.throwError("Unable to download pdf")},t}();function Op(t){return{invoiceId:t.invoiceId,invoiceNumber:t.invoiceNumber,merchantId:t.merchantId,invoiceDate:t.invoiceDate?new Date(t.invoiceDate):null,startDate:t.startDate?new Date(t.startDate):null,endDate:t.endDate?new Date(t.endDate):null,dueDate:t.dueDate?new Date(t.dueDate):null,currency:Ca(t.currency),status:Rp(t.status),type:Dp(t.type),total:t.total||0,paymentStatus:t.paymentStatus,outstanding:t.outstanding||0}}function Ep(e){return new yr(Object.assign(Object.assign({},e),{statuses:(e.statuses||[]).map((function(e){return function(e){switch(e){case t.SalesInvoiceStatus.ReadyToPost:return Y.SALES_INVOICE_STATUS_READY_TO_POST;case t.SalesInvoiceStatus.Complete:return Y.SALES_INVOICE_STATUS_COMPLETE;case t.SalesInvoiceStatus.Discarded:return Y.SALES_INVOICE_STATUS_DISCARDED}return Y.SALES_INVOICE_STATUS_IN_PROGRESS}(e)})),paymentStatuses:(e.paymentStatuses||[]).map((function(e){return function(e){switch(e){case t.PaymentStatusType.Paid:return L.PAYMENT_STATUSES_PAID;case t.PaymentStatusType.Part_Paid:return L.PAYMENT_STATUSES_PART_PAID;case t.PaymentStatusType.Unpaid:return L.PAYMENT_STATUSES_UNPAID;case t.PaymentStatusType.Not_Applicable:return L.PAYMENT_STATUSES_NOT_APPLICABLE}return L.PAYMENT_STATUSES_NOT_SET}(e)}))}))}function Rp(e){switch(e){case Y.SALES_INVOICE_STATUS_READY_TO_POST:return t.SalesInvoiceStatus.ReadyToPost;case Y.SALES_INVOICE_STATUS_COMPLETE:return t.SalesInvoiceStatus.Complete;case Y.SALES_INVOICE_STATUS_DISCARDED:return t.SalesInvoiceStatus.Discarded}return t.SalesInvoiceStatus.InProgress}function Dp(e){switch(e){case q.SALES_INVOICE_TYPE_INVOICED:return t.SalesInvoiceType.Invoiced;case q.SALES_INVOICE_TYPE_INSTANT:return t.SalesInvoiceType.Instant}return null}Tp.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Tp(e.ɵɵinject($s),e.ɵɵinject(i.HttpClient),e.ɵɵinject(Ia))},token:Tp,providedIn:"root"}),Tp.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Tp.ctorParameters=function(){return[{type:$s},{type:i.HttpClient},{type:Ia}]},function(t){t.InProgress="IN_PROGRESS",t.ReadyToPost="READY_TO_POST",t.Complete="COMPLETE",t.Discarded="DISCARDED"}(t.SalesInvoiceStatus||(t.SalesInvoiceStatus={})),function(t){t.Instant="INSTANT",t.Invoiced="INVOICED"}(t.SalesInvoiceType||(t.SalesInvoiceType={})),(bp=t.PaymentStatusType||(t.PaymentStatusType={})).Not_Applicable="Not Applicable",bp.Unpaid="Unpaid",bp.Paid="Paid",bp.Part_Paid="Part Paid";var Cp=function(){function t(t,e,i){this.hostService=t,this.http=e,this.salesInvoiceApi=i}return t.prototype.downloadPdf=function(t,e){var i;return i=e?{salesInvoiceId:t,merchantId:e}:{salesInvoiceId:t},this.http.get(this.hostService.httpsHostWithScheme()+"/sales-invoice-pdf",{observe:"body",params:i,responseType:"blob",withCredentials:!0}).pipe(o.share(),o.catchError(_p))},t.prototype.listSalesInvoices=function(t,e,i,n){var r=new Ar({filters:Ep(t),pagingOptions:new H({cursor:e,pageSize:i}),searchTerm:n||""});return this.salesInvoiceApi.list(r).pipe(o.map((function(t){var e=(t.invoice||[]).map((function(t){return Op(t)}));return new Ac(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.postSalesInvoice=function(t){var e=new Pr({invoiceId:t});return this.salesInvoiceApi.post(e).pipe(o.mapTo(!0))},t.prototype.getSalesInvoice=function(t,e){var i=new gr({invoiceId:t,merchantId:e});return this.salesInvoiceApi.get(i).pipe(o.map((function(t){return Op(t.invoice)})))},t}();function _p(t){return t.error instanceof ErrorEvent?console.error("An error occurred:",t.error.message):console.error("Server returned "+t.message),r.throwError("Unable to download pdf")}Cp.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Cp(e.ɵɵinject($s),e.ɵɵinject(i.HttpClient),e.ɵɵinject(ya))},token:Cp,providedIn:"root"}),Cp.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Cp.ctorParameters=function(){return[{type:$s},{type:i.HttpClient},{type:ya}]};var Jp,wp=function(){function t(t,e){this.hostService=t,this.httpClient=e}return t.prototype.uploadFile=function(t,e,i){var n=new FormData;return n.append("merchant_id",t),n.append("purpose",e),n.append("file",i),this.httpClient.post(this.hostService.httpsHostWithScheme()+"/stripe/files",n,this.apiOptions()).pipe(o.share(),o.catchError(Ec))},t.prototype.apiOptions=function(){return{withCredentials:!0}},t}();function jp(t){return{id:t.id||"",merchantId:t.merchantId||"",countryCode:t.countryCode||"",stateCode:t.stateCode||"",name:t.name||"",description:t.description||"",percentage:t.percentage||0,accountingSystemId:t.accountingSystemId||""}}wp.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new wp(e.ɵɵinject($s),e.ɵɵinject(i.HttpClient))},token:wp,providedIn:"root"}),wp.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],wp.ctorParameters=function(){return[{type:$s},{type:i.HttpClient}]},(Jp=t.FilePurpose||(t.FilePurpose={})).ACCOUNT_REQUIREMENT="account_requirement",Jp.ADDITIONAL_VERIFICATION="additional_verification",Jp.BUSINESS_ICON="business_icon",Jp.BUSINESS_LOGO="business_logo",Jp.CUSTOMER_SIGNATURE="customer_signature",Jp.DISPUTE_EVIDENCE="dispute_evidence",Jp.IDENTITY_DOCUMENT="identity_document",Jp.PCI_DOCUMENT="pci_document",Jp.TAX_DOCUMENT_USER_UPLOAD="tax_document_user_upload";var Np=function(){function t(t){this.taxRateApi=t}return t.prototype.calculate=function(t,e,i){var n=new Pe({merchantId:t,customerId:e,amount:i});return this.taxRateApi.calculate(n).pipe(o.map((function(t){var e=(t.taxRates||[]).map((function(t){return jp(t)}));return{taxableAmount:t.taxableAmount||0,taxRates:e}})))},t.prototype.create=function(t,e,i,n,o,r,s){var a=new Te({merchantId:t,countryCode:e,stateCode:i,name:n,description:o,percentage:r,accountingSystemId:s});return this.taxRateApi.create(a)},t.prototype.update=function(t,e,i,n,o,r,s,a){var c=new Je({merchantId:t,id:e,countryCode:i,stateCode:n,name:o,description:r,percentage:s,accountingSystemId:a});return this.taxRateApi.update(c)},t.prototype.list=function(t,e,i){var n=new De({filters:t,pagingOptions:new H({cursor:e,pageSize:i})});return this.taxRateApi.list(n).pipe(o.map((function(t){var e=(t.taxRates||[]).map((function(t){return jp(t)}));return new Ac(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.getMulti=function(t,e){var i=new Ee({merchantId:t,ids:e});return this.taxRateApi.getMulti(i).pipe(o.map((function(t){return(t.taxRates||[]).map((function(t){return jp(t)}))})))},t.prototype.archive=function(t,e){var i=new Se({merchantId:t,id:e});return this.taxRateApi.archive(i)},t}();Np.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Np(e.ɵɵinject(Aa))},token:Np,providedIn:"root"}),Np.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Np.ctorParameters=function(){return[{type:Aa}]},t.AddLineItemRequest=Be,t.AddLineItemResponse=ke,t.Agency=kc,t.BankAccountService=Ea,t.BankReconciliationService=Sc,t.BillingApiService=ea,t.BillingHostService=Tc,t.BillingService=Kc,t.BundleService=$c,t.CanCreateSubscriptionsResponse=_r,t.ChannelPartnersGrowthHighTouch=qc,t.ChannelPartnersGrowthMediumTouch=Yc,t.ChannelPartnersUnassistedPLG=Lc,t.ConnectStripeAccountRequest=Ri,t.ConnectStripeAccountResponse=Di,t.ContractDocumentService=tu,t.ContractService=Wc,t.CreateDiscountRequest=he,t.CreateInvoiceRequest=xe,t.CreateInvoiceResponse=Le,t.CreateMerchantRequest=Ci,t.CreatePaymentCardRequest=$n,t.CreateProductRequest=No,t.CreateRefundRequest=sr,t.CreateTaxRequest=Te,t.CreditService=eu,t.DeclineReasons=Fu,t.DeleteBankAccountRequest=Ht,t.DeleteContractDocumentRequest=qr,t.DeleteInvoiceRequest=Ge,t.DeleteLineItemRequest=We,t.DeleteLineItemResponse=He,t.DeleteProductRequest=Uo,t.DeleteRetailPricingRequest=Ts,t.Dimension=Mc,t.DiscountService=nu,t.ExistingEnterprise=xc,t.ExpireDiscountRequest=me,t.GenerateBillableItemsCSVRequest=Os,t.GenerateBillableItemsCSVResponse=Es,t.GenerateVendorReportRequest=Rs,t.GenerateVendorReportResponse=Ds,t.GetBalanceRequest=$r,t.GetBalanceResponse=ts,t.GetInvoiceRequest=Xe,t.GetInvoiceResponse=Qe,t.GetMerchantRequest=Ji,t.GetMerchantResponse=wi,t.GetMultiBundleRetailPricingRequest=Cs,t.GetMultiBundleRetailPricingResponse=_s,t.GetMultiBundleRetailPricingResponsePricesEntry=Ws,t.GetMultiContractsRequest=wt,t.GetMultiContractsResponse=jt,t.GetMultiProductPricingRequest=Js,t.GetMultiProductPricingResponse=ws,t.GetMultiProductPricingResponseProductPricesEntry=zs,t.GetMultiProductRequest=Mo,t.GetMultiProductResponse=Bo,t.GetMultiRetailPricingRequest=js,t.GetMultiRetailPricingResponse=Ns,t.GetMultiRetailPricingResponseProductPricesEntry=Vs,t.GetMultiTaxRequest=Ee,t.GetMultiTaxResponse=Re,t.GetOutstandingBalanceRequest=Ui,t.GetOutstandingBalanceResponse=Mi,t.GetPurchaseCostRequest=Us,t.GetPurchaseCostResponse=Ms,t.GetRevenueStatsRequest=Bs,t.GetRevenueStatsResponse=ks,t.GetStatisticsRequest=Fs,t.GetStatisticsResponse=xs,t.GetWholesaleComparisonRequest=Ys,t.GetWholesaleComparisonRequestGetWholesaleComparisonFilters=Ls,t.GetWholesaleComparisonResponse=qs,t.GetWholesaleComparisonResponseGetWholesaleComparisonResult=Gs,t.InvoiceService=vu,t.InvoiceTemplateService=Au,t.ListBankAccountsRequest=Vt,t.ListBankAccountsResponse=zt,t.ListBillableItemsRequestFilters=nt,t.ListContractDocumentsRequest=Wr,t.ListContractDocumentsResponse=Hr,t.ListContractsRequest=Nt,t.ListContractsResponse=Ut,t.ListDiscountsRequest=fe,t.ListDiscountsResponse=ge,t.ListInvoicesRequest=ti,t.ListInvoicesResponse=ei,t.ListMerchantBillingReportsRequest=an,t.ListMerchantBillingReportsResponse=cn,t.ListPaymentCardsRequest=eo,t.ListPaymentCardsResponse=io,t.ListPaymentRequest=Jn,t.ListPaymentResponse=wn,t.ListProductsRequest=Fo,t.ListProductsResponse=xo,t.ListPurchaseItemsFilters=Xo,t.ListPurchaseItemsRequest=Qo,t.ListPurchaseItemsResponse=Zo,t.ListPurchaseRequest=$o,t.ListPurchaseResponse=tr,t.ListRefundsRequest=ar,t.ListRefundsResponse=cr,t.ListRetailPaymentsRequest=Mn,t.ListRetailPaymentsResponse=Bn,t.ListSalesCreditNoteRequest=lr,t.ListSalesCreditNoteResponse=mr,t.ListTaxRequest=De,t.ListTaxResponse=Ce,t.MerchantApiService=ua,t.MerchantReportApiService=Cc,t.MerchantService=Eu,t.NewEnterprise=Fc,t.PagedResponse=Ac,t.PayInvoiceRequest=ii,t.PaymentCardService=np,t.PaymentMethodService=pp,t.PaymentService=up,t.PrepareRetailPaymentRequest=Ln,t.PrepareRetailPaymentResponse=Yn,t.PricingPlanService=Qa,t.ProductSummary=ae,t.ProductSummaryService=lp,t.PurchaseService=mp,t.REPUTATION_MANGEMENT_SKU="RM",t.RefundApiService=fa,t.RefundService=Ap,t.ResetContractPricingRequest=Bt,t.RetailCustomerConfigurationService=cu,t.RetailPayout=Ti,t.RetryPurchaseRequest=nr,t.RevenueApiService=Rc,t.SNAPSHOT_REPORT_REFRESH_SKU="snapshotreportrefresh",t.SNAPSHOT_REPORT_SKU="ST",t.SalesCreditNoteService=Tp,t.SalesInvoiceService=Cp,t.SearchMerchantsRequest=Ki,t.SearchMerchantsResponse=Xi,t.SendInvoiceRequest=ri,t.SetAutoChargeInvoicesRequest=Qi,t.SetAutoPostInvoicesRequest=Zi,t.SetDefaultBankAccountRequest=Kt,t.SetDefaultPaymentCardRequest=$i,t.SetHasAlternativePaymentMethodRequest=tn,t.SetIncludeInFinancialRecordsRequest=en,t.SetWholesaleProductStrategyRequest=Ks,t.SetWholesaleProductVolumeCommitmentRequest=Xs,t.StartRevRecTemplateBackfillRequest=Qs,t.StripeFileService=wp,t.SubscriptionService=bc,t.TaxRateService=Np,t.UpdateInvoiceRequest=pi,t.UpdateInvoiceResponse=di,t.UpdateLineItemRequest=hi,t.UpdateLineItemResponse=li,t.UpdateMerchantRequest=nn,t.UpdatePaymentCardRequest=ro,t.UpdateProductRequest=Yo,t.UpdateTaxRequest=Je,t.UpsertRetailPricingRequest=Zs,t.UpsertRetailPricingRequestPricingEntry=Hs,t.ValidateResponse=Lr,t.VoidInvoiceRequest=mi,t.VoidPurchaseRequest=or,t.WholesalePricingService=Wa,t.appliedCreditFromAPI=jc,t.appliedCreditTypeFromAPI=Nc,t.appliedDiscountFromApi=Oa,t.appliedTaxRateFromAPI=Uc,t.billingStrategyFromAPI=Ra,t.billingStrategyToAPI=Da,t.collectionMethodFromApi=ru,t.collectionMethodToApi=ou,t.contractFromApi=Gc,t.convertApiAppliedBundle=s,t.currencyFromApi=Ca,t.currencyPricingMapToApi=La,t.disputeFromApi=Ru,t.disputeStatusFromApi=Ju,t.enumStringToValue=bs,t.frequencyFromApi=Ja,t.frequencyFromLegacyApi=_a,t.frequencyToApi=wa,t.isBillingStrategyInstant=function(e){return e===t.BillingStrategy.Instantly||e===t.BillingStrategy.EndOfDay},t.listProductsFilterToApi=zc,t.paymentAllocationFromApi=Mu,t.paymentAllocationTypeFromApi=Nu,t.paymentFromApi=Uu,t.paymentSourceFromApi=wu,t.paymentStatusFromApi=ju,t.pricesFromApi=Fa,t.pricingPlanFromAPI=Ha,t.pricingPlanProductFromApi=xa,t.pricingPlanProductPricingToApi=qa,t.productFromApi=Vc,t.productPricingFromApi=ka,t.productPricingRulesFromApi=ja,t.productPricingRulesToApi=Ya,t.productPricingTypeFromApi=Na,t.productPricingTypeToApi=Ua,t.purchaseCostFromAPI=Ba,t.purchaseFromApi=Jc,t.purchaseItemFromApi=wc,t.purchaseStatusFromApi=_c,t.reasonFromApi=fp,t.reasonToApi=vp,t.referenceFromApi=Ip,t.refundFromApi=yp,t.retailCustomerConfigurationFromApi=su,t.retailPaymentFromApi=op,t.retailPaymentStatusFromApi=sp,t.retailResponseFromAPI=cp,t.setActivated=function(t){return{activated:t}},t.setCreditLimit=function(t){return{creditLimit:t}},t.setCurrencyCode=function(t){return{currencyCode:t}},t.setDimension=function(t){return{dimension:t}},t.setEnd=function(t){return{end:t}},t.setModified=function(t){return{modified:t}},t.setNetD=function(t){return{netD:t}},t.setSigned=function(t){return{signed:t}},t.setStatus=function(t){return{status:t}},t.setSubscriptionId=function(t){return{subscriptionId:t}},t.statusFromApi=gp,t.subscriptionMetricByGroupFromAPI=hp,t.subscriptionMetricFromAPI=dp,Object.defineProperty(t,"__esModule",{value:!0})}));
15
+ ***************************************************************************** */sc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new sc(e.ɵɵinject(la),e.ɵɵinject(i.HttpClient),e.ɵɵinject(Ea),e.ɵɵinject(va))},token:sc,providedIn:"root"}),sc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],sc.ctorParameters=function(){return[{type:la},{type:i.HttpClient},{type:Ea},{type:va}]},(rc=t.Distribution||(t.Distribution={})).Retail="Retail",rc.Wholesale="Wholesale";var cc=function(t,e){return(cc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(t,e)};function uc(t,e){function i(){this.constructor=t}cc(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}Object.create;function pc(t){var e="function"==typeof Symbol&&Symbol.iterator,i=e&&t[e],n=0;if(i)return i.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function dc(t,e){var i="function"==typeof Symbol&&t[Symbol.iterator];if(!i)return t;var n,o,r=i.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(n=r.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(i=r.return)&&i.call(r)}finally{if(o)throw o.error}}return s}function hc(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(dc(arguments[e]));return t}Object.create;var lc,mc=function(){function e(t,e){this.environmentService=t,this.billingService=e}return e.prototype.list=function(e){var i=this.environmentService.getEnvironment();switch(e){case t.Distribution.Retail:return bc.get(i);case t.Distribution.Wholesale:return Pc.get(i)}return Sc.get(i)||[]},e.prototype.isDefault=function(t){return t===this.list().find((function(t){return t.name===vc.Default})).id},e.prototype.nameForId=function(t){return this.list().find((function(e){return e.id===t})).name||null},e.prototype.idForName=function(t){var e=this.list().find((function(e){return e.name===t}));return e?e.id:null},e.prototype.idForSubscriptionName=function(t){var e=this.list().find((function(e){return e.subscriptionName===t}));return e?e.id:null},e.prototype.setDefaultStrategy=function(t,e){var i={id:t,fieldMask:{paths:["default_billing_strategy"]},defaultBillingStrategy:Ga(e)};return this.billingService.updatePricingPlan(i)},e.prototype.getMulti=function(t){return this.billingService.getMultiPricingPlan({pricingPlanIds:t}).pipe(o.map((function(t){return t.plans.map((function(t){return ac(t)}))})))},e}();mc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new mc(e.ɵɵinject(n.EnvironmentService),e.ɵɵinject(va))},token:mc,providedIn:"root"}),mc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],mc.ctorParameters=function(){return[{type:n.EnvironmentService},{type:va}]},function(t){t.MSRP="MSRP"}(lc||(lc={}));var vc,fc=[{id:"PP-5049b4b2-fe28-473f-96d6-84d4ea91ada9",name:lc.MSRP,subscriptionName:"msrp",defaultStrategy:t.BillingStrategy.Invalid}],gc=[{id:"PP-148b6d8c-6222-4fce-9cd2-f0587f0db563",name:lc.MSRP,subscriptionName:"msrp",defaultStrategy:t.BillingStrategy.Invalid}];!function(t){t.VBPFree="Free",t.VBPStarter="Starter",t.VBPBasic="Basic+",t.VBPProfessional="Professional+",t.VBPEnterprise="Enterprise+",t.VBPEnterprisePilot="Enterprise+ Pilot",t.VBP2Startup="Startup+",t.VBP2Essentials="Essentials+",t.VBP2Growth="Growth+",t.VBP2Scale="Scale+",t.BasicSubscription="Basic",t.ProfessionalSubscription="Professional",t.EnterpriseSubscription="Enterprise",t.EliteSubscription="Elite",t.PremiumSubscription="Premium (Legacy)",t.VBP2Premium="Premium",t.Default="Default"}(vc||(vc={}));var Ic,Ac=[{id:"PP-587f8f25-b278-4727-b7c4-3ce60e542c8b",name:vc.VBPFree,subscriptionName:"free_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-a5ad2825-8225-4bbe-a868-c1b2a7d2a2e3",name:vc.VBPStarter,subscriptionName:"starter_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-438ccc87-eaff-4180-ad79-f5d3d51e1bc0",name:vc.VBPBasic,subscriptionName:"vbp_basic_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-7201f892-3d44-44b8-b9db-4b23dd34d112",name:vc.VBPProfessional,subscriptionName:"vbp_professional_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-3cc1ec9f-17a8-46c8-9e79-b337e4ea651b",name:vc.VBPEnterprise,subscriptionName:"vbp_enterprise_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-7ffa4745-4ea1-4603-983b-81a1404faa3b",name:vc.VBPEnterprisePilot,subscriptionName:"vbp_enterprise_pilot_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-02895bb5-ff6b-4f37-ae1e-8473b895a59d",name:vc.VBP2Startup,subscriptionName:"vbp2_startup_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-c69f1724-d380-432f-8f50-5778da6ea250",name:vc.VBP2Essentials,subscriptionName:"vbp2_essentials_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-8abe2c53-be4a-43d5-bd2c-a8d9be1c82db",name:vc.VBP2Growth,subscriptionName:"vbp2_growth_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-0a872f89-e582-420a-90b0-c98e19b174a4",name:vc.VBP2Scale,subscriptionName:"vbp2_scale_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-7abd1cb2-317b-40d2-9fdc-d2b365d645b7",name:vc.VBP2Premium,subscriptionName:"vbp2_premium_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-a7eca7c3-84fd-4fc2-86a5-87a743f6c3d1",name:vc.BasicSubscription,subscriptionName:"basic_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-7d0053b8-fab4-407d-ae69-33c67d5314eb",name:vc.ProfessionalSubscription,subscriptionName:"professional_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-e85cdb56-2944-4fe0-9e78-a98520eb1489",name:vc.EnterpriseSubscription,subscriptionName:"enterprise_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-9a0d6430-5e73-41d2-bd3d-dc3645664bb9",name:vc.EliteSubscription,subscriptionName:"elite_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-a03a1c1e-d03e-4c77-8132-34908012a65c",name:vc.PremiumSubscription,subscriptionName:"premium_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-cf943a15-3eea-40cf-8d3e-e7ea5a5a9817",name:vc.Default,subscriptionName:null,defaultStrategy:t.BillingStrategy.Invalid}],yc=[{id:"PP-77912c15-00af-4a56-bfc0-e8e6c27c7a53",name:vc.VBPFree,subscriptionName:"free_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-1cc75309-ddff-4d8b-aedf-88a7472e2b4e",name:vc.VBPStarter,subscriptionName:"starter_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-52f98211-bd1e-4112-88cd-e78040173198",name:vc.VBPBasic,subscriptionName:"vbp_basic_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-c278bcc6-bd5d-43e5-9ff5-a27e70b48ba9",name:vc.VBPProfessional,subscriptionName:"vbp_professional_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-4133fc94-a58a-4fcd-91cd-9ed111182e77",name:vc.VBPEnterprise,subscriptionName:"vbp_enterprise_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-dbbac61e-132f-468f-aa62-7a691b59bb74",name:vc.VBPEnterprisePilot,subscriptionName:"vbp_enterprise_pilot_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-45f8099f-d3f3-4302-83bf-bbf64f431e31",name:vc.VBP2Startup,subscriptionName:"vbp2_startup_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-d44c5a8b-f3b6-4b63-b203-8b7253060984",name:vc.VBP2Essentials,subscriptionName:"vbp2_essentials_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-c1761320-62df-41d7-8df3-008554a4b592",name:vc.VBP2Growth,subscriptionName:"vbp2_growth_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-b6607aae-606f-4fd5-84e4-c48f38b59892",name:vc.VBP2Scale,subscriptionName:"vbp2_scale_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-7375d567-8890-4cb1-930c-5673ea89acba",name:vc.VBP2Premium,subscriptionName:"vbp2_premium_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-38a06671-526b-4d28-b425-bbce3be34699",name:vc.BasicSubscription,subscriptionName:"basic_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-d9717300-f1c3-4471-8433-c3ac7baf003d",name:vc.ProfessionalSubscription,subscriptionName:"professional_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-f6a60130-878b-4a33-9a10-d5bdeac0cdef",name:vc.EnterpriseSubscription,subscriptionName:"enterprise_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-dff68124-2223-4c88-91dc-b638a3135fc5",name:vc.EliteSubscription,subscriptionName:"elite_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-15641015-560e-4cd7-977b-b1fc627b18d1",name:vc.PremiumSubscription,subscriptionName:"premium_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-0e9ac148-a2d0-42d0-9250-8c42189bf432",name:vc.Default,subscriptionName:null,defaultStrategy:t.BillingStrategy.Invalid}],Sc=new Map([[n.Environment.DEMO,hc(Ac,fc)],[n.Environment.PROD,hc(yc,gc)]]),Pc=new Map([[n.Environment.DEMO,hc(Ac)],[n.Environment.PROD,hc(yc)]]),bc=new Map([[n.Environment.DEMO,hc(fc)],[n.Environment.PROD,hc(gc)]]);(Ic=t.PayoutStatusType||(t.PayoutStatusType={}))[Ic.NOT_SET=0]="NOT_SET",Ic[Ic.PAID=1]="PAID",Ic[Ic.PENDING=2]="PENDING",Ic[Ic.IN_TRANSIT=3]="IN_TRANSIT",Ic[Ic.CANCELED=4]="CANCELED",Ic[Ic.FAILED=5]="FAILED";var Tc,Oc=t.PayoutStatusType.NOT_SET,Ec=t.PayoutStatusType.PAID,Rc=t.PayoutStatusType.PENDING,Cc=t.PayoutStatusType.IN_TRANSIT,Dc=t.PayoutStatusType.CANCELED,_c=t.PayoutStatusType.FAILED,Jc=new Map([[t.PayoutStatus.PAYOUT_STATUS_NOT_SET,{id:Oc,value:"Unknown"}],[t.PayoutStatus.PAYOUT_STATUS_PAID,{id:Ec,value:"Paid"}],[t.PayoutStatus.PAYOUT_STATUS_PENDING,{id:Rc,value:"Pending"}],[t.PayoutStatus.PAYOUT_STATUS_IN_TRANSIT,{id:Cc,value:"In Transit"}],[t.PayoutStatus.PAYOUT_STATUS_CANCELED,{id:Dc,value:"Canceled"}],[t.PayoutStatus.PAYOUT_STATUS_FAILED,{id:_c,value:"Failed"}]]);function Nc(t){return Jc.get(t)}(Tc=t.PayoutTypeType||(t.PayoutTypeType={}))[Tc.NOT_SET=0]="NOT_SET",Tc[Tc.BANK_ACCOUNT=1]="BANK_ACCOUNT",Tc[Tc.CARD=2]="CARD";var wc=t.PayoutTypeType.NOT_SET,jc=t.PayoutTypeType.BANK_ACCOUNT,Mc=t.PayoutTypeType.CARD,Uc=new Map([[I.PAYOUT_TYPE_NOT_SET,{id:wc,value:"Unknown"}],[I.PAYOUT_TYPE_BANK_ACCOUNT,{id:jc,value:"Bank Account"}],[I.PAYOUT_TYPE_CARD,{id:Mc,value:"Card"}]]);!function(t){t[t.Ascending=0]="Ascending",t[t.Descending=1]="Descending"}(t.SortDirection||(t.SortDirection={}));var Bc=function(t,e,i){this.results=t,this.nextCursor=e,this.hasMore=i},Lc=function(){function t(t){this.apiService=t}return t.prototype.reconcilePayout=function(t,e){return this.apiService.reconcilePayout(new Ei({payoutId:e,bankReconciliationId:t})).pipe(o.map((function(t){return t?t.pipelineId:""})))},t.prototype.listPayouts=function(t,e,i,n){return this.apiService.listPayouts(new bi({filters:new Pi({arrivalDateRange:new yi({start:t,end:e})}),pagingOptions:new X({cursor:n,pageSize:i})})).pipe(o.map((function(t){if(!t)return new Bc([],"",!1);var e=(t.payouts||[]).map((function(t){return{id:(e=t).id,arrivalDate:e.arrivalDate?new Date(e.arrivalDate):null,amount:e.amount,type:(i=e.type,Uc.get(i)),status:Nc(e.status),currency:qa(e.currency),lastFourDigits:e.lastFourDigits,bankName:e.bankName,bankId:e.bankId};var e,i})),i="",n=!1;return t.pagingMetadata&&(i=t.pagingMetadata.nextCursor,n=t.pagingMetadata.hasMore),new Bc(e,i,n)})))},t}();function kc(t){var e,i=new Date("0001-01-01T00:00:00Z").valueOf();return{merchantId:t.merchantId||"",sku:t.sku||"",productName:t.productName||"",customerId:t.customerId||"",customerName:t.customerName||"",orderId:t.orderId||"",expiry:t.expiry.valueOf()!==i?new Date(t.expiry):null,billingStart:t.billingStart.valueOf()!==i?new Date(t.billingStart):null,created:t.created.valueOf()!==i?new Date(t.created):null,updated:t.updated.valueOf()!==i?new Date(t.updated):null,frequency:Wa(t.frequency),retailFrequency:Wa(t.retailFrequency),nextRenewal:t.nextRenewal.valueOf()!==i?new Date(t.nextRenewal):null,nextRetailRenewal:t.nextRetailRenewal.valueOf()!==i?new Date(t.nextRetailRenewal):null,customerAddress:(e=t.customerAddress,{address:e&&e.address||"",city:e&&e.city||"",state:e&&e.state||"",zip:e&&e.zip||"",country:e&&e.country||""}),customUnitPrice:t.customUnitPrice||0,retailUnitPrice:t.retailUnitPrice||0}}Lc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Lc(e.ɵɵinject(ma))},token:Lc,providedIn:"root"}),Lc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Lc.ctorParameters=function(){return[{type:ma}]};var xc=function(){function t(t,e){this.hostService=t,this.http=e}return t.prototype.exportCSV=function(t){var e=function(t){return{merchantId:t.merchantId,customerId:t.customerId,skus:t.skus}}(t);return this.http.post(this.hostService.httpsHostWithScheme()+"/subscription/export-csv",{filters:e},{observe:"body",responseType:"blob",withCredentials:!0}).pipe(o.share())},t}();xc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new xc(e.ɵɵinject(la),e.ɵɵinject(i.HttpClient))},token:xc,providedIn:"root"}),xc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],xc.ctorParameters=function(){return[{type:la},{type:i.HttpClient}]};var Fc=function(){function t(t){this.environment=t,this.billingHosts=new Map([[n.Environment.LOCAL,"http://localhost:8088"],[n.Environment.DEMO,"https://vbilling-demo.appspot.com"],[n.Environment.PROD,"https://vbilling-prod.appspot.com"]]),this.microserviceHosts=new Map([[n.Environment.DEMO,"https://billing-api-demo.vendasta-internal.com"],[n.Environment.PROD,"https://billing-api-prod.vendasta-internal.com"]])}return Object.defineProperty(t.prototype,"billingHost",{get:function(){return this.env||(this.env=this.environment.getEnvironment()),this.billingHosts.get(this.env)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"microserviceHost",{get:function(){return this.env||(this.env=this.environment.getEnvironment()),this.microserviceHosts.get(this.env)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"constructInvoiceRoute",{get:function(){return this.billingHost+"/internalApi/v1/invoice/construct/"},enumerable:!1,configurable:!0}),t}();function Yc(t){return t.error instanceof ErrorEvent?console.error("An error occurred:",t.error.message):console.error("Server returned "+t.message),r.throwError("Unable to download csv")}function Gc(t){return t.error instanceof ErrorEvent?console.error("An error occurred:",t.error.message):console.error("Server returned "+t.message),r.throwError("Unable to upload file")}Fc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Fc(e.ɵɵinject(n.EnvironmentService))},token:Fc,providedIn:"root"}),Fc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Fc.ctorParameters=function(){return[{type:n.EnvironmentService}]};var qc=function(){function t(t,e){this.hostService=t,this.http=e}return t.prototype.downloadCsv=function(t){var e="?filename="+t.filename;return this.http.get(this.hostService.httpsHostWithScheme()+"/revenue-csv"+e,this.apiOptions()).pipe(o.share(),o.catchError(Yc))},t.prototype.apiOptions=function(){return{responseType:"blob",withCredentials:!0}},t}();qc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new qc(e.ɵɵinject(la),e.ɵɵinject(i.HttpClient))},token:qc,providedIn:"root"}),qc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],qc.ctorParameters=function(){return[{type:la},{type:i.HttpClient}]};var Hc,Wc=function(){function t(t,e){this.hostService=t,this.http=e}return t.prototype.downloadCsv=function(t){var e="?merchantID="+t.merchantId+"&year="+t.year+"&month="+t.month;return this.http.get(this.hostService.httpsHostWithScheme()+"/billing-report/get"+e,this.apiOptions()).pipe(o.share(),o.catchError(Yc))},t.prototype.generateCsv=function(t){var e="?merchantID="+t.merchantId+"&year="+t.year+"&month="+t.month;return this.http.get(this.hostService.httpsHostWithScheme()+"/billing-report/generate"+e,this.apiOptions()).pipe(o.share(),o.catchError(Yc))},t.prototype.apiOptions=function(){return{responseType:"blob",withCredentials:!0}},t}();function Vc(e){switch(e){case t.PurchaseStatusEnum.PURCHASE_STATUS_PENDING:return t.PurchaseStatus.Pending;case t.PurchaseStatusEnum.PURCHASE_STATUS_DUE:return t.PurchaseStatus.Due;case t.PurchaseStatusEnum.PURCHASE_STATUS_SUCCESS:return t.PurchaseStatus.Success;case t.PurchaseStatusEnum.PURCHASE_STATUS_DUNNING:return t.PurchaseStatus.Dunning;case t.PurchaseStatusEnum.PURCHASE_STATUS_FAILED:return t.PurchaseStatus.Failed}return t.PurchaseStatus.Unset}function zc(e){return{merchantId:e.merchantId||"",timestamp:e.timestamp?new Date(e.timestamp):null,purchaseId:e.purchaseId||"",total:e.total||0,currency:e.currency?qa(e.currency):t.Currency.USD,renewal:e.renewal||!1,items:e.items?e.items.map((function(t){return Kc(t)})):[],billingStrategy:Ya(e.billingStrategy),isDunning:e.isDunning||!1,dunningAttempt:e.dunningAttempt||0,voided:e.voided?new Date(e.voided):null,paid:e.paid||!1,status:Vc(e.status),creditAmount:e.creditAmount||0,appliedCredits:e.appliedCredits?e.appliedCredits.map((function(t){return Xc(t)})):[],taxAmount:e.taxAmount||0,appliedTaxRates:(e.appliedTaxRates||[]).map((function(t){return Zc(t)}))}}function Kc(e,i){var n;return void 0!==i&&(n=qa(i)),{sku:e.sku||"",description:e.description||null,amount:e.amount||0,orderId:e.orderId||"",customerId:e.customerId||"",discountAmount:e.discountAmount||0,total:e.total||0,currency:n||t.Currency.USD,appliedDiscounts:e.appliedDiscounts?e.appliedDiscounts.map((function(t){return xa(t)})):[],merchantId:e.merchantId,purchaseDay:e.day,purchaseId:e.purchaseId,taxAmount:e.taxAmount||0,appliedTaxRates:(e.appliedTaxRates||[]).map((function(t){return Zc(t)})),setupFee:e.setupFee||0}}function Xc(t){return{appliedAmount:t.appliedAmount,referenceId:t.referenceId,referenceType:Qc(t.referenceType)}}function Qc(e){switch(e){case j.CREDIT_TYPE_CREDIT_NOTE:return t.AppliedCreditType.CREDIT_TYPE_CREDIT_NOTE;case j.CREDIT_TYPE_PROMOTIONAL:return t.AppliedCreditType.CREDIT_TYPE_PROMOTIONAL}return t.AppliedCreditType.CREDIT_TYPE_UNSET}function Zc(t){return{amount:t.amount||0,name:t.name||"",percentage:t.percentage||0,taxRateId:t.taxRateId||""}}Wc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Wc(e.ɵɵinject(la),e.ɵɵinject(i.HttpClient))},token:Wc,providedIn:"root"}),Wc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Wc.ctorParameters=function(){return[{type:la},{type:i.HttpClient}]},function(t){t.Unset="UNSET",t.Pending="PENDING",t.Due="DUE",t.Success="SUCCESS",t.Dunning="DUNNING",t.Failed="FAILED"}(t.PurchaseStatus||(t.PurchaseStatus={})),(Hc=t.AppliedCreditType||(t.AppliedCreditType={})).CREDIT_TYPE_CREDIT_NOTE="Credit note",Hc.CREDIT_TYPE_PROMOTIONAL="Promotional",Hc.CREDIT_TYPE_UNSET="";var $c=function(t){this.dimensionId=t,this.name=tu[t]||""},tu={existing_enterprise:"Existing Enterprise",new_enterprise:"New Enterprise",agency:"Agency",CP_unassisted:"Channel Partners, Unassisted (PLG)",CP_growth_MT:"Channel Partners, Growth (Medium-Touch)",CP_growth_HT:"Channel Partners, Growth (High-Touch)"},eu=new $c("agency"),iu=new $c("new_enterprise"),nu=new $c("existing_enterprise"),ou=new $c("CP_unassisted"),ru=new $c("CP_growth_MT"),su=new $c("CP_growth_HT");function au(t){return{merchantId:t.merchantId||"",netD:t.netD||0,created:t.created||null,subscriptionId:t.subscriptionId||"",dimension:new $c(t.dimension),currency:qa(t.currency),signed:t.signed||null,end:t.end||null,activated:t.activated||null,modified:t.modified||null,verified:t.verified||null,status:t.status||"",creditLimit:t.creditLimit||0,pricingPlanId:t.pricingPlanId||""}}var cu=function(){function t(t){this.api=t}return t.prototype.get=function(t){return this.api.get({merchantId:t}).pipe(o.map((function(t){return au(t.contract)})))},t.prototype.update=function(t,e){return this.api.update({merchantId:t,mutations:e}).pipe(o.map((function(t){return au(t.contract)})))},t}();cu.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new cu(e.ɵɵinject(Ia))},token:cu,providedIn:"root"}),cu.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],cu.ctorParameters=function(){return[{type:Ia}]};var uu;function pu(t){return{name:t.name||"",sku:t.sku||"",iconUrl:t.iconUrl||"",hasPricingOverride:t.hasPricingOverride||!1,hasDiscount:t.hasDiscount||!1}}function du(t){return Object.assign(Object.assign({},t),{productType:(t.productType||[]).map((function(t){return function(t){switch(t){case uu.Standard:return w.PRODUCT_TYPE_STANDARD_PRODUCT;case uu.Vendasta:return w.PRODUCT_TYPE_VENDASTA_PRODUCT;case uu.Subscription:return w.PRODUCT_TYPE_SUBSCRIPTION;case uu.Fee:return w.PRODUCT_TYPE_FEE;case uu.PartnerSupportSales:return w.PRODUCT_TYPE_PARTNER_SUPPORT_SALES}return w.PRODUCT_TYPE_INVALID}(t)}))})}!function(t){t[t.Invalid=0]="Invalid",t[t.Standard=1]="Standard",t[t.Vendasta=2]="Vendasta",t[t.Subscription=3]="Subscription",t[t.Fee=4]="Fee",t[t.PartnerSupportSales=5]="PartnerSupportSales"}(uu||(uu={}));var hu=function(){function e(t,e,i,n,o,r){this.billingApi=t,this.revenueApi=e,this.merchantReportApi=i,this.pricingApi=n,this.purchaseApi=o,this.vendorApi=r}return e.prototype.getPurchaseCost=function(t,e,i){var n=new Ks({merchantId:t,sku:e,quantity:i});return this.billingApi.getPurchaseCost(n).pipe(o.map((function(t){return t.currency||(t.currency=u.USD),t})))},e.prototype.canCreateSubscriptions=function(t,e){var i=new wr({merchantId:t,skus:e});return this.billingApi.canCreateSubscriptions(i)},e.prototype.canCreateSubscriptionsWithFrequencies=function(t,e){var i=new wr({merchantId:t,items:e&&e.map((function(t){return t?{sku:t.sku,frequency:Va(t.frequency),quantity:t.quantity||0}:null}))});return this.billingApi.canCreateSubscriptions(i)},e.prototype.downloadRevenueCsv=function(t){return this.revenueApi.downloadCsv({filename:t})},e.prototype.downloadBillingReportCsv=function(t,e,i){return this.merchantReportApi.downloadCsv({merchantId:t,year:e,month:i})},e.prototype.generateBillingReportCsv=function(t,e,i){return this.merchantReportApi.generateCsv({merchantId:t,year:e,month:i})},e.prototype.listMerchantBillingReports=function(t,e,i){var n=new dn({merchantId:t,pagingOptions:new X({cursor:e,pageSize:i})});return this.billingApi.listMerchantBillingReports(n).pipe(o.map((function(t){var e=(t.reports||[]).map((function(t){return{merchantId:t.merchantId,year:t.year,month:t.month,created:t.created,status:P[t.status||0]}}));return new Bc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},e.prototype.canBillCreateSnapshot=function(t){return this.billingApi.canBillItem({merchantId:t,sku:"ST"})},e.prototype.canBillRefreshSnapshot=function(t){return this.billingApi.canBillItem({merchantId:t,sku:"snapshotreportrefresh"})},e.prototype.canBillItem=function(t,e){return this.billingApi.canBillItem({merchantId:t,sku:e}).pipe(o.map((function(t){return t.ok})))},e.prototype.createPricingPlanProduct=function(t,e,i,n,r,s,a){var c=new bo({pricingPlanId:t,sku:e,volumeCommitment:a});return c.frequency=Va(i),c.pricing=ic(n),c.commitment=new Dt(r),c.strategy=Ga(s),this.billingApi.createPricingPlanProduct(c).pipe(o.mapTo(!0))},e.prototype.updatePricingPlanProduct=function(t,e,i){var n=i.frequency,r=i.pricing,s=i.commitment,a=i.strategy,c=i.volumeCommitment,u=new Te({paths:[]}),p=new jo({pricingPlanId:t,sku:e});return null!==n&&(p.frequency=Va(n),u.paths.push("frequency")),null!==r&&(p.pricing=ic(r),u.paths.push("pricing")),null!==s&&(p.commitment=new Dt(s),u.paths.push("commitment")),null!==a&&(p.strategy=Ga(a),u.paths.push("strategy")),null!==c&&(p.volumeCommitment=c,u.paths.push("volumeCommitment")),this.billingApi.updatePricingPlanProduct(p).pipe(o.mapTo(!0))},e.prototype.deletePricingPlanProduct=function(t,e){var i=new Oo({pricingPlanId:t,sku:e});return this.billingApi.deletePricingPlanProduct(i).pipe(o.mapTo(!0))},e.prototype.getMultiProductPricing=function(t,e,i){return this.billingApi.getMultiProductPricing({merchantId:t,skus:e,pricingPlanId:i}).pipe(o.map((function(t){var e,i,n=t.productPrices||{},o={};try{for(var r=pc(Object.keys(n)),s=r.next();!s.done;s=r.next()){var a=s.value,c=n[a];o[a]=$a(c)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(e)throw e.error}}return o})))},e.prototype.getMultiRetailPricing=function(t,e,i,n){var r=void 0===n?"":n;return this.pricingApi.getMultiRetail({merchantId:t,currency:e,skus:i,groupId:r}).pipe(o.map((function(t){var e,i,n=t.productPrices||{},o={};try{for(var r=pc(Object.keys(n)),s=r.next();!s.done;s=r.next()){var a=s.value,c=n[a];o[a]=$a(c)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(e)throw e.error}}return o})))},e.prototype.listPricingPlanProducts=function(t,e,i){var n=new Jo({filters:t,pagingOptions:new X({cursor:e,pageSize:i})});return this.billingApi.listPricingPlanProducts(n).pipe(o.map((function(t){var e=(t.products||[]).map((function(t){return ec(t)}));return new Bc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},e.prototype.getPricingPlanProduct=function(t,e){var i=new Co({pricingPlanId:t,sku:e});return this.billingApi.getPricingPlanProduct(i).pipe(o.map((function(t){var e=ec(t.pricingPlanProduct);return e.defaultStrategy=Ya(t.pricingPlanDefaultStrategy),e})))},e.prototype.listPurchases=function(t,e,i){var n=new nr({filters:t,pagingOptions:new X({cursor:e,pageSize:i})});return this.purchaseApi.list(n).pipe(o.map((function(t){var e=(t.purchases||[]).map((function(t){return zc(t)}));return new Bc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},e.prototype.voidPurchase=function(t,e,i){var n=new cr({purchaseId:e,merchantId:t,day:i});return this.purchaseApi.void(n).pipe(o.mapTo(!0))},e.prototype.listPurchaseItems=function(t,e,i){var n=new nr({filters:t,pagingOptions:new X({cursor:e,pageSize:i})});return this.purchaseApi.listPurchaseItems(n).pipe(o.map((function(t){var e=(t.purchaseItems||[]).map((function(e){return Kc(e,t.currency)}));return new Bc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},e.prototype.retryPurchase=function(t,e,i){var n=new ar({merchantId:t,day:e,purchaseId:i});return this.purchaseApi.retry(n).pipe(o.map((function(){return!0})))},e.prototype.getMultiCustomerSummaries=function(e,i,n,r){var s=new Wt({customerIds:i,merchantId:e,periodStart:n,periodEnd:r});return this.purchaseApi.getMultiCustomerSummaries(s).pipe(o.map((function(e){return(e.customerSummaries||[]).map((function(e){return void 0!==(i=e).currency&&(n=qa(i.currency)),{customerId:i.customerId||"",purchaseItemQuantity:i.purchaseItemQuantity||0,purchaseItemTotal:i.purchaseItemTotal||0,currency:n||t.Currency.USD};var i,n}))})))},e.prototype.getMultiContract=function(t){return this.billingApi.getMultiContract({merchantIds:t}).pipe(o.map((function(t){var e,i,n=t.contracts||{},o={};try{for(var r=pc(Object.keys(n)),s=r.next();!s.done;s=r.next()){var a=s.value,c=n[a];o[a]=au(c)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(e)throw e.error}}return o})))},e.prototype.generateVendorReport=function(t,e,i,n,r){var s=new Fs({skus:t,periodStart:e,periodEnd:i,vendorName:n,markAsApproved:r});return this.vendorApi.generateReport(s).pipe(o.map((function(t){return t.url})))},e.prototype.getVendorStats=function(t,e,i){var n=new Qs({skus:t,periodStart:e,periodEnd:i});return this.vendorApi.getRevenueStats(n).pipe(o.map((function(t){return t.totalRevenue||0})))},e.prototype.listContracts=function(t,e){var i=new Lt({pagingOptions:new X({cursor:t,pageSize:e})});return this.billingApi.listContracts(i).pipe(o.map((function(t){var e=(t.contracts||[]).map((function(t){return au(t)}));return new Bc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},e.prototype.listProducts=function(t,e,i,n,r){var s=du(i),a=new Go({merchantId:t,searchTerm:e,filters:s,pagingOptions:new X({cursor:n,pageSize:r})});return this.billingApi.listProducts(a).pipe(o.map((function(t){var e=(t.products||[]).map((function(t){return pu(t)}));return new Bc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},e.prototype.getMultiProduct=function(t){var e=new xo({skus:t});return this.billingApi.getMultiProduct(e).pipe(o.map((function(e){var i=new Map;return t.forEach((function(t){i[t]=pu(e.products[t])})),i})))},e.prototype.getBillableItem=function(t,e,i,n){var r=new ct({merchantId:t,sku:e,customerId:i,orderId:n});return this.billingApi.getBillableItem(r).pipe(o.map((function(t){return kc(t.item)})))},e.prototype.changeBillableItemFrequency=function(t,e,i,n,o){var r=new Ur({merchantId:t,sku:e,customerId:i,orderId:n,frequency:Va(o)});return this.billingApi.changeFrequency(r)},e.prototype.changeBillableItemNextRenewalDate=function(t,e,i,n,o){var r=new Br({merchantId:t,sku:e,customerId:i,orderId:n,nextRenewalDate:o});return this.billingApi.changeRenewalDate(r)},e.prototype.changeBillableItemCustomUnitPrice=function(t,e,i,n,o){var r=new Mr({merchantId:t,sku:e,customerId:i,orderId:n,customUnitPrice:o});return this.billingApi.changeCustomUnitPrice(r)},e.prototype.listBillableItems=function(t,e,i,n){var r=new mt({searchTerm:t,filters:e,pagingOptions:new X({cursor:i,pageSize:n})});return this.billingApi.listBillableItems(r).pipe(o.map((function(t){var e=(t.items||[]).map((function(t){return kc(t)}));return new Bc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},e.prototype.startRevRecBackfillWorkflow=function(){return this.billingApi.startRevRecTemplateBackfill({})},e}();function lu(e){switch(e){case c.DISCOUNT_TYPE_FIXED_AMOUNT_PER_UNIT:return t.DiscountType.FIXED_AMOUNT_PER_UNIT;case c.DISCOUNT_TYPE_FIXED_NUMBER_OF_UNITS:return t.DiscountType.FIXED_NUMBER_OF_UNITS;case c.DISCOUNT_TYPE_PERCENT_AMOUNT:return t.DiscountType.PERCENT_AMOUNT}return t.DiscountType.FIXED_AMOUNT}function mu(e){switch(e){case t.DiscountType.FIXED_AMOUNT_PER_UNIT:return c.DISCOUNT_TYPE_FIXED_AMOUNT_PER_UNIT;case t.DiscountType.FIXED_NUMBER_OF_UNITS:return c.DISCOUNT_TYPE_FIXED_NUMBER_OF_UNITS;case t.DiscountType.PERCENT_AMOUNT:return c.DISCOUNT_TYPE_PERCENT_AMOUNT}return c.DISCOUNT_TYPE_FIXED_AMOUNT}function vu(t){if(!t)return null;var e=(t.items||[]).map((function(t){return{productId:(e=t).productId,discountType:lu(e.discountType),discountAmount:e.discountAmount,quantity:e.quantity,defaultSku:e.defaultSku,price:e.price};var e}));return{merchantId:t.merchantId,bundleId:t.bundleId,name:t.name,hideBundleDetails:t.hideBundleDetails,items:e,created:t.created,updated:t.updated}}hu.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new hu(e.ɵɵinject(va),e.ɵɵinject(qc),e.ɵɵinject(Wc),e.ɵɵinject(Ea),e.ɵɵinject(Da),e.ɵɵinject(Ba))},token:hu,providedIn:"root"}),hu.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],hu.ctorParameters=function(){return[{type:va},{type:qc},{type:Wc},{type:Ea},{type:Da},{type:Ba}]},function(t){t.FIXED_AMOUNT="FIXED_AMOUNT",t.PERCENT_AMOUNT="PERCENT_AMOUNT",t.FIXED_NUMBER_OF_UNITS="FIXED_NUMBER_OF_UNITS",t.FIXED_AMOUNT_PER_UNIT="FIXED_AMOUNT_PER_UNIT"}(t.DiscountType||(t.DiscountType={}));var fu=function(){function t(t){this.bundleApiService=t}return t.prototype.upsert=function(t,e,i,n,r){var s=new Ct({merchantId:t,bundleId:e,name:i,hideBundleDetails:n,items:(r||[]).map((function(t){return{productId:(e=t).productId,discountType:mu(e.discountType),discountAmount:e.discountAmount,quantity:e.quantity,defaultSku:e.defaultSku,price:e.price};var e}))});return this.bundleApiService.upsert(s).pipe(o.mapTo(!0))},t.prototype.getMulti=function(t,e){var i=new Pt({merchantId:t,bundleIds:e});return this.bundleApiService.getMulti(i).pipe(o.map((function(t){var i=new Map;return t&&t.bundles&&e.forEach((function(e){i.set(e,vu(t.bundles[e]))})),i})))},t.prototype.list=function(t,e,i,n){var r=new Tt({filters:t,searchTerm:e,pagingOptions:new X({cursor:i,pageSize:n})});return this.bundleApiService.list(r).pipe(o.map((function(t){var e=(t.bundles||[]).map((function(t){return vu(t)}));return new Bc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t}();fu.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new fu(e.ɵɵinject(fa))},token:fu,providedIn:"root"}),fu.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],fu.ctorParameters=function(){return[{type:fa}]};var gu=function(){function t(t,e,i){this.contractDocumentApi=t,this.hostService=e,this.http=i}return t.prototype.upload=function(t,e){var n=this.hostService.httpsHostWithScheme()+"/contract-document/upload";return this.http.post(n,e,{headers:new i.HttpHeaders({"Content-Type":"application/pdf","Content-Disposition":"attachment; filename="+e.name}),observe:"body",responseType:"blob",withCredentials:!0,params:{merchantId:t}}).pipe(o.share(),o.mapTo(!0))},t.prototype.list=function(t,e,i){var n=new Kr({filters:t,pagingOptions:new X({cursor:e,pageSize:i})});return this.contractDocumentApi.list(n).pipe(o.map((function(t){var e=(t.contractDocuments||[]).map((function(t){return{id:(e=t).id||"",merchantId:e.merchantId||"",filename:e.filename||"",created:e.created||null};var e}));return new Bc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.download=function(t,e,i){var n={merchant_id:t,id:e,filename:i};return this.http.get(this.hostService.httpsHostWithScheme()+"/contract-document/download",{observe:"body",params:n,responseType:"blob",withCredentials:!0}).pipe(o.share())},t.prototype.delete=function(t,e){var i=new Vr({merchantId:t,id:e});return this.contractDocumentApi.delete(i).pipe(o.mapTo(!0))},t}();gu.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new gu(e.ɵɵinject(ga),e.ɵɵinject(la),e.ɵɵinject(i.HttpClient))},token:gu,providedIn:"root"}),gu.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],gu.ctorParameters=function(){return[{type:ga},{type:la},{type:i.HttpClient}]};var Iu=function(){function t(t){this.creditApi=t}return t.prototype.getBalance=function(t){return this.creditApi.getBalance(new ns({merchantId:t})).pipe(o.map((function(t){return{merchantId:(e=t.creditBalance).merchantId||"",currency:e.currency||"",amount:e.amount||0};var e})))},t.prototype.add=function(t,e,i,n,r){return this.creditApi.add(new es({merchantId:t,currency:e,amount:i,idempotencyKey:n,reason:r})).pipe(o.map((function(){return null})))},t}();Iu.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Iu(e.ɵɵinject(Aa))},token:Iu,providedIn:"root"}),Iu.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Iu.ctorParameters=function(){return[{type:Aa}]};var Au=function(){function t(t){this.discountApi=t}return t.prototype.list=function(t,e,i){var n=new ye({filters:t,pagingOptions:new X({cursor:e,pageSize:i})});return this.discountApi.list(n).pipe(o.map((function(t){var e=(t.discounts||[]).map((function(t){return{merchantId:(e=t).merchantId||"",discountId:e.discountId||0,id:e.id||"",discountType:lu(e.discountType),amount:e.amount||0,start:e.start?new Date(e.start):null,end:e.end?new Date(e.end):null,resetEachPeriod:e.resetEachPeriod||!1,created:e.created?new Date(e.created):null,updated:e.updated?new Date(e.updated):null,SKU:e.sku||"",description:e.description||""};var e}));return new Bc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.create=function(t,e,i,n,o,r,s,a){var c,u;c=new Date(o),u=mu(i);var p=new fe({merchantId:t,sku:e,discountType:u,amount:n,start:c,resetEachPeriod:s,description:a});return r&&""!==r&&(p.end=new Date(r)),this.discountApi.create(p)},t.prototype.update=function(t,e,i,n,o,r,s,a){var c,u;c=new Date(o),u=mu(i);var p=new Pe({merchantId:t,id:e,discountType:u,amount:n,start:c,resetEachPeriod:s,description:a});return r&&""!==r&&(p.end=new Date(r)),this.discountApi.update(p)},t.prototype.expire=function(t,e){return this.discountApi.expire(new Ie({merchantId:t,id:e}))},t}();function yu(e){switch(e){case t.CollectionMethod.MANUAL_COLLECTION:return"manual-collection";case t.CollectionMethod.CHARGE_AUTOMATICALLY:return"charge-automatically";case t.CollectionMethod.SEND_EMAIL:return"send-email";default:return""}}function Su(e){switch(e){case"manual-collection":return t.CollectionMethod.MANUAL_COLLECTION;case"charge-automatically":return t.CollectionMethod.CHARGE_AUTOMATICALLY;case"send-email":return t.CollectionMethod.SEND_EMAIL;default:return t.CollectionMethod.UNSET}}function Pu(t){return{merchantId:t.merchantId||"",customerId:t.customerId||"",contactId:t.contactId||"",autoPost:t.autoPost||!1,autoGenerate:t.autoGenerate||!1,useTemplateInvoice:t.useTemplateInvoice||!1,collectionMethod:Su(t.collectionMethod),invoiceDay:t.invoiceDay||0}}Au.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Au(e.ɵɵinject(ya))},token:Au,providedIn:"root"}),Au.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Au.ctorParameters=function(){return[{type:ya}]},function(t){t.UNSET="Unset",t.MANUAL_COLLECTION="Manual Collection",t.CHARGE_AUTOMATICALLY="Charge Automatically",t.SEND_EMAIL="Send Email"}(t.CollectionMethod||(t.CollectionMethod={}));var bu,Tu=function(){function t(t){this.configApiService=t}return t.prototype.get=function(t,e){var i=new Qr({merchantId:t,customerId:e});return this.configApiService.get(i).pipe(o.map((function(t){return Pu(t.configuration)})))},t.prototype.upsert=function(t,e,i,n,r,s,a,c){var u=new ts({merchantId:t,customerId:e,contactId:i,autoPost:n,autoGenerate:r,collectionMethod:yu(s),invoiceDay:a,useTemplateInvoice:c});return this.configApiService.upsert(u).pipe(o.mapTo(null))},t}();function Ou(e){switch(e){case f.DUE:return t.InvoiceStatus.DUE;case f.PAID:return t.InvoiceStatus.PAID;case f.VOID:return t.InvoiceStatus.VOID;default:return t.InvoiceStatus.DRAFT}}function Eu(e){switch(e){case"manual":return t.InvoiceOrigin.MANUAL;case"sales-order":return t.InvoiceOrigin.SALES_ORDER;case"renewal":return t.InvoiceOrigin.RENEWAL;default:return t.InvoiceOrigin.UNSET}}function Ru(t){return t?{amount:t.amount||0,taxRateId:t.taxRateId||"",percentage:t.percentage||0,name:t.name||""}:null}function Cu(t){return t?{id:t.id||"",name:t.name||"",description:t.description||"",percentage:t.percentage||0}:null}function Du(t){if(!t)return null;var e,i=new Date("0001-01-01T00:00:00Z").valueOf(),n=(t.items||[]).map((function(t){return function(t){if(!t)return null;var e=(t.appliedTaxes||[]).map((function(t){return Ru(t)})),i=(t.taxRates||[]).map((function(t){return Cu(t)})),n=(t.discounts||[]).map((function(t){return xa(t)}));return{id:t.id||"",sku:t.sku||"",amount:t.amount||0,quantity:t.quantity||0,description:t.description||"",subtotal:t.subtotal||0,total:t.total||0,appliedDiscounts:n||[],appliedTaxes:e||[],taxRates:i||[],bundleId:t.bundleId||"",bundleInstanceId:t.bundleInstanceId||""}}(t)})),o=(t.appliedTaxes||[]).map((function(t){return Ru(t)})),r=(t.defaultTaxRates||[]).map((function(t){return Cu(t)})),a=(t.appliedBundles||[]).map((function(t){return s(t)}));return{id:t.id||"",number:t.number||"",customerId:t.customerId||"",customerName:t.customerName||"",contactId:t.contactId||"",status:Ou(t.status),subtotal:t.subtotal||0,total:t.total||0,discountTotal:t.amountDiscount||0,paid:t.paid.valueOf()!==i?t.paid:null,issued:t.issued.valueOf()!==i?t.issued:null,due:t.due.valueOf()!==i?t.due:null,created:t.created.valueOf()!==i?t.created:null,updated:t.updated.valueOf()!==i?t.updated:null,items:n||[],currency:qa(t.currency),orderId:t.orderId||"",appliedTaxes:o||[],defaultTaxRates:r||[],appliedBundles:a||[],origin:Eu(t.origin),collectionMethod:Su(t.collectionMethod),memo:t.memo||"",defaultPaymentMethod:t.defaultPaymentMethod||"",customerAddress:(e=t.customerAddress,{address:(null==e?void 0:e.address)||"",address2:(null==e?void 0:e.address2)||"",city:(null==e?void 0:e.city)||"",state:(null==e?void 0:e.state)||"",zip:(null==e?void 0:e.zip)||"",country:(null==e?void 0:e.country)||""}),externalCustomerIdentifier:t.externalCustomerIdentifier||""}}function _u(e){var i,n,o;return new $e(Object.assign(Object.assign({},e),{statuses:(e.statuses||[]).map((function(e){return function(e){switch(e){case t.InvoiceStatus.DUE:return f.DUE;case t.InvoiceStatus.PAID:return f.PAID;case t.InvoiceStatus.VOID:return f.VOID;default:return f.DRAFT}}(e)})),dateFilter:{dateGte:null===(i=e.dateFilter)||void 0===i?void 0:i.dateGte,dateLte:null===(n=e.dateFilter)||void 0===n?void 0:n.dateLte,dateField:(null===(o=e.dateFilter)||void 0===o||o.dateField,v.CREATED)}}))}Tu.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Tu(e.ɵɵinject(Na))},token:Tu,providedIn:"root"}),Tu.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Tu.ctorParameters=function(){return[{type:Na}]},function(t){t.DRAFT="Draft",t.DUE="Due",t.PAID="Paid",t.VOID="Void"}(t.InvoiceStatus||(t.InvoiceStatus={})),(t.InvoiceDateField||(t.InvoiceDateField={})).CREATED="Created",(bu=t.InvoiceOrigin||(t.InvoiceOrigin={})).MANUAL="Manual",bu.SALES_ORDER="Sales Order",bu.RENEWAL="Renewal",bu.UNSET="Unset";var Ju=function(){function t(t,e,i){this.hostService=t,this.http=e,this.invoiceApiService=i}return t.prototype.addBundle=function(t,e,i){return this.invoiceApiService.addBundle(new ke({merchantId:t,invoiceId:e,bundleId:i})).pipe(o.map((function(t){return Du(t.invoice)})))},t.prototype.addLineItem=function(t,e,i,n,r,s,a){return this.invoiceApiService.addLineItem(new Fe({merchantId:t,invoiceId:e,sku:i,amount:n,quantity:r,description:s,taxRates:a})).pipe(o.map((function(t){return Du(t.invoice)})))},t.prototype.charge=function(t,e,i,n){return this.invoiceApiService.charge(new Ge({merchantId:t,customerId:e,invoiceId:i,paymentMethodId:n}))},t.prototype.create=function(t,e,i,n){return this.invoiceApiService.create(new qe({merchantId:t,customerId:e,orderId:i,currencyCode:n})).pipe(o.map((function(t){return t?t.invoiceId:""})))},t.prototype.delete=function(t,e){return this.invoiceApiService.delete(new ze({merchantId:t,invoiceId:e}))},t.prototype.deleteLineItem=function(t,e,i){return this.invoiceApiService.deleteLineItem(new Ke({merchantId:t,invoiceId:e,id:i})).pipe(o.map((function(t){return Du(t.invoice)})))},t.prototype.exportCSV=function(t,e){var i=this.hostService.httpsHostWithScheme()+"/invoice/export";return this.http.post(i,{merchant_id:t,filters:e},{observe:"body",responseType:"blob",withCredentials:!0}).pipe(o.share())},t.prototype.generatePDF=function(t,e,i){var n=this.hostService.httpsHostWithScheme()+"/invoice/generate-pdf";return this.http.post(n,{merchant_id:t,invoice_id:e,document_type:i},{observe:"body",responseType:"blob"}).pipe(o.share())},t.prototype.get=function(t,e){return this.invoiceApiService.get(new ti({merchantId:t,invoiceId:e})).pipe(o.map((function(t){return Du(t.invoice)})))},t.prototype.list=function(t,e,i){var n=new oi({filters:_u(t),pagingOptions:new X({cursor:e,pageSize:i})});return this.invoiceApiService.list(n).pipe(o.map((function(t){var e=(t.invoices||[]).map((function(t){return Du(t)}));return new Bc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.pay=function(t,e){return this.invoiceApiService.pay(new si({merchantId:t,invoiceId:e}))},t.prototype.preview=function(t,e){var i=this.hostService.httpsHostWithScheme()+"/retail-invoice/preview";return this.http.post(i,{merchant_id:t,invoice_id:e},{responseType:"text",withCredentials:!0})},t.prototype.removeBundle=function(t,e,i,n){return this.invoiceApiService.removeBundle(new ai({merchantId:t,invoiceId:e,bundleId:i,bundleInstanceId:n})).pipe(o.map((function(t){return Du(t.invoice)})))},t.prototype.send=function(t,e,i){return this.invoiceApiService.send(new ui({merchantId:t,invoiceId:e,emailAddresses:i}))},t.prototype.updateBundle=function(t,e,i,n,r){return this.invoiceApiService.updateBundle(new pi({merchantId:t,invoiceId:e,bundleId:i,hideBundleItems:n,bundleInstanceId:r})).pipe(o.map((function(t){return Du(t.invoice)})))},t.prototype.updateCurrency=function(t,e,i){var n=new ii({merchantId:t,id:e,currency:qa(i)}),o=new Te({paths:["currency"]});return this.update(n,o)},t.prototype.updateDueDate=function(t,e,i){var n=new ii({merchantId:t,id:e,due:i}),o=new Te({paths:["due"]});return this.update(n,o)},t.prototype.updateContact=function(t,e,i){var n=new ii({merchantId:t,id:e,contactId:i}),o=new Te({paths:["contactId"]});return this.update(n,o)},t.prototype.updateCollectionMethod=function(t,e,i){var n=yu(i),o=new ii({merchantId:t,id:e,collectionMethod:n}),r=new Te({paths:["collectionMethod"]});return this.update(o,r)},t.prototype.updateMemo=function(t,e,i){var n=new ii({merchantId:t,id:e,memo:i}),o=new Te({paths:["memo"]});return this.update(n,o)},t.prototype.updateDefaultPaymentMethod=function(t,e,i){var n=new ii({merchantId:t,id:e,defaultPaymentMethod:i}),o=new Te({paths:["defaultPaymentMethod"]});return this.update(n,o)},t.prototype.updateDefaultTaxes=function(t,e,i){return this.invoiceApiService.updateDefaultTaxRates(new hi({merchantId:t,invoiceId:e,taxRateIds:i})).pipe(o.map((function(t){return Du(t.invoice)})))},t.prototype.updateLineItem=function(t,e,i,n,r,s,a,c){return this.invoiceApiService.updateLineItem(new fi({merchantId:t,invoiceId:e,id:i,sku:n,amount:r,quantity:s,description:a,taxRates:c})).pipe(o.map((function(t){return Du(t.invoice)})))},t.prototype.update=function(t,e){return this.invoiceApiService.update(new mi({invoice:t,fieldMask:e})).pipe(o.map((function(t){return Du(t.invoice)})))},t.prototype.void=function(t,e){return this.invoiceApiService.void(new Ii({merchantId:t,invoiceId:e}))},t.prototype.duplicate=function(t,e){return this.invoiceApiService.duplicate(new Qe({merchantId:t,invoiceId:e})).pipe(o.map((function(t){return t?t.invoiceId:""})))},t}();function Nu(t){var e=new Date("0001-01-01T00:00:00Z").valueOf(),i=((null==t?void 0:t.appliedBundles)||[]).map((function(t){return s(t)}));return{merchantId:t.merchantId,customerId:t.customerId,currency:qa(t.currency),items:(t.items||[]).map((function(t){return function(t){var e=((null==t?void 0:t.discounts)||[]).map((function(t){return xa(t)}));return{sku:null==t?void 0:t.sku,unitPrice:(null==t?void 0:t.unitPrice)||0,quantity:(null==t?void 0:t.quantity)||0,description:null==t?void 0:t.description,total:(null==t?void 0:t.total)||0,appliedTaxes:(null==t?void 0:t.appliedTaxes)||[],taxRates:(null==t?void 0:t.taxRates)||[],subtotal:(null==t?void 0:t.subtotal)||0,bundleId:(null==t?void 0:t.bundleId)||"",appliedDiscounts:e||[]}}(t)})),appliedTaxes:(t.appliedTaxes||[]).map((function(t){return Ru(t)})),total:t.total||0,subtotal:t.subtotal||0,created:t.created.valueOf()!==e?t.created:null,updated:t.updated.valueOf()!==e?t.updated:null,defaultTaxRates:(t.defaultTaxRates||[]).map((function(t){return Cu(t)})),appliedBundles:i||[],discountTotal:t.amountDiscount||0}}Ju.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Ju(e.ɵɵinject(la),e.ɵɵinject(i.HttpClient),e.ɵɵinject(Sa))},token:Ju,providedIn:"root"}),Ju.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Ju.ctorParameters=function(){return[{type:la},{type:i.HttpClient},{type:Sa}]};var wu,ju,Mu,Uu=function(){function t(t){this.invoiceTemplateApiService=t}return t.prototype.upsert=function(t,e,i,n){var r=(i||[]).map((function(t){var e=(t.appliedDiscounts||[]).map((function(t){return function(t){return{type:ka(t.type),value:t.value||0,totalAmount:t.totalAmount||0,description:t.description||""}}(t)}));return new Is({sku:t.sku,unitPrice:t.unitPrice,quantity:t.quantity,description:t.description,taxRates:(t.taxRates||[]).map((function(t){return t.id})),bundleId:t.bundleId,appliedDiscounts:e})})),s=new Os({merchantId:t,customerId:e,items:r||[],defaultTaxRates:n});return this.invoiceTemplateApiService.upsert(s).pipe(o.map((function(t){return Nu(null==t?void 0:t.invoiceTemplate)})))},t.prototype.get=function(t,e){var i=new ms({merchantId:t,customerId:e});return this.invoiceTemplateApiService.get(i).pipe(o.map((function(t){return Nu(null==t?void 0:t.invoiceTemplate)})))},t.prototype.delete=function(t,e){var i=new ds({merchantId:t,customerId:e});return this.invoiceTemplateApiService.delete(i)},t.prototype.updateDefaultTaxRates=function(t,e,i){var n=new Ss({customerId:e,merchantId:t,taxRateIds:i});return this.invoiceTemplateApiService.updateTemplateDefaultTaxRates(n).pipe(o.map((function(t){return Nu(null==t?void 0:t.invoiceTemplate)})))},t.prototype.addBundle=function(t,e,i){return this.invoiceTemplateApiService.addBundle(new rs({merchantId:t,customerId:e,bundleId:i})).pipe(o.map((function(t){return Nu(null==t?void 0:t.invoiceTemplate)})))},t.prototype.updateBundle=function(t,e,i,n){return this.invoiceTemplateApiService.updateBundle(new As({merchantId:t,customerId:e,bundleId:i,hideBundleItems:n})).pipe(o.map((function(t){return Nu(null==t?void 0:t.invoiceTemplate)})))},t}();function Bu(t){return{merchantId:t.merchantId,address:t.address,city:t.city,state:t.state,country:t.country,zipCode:t.zipCode,emailAddress:t.emailAddress,phoneNumber:t.phoneNumber,contactName:t.contactName,companyName:t.companyName,autoPostInvoices:t.autoPostInvoices,autoChargeInvoices:t.autoChargeInvoices,includeInFinancialRecords:t.includeInFinancialRecords,additionalEmailAddresses:t.additionalEmailAddresses||[],stripeConnectId:t.stripeAccountId}}function Lu(e){switch(e){case"daily":return t.PayoutInterval.Daily;case"weekly":return t.PayoutInterval.Weekly;case"monthly":return t.PayoutInterval.Monthly}return null}function ku(e){switch(e){case t.GenerateMethod.SUBSCRIPTION:return"subscription";case t.GenerateMethod.TEMPLATE:return"template";default:return""}}function xu(e){switch(e){case"subscription":return t.GenerateMethod.SUBSCRIPTION;case"template":return t.GenerateMethod.TEMPLATE;default:return t.GenerateMethod.UNSET}}function Fu(t){return t?{generateMethod:xu(t.generateMethod),collectionMethod:Su(t.collectionMethod),invoiceDay:t.invoiceDay}:null}Uu.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Uu(e.ɵɵinject(Pa))},token:Uu,providedIn:"root"}),Uu.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Uu.ctorParameters=function(){return[{type:Pa}]},(wu=t.PayoutInterval||(t.PayoutInterval={})).Daily="daily",wu.Weekly="weekly",wu.Monthly="monthly",(ju=t.GenerateMethod||(t.GenerateMethod={})).UNSET="Unset",ju.SUBSCRIPTION="Subscription",ju.TEMPLATE="Template",(Mu=t.SortMerchantsBy||(t.SortMerchantsBy={}))[Mu.merchantId=0]="merchantId",Mu[Mu.companyName=1]="companyName",Mu[Mu.contactName=2]="contactName",Mu[Mu.emailAddress=3]="emailAddress",Mu[Mu.country=4]="country",Mu[Mu.state=5]="state",Mu[Mu.created=6]="created",Mu[Mu.updated=7]="updated";var Yu=function(){function t(t,e,i){this.merchantApi=t,this.hostService=e,this.http=i}return t.prototype.get=function(t){var e=new Mi({merchantId:t});return this.merchantApi.get(e).pipe(o.map((function(t){return Bu(t.merchant)})))},t.prototype.create=function(t,e,i,n,r,s,a,c,u,p,d){return this.merchantApi.create({merchantId:t,address:e,city:i,state:n,country:r,zipCode:s,emailAddress:a,phoneNumber:c,contactName:u,companyName:p,additionalEmailAddresses:d}).pipe(o.mapTo(!0))},t.prototype.update=function(t,e,i,n,r,s,a,c,u,p,d){return this.merchantApi.update({merchantId:t,address:e,city:i,state:n,country:r,zipCode:s,emailAddress:a,phoneNumber:c,contactName:u,companyName:p,additionalEmailAddresses:d}).pipe(o.mapTo(!0))},t.prototype.getOutstandingBalance=function(t){var e=new ki({merchantId:t});return this.merchantApi.getOutstandingBalance(e).pipe(o.map((function(t){return{outstanding:t.outstandingBalance||0,currency:qa(t.currency)}})))},t.prototype.getStatistics=function(t){var e=new $s({merchantId:t});return this.merchantApi.getStatistics(e)},t.prototype.search=function(t,e,i,n){return this.merchantApi.search({searchTerm:t,sortBy:y[y[e]],sortDirection:A[A[i]],pagingOptions:new X(n)}).pipe(o.map((function(t){return new Bc(t.merchants.map((function(t){return Bu(t)})),t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.setAutoPostInvoices=function(t,e){return this.merchantApi.setAutoPostInvoices({merchantId:t,shouldAutoPostInvoices:e}).pipe(o.mapTo(!0))},t.prototype.setAutoChargeInvoices=function(t,e){return this.merchantApi.setAutoChargeInvoices({merchantId:t,autoChargeInvoices:e}).pipe(o.mapTo(!0))},t.prototype.downloadCsv=function(t){var e="?filename="+t.filename;return this.http.get(this.hostService.httpsHostWithScheme()+"/merchants-csv"+e,this.apiOptions()).pipe(o.catchError(Yc))},t.prototype.setIncludeInFinancialRecords=function(t,e){return this.merchantApi.setIncludeInFinancialRecords({merchantId:t,includeInFinancialRecords:e}).pipe(o.mapTo(!0))},t.prototype.sendSalesInvoiceEmail=function(t,e){return this.merchantApi.sendSalesInvoiceEmail({merchantId:t,invoiceId:e}).pipe(o.mapTo(!0))},t.prototype.chargeSalesInvoice=function(t,e,i){return this.merchantApi.chargeSalesInvoice({merchantId:t,invoiceId:e,amount:i}).pipe(o.mapTo(!0))},t.prototype.sendSalesInvoiceReceiptEmail=function(t,e){return this.merchantApi.sendSalesInvoiceReceiptEmail({merchantId:t,invoiceId:e}).pipe(o.mapTo(!0))},t.prototype.apiOptions=function(){return{responseType:"blob",withCredentials:!0}},t.prototype.createExternalAccount=function(t,e){return this.merchantApi.createStripeExternalAccount(new Kt({merchantId:t,stripeToken:e})).pipe(o.mapTo(!0))},t.prototype.generateAccountBalanceReport=function(t){var e="?merchantID="+t;return this.http.get(this.hostService.httpsHostWithScheme()+"/merchant-balance-details-report"+e,this.apiOptions()).pipe(o.share(),o.catchError(Yc))},t.prototype.getMultiRetailConfigurations=function(t,e){var i=new Bi({merchantId:t,retailGroupIds:e});return this.merchantApi.getMultiRetailConfigurations(i).pipe(o.map((function(t){var i=new Map;return e.forEach((function(e){var n;i.set(e,{merchantId:(n=t.retailConfigurations[e]).merchantId,retailGroupId:n.retailGroupId,currencyCode:n.currencyCode,currencyConversionRate:n.currencyConversionRate||0,defaultCustomerConfiguration:Fu(n.defaultCustomerConfiguration)})})),i})))},t.prototype.upsertRetailConfiguration=function(t,e,i,n){var r=new un({merchantId:t,retailGroupId:e,currencyCode:i,currencyConversionRate:n});return this.merchantApi.upsertRetailConfiguration(r).pipe(o.mapTo(null))},t.prototype.getPayoutSummary=function(t){return this.merchantApi.getPayoutSummary(new Fi({merchantId:t})).pipe(o.map((function(t){return e=t,i=new Date("0001-01-01T00:00:00Z").valueOf(),{nextInTransitPayout:e.nextInTransitPayoutExpectedDate.valueOf()!==i?e.nextInTransitPayoutExpectedDate:null,payoutInterval:Lu(e.payoutInterval),payoutDelayDays:e.payoutDelayDays,balances:(e.balances||[]).map((function(t){return{currencyCode:t.currencyCode,amount:t.amount||0,futurePayouts:t.futurePayouts||0,inTransit:t.inTransit||0}}))};var e,i})))},t.prototype.getRetailPayout=function(t,e){return this.merchantApi.getRetailPayout(new Hi({merchantId:t,payoutId:e})).pipe(o.map((function(t){return t.payout})))},t.prototype.listRetailPayouts=function(t,e,i){return void 0===e&&(e=""),void 0===i&&(i=10),this.merchantApi.listRetailPayouts(new Ki({merchantId:t,pagingOptions:new X({cursor:e,pageSize:i})})).pipe(o.map((function(t){var e=t.payouts||[];return new Bc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.upsertDefaultRetailCustomerConfiguration=function(t,e,i){return this.merchantApi.upsertDefaultRetailCustomerConfiguration(new cn({merchantId:t,retailGroupId:e,defaultCustomerConfiguration:(n=i,n?{generateMethod:ku(n.generateMethod),collectionMethod:yu(n.collectionMethod),invoiceDay:n.invoiceDay}:null)}));var n},t}();function Gu(t){return t?{id:t.id||"",paymentId:t.paymentId||"",status:Vu(t.status),amount:t.amount||0,created:t.created,currencyCode:t.currencyCode,evidence:qu(t.evidence),evidenceDetails:Wu(t.evidenceDetails),isChargeRefundable:t.isChargeRefundable||!1,reason:t.reason||"",fee:t.fee,feeCurrencyCode:t.feeCurrencyCode}:null}function qu(t){return t?{customerCommunication:Hu(t.customerCommunication),customerSignature:Hu(t.customerSignature),shippingDocumentation:Hu(t.shippingDocumentation),receipt:Hu(t.receipt),uncategorizedFile:Hu(t.uncategorizedFile),billingAddress:t.billingAddress||"",customerEmailAddress:t.customerEmailAddress||"",customerName:t.customerName||"",productDescription:t.productDescription||""}:null}function Hu(t){return t?{id:t.id||"",created:t.created,filename:t.filename||"",url:t.url||""}:null}function Wu(t){return t?{dueBy:t.dueBy,hasEvidence:t.hasEvidence,pastDue:t.pastDue,submissionCount:t.submissionCount}:null}function Vu(e){switch(e){case T.DISPUTE_STATUS_WARNING_NEEDS_RESPONSE:return t.DisputeStatus.WARNING_NEEDS_RESPONSE;case T.DISPUTE_STATUS_WARNING_UNDER_REVIEW:return t.DisputeStatus.WARNING_UNDER_REVIEW;case T.DISPUTE_STATUS_WARNING_CLOSED:return t.DisputeStatus.WARNING_CLOSED;case T.DISPUTE_STATUS_NEEDS_RESPONSE:return t.DisputeStatus.NEEDS_RESPONSE;case T.DISPUTE_STATUS_UNDER_REVIEW:return t.DisputeStatus.UNDER_REVIEW;case T.DISPUTE_STATUS_CHARGE_REFUNDED:return t.DisputeStatus.CHARGE_REFUNDED;case T.DISPUTE_STATUS_LOST:return t.DisputeStatus.LOST;case T.DISPUTE_STATUS_WON:return t.DisputeStatus.WON;default:return null}}function zu(e){switch(e){case E.PAYMENT_SOURCE_STRIPE:return t.PaymentSource.STRIPE;case E.PAYMENT_SOURCE_VCASH:return t.PaymentSource.VCASH;default:return t.PaymentSource.UNSET}}function Ku(e){switch(e){case R.PAYMENT_STATUS_FAILED:return t.PaymentStatus.Failed;case R.PAYMENT_STATUS_SUCCEEDED:return t.PaymentStatus.Succeeded}return t.PaymentStatus.Unset}function Xu(e){switch(e){case O.PAYMENT_ALLOCATION_TYPE_INVOICE:return t.PaymentAllocationType.INVOICE;case O.PAYMENT_ALLOCATION_TYPE_PURCHASE:return t.PaymentAllocationType.PURCHASE;default:return t.PaymentAllocationType.UNSET}}function Qu(e){return{merchantId:e.merchantId||"",created:e.created?new Date(e.created):null,currency:e.currency?qa(e.currency):t.Currency.USD,paymentSource:zu(e.paymentSource),allocations:e.allocations?e.allocations.map((function(t){return Zu(t)})):[],total:e.total||0,description:e.description||"",externalReferenceId:e.externalReferenceId||"",status:Ku(e.status)}}function Zu(e){return{referenceId:e.referenceId||"",amount:e.amount||0,type:e.type?Xu(e.type):t.PaymentAllocationType.UNSET}}Yu.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Yu(e.ɵɵinject(ba),e.ɵɵinject(la),e.ɵɵinject(i.HttpClient))},token:Yu,providedIn:"root"}),Yu.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Yu.ctorParameters=function(){return[{type:ba},{type:la},{type:i.HttpClient}]},function(t){t.WARNING_NEEDS_RESPONSE="Warning Needs Response",t.WARNING_UNDER_REVIEW="Warning Under Review",t.WARNING_CLOSED="Warning Closed",t.NEEDS_RESPONSE="Needs Response",t.UNDER_REVIEW="Under Review",t.CHARGE_REFUNDED="Charge Refunded",t.LOST="Lost",t.WON="Won"}(t.DisputeStatus||(t.DisputeStatus={})),function(t){t.UNSET="Unset",t.STRIPE="Stripe",t.VCASH="vCash"}(t.PaymentSource||(t.PaymentSource={})),function(t){t.Unset="UNSET",t.Failed="FAILED",t.Succeeded="SUCCEEDED"}(t.PaymentStatus||(t.PaymentStatus={})),function(t){t.UNSET="UNSET",t.PURCHASE="PURCHASE",t.INVOICE="INVOICE"}(t.PaymentAllocationType||(t.PaymentAllocationType={}));var $u,tp,ep=new Map([["authentication_required",{description:"The card was declined as the transaction requires authentication.",nextSteps:"The customer should try again and authenticate their card when prompted during the transaction."}],["approve_with_id",{description:"The payment cannot be authorized.",nextSteps:"The payment should be attempted again. If it still cannot be processed, the customer needs to contact their card issuer."}],["call_issuer",{description:"The card has been declined for an unknown reason.",nextSteps:"The customer needs to contact their card issuer for more information."}],["card_not_supported",{description:"The card does not support the specified currency.",nextSteps:"The customer needs to check with the issuer whether the card can be used for the type of currency specified."}],["do_not_honor",{description:"The card has been declined for an unknown reason.",nextSteps:"The customer needs to contact their card issuer for more information."}],["do_not_try_again",{description:"The card has been declined for an unknown reason.",nextSteps:"The customer should contact their card issuer for more information."}],["duplicate_transaction",{description:"A transaction with identical amount and credit card information was submitted very recently.",nextSteps:"Check to see if a recent payment already exists."}],["expired_card",{description:"The card has expired.",nextSteps:"The customer should use another card."}],["fraudulent",{description:"The payment has been declined as Stripe suspects it is fraudulent.",nextSteps:"Do not report more detailed information to your customer. Instead, present as you would the generic_decline described below."}],["generic_decline",{description:"The card has been declined for an unknown reason.",nextSteps:"The customer needs to contact their card issuer for more information."}],["incorrect_number",{description:"The card number is incorrect.",nextSteps:"The customer should try again using the correct card number."}],["incorrect_cvc",{description:"The CVC number is incorrect.",nextSteps:"The customer should try again using the correct CVC."}],["incorrect_pin",{description:"The PIN entered is incorrect. This decline code only applies to payments made with a card reader.",nextSteps:"The customer should try again using the correct PIN."}],["incorrect_zip",{description:"The ZIP/postal code is incorrect.",nextSteps:"The customer should try again using the correct billing ZIP/postal code."}],["insufficient_funds",{description:"The card has insufficient funds to complete the purchase.",nextSteps:"The customer should use an alternative payment method."}],["invalid_account",{description:"The card, or account the card is connected to, is invalid.",nextSteps:"The customer needs to contact their card issuer to check that the card is working correctly."}],["invalid_amount",{description:"The payment amount is invalid, or exceeds the amount that is allowed.",nextSteps:"If the amount appears to be correct, the customer needs to check with their card issuer that they can make purchases of that amount."}],["invalid_cvc",{description:"The CVC number is incorrect.",nextSteps:"The customer should try again using the correct CVC."}],["invalid_expiry_year",{description:"The expiration year invalid.",nextSteps:"The customer should try again using the correct expiration date."}],["invalid_number",{description:"The card number is incorrect.",nextSteps:"The customer should try again using the correct card number."}],["invalid_pin",{description:"The PIN entered is incorrect. This decline code only applies to payments made with a card reader.",nextSteps:"The customer should try again using the correct PIN."}],["issuer_not_available",{description:"The card issuer could not be reached, so the payment could not be authorized.",nextSteps:"The payment should be attempted again. If it still cannot be processed, the customer needs to contact their card issuer."}],["lost_card",{description:"The payment has been declined because the card is reported lost.",nextSteps:"The specific reason for the decline should not be reported to the customer. Instead, it needs to be presented as a generic decline."}],["merchant_blacklist",{description:"The payment has been declined because it matches a value on the Stripe user's block list.",nextSteps:"Do not report more detailed information to your customer. Instead, present as you would the generic_decline described above."}],["new_account_information_available",{description:"The card, or account the card is connected to, is invalid.",nextSteps:"The customer needs to contact their card issuer for more information."}],["no_action_taken",{description:"The card has been declined for an unknown reason.",nextSteps:"The customer should contact their card issuer for more information."}],["not_permitted",{description:"The payment is not permitted.",nextSteps:"The customer needs to contact their card issuer for more information."}],["offline_pin_required",{description:"The card has been declined as it requires a PIN.",nextSteps:"The customer should try again by inserting their card and entering a PIN."}],["online_or_offline_pin_required",{description:"The card has been declined as it requires a PIN.",nextSteps:"If the card reader supports Online PIN, the customer should be prompted for a PIN without a new transaction being created. If the card reader does not support Online PIN, the customer should try again by inserting their card and entering a PIN."}],["pickup_card",{description:"The card cannot be used to make this payment (it is possible it has been reported lost or stolen).",nextSteps:"The customer needs to contact their card issuer for more information."}],["pin_try_exceeded",{description:"The allowable number of PIN tries has been exceeded.",nextSteps:"The customer must use another card or method of payment."}],["processing_error",{description:"An error occurred while processing the card.",nextSteps:"The payment should be attempted again. If it still cannot be processed, try again later."}],["reenter_transaction",{description:"The payment could not be processed by the issuer for an unknown reason.",nextSteps:"The payment should be attempted again. If it still cannot be processed, the customer needs to contact their card issuer."}],["restricted_card",{description:"The card cannot be used to make this payment (it is possible it has been reported lost or stolen).",nextSteps:"The customer needs to contact their card issuer for more information."}],["revocation_of_all_authorizations",{description:"The card has been declined for an unknown reason.",nextSteps:"The customer should contact their card issuer for more information."}],["revocation_of_authorization",{description:"The card has been declined for an unknown reason.",nextSteps:"The customer should contact their card issuer for more information."}],["security_violation",{description:"The card has been declined for an unknown reason.",nextSteps:"The customer needs to contact their card issuer for more information."}],["service_not_allowed",{description:"The card has been declined for an unknown reason.",nextSteps:"The customer should contact their card issuer for more information."}],["stolen_card",{description:"The payment has been declined because the card is reported stolen.",nextSteps:"The specific reason for the decline should not be reported to the customer. Instead, it needs to be presented as a generic decline."}],["stop_payment_order",{description:"The card has been declined for an unknown reason.",nextSteps:"The customer should contact their card issuer for more information."}],["testmode_decline",{description:"A Stripe test card number was used.",nextSteps:"A genuine card must be used to make a payment."}],["transaction_not_allowed",{description:"The card has been declined for an unknown reason.",nextSteps:"The customer needs to contact their card issuer for more information."}],["try_again_later",{description:"The card has been declined for an unknown reason.",nextSteps:"Ask the customer to attempt the payment again. If subsequent payments are declined, the customer should contact their card issuer for more information."}],["withdrawal_count_limit_exceeded",{description:"The customer has exceeded the balance or credit limit available on their card.",nextSteps:"The customer should use an alternative payment method."}]]);($u=t.FundingType||(t.FundingType={})).PREPAID="Pre-paid",$u.DEBIT="Debit",$u.CREDIT="Credit",$u.UNKNOWN="Unknown",(tp=t.PaymentCardType||(t.PaymentCardType={})).AMEX="American Express",tp.VISA="Visa",tp.MASTERCARD="Mastercard",tp.JCB="JCB",tp.DINERS_CLUB="Diners Club",tp.DISCOVER="Discover",tp.UNKNOWN="Unknown";var ip=t.PaymentCardType.AMEX,np=t.PaymentCardType.VISA,op=t.PaymentCardType.MASTERCARD,rp=t.PaymentCardType.JCB,sp=t.PaymentCardType.DINERS_CLUB,ap=t.PaymentCardType.DISCOVER,cp=t.PaymentCardType.UNKNOWN,up=new Map([[t.CARD_TYPE.AMEX,{id:ip,value:"American Express"}],[t.CARD_TYPE.VISA,{id:np,value:"Visa"}],[t.CARD_TYPE.MASTERCARD,{id:op,value:"Mastercard"}],[t.CARD_TYPE.JCB,{id:rp,value:"JCB"}],[t.CARD_TYPE.DINERS_CLUB,{id:sp,value:"Diners Club"}],[t.CARD_TYPE.DISCOVER,{id:ap,value:"Discover"}],[t.CARD_TYPE.UNKNOWN,{id:cp,value:"Unknown"}]]);var pp=t.FundingType.DEBIT,dp=t.FundingType.CREDIT,hp=t.FundingType.PREPAID,lp=t.FundingType.UNKNOWN,mp=new Map([[_.FUNDING_TYPE_DEBIT,{id:pp,value:"Debit"}],[_.FUNDING_TYPE_CREDIT,{id:dp,value:"Credit"}],[_.FUNDING_TYPE_PREPAID,{id:hp,value:"Pre-paid"}],[_.FUNDING_TYPE_UNKNOWN,{id:lp,value:"Unknown"}]]);function vp(t){return mp.get(t)}function fp(t){return{cardType:(e=t.cardType,up.get(e)),fundingType:vp(t.fundingType),cardId:t.cardId,lastFourDigits:t.lastFourDigits,expiryMonth:t.expiryMonth,expiryYear:t.expiryYear,cardholderName:t.cardholderName,address:t.address,city:t.city,state:t.state,country:t.country,zipCode:t.zipCode,default:t.default};var e}var gp,Ip,Ap=function(){function t(t){this.apiService=t}return t.prototype.setDefaultCard=function(t,e){var i=new on({merchantId:t,cardId:e});return this.apiService.setDefaultPaymentCard(i)},t.prototype.getFirstPaymentCard=function(t){return this.getAll(t).pipe(o.map((function(t){return t&&t.length?t[0]:null})))},t.prototype.getAll=function(t){var e=new ro({merchantId:t});return this.apiService.listPaymentCards(e).pipe(o.map((function(t){return t&&t.paymentCard?t.paymentCard:[]})),o.map((function(t){return t.map((function(t){return fp(t)}))})))},t.prototype.update=function(t,e){var i=new uo({merchantId:t,stripeToken:e});return this.apiService.updatePaymentCard(new uo(i))},t.prototype.create=function(t,e){var i=new no({merchantId:t,stripeToken:e});return this.apiService.createPaymentCard(new no(i))},t}();function yp(t){return{id:t.id||"",merchantId:t.merchantId||"",created:t.created||null,currencyCode:t.currencyCode||"",amount:t.amount||0,referenceId:t.referenceId||"",referenceType:t.referenceType,description:t.description||"",customerId:t.customerId||"",status:Pp(t.status,t.disputed),failureCode:t.failureCode,failureMessage:t.failureMessage,applicationFee:t.applicationFee,dispute:Gu(t.dispute),cardDetails:(e=t.cardDetails,{lastFourDigits:e.lastFourDigits,cardType:Sp(e.cardType)})};var e}function Sp(e){switch(e){case b.CARD_TYPE_VISA:return t.PaymentCardType.VISA;case b.CARD_TYPE_MASTERCARD:return t.PaymentCardType.MASTERCARD;case b.CARD_TYPE_AMEX:return t.PaymentCardType.AMEX;case b.CARD_TYPE_DISCOVER:return t.PaymentCardType.DISCOVER;case b.CARD_TYPE_JCB:return t.PaymentCardType.JCB;case b.CARD_TYPE_DINERS_CLUB:return t.PaymentCardType.UNKNOWN}}function Pp(e,i){if(i)return t.RetailPaymentStatus.Disputed;switch(e){case R.PAYMENT_STATUS_SUCCEEDED:return t.RetailPaymentStatus.Succeeded;case R.PAYMENT_STATUS_FAILED:return t.RetailPaymentStatus.Failed;case R.PAYMENT_STATUS_REFUNDED:return t.RetailPaymentStatus.Refunded;case R.PAYMENT_STATUS_PARTIALLY_REFUNDED:return t.RetailPaymentStatus.PartialyRefunded;default:return null}}function bp(e){switch(e){case"rejected.fraud":case"rejected.listed":case"rejected.other":case"rejected.terms_of_service":return t.DisabledReason.REJECTED;case"other":return t.DisabledReason.OTHER;case"listed":return t.DisabledReason.LISTED;case"under_review":return t.DisabledReason.UNDER_REVIEW;default:return null}}function Tp(t){return{supportedRegion:t.supportedRegion||!1,canAcceptPayment:t.canAcceptPayment||!1,disabledReason:bp(t.disabledReason),requirements:(e=t.requirements,e?{due:e.due,errors:(e.error||[]).map((function(t){return function(t){return{requirement:t.requirement,code:t.code,reason:t.reason}}(t)}))}:{due:[],errors:[]})};var e}Ap.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Ap(e.ɵɵinject(ba))},token:Ap,providedIn:"root"}),Ap.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Ap.ctorParameters=function(){return[{type:ba}]},(gp=t.RetailPaymentStatus||(t.RetailPaymentStatus={})).Failed="Failed",gp.Succeeded="Succeeded",gp.Refunded="Refunded",gp.PartialyRefunded="Partially refunded",gp.Disputed="Disputed",(Ip=t.DisabledReason||(t.DisabledReason={})).FIELDS_NEEDED="fields needed",Ip.LISTED="listed",Ip.REJECTED="rejected",Ip.UNDER_REVIEW="under review",Ip.OTHER="other";var Op=function(){function t(t){this.paymentApi=t}return t.prototype.listPayments=function(t,e,i){var n=new Mn({filters:t,pagingOptions:new X({cursor:e,pageSize:i})});return this.paymentApi.list(n).pipe(o.map((function(t){var e=(t.payments||[]).map((function(t){return Qu(t)}));return new Bc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.prepareRetailPayment=function(t,e){var i=new Hn({merchantId:t,customerId:e});return this.paymentApi.prepareRetail(i).pipe(o.map((function(t){return{stripeClientSecret:t.stripeClientSecret,intentId:t.intentId}})))},t.prototype.getRetail=function(t,e){return this.paymentApi.getRetail({merchantId:t,paymentId:e}).pipe(o.map((function(t){return yp(t.payment)})))},t.prototype.listRetail=function(t,e,i,n,r,s,a){void 0===e&&(e=""),void 0===i&&(i=10);var c=new Date("0001-01-01T00:00:00Z").valueOf(),u=new kn({payoutId:n||"",customerId:r||""});return s&&s.valueOf()!==c&&(u.createdDateGte=s),a&&a.valueOf()!==c&&(u.createdDateLte=a),this.paymentApi.listRetail(new xn({merchantId:t,filters:u,pagingOptions:new X({cursor:e,pageSize:i})})).pipe(o.map((function(t){var e=(t.payments||[]).map((function(t){return yp(t)}));return new Bc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.getRetailDispute=function(t,e){return this.paymentApi.getRetailDispute({merchantId:t,disputeId:e}).pipe(o.map((function(t){return Gu(t.dispute)})))},t.prototype.listRetailDisputes=function(t,e,i){return void 0===e&&(e=""),void 0===i&&(i=10),this.paymentApi.listRetailDisputes(new Bn({merchantId:t,pagingOptions:new X({cursor:e,pageSize:i})})).pipe(o.map((function(t){var e=(t.disputes||[]).map((function(t){return Gu(t)}));return new Bc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.retailStatus=function(t){var e=new Xn({merchantId:t});return this.paymentApi.retailStatus(e).pipe(o.map((function(t){return Tp(t)})))},t.prototype.retailPaymentsEnabled=function(t){var e=new zn({merchantId:t});return this.paymentApi.retailPaymentsEnabled(e).pipe(o.map((function(t){return t.enabled})))},t.prototype.configureRetailProvider=function(t,e,i){return this.paymentApi.configureRetailProvider({merchantId:t,successUrl:e,failureUrl:i}).pipe(o.map((function(t){return t.stripeUrl})))},t.prototype.getRetailProvider=function(t){return this.paymentApi.getRetailProvider({merchantId:t}).pipe(o.map((function(t){return{statementDescriptor:t.statementDescriptor,stripeConnectId:t.stripeConnectId}})))},t.prototype.updateRetailProvider=function(t,e){return this.paymentApi.updateRetailProvider({merchantId:t,statementDescriptor:e}).pipe(o.mapTo(null))},t.prototype.submitEvidence=function(t,e,i,n,r){return this.paymentApi.submitEvidence({merchantId:t,disputeId:e,paymentId:i,evidence:{billingAddress:(null==r?void 0:r.billingAddress)||null,customerEmailAddress:(null==r?void 0:r.customerEmailAddress)||null,customerName:(null==r?void 0:r.customerName)||null,productDescription:(null==r?void 0:r.productDescription)||null,customerSignatureFileId:(null==r?void 0:r.customerSignatureFileId)||null,customerCommunicationFileId:(null==r?void 0:r.customerCommunicationFileId)||null,receiptFileId:(null==r?void 0:r.receiptFileId)||null,shippingDocumentationFileId:(null==r?void 0:r.shippingDocumentationFileId)||null,uncategorizedFileId:(null==r?void 0:r.uncategorizedFileId)||null},submit:n}).pipe(o.mapTo(null))},t.prototype.closeDispute=function(t,e){return this.paymentApi.closeRetailDispute({merchantId:t,disputeId:e}).pipe(o.mapTo(null))},t}();Op.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Op(e.ɵɵinject(Oa))},token:Op,providedIn:"root"}),Op.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Op.ctorParameters=function(){return[{type:Oa}]};var Ep=function(){function t(t){this.apiService=t}return t.prototype.listPaymentCards=function(t,e){var i=new ro({merchantId:t,customerId:e});return this.apiService.listPaymentCards(i).pipe(o.map((function(t){return(t&&t.paymentCard?t.paymentCard:[]).map((function(t){return fp(t)}))})))},t.prototype.deletePaymentCard=function(t,e){var i=new oo({merchantId:t,cardId:e});return this.apiService.deletePaymentCard(i).pipe(o.mapTo(!0))},t.prototype.setDefaultPaymentCard=function(t,e,i){var n=new co({merchantId:t,customerId:e,paymentMethodId:i});return this.apiService.setDefaultPaymentMethod(n).pipe(o.mapTo(!0))},t}();function Rp(t){return{sku:t.sku||"",productName:t.productName||"",startingCount:t.startingCount||0,activations:t.activations||0,deactivations:t.deactivations||0,churn:t.churn||0,retention:t.retention||0}}function Cp(t){var e=(t.subscriptionMetrics||[]).map((function(t){return Rp(t)}));return{groupID:t.groupId||"",metrics:e||[]}}Ep.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Ep(e.ɵɵinject(Ta))},token:Ep,providedIn:"root"}),Ep.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Ep.ctorParameters=function(){return[{type:Ta}]};var Dp=function(){function t(t){this.productSummaryApi=t}return t.prototype.listSubscriptionRetentionBySKU=function(t,e,i,n){var r=new ue({merchantId:t,filters:e,pagingOptions:new X({cursor:i,pageSize:n})});return this.productSummaryApi.listSubscriptionRetentionBySku(r).pipe(o.map((function(t){var e=(t.subscriptionMetrics||[]).map((function(t){return Rp(t)}));return new Bc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.listSubscriptionRetentionByGroup=function(t,e,i,n){var r=new ue({merchantId:t,filters:e,pagingOptions:new X({cursor:i,pageSize:n})});return this.productSummaryApi.listSubscriptionRetentionByGroup(r).pipe(o.map((function(t){var e=(t.metricsByGroup||[]).map((function(t){return Cp(t)}));return new Bc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t}();Dp.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Dp(e.ɵɵinject(Ca))},token:Dp,providedIn:"root"}),Dp.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Dp.ctorParameters=function(){return[{type:Ca}]};var _p=function(){function t(t,e){this.hostService=t,this.http=e}return t.prototype.exportCSV=function(t){var e=function(t){return{merchantId:t.merchantId,purchaseId:t.purchaseId,start:t.start?t.start.toISOString():void 0,end:t.end?t.end.toISOString():void 0,billingStrategyFilter:t.billingStrategyFilter?{billingStrategy:t.billingStrategyFilter.billingStrategy?t.billingStrategyFilter.billingStrategy.map((function(t){return t.valueOf()})):[]}:void 0,state:t.state?t.state.valueOf():void 0,minPrice:t.minPrice,status:t.status,includeVoided:t.includeVoided}}(t);return this.http.post(this.hostService.httpsHostWithScheme()+"/purchase/export-csv",{filters:e},{observe:"body",responseType:"blob",withCredentials:!0}).pipe(o.share())},t}();function Jp(e){switch(e){case t.RefundReason.REQUESTED_BY_CUSTOMER:return t.RefundReasonEnum.REQUESTED_BY_CUSTOMER;case t.RefundReason.FRAUDULENT:return t.RefundReasonEnum.FRAUDULENT;case t.RefundReason.DUPLICATE:return t.RefundReasonEnum.DUPLICATE}return t.RefundReasonEnum.DUPLICATE}function Np(e){switch(e){case t.RefundReasonEnum.DUPLICATE:return t.RefundReason.DUPLICATE;case t.RefundReasonEnum.REQUESTED_BY_CUSTOMER:return t.RefundReason.REQUESTED_BY_CUSTOMER;case t.RefundReasonEnum.FRAUDULENT:return t.RefundReason.FRAUDULENT}return t.RefundReason.REQUESTED_BY_CUSTOMER}function wp(e){switch(e){case t.RefundStatusEnum.SUCCEEDED:return t.RefundStatus.SUCCEEDED;case t.RefundStatusEnum.FAILED:return t.RefundStatus.FAILED;case t.RefundStatusEnum.PENDING:return t.RefundStatus.PENDING}return t.RefundStatus.SUCCEEDED}function jp(e){switch(e){case t.ReferenceTypeEnum.PURCHASE:return t.ReferenceType.PURCHASE;case t.ReferenceTypeEnum.PURCHASE_ITEM:return t.ReferenceType.PURCHASE_ITEM;case t.ReferenceTypeEnum.INVOICE:return t.ReferenceType.INVOICE}return t.ReferenceType.PURCHASE}function Mp(t){return{merchantId:t.merchantId||"",chargeId:t.chargeId||"",refundId:t.refundId||"",amount:t.amount||0,reason:Np(t.reason),status:wp(t.status),created:t.created?new Date(t.created):null,updated:t.updated?new Date(t.updated):null,referenceType:jp(t.referenceType),referenceId:t.referenceId||""}}_p.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new _p(e.ɵɵinject(la),e.ɵɵinject(i.HttpClient))},token:_p,providedIn:"root"}),_p.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],_p.ctorParameters=function(){return[{type:la},{type:i.HttpClient}]},function(t){t.REQUESTED_BY_CUSTOMER="Requested by Customer",t.DUPLICATE="Duplicate",t.FRAUDULENT="Fraudulent",t.UNKNOWN="Unknown"}(t.RefundReason||(t.RefundReason={})),function(t){t.SUCCEEDED="Succeeded",t.FAILED="Failed",t.PENDING="Pending",t.UNKNOWN="Unknown"}(t.RefundStatus||(t.RefundStatus={})),function(t){t.PURCHASE="Purchase",t.PURCHASE_ITEM="Purchase Item",t.INVOICE="Invoice",t.UNKNOWN="Unknown"}(t.ReferenceType||(t.ReferenceType={}));var Up=function(){function t(t){this.refundApiService=t}return t.prototype.create=function(t,e,i,n){var r=new pr({merchantId:t,paymentId:e,amount:i,reason:Jp(n)});return this.refundApiService.create(r).pipe(o.catchError(this.handleError),o.mapTo(null))},t.prototype.list=function(t,e,i,n){var r=new dr({paymentIds:e,cursor:i,pageSize:n,merchantId:t});return this.refundApiService.list(r).pipe(o.map((function(t){var e=(t.refunds||[]).map((function(t){return Mp(t)}));return new Bc(e,t.nextCursor,t.hasMore)})))},t.prototype.handleError=function(t){return t.error instanceof ErrorEvent?console.error("An error occurred:",t.error.message):console.error("Server returned "+t.message),r.throwError("Unable to issue a refund")},t}();function Bp(e){switch(e){case V.COLLECTION_METHOD_INVALID:return t.CollectionMethod.UNSET;case V.COLLECTION_METHOD_MANUAL:return t.CollectionMethod.MANUAL_COLLECTION;case V.COLLECTION_METHOD_EMAIL:return t.CollectionMethod.SEND_EMAIL;case V.COLLECTION_METHOD_CHARGE_AUTOMATICALLY:return t.CollectionMethod.CHARGE_AUTOMATICALLY;default:return t.CollectionMethod.UNSET}}function Lp(e){switch(e){case t.CollectionMethod.UNSET:return V.COLLECTION_METHOD_INVALID;case t.CollectionMethod.MANUAL_COLLECTION:return V.COLLECTION_METHOD_MANUAL;case t.CollectionMethod.SEND_EMAIL:return V.COLLECTION_METHOD_EMAIL;case t.CollectionMethod.CHARGE_AUTOMATICALLY:return V.COLLECTION_METHOD_CHARGE_AUTOMATICALLY;default:return V.COLLECTION_METHOD_INVALID}}function kp(e){switch(e){case z.INTERVAL_INVALID:return t.Interval.INVALID;case z.INTERVAL_DAY:return t.Interval.DAY;case z.INTERVAL_WEEK:return t.Interval.WEEK;case z.INTERVAL_MONTH:return t.Interval.MONTH;case z.INTERVAL_YEAR:return t.Interval.YEAR;default:return t.Interval.INVALID}}function xp(e){switch(e){case t.Interval.INVALID:return z.INTERVAL_INVALID;case t.Interval.DAY:return z.INTERVAL_DAY;case t.Interval.WEEK:return z.INTERVAL_WEEK;case t.Interval.MONTH:return z.INTERVAL_MONTH;case t.Interval.YEAR:return z.INTERVAL_YEAR;default:return z.INTERVAL_INVALID}}function Fp(e){switch(e){case W.PAYMENT_PROCESSOR_INVALID:return t.PaymentProcessor.INVALID;case W.PAYMENT_PROCESSOR_UNSET:return t.PaymentProcessor.UNSET;case W.PAYMENT_PROCESSOR_STRIPE:return t.PaymentProcessor.STRIPE;default:return t.PaymentProcessor.INVALID}}function Yp(e){switch(e){case t.PaymentProcessor.INVALID:return W.PAYMENT_PROCESSOR_INVALID;case t.PaymentProcessor.UNSET:return W.PAYMENT_PROCESSOR_UNSET;case t.PaymentProcessor.STRIPE:return W.PAYMENT_PROCESSOR_STRIPE;default:return W.PAYMENT_PROCESSOR_INVALID}}function Gp(e){switch(e){case K.RECURRING_INVOICE_STATUS_INVALID:return t.RecurringInvoiceStatus.INVALID;case K.RECURRING_INVOICE_STATUS_INACTIVE:return t.RecurringInvoiceStatus.INACTIVE;case K.RECURRING_INVOICE_STATUS_ACTIVE:return t.RecurringInvoiceStatus.ACTIVE;case K.RECURRING_INVOICE_STATUS_ARCHIVED:return t.RecurringInvoiceStatus.ARCHIVED;default:return t.RecurringInvoiceStatus.INVALID}}function qp(e){switch(e){case t.RecurringInvoiceStatus.INVALID:return K.RECURRING_INVOICE_STATUS_INVALID;case t.RecurringInvoiceStatus.INACTIVE:return K.RECURRING_INVOICE_STATUS_INACTIVE;case t.RecurringInvoiceStatus.ACTIVE:return K.RECURRING_INVOICE_STATUS_ACTIVE;case t.RecurringInvoiceStatus.ARCHIVED:return K.RECURRING_INVOICE_STATUS_ARCHIVED;default:return K.RECURRING_INVOICE_STATUS_INVALID}}Up.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Up(e.ɵɵinject(Ja))},token:Up,providedIn:"root"}),Up.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Up.ctorParameters=function(){return[{type:Ja}]},function(t){t.INVALID="Invalid",t.DAY="Daily",t.WEEK="Weekly",t.MONTH="Monthly",t.YEAR="Yearly"}(t.Interval||(t.Interval={})),function(t){t.INVALID="Invalid",t.UNSET="Unset",t.STRIPE="Stripe"}(t.PaymentProcessor||(t.PaymentProcessor={})),function(t){t.INVALID="Invalid",t.INACTIVE="Inactive",t.ACTIVE="Active",t.ARCHIVED="Archived"}(t.RecurringInvoiceStatus||(t.RecurringInvoiceStatus={}));var Hp=function(t){this.customerId=t},Wp=function(t){this.merchantId=t},Vp=function(t){this.name=t},zp=function(t){function e(e){var i=t.call(this,e.name)||this;return e?(Object.assign(i,e),i):i}return uc(e,t),e}(Vp),Kp=function(t){function e(e){var i=t.call(this,e.name)||this;return e?(Object.assign(i,e),i):i}return uc(e,t),e}(Vp);function Xp(t){if(t)return new zp({sku:t.sku,unitPrice:t.unitPrice,quantity:t.quantity,name:t.name,taxRateIds:t.taxRateIds||[]})}function Qp(t){return t.lineItem?Xp(t.lineItem):t.bundle?function(t){if(t)return new Kp({name:t.name,hideLineItems:t.hideLineItems||!1,lineItems:(t.lineItems||[]).map((function(t){return Xp(t)}))})}(t.bundle):null}function Zp(t){if(t){var e=new Date("0001-01-01T00:00:00Z").valueOf();return{id:t.id,created:t.created.valueOf()!==e?t.created:null,updated:t.updated.valueOf()!==e?t.updated:null,customerId:t.customerId,status:Gp(t.status),issuedAt:t.issuedAt.valueOf()!==e?t.issuedAt:null,nextIssue:t.nextIssue.valueOf()!==e?t.nextIssue:null,intervalCount:t.intervalCount,interval:kp(t.interval),collectionMethod:Bp(t.collectionMethod),recipientUserId:t.recipientUserId,paymentProcessor:Fp(t.paymentProcessor),paymentProcessorId:t.paymentProcessorId,items:(t.items||[]).map((function(t){return Qp(t)})),totalAmount:t.totalAmount||0,currencyCode:t.currencyCode}}}function $p(t){if(t)return new Ms({sku:t.sku,unitPrice:t.unitPrice,quantity:t.quantity,name:t.name,taxRateIds:t.taxRateIds})}function td(t){var e,i;return t instanceof zp?e=$p(t):t instanceof Kp&&(i=new ws({name:t.name,hideLineItems:t.hideLineItems,lineItems:(t.lineItems||[]).map((function(t){return $p(t)}))})),new js({lineItem:e,bundle:i})}var ed=function(){function t(t){this.recurringInvoiceApiService=t}return t.prototype.create=function(t){var e=new Ns(Object.assign(Object.assign({},t),{status:qp(t.status),interval:xp(t.interval),collectionMethod:Lp(t.collectionMethod),paymentProcessor:Yp(t.paymentProcessor),items:(t.items||[]).map((function(t){return td(t)}))}));return this.recurringInvoiceApiService.createRecurringInvoice(e).pipe(o.map((function(t){return Zp(t)})))},t.prototype.get=function(t){var e=new Ds({id:t});return this.recurringInvoiceApiService.getRecurringInvoice(e).pipe(o.map((function(t){return Zp(t)})))},t.prototype.delete=function(t){var e=new Cs({id:t});return this.recurringInvoiceApiService.deleteRecurringInvoice(e)},t.prototype.list=function(t,e,i){var n=new _s({pagingOptions:{cursor:e,pageSize:i}});return t instanceof Hp?n.customerId=t.customerId:t instanceof Wp&&(n.merchantId=t.merchantId),this.recurringInvoiceApiService.listRecurringInvoices(n).pipe(o.map((function(t){var e=(t.recurringInvoices||[]).map((function(t){return Zp(t)}));return new Bc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.update=function(t){var e=new Us({recurringInvoice:new Ns(Object.assign(Object.assign({},t),{status:qp(t.status),interval:xp(t.interval),collectionMethod:Lp(t.collectionMethod),paymentProcessor:Yp(t.paymentProcessor),items:(t.items||[]).map((function(t){return td(t)}))}))});return this.recurringInvoiceApiService.updateRecurringInvoice(e).pipe(o.map((function(t){return Zp(t)})))},t}();function id(e){return new fr(Object.assign(Object.assign({},e),{statuses:(e.statuses||[]).map((function(e){return function(e){switch(e){case t.SalesCreditNoteStatus.ReadyToPost:return x.SALES_CREDIT_NOTE_STATUS_READY_TO_POST;case t.SalesCreditNoteStatus.Complete:return x.SALES_CREDIT_NOTE_STATUS_COMPLETE;case t.SalesCreditNoteStatus.Discarded:return x.SALES_CREDIT_NOTE_STATUS_DISCARDED}return x.SALES_CREDIT_NOTE_STATUS_IN_PROGRESS}(e)}))}))}function nd(e){switch(e){case x.SALES_CREDIT_NOTE_STATUS_READY_TO_POST:return t.SalesCreditNoteStatus.ReadyToPost;case x.SALES_CREDIT_NOTE_STATUS_COMPLETE:return t.SalesCreditNoteStatus.Complete;case x.SALES_CREDIT_NOTE_STATUS_DISCARDED:return t.SalesCreditNoteStatus.Discarded}return t.SalesCreditNoteStatus.InProgress}ed.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ed(e.ɵɵinject(_a))},token:ed,providedIn:"root"}),ed.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ed.ctorParameters=function(){return[{type:_a}]},function(t){t.InProgress="IN_PROGRESS",t.ReadyToPost="READY_TO_POST",t.Complete="COMPLETE",t.Discarded="DISCARDED"}(t.SalesCreditNoteStatus||(t.SalesCreditNoteStatus={}));var od,rd=function(){function t(t,e,i){this.hostService=t,this.http=e,this.salesCreditNoteApi=i}return t.prototype.downloadPdf=function(t,e){var i;return i=e?{salesCreditNoteId:t,merchantId:e}:{salesCreditNoteId:t},this.http.get(this.hostService.httpsHostWithScheme()+"/sales-credit-note-pdf",{observe:"body",params:i,responseType:"blob",withCredentials:!0}).pipe(o.share(),o.catchError(this.handleDownloadPDFError.bind(this)))},t.prototype.createAutomatedCreditNote=function(t,e,i,n){var r=new vr({merchantId:t,creditNoteReason:e,total:i,sku:n});return this.salesCreditNoteApi.create(r).pipe(o.map((function(){return null})))},t.prototype.list=function(t,e,i){var n=new gr({filters:id(t),pagingOptions:new X({cursor:e,pageSize:i})});return this.salesCreditNoteApi.list(n).pipe(o.map((function(t){var e=(t.creditNote||[]).map((function(t){return{creditNoteId:(e=t).creditNoteId,creditNoteNumber:e.creditNoteNumber,merchantId:e.merchantId,creditNoteReason:e.creditNoteReason,creditNoteDate:e.creditNoteDate?new Date(e.creditNoteDate):null,dueDate:e.dueDate?new Date(e.dueDate):null,currency:qa(e.currency),total:e.total||0,outstanding:e.outstanding||0,invoiceId:e.invoiceId,invoiceNumber:e.invoiceNumber,status:nd(e.status),paymentStatus:e.paymentStatus};var e}));return new Bc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.handleDownloadPDFError=function(t){return t.error instanceof ErrorEvent?console.error("An error occurred:",t.error.message):console.error("Server returned "+t.message),r.throwError("Unable to download pdf")},t}();function sd(t){return{invoiceId:t.invoiceId,invoiceNumber:t.invoiceNumber,merchantId:t.merchantId,invoiceDate:t.invoiceDate?new Date(t.invoiceDate):null,startDate:t.startDate?new Date(t.startDate):null,endDate:t.endDate?new Date(t.endDate):null,dueDate:t.dueDate?new Date(t.dueDate):null,currency:qa(t.currency),status:cd(t.status),type:ud(t.type),total:t.total||0,paymentStatus:t.paymentStatus,outstanding:t.outstanding||0}}function ad(e){return new br(Object.assign(Object.assign({},e),{statuses:(e.statuses||[]).map((function(e){return function(e){switch(e){case t.SalesInvoiceStatus.ReadyToPost:return Y.SALES_INVOICE_STATUS_READY_TO_POST;case t.SalesInvoiceStatus.Complete:return Y.SALES_INVOICE_STATUS_COMPLETE;case t.SalesInvoiceStatus.Discarded:return Y.SALES_INVOICE_STATUS_DISCARDED}return Y.SALES_INVOICE_STATUS_IN_PROGRESS}(e)})),paymentStatuses:(e.paymentStatuses||[]).map((function(e){return function(e){switch(e){case t.PaymentStatusType.Paid:return F.PAYMENT_STATUSES_PAID;case t.PaymentStatusType.Part_Paid:return F.PAYMENT_STATUSES_PART_PAID;case t.PaymentStatusType.Unpaid:return F.PAYMENT_STATUSES_UNPAID;case t.PaymentStatusType.Not_Applicable:return F.PAYMENT_STATUSES_NOT_APPLICABLE}return F.PAYMENT_STATUSES_NOT_SET}(e)}))}))}function cd(e){switch(e){case Y.SALES_INVOICE_STATUS_READY_TO_POST:return t.SalesInvoiceStatus.ReadyToPost;case Y.SALES_INVOICE_STATUS_COMPLETE:return t.SalesInvoiceStatus.Complete;case Y.SALES_INVOICE_STATUS_DISCARDED:return t.SalesInvoiceStatus.Discarded}return t.SalesInvoiceStatus.InProgress}function ud(e){switch(e){case G.SALES_INVOICE_TYPE_INVOICED:return t.SalesInvoiceType.Invoiced;case G.SALES_INVOICE_TYPE_INSTANT:return t.SalesInvoiceType.Instant}return null}rd.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new rd(e.ɵɵinject(la),e.ɵɵinject(i.HttpClient),e.ɵɵinject(wa))},token:rd,providedIn:"root"}),rd.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],rd.ctorParameters=function(){return[{type:la},{type:i.HttpClient},{type:wa}]},function(t){t.InProgress="IN_PROGRESS",t.ReadyToPost="READY_TO_POST",t.Complete="COMPLETE",t.Discarded="DISCARDED"}(t.SalesInvoiceStatus||(t.SalesInvoiceStatus={})),function(t){t.Instant="INSTANT",t.Invoiced="INVOICED"}(t.SalesInvoiceType||(t.SalesInvoiceType={})),(od=t.PaymentStatusType||(t.PaymentStatusType={})).Not_Applicable="Not Applicable",od.Unpaid="Unpaid",od.Paid="Paid",od.Part_Paid="Part Paid";var pd=function(){function t(t,e,i){this.hostService=t,this.http=e,this.salesInvoiceApi=i}return t.prototype.downloadPdf=function(t,e){var i;return i=e?{salesInvoiceId:t,merchantId:e}:{salesInvoiceId:t},this.http.get(this.hostService.httpsHostWithScheme()+"/sales-invoice-pdf",{observe:"body",params:i,responseType:"blob",withCredentials:!0}).pipe(o.share(),o.catchError(dd))},t.prototype.listSalesInvoices=function(t,e,i,n){var r=new Tr({filters:ad(t),pagingOptions:new X({cursor:e,pageSize:i}),searchTerm:n||""});return this.salesInvoiceApi.list(r).pipe(o.map((function(t){var e=(t.invoice||[]).map((function(t){return sd(t)}));return new Bc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.postSalesInvoice=function(t){var e=new Er({invoiceId:t});return this.salesInvoiceApi.post(e).pipe(o.mapTo(!0))},t.prototype.getSalesInvoice=function(t,e){var i=new Sr({invoiceId:t,merchantId:e});return this.salesInvoiceApi.get(i).pipe(o.map((function(t){return sd(t.invoice)})))},t}();function dd(t){return t.error instanceof ErrorEvent?console.error("An error occurred:",t.error.message):console.error("Server returned "+t.message),r.throwError("Unable to download pdf")}pd.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new pd(e.ɵɵinject(la),e.ɵɵinject(i.HttpClient),e.ɵɵinject(ja))},token:pd,providedIn:"root"}),pd.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],pd.ctorParameters=function(){return[{type:la},{type:i.HttpClient},{type:ja}]};var hd,ld=function(){function t(t,e){this.hostService=t,this.httpClient=e}return t.prototype.uploadFile=function(t,e,i){var n=new FormData;return n.append("merchant_id",t),n.append("purpose",e),n.append("file",i),this.httpClient.post(this.hostService.httpsHostWithScheme()+"/stripe/files",n,this.apiOptions()).pipe(o.share(),o.catchError(Gc))},t.prototype.apiOptions=function(){return{withCredentials:!0}},t}();function md(t){return{id:t.id||"",merchantId:t.merchantId||"",countryCode:t.countryCode||"",stateCode:t.stateCode||"",name:t.name||"",description:t.description||"",percentage:t.percentage||0,accountingSystemId:t.accountingSystemId||""}}ld.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ld(e.ɵɵinject(la),e.ɵɵinject(i.HttpClient))},token:ld,providedIn:"root"}),ld.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ld.ctorParameters=function(){return[{type:la},{type:i.HttpClient}]},(hd=t.FilePurpose||(t.FilePurpose={})).ACCOUNT_REQUIREMENT="account_requirement",hd.ADDITIONAL_VERIFICATION="additional_verification",hd.BUSINESS_ICON="business_icon",hd.BUSINESS_LOGO="business_logo",hd.CUSTOMER_SIGNATURE="customer_signature",hd.DISPUTE_EVIDENCE="dispute_evidence",hd.IDENTITY_DOCUMENT="identity_document",hd.PCI_DOCUMENT="pci_document",hd.TAX_DOCUMENT_USER_UPLOAD="tax_document_user_upload";var vd=function(){function t(t){this.taxRateApi=t}return t.prototype.calculate=function(t,e,i){var n=new Ee({merchantId:t,customerId:e,amount:i});return this.taxRateApi.calculate(n).pipe(o.map((function(t){var e=(t.taxRates||[]).map((function(t){return md(t)}));return{taxableAmount:t.taxableAmount||0,taxRates:e}})))},t.prototype.create=function(t,e,i,n,o,r,s){var a=new Ce({merchantId:t,countryCode:e,stateCode:i,name:n,description:o,percentage:r,accountingSystemId:s});return this.taxRateApi.create(a)},t.prototype.update=function(t,e,i,n,o,r,s,a){var c=new Me({merchantId:t,id:e,countryCode:i,stateCode:n,name:o,description:r,percentage:s,accountingSystemId:a});return this.taxRateApi.update(c)},t.prototype.list=function(t,e,i){var n=new Ne({filters:t,pagingOptions:new X({cursor:e,pageSize:i})});return this.taxRateApi.list(n).pipe(o.map((function(t){var e=(t.taxRates||[]).map((function(t){return md(t)}));return new Bc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.getMulti=function(t,e){var i=new _e({merchantId:t,ids:e});return this.taxRateApi.getMulti(i).pipe(o.map((function(t){return(t.taxRates||[]).map((function(t){return md(t)}))})))},t.prototype.archive=function(t,e){var i=new Oe({merchantId:t,id:e});return this.taxRateApi.archive(i)},t}();vd.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new vd(e.ɵɵinject(Ma))},token:vd,providedIn:"root"}),vd.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],vd.ctorParameters=function(){return[{type:Ma}]},t.AddLineItemRequest=Fe,t.AddLineItemResponse=Ye,t.Agency=eu,t.BankAccountService=Fa,t.BankReconciliationService=Lc,t.BillingApiService=va,t.BillingHostService=Fc,t.BillingService=hu,t.BundleService=fu,t.CanCreateSubscriptionsResponse=jr,t.ChannelPartnersGrowthHighTouch=su,t.ChannelPartnersGrowthMediumTouch=ru,t.ChannelPartnersUnassistedPLG=ou,t.ConnectStripeAccountRequest=Ji,t.ConnectStripeAccountResponse=Ni,t.ContractDocumentService=gu,t.ContractService=cu,t.CreateDiscountRequest=fe,t.CreateInvoiceRequest=qe,t.CreateInvoiceResponse=He,t.CreateMerchantRequest=wi,t.CreatePaymentCardRequest=no,t.CreateProductRequest=Lo,t.CreateRefundRequest=pr,t.CreateTaxRequest=Ce,t.CreditService=Iu,t.DeclineReasons=ep,t.DeleteBankAccountRequest=Xt,t.DeleteContractDocumentRequest=Vr,t.DeleteInvoiceRequest=ze,t.DeleteLineItemRequest=Ke,t.DeleteLineItemResponse=Xe,t.DeleteProductRequest=ko,t.DeleteRetailPricingRequest=Ls,t.Dimension=$c,t.DiscountService=Au,t.ExistingEnterprise=nu,t.ExpireDiscountRequest=Ie,t.GenerateBillableItemsCSVRequest=ks,t.GenerateBillableItemsCSVResponse=xs,t.GenerateVendorReportRequest=Fs,t.GenerateVendorReportResponse=Ys,t.GetBalanceRequest=ns,t.GetBalanceResponse=os,t.GetInvoiceRequest=ti,t.GetInvoiceResponse=ei,t.GetMerchantRequest=Mi,t.GetMerchantResponse=Ui,t.GetMultiBundleRetailPricingRequest=Gs,t.GetMultiBundleRetailPricingResponse=qs,t.GetMultiBundleRetailPricingResponsePricesEntry=ra,t.GetMultiContractsRequest=Ut,t.GetMultiContractsResponse=Bt,t.GetMultiProductPricingRequest=Hs,t.GetMultiProductPricingResponse=Ws,t.GetMultiProductPricingResponseProductPricesEntry=ca,t.GetMultiProductRequest=xo,t.GetMultiProductResponse=Fo,t.GetMultiRetailPricingRequest=Vs,t.GetMultiRetailPricingResponse=zs,t.GetMultiRetailPricingResponseProductPricesEntry=aa,t.GetMultiTaxRequest=_e,t.GetMultiTaxResponse=Je,t.GetOutstandingBalanceRequest=ki,t.GetOutstandingBalanceResponse=xi,t.GetPurchaseCostRequest=Ks,t.GetPurchaseCostResponse=Xs,t.GetRevenueStatsRequest=Qs,t.GetRevenueStatsResponse=Zs,t.GetStatisticsRequest=$s,t.GetStatisticsResponse=ta,t.GetWholesaleComparisonRequest=ia,t.GetWholesaleComparisonRequestGetWholesaleComparisonFilters=ea,t.GetWholesaleComparisonResponse=na,t.GetWholesaleComparisonResponseGetWholesaleComparisonResult=oa,t.InvoiceService=Ju,t.InvoiceTemplateService=Uu,t.ListBankAccountsRequest=Qt,t.ListBankAccountsResponse=Zt,t.ListBillableItemsRequestFilters=at,t.ListContractDocumentsRequest=Kr,t.ListContractDocumentsResponse=Xr,t.ListContractsRequest=Lt,t.ListContractsResponse=kt,t.ListDiscountsRequest=ye,t.ListDiscountsResponse=Se,t.ListInvoicesRequest=oi,t.ListInvoicesResponse=ri,t.ListMerchantBillingReportsRequest=dn,t.ListMerchantBillingReportsResponse=hn,t.ListPaymentCardsRequest=ro,t.ListPaymentCardsResponse=so,t.ListPaymentRequest=Mn,t.ListPaymentResponse=Un,t.ListProductsRequest=Go,t.ListProductsResponse=qo,t.ListPurchaseItemsFilters=tr,t.ListPurchaseItemsRequest=er,t.ListPurchaseItemsResponse=ir,t.ListPurchaseRequest=nr,t.ListPurchaseResponse=or,t.ListRecurringInvoicesByCustomerID=Hp,t.ListRecurringInvoicesByMerchantID=Wp,t.ListRefundsRequest=dr,t.ListRefundsResponse=hr,t.ListRetailPaymentsRequest=xn,t.ListRetailPaymentsResponse=Fn,t.ListSalesCreditNoteRequest=gr,t.ListSalesCreditNoteResponse=Ir,t.ListTaxRequest=Ne,t.ListTaxResponse=we,t.MerchantApiService=ba,t.MerchantReportApiService=Wc,t.MerchantService=Yu,t.NewEnterprise=iu,t.PagedResponse=Bc,t.PayInvoiceRequest=si,t.PaymentCardService=Ap,t.PaymentMethodService=Ep,t.PaymentService=Op,t.PrepareRetailPaymentRequest=Hn,t.PrepareRetailPaymentResponse=Wn,t.PricingPlanService=mc,t.ProductSummary=de,t.ProductSummaryService=Dp,t.PurchaseService=_p,t.REPUTATION_MANGEMENT_SKU="RM",t.RecurringInvoiceBundle=Kp,t.RecurringInvoiceLineItem=zp,t.RecurringInvoiceService=ed,t.RefundApiService=Ja,t.RefundService=Up,t.ResetContractPricingRequest=Ft,t.RetailCustomerConfigurationService=Tu,t.RetailPayout=Ci,t.RetryPurchaseRequest=ar,t.RevenueApiService=qc,t.SNAPSHOT_REPORT_REFRESH_SKU="snapshotreportrefresh",t.SNAPSHOT_REPORT_SKU="ST",t.SalesCreditNoteService=rd,t.SalesInvoiceService=pd,t.SearchMerchantsRequest=$i,t.SearchMerchantsResponse=tn,t.SendInvoiceRequest=ui,t.SetAutoChargeInvoicesRequest=en,t.SetAutoPostInvoicesRequest=nn,t.SetDefaultBankAccountRequest=$t,t.SetDefaultPaymentCardRequest=on,t.SetHasAlternativePaymentMethodRequest=rn,t.SetIncludeInFinancialRecordsRequest=sn,t.SetWholesaleProductStrategyRequest=ua,t.SetWholesaleProductVolumeCommitmentRequest=pa,t.StartRevRecTemplateBackfillRequest=da,t.StripeFileService=ld,t.SubscriptionService=xc,t.TaxRateService=vd,t.UpdateInvoiceRequest=mi,t.UpdateInvoiceResponse=vi,t.UpdateLineItemRequest=fi,t.UpdateLineItemResponse=gi,t.UpdateMerchantRequest=an,t.UpdatePaymentCardRequest=uo,t.UpdateProductRequest=Wo,t.UpdateTaxRequest=Me,t.UpsertRetailPricingRequest=ha,t.UpsertRetailPricingRequestPricingEntry=sa,t.ValidateResponse=Hr,t.VoidInvoiceRequest=Ii,t.VoidPurchaseRequest=cr,t.WholesalePricingService=sc,t.appliedCreditFromAPI=Xc,t.appliedCreditTypeFromAPI=Qc,t.appliedDiscountFromApi=xa,t.appliedTaxRateFromAPI=Zc,t.billingStrategyFromAPI=Ya,t.billingStrategyToAPI=Ga,t.collectionMethodFromApi=Su,t.collectionMethodToApi=yu,t.contractFromApi=au,t.convertApiAppliedBundle=s,t.currencyFromApi=qa,t.currencyPricingMapToApi=ic,t.disputeFromApi=Gu,t.disputeStatusFromApi=Vu,t.enumStringToValue=Bs,t.frequencyFromApi=Wa,t.frequencyFromLegacyApi=Ha,t.frequencyToApi=Va,t.isBillingStrategyInstant=function(e){return e===t.BillingStrategy.Instantly||e===t.BillingStrategy.EndOfDay},t.listProductsFilterToApi=du,t.paymentAllocationFromApi=Zu,t.paymentAllocationTypeFromApi=Xu,t.paymentFromApi=Qu,t.paymentSourceFromApi=zu,t.paymentStatusFromApi=Ku,t.pricesFromApi=tc,t.pricingPlanFromAPI=ac,t.pricingPlanProductFromApi=ec,t.pricingPlanProductPricingToApi=oc,t.productFromApi=pu,t.productPricingFromApi=$a,t.productPricingRulesFromApi=za,t.productPricingRulesToApi=nc,t.productPricingTypeFromApi=Ka,t.productPricingTypeToApi=Xa,t.purchaseCostFromAPI=Za,t.purchaseFromApi=zc,t.purchaseItemFromApi=Kc,t.purchaseStatusFromApi=Vc,t.reasonFromApi=Np,t.reasonToApi=Jp,t.referenceFromApi=jp,t.refundFromApi=Mp,t.retailCustomerConfigurationFromApi=Pu,t.retailPaymentFromApi=yp,t.retailPaymentStatusFromApi=Pp,t.retailResponseFromAPI=Tp,t.setActivated=function(t){return{activated:t}},t.setCreditLimit=function(t){return{creditLimit:t}},t.setCurrencyCode=function(t){return{currencyCode:t}},t.setDimension=function(t){return{dimension:t}},t.setEnd=function(t){return{end:t}},t.setModified=function(t){return{modified:t}},t.setNetD=function(t){return{netD:t}},t.setSigned=function(t){return{signed:t}},t.setStatus=function(t){return{status:t}},t.setSubscriptionId=function(t){return{subscriptionId:t}},t.statusFromApi=wp,t.subscriptionMetricByGroupFromAPI=Cp,t.subscriptionMetricFromAPI=Rp,Object.defineProperty(t,"__esModule",{value:!0})}));
16
16
  //# sourceMappingURL=vendasta-billing.umd.min.js.map