@vendasta/billing 6.4.0 → 8.1.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.
- package/bundles/vendasta-billing.umd.js +37 -75
- package/bundles/vendasta-billing.umd.js.map +1 -1
- package/bundles/vendasta-billing.umd.min.js +2 -2
- package/bundles/vendasta-billing.umd.min.js.map +1 -1
- package/esm2015/lib/_generated/host.service.js +1 -1
- package/esm2015/lib/_generated/index.js +1 -1
- package/esm2015/lib/_internal/bank-reconciliation.api.service.js +1 -1
- package/esm2015/lib/_internal/billing.api.service.js +1 -1
- package/esm2015/lib/_internal/bundle.api.service.js +1 -1
- package/esm2015/lib/_internal/contract-document.api.service.js +1 -1
- package/esm2015/lib/_internal/contract.api.service.js +1 -1
- package/esm2015/lib/_internal/credit.api.service.js +1 -1
- package/esm2015/lib/_internal/discount.api.service.js +1 -1
- package/esm2015/lib/_internal/enums/applied-discount.enum.js +1 -1
- package/esm2015/lib/_internal/enums/card.enum.js +1 -1
- package/esm2015/lib/_internal/enums/contract.enum.js +1 -1
- package/esm2015/lib/_internal/enums/currency.enum.js +1 -1
- package/esm2015/lib/_internal/enums/frequency.enum.js +1 -1
- package/esm2015/lib/_internal/enums/index.js +1 -1
- package/esm2015/lib/_internal/enums/invoice.enum.js +1 -1
- package/esm2015/lib/_internal/enums/merchant-report.enum.js +1 -1
- package/esm2015/lib/_internal/enums/merchant.enum.js +1 -1
- package/esm2015/lib/_internal/enums/month.enum.js +1 -1
- package/esm2015/lib/_internal/enums/payment-card.enum.js +1 -1
- package/esm2015/lib/_internal/enums/payment.enum.js +1 -1
- package/esm2015/lib/_internal/enums/payout.enum.js +1 -1
- package/esm2015/lib/_internal/enums/pricing-plan.enum.js +1 -1
- package/esm2015/lib/_internal/enums/product-summary.enum.js +1 -1
- package/esm2015/lib/_internal/enums/product.enum.js +1 -1
- package/esm2015/lib/_internal/enums/purchase.enum.js +1 -1
- package/esm2015/lib/_internal/enums/refund.enum.js +1 -1
- package/esm2015/lib/_internal/enums/sales-credit-note.enum.js +1 -1
- package/esm2015/lib/_internal/enums/sales-invoice.enum.js +1 -1
- package/esm2015/lib/_internal/enums/sort-direction.enum.js +1 -1
- package/esm2015/lib/_internal/enums/subscribe-validation.enum.js +1 -1
- package/esm2015/lib/_internal/enums/subscription.enum.js +1 -1
- package/esm2015/lib/_internal/index.js +1 -1
- package/esm2015/lib/_internal/interfaces/api.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/applied-bundle.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/applied-discount.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/applied-tax-rate.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/balance.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/billable-item.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/bundle.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/card.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/commitment.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/common.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/contract-document.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/contract.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/credit.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/currency.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/customer-summary.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/date-range.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/discount.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/external-account.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/field-mask.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/frequency.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/index.js +1 -1
- package/esm2015/lib/_internal/interfaces/invoice-template.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/invoice.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/merchant-report.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/merchant.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/metered-component.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/month.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/payment-card.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/payment.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/payout.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/pricing-plan-product.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/pricing-plan.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/product-pricing.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/product-summary.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/product.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/purchase.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/refund.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/retail-customer-configuration.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/sales-credit-note.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/sales-invoice.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/sort-direction.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/subscribe-validation.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/subscription.interface.js +1 -1
- package/esm2015/lib/_internal/interfaces/tax-rate.interface.js +1 -1
- package/esm2015/lib/_internal/invoice-template.api.service.js +1 -1
- package/esm2015/lib/_internal/invoice.api.service.js +1 -1
- package/esm2015/lib/_internal/merchant.api.service.js +1 -1
- package/esm2015/lib/_internal/objects/api.js +1 -1
- package/esm2015/lib/_internal/objects/applied-bundle.js +1 -1
- package/esm2015/lib/_internal/objects/applied-discount.js +1 -1
- package/esm2015/lib/_internal/objects/applied-tax-rate.js +1 -1
- package/esm2015/lib/_internal/objects/balance.js +1 -1
- package/esm2015/lib/_internal/objects/billable-item.js +7 -1
- package/esm2015/lib/_internal/objects/bundle.js +1 -1
- package/esm2015/lib/_internal/objects/card.js +1 -1
- package/esm2015/lib/_internal/objects/commitment.js +1 -1
- package/esm2015/lib/_internal/objects/common.js +1 -1
- package/esm2015/lib/_internal/objects/contract-document.js +1 -1
- package/esm2015/lib/_internal/objects/contract.js +1 -1
- package/esm2015/lib/_internal/objects/credit.js +1 -1
- package/esm2015/lib/_internal/objects/currency.js +1 -1
- package/esm2015/lib/_internal/objects/customer-summary.js +1 -1
- package/esm2015/lib/_internal/objects/date-range.js +1 -1
- package/esm2015/lib/_internal/objects/discount.js +1 -1
- package/esm2015/lib/_internal/objects/external-account.js +1 -1
- package/esm2015/lib/_internal/objects/field-mask.js +1 -1
- package/esm2015/lib/_internal/objects/frequency.js +1 -1
- package/esm2015/lib/_internal/objects/index.js +1 -1
- package/esm2015/lib/_internal/objects/invoice-template.js +1 -1
- package/esm2015/lib/_internal/objects/invoice.js +1 -1
- package/esm2015/lib/_internal/objects/merchant-report.js +1 -1
- package/esm2015/lib/_internal/objects/merchant.js +1 -1
- package/esm2015/lib/_internal/objects/metered-component.js +1 -1
- package/esm2015/lib/_internal/objects/month.js +1 -1
- package/esm2015/lib/_internal/objects/payment-card.js +1 -1
- package/esm2015/lib/_internal/objects/payment.js +1 -1
- package/esm2015/lib/_internal/objects/payout.js +1 -1
- package/esm2015/lib/_internal/objects/pricing-plan-product.js +1 -1
- package/esm2015/lib/_internal/objects/pricing-plan.js +1 -1
- package/esm2015/lib/_internal/objects/product-pricing.js +1 -1
- package/esm2015/lib/_internal/objects/product-summary.js +1 -1
- package/esm2015/lib/_internal/objects/product.js +1 -1
- package/esm2015/lib/_internal/objects/purchase.js +1 -1
- package/esm2015/lib/_internal/objects/refund.js +1 -1
- package/esm2015/lib/_internal/objects/retail-customer-configuration.js +1 -1
- package/esm2015/lib/_internal/objects/sales-credit-note.js +1 -1
- package/esm2015/lib/_internal/objects/sales-invoice.js +1 -1
- package/esm2015/lib/_internal/objects/sort-direction.js +1 -1
- package/esm2015/lib/_internal/objects/subscribe-validation.js +1 -1
- package/esm2015/lib/_internal/objects/subscription.js +25 -1
- package/esm2015/lib/_internal/objects/tax-rate.js +1 -1
- package/esm2015/lib/_internal/payment-method.api.service.js +1 -1
- package/esm2015/lib/_internal/payment.api.service.js +1 -1
- package/esm2015/lib/_internal/pricing.api.service.js +1 -1
- package/esm2015/lib/_internal/product-summary.api.service.js +1 -1
- package/esm2015/lib/_internal/product.api.service.js +1 -1
- package/esm2015/lib/_internal/purchase.api.service.js +1 -1
- package/esm2015/lib/_internal/refund.api.service.js +1 -1
- package/esm2015/lib/_internal/retail-customer-configuration.api.service.js +1 -1
- package/esm2015/lib/_internal/sales-credit-note.api.service.js +1 -1
- package/esm2015/lib/_internal/sales-invoice.api.service.js +1 -1
- package/esm2015/lib/_internal/tax.api.service.js +1 -1
- package/esm2015/lib/_internal/vendor.api.service.js +1 -1
- package/esm2015/lib/applied_bundle/applied_bundle.js +1 -1
- package/esm2015/lib/applied_bundle/index.js +1 -1
- package/esm2015/lib/applied_discount/applied_discount.js +1 -1
- package/esm2015/lib/applied_discount/index.js +1 -1
- package/esm2015/lib/bank_account/bank-account.service.js +1 -1
- package/esm2015/lib/bank_account/bank_account.js +1 -1
- package/esm2015/lib/bank_account/index.js +1 -1
- package/esm2015/lib/bank_reconciliation/bank-reconciliation.service.js +1 -1
- package/esm2015/lib/bank_reconciliation/index.js +1 -1
- package/esm2015/lib/bank_reconciliation/payout.js +1 -1
- package/esm2015/lib/billable-item/billable-item.js +3 -2
- package/esm2015/lib/billable-item/billable-item.service.js +1 -1
- package/esm2015/lib/billable-item/index.js +1 -1
- package/esm2015/lib/billing-host.service.js +1 -1
- package/esm2015/lib/billing.service.js +1 -1
- package/esm2015/lib/bundle/bundle.js +1 -1
- package/esm2015/lib/bundle/bundle.service.js +1 -1
- package/esm2015/lib/bundle/index.js +1 -1
- package/esm2015/lib/contract/contract.js +1 -1
- package/esm2015/lib/contract/contract.service.js +1 -1
- package/esm2015/lib/contract/dimension.js +1 -1
- package/esm2015/lib/contract/index.js +1 -2
- package/esm2015/lib/contract/mutations.js +1 -1
- package/esm2015/lib/contract-document/contract-document.js +1 -1
- package/esm2015/lib/contract-document/contract-document.service.js +1 -1
- package/esm2015/lib/contract-document/index.js +1 -1
- package/esm2015/lib/contract-document/list-contract-document.js +1 -1
- package/esm2015/lib/core/index.js +1 -1
- package/esm2015/lib/core/paged-response.js +1 -1
- package/esm2015/lib/core/sort-direction.js +1 -1
- package/esm2015/lib/credit/credit.js +1 -1
- package/esm2015/lib/credit/credit.service.js +1 -1
- package/esm2015/lib/credit/index.js +1 -1
- package/esm2015/lib/customer_summary/customer-summary.js +1 -1
- package/esm2015/lib/discount/discount.js +1 -1
- package/esm2015/lib/discount/discount.service.js +1 -1
- package/esm2015/lib/discount/discount_type.js +1 -1
- package/esm2015/lib/discount/index.js +1 -1
- package/esm2015/lib/discount/list-discount.js +1 -1
- package/esm2015/lib/http-shared/error-handlers.js +1 -1
- package/esm2015/lib/index.js +1 -1
- package/esm2015/lib/invoice/index.js +1 -1
- package/esm2015/lib/invoice/invoice.js +1 -1
- package/esm2015/lib/invoice/invoice.service.js +1 -1
- package/esm2015/lib/invoice/list-invoice.js +1 -1
- package/esm2015/lib/invoice-template/index.js +1 -1
- package/esm2015/lib/invoice-template/invoice-template.js +1 -1
- package/esm2015/lib/invoice-template/invoice-template.service.js +2 -3
- package/esm2015/lib/merchant/balance.js +1 -1
- package/esm2015/lib/merchant/index.js +1 -1
- package/esm2015/lib/merchant/merchant.interface.js +1 -1
- package/esm2015/lib/merchant/merchant.js +1 -1
- package/esm2015/lib/merchant/merchant.service.js +1 -1
- package/esm2015/lib/merchant/payout-summary.js +1 -1
- package/esm2015/lib/merchant/retail-configuration.js +1 -1
- package/esm2015/lib/merchant-report/index.js +1 -1
- package/esm2015/lib/merchant-report/merchant-report-status.js +1 -1
- package/esm2015/lib/merchant-report/merchant-report.interfaces.js +1 -1
- package/esm2015/lib/merchant-report/merchant-report.js +1 -1
- package/esm2015/lib/merchant-report/merchant-report.service.js +1 -1
- package/esm2015/lib/payment/dispute.js +1 -1
- package/esm2015/lib/payment/index.js +1 -1
- package/esm2015/lib/payment/payment-allocation-type.js +1 -1
- package/esm2015/lib/payment/payment-source.js +1 -1
- package/esm2015/lib/payment/payment-status.js +1 -1
- package/esm2015/lib/payment/payment.js +1 -1
- package/esm2015/lib/payment/payment.service.js +1 -1
- package/esm2015/lib/payment/retail-payment.js +1 -1
- package/esm2015/lib/payment/retail-status.js +1 -1
- package/esm2015/lib/payment-card/index.js +1 -1
- package/esm2015/lib/payment-card/payment-card.js +1 -1
- package/esm2015/lib/payment-card/payment-card.service.js +1 -1
- package/esm2015/lib/payment-method/index.js +1 -1
- package/esm2015/lib/payment-method/payment-method.service.js +1 -1
- package/esm2015/lib/pricing/billing-strategy.js +1 -1
- package/esm2015/lib/pricing/commitment.js +1 -1
- package/esm2015/lib/pricing/currency.js +1 -1
- package/esm2015/lib/pricing/frequency.js +1 -1
- package/esm2015/lib/pricing/index.js +1 -1
- package/esm2015/lib/pricing/list-pricing-plan-product-filter.js +1 -1
- package/esm2015/lib/pricing/pricing-plan-product.js +1 -1
- package/esm2015/lib/pricing/pricing-plan.js +1 -1
- package/esm2015/lib/pricing/pricing-plan.service.js +1 -1
- package/esm2015/lib/pricing/product-pricing-rules.js +1 -1
- package/esm2015/lib/pricing/product-pricing-type.js +1 -1
- package/esm2015/lib/pricing/product-pricing.js +1 -1
- package/esm2015/lib/pricing/wholesale-pricing.service.js +1 -1
- package/esm2015/lib/product/index.js +1 -1
- package/esm2015/lib/product/list-products.js +1 -1
- package/esm2015/lib/product/product.js +1 -1
- package/esm2015/lib/product-summary/index.js +1 -1
- package/esm2015/lib/product-summary/product-summary.service.js +1 -1
- package/esm2015/lib/product-summary/subscription-retention.js +1 -1
- package/esm2015/lib/purchase/index.js +1 -1
- package/esm2015/lib/purchase/list-purchases.js +1 -1
- package/esm2015/lib/purchase/purchase.js +1 -1
- package/esm2015/lib/purchase/purchase.service.js +1 -1
- package/esm2015/lib/purchase/purchase_status.js +1 -1
- package/esm2015/lib/refund/index.js +1 -1
- package/esm2015/lib/refund/refund.js +1 -1
- package/esm2015/lib/refund/refund.service.js +1 -1
- package/esm2015/lib/retail-customer-configuration/index.js +1 -1
- package/esm2015/lib/retail-customer-configuration/retail-customer-configuration.js +1 -1
- package/esm2015/lib/retail-customer-configuration/retail-customer-configuration.service.js +1 -1
- package/esm2015/lib/revenue/index.js +1 -1
- package/esm2015/lib/revenue/revenue.interfaces.js +1 -1
- package/esm2015/lib/revenue/revenue.service.js +1 -1
- package/esm2015/lib/sales-credit-note/index.js +1 -1
- package/esm2015/lib/sales-credit-note/sales-credit-note.js +1 -1
- package/esm2015/lib/sales-credit-note/sales-credit-note.service.js +1 -1
- package/esm2015/lib/sales-invoice/index.js +1 -1
- package/esm2015/lib/sales-invoice/sales-invoice.js +1 -1
- package/esm2015/lib/sales-invoice/sales-invoice.service.js +1 -1
- package/esm2015/lib/sku.js +1 -1
- package/esm2015/lib/stripe-file/file.js +1 -1
- package/esm2015/lib/stripe-file/index.js +1 -1
- package/esm2015/lib/stripe-file/purpose.js +1 -1
- package/esm2015/lib/stripe-file/stripe-file.service.js +1 -1
- package/esm2015/lib/subscription/can-create-subscriptions-item.js +1 -1
- package/esm2015/lib/subscription/index.js +1 -1
- package/esm2015/lib/tax-rate/index.js +1 -1
- package/esm2015/lib/tax-rate/tax-rate.js +1 -1
- package/esm2015/lib/tax-rate/tax-rate.service.js +1 -1
- package/esm2015/public_api.js +1 -1
- package/esm2015/vendasta-billing.js +1 -1
- package/fesm2015/vendasta-billing.js +34 -71
- package/fesm2015/vendasta-billing.js.map +1 -1
- package/lib/_internal/interfaces/billable-item.interface.d.ts +1 -0
- package/lib/_internal/interfaces/subscription.interface.d.ts +4 -0
- package/lib/_internal/objects/billable-item.d.ts +1 -0
- package/lib/_internal/objects/subscription.d.ts +4 -0
- package/lib/billable-item/billable-item.d.ts +1 -0
- package/lib/contract/index.d.ts +0 -1
- package/lib/invoice-template/invoice-template.service.d.ts +1 -1
- package/package.json +1 -1
- package/esm2015/lib/contract/contract-pricing/billed-product.js +0 -50
- package/esm2015/lib/contract/contract-pricing/billing-model.js +0 -10
- package/esm2015/lib/contract/contract-pricing/index.js +0 -4
- package/esm2015/lib/contract/contract-pricing/product-category.js +0 -9
- package/lib/contract/contract-pricing/billed-product.d.ts +0 -46
- package/lib/contract/contract-pricing/billing-model.d.ts +0 -8
- package/lib/contract/contract-pricing/index.d.ts +0 -3
- package/lib/contract/contract-pricing/product-category.d.ts +0 -7
|
@@ -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"),require("@vendasta/core/shared")):"function"==typeof define&&define.amd?define("@vendasta/billing",["exports","@angular/core","@angular/common/http","@vendasta/core","rxjs/operators","rxjs","@vendasta/core/shared"],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,t.shared)}(this,(function(t,e,i,n,o,r,s){"use strict";function a(t){return t?{bundleId:t.bundleId,bundleInstanceId:t.bundleInstanceId,name:t.name,hideBundleItems:t.hideBundleItems||!1}:null}var 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,H;(c=t.GeneratedFrequency||(t.GeneratedFrequency={}))[c.INVALID=0]="INVALID",c[c.MONTHLY=1]="MONTHLY",c[c.YEARLY=2]="YEARLY",c[c.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"}(u||(u={})),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"}(p||(p={})),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"}(d||(d={})),(h=t.ProductSummaryBillingStrategy||(t.ProductSummaryBillingStrategy={}))[h.CHARGE_AT_END_OF_BILLING_PERIOD=0]="CHARGE_AT_END_OF_BILLING_PERIOD",h[h.CHARGE_AT_START_OF_BILLING_PERIOD=1]="CHARGE_AT_START_OF_BILLING_PERIOD",h[h.CHARGE_INSTANTLY=2]="CHARGE_INSTANTLY",h[h.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"}(l||(l={})),(m=t.ProductType||(t.ProductType={}))[m.BUNDLE=0]="BUNDLE",m[m.FEE=1]="FEE",m[m.PRODUCT=2]="PRODUCT",m[m.SUBSCRIPTION=3]="SUBSCRIPTION",m[m.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"}(v||(v={})),function(t){t[t.CREATED=0]="CREATED"}(f||(f={})),function(t){t[t.DRAFT=0]="DRAFT",t[t.DUE=1]="DUE",t[t.PAID=2]="PAID",t[t.VOID=3]="VOID"}(g||(g={})),(I=t.PayoutStatus||(t.PayoutStatus={}))[I.PAYOUT_STATUS_NOT_SET=0]="PAYOUT_STATUS_NOT_SET",I[I.PAYOUT_STATUS_PAID=1]="PAYOUT_STATUS_PAID",I[I.PAYOUT_STATUS_PENDING=2]="PAYOUT_STATUS_PENDING",I[I.PAYOUT_STATUS_IN_TRANSIT=3]="PAYOUT_STATUS_IN_TRANSIT",I[I.PAYOUT_STATUS_CANCELED=4]="PAYOUT_STATUS_CANCELED",I[I.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"}(y||(y={})),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"}(S||(S={})),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"}(P||(P={})),function(t){t[t.FAILED=0]="FAILED",t[t.PENDING=1]="PENDING",t[t.COMPLETED=2]="COMPLETED"}(b||(b={})),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"}(T||(T={})),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"}(O||(O={})),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"}(E||(E={})),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"}(R||(R={})),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"}(D||(D={})),(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",(_=t.CARD_TYPE||(t.CARD_TYPE={}))[_.UNKNOWN=0]="UNKNOWN",_[_.VISA=1]="VISA",_[_.MASTERCARD=2]="MASTERCARD",_[_.AMEX=3]="AMEX",_[_.DISCOVER=4]="DISCOVER",_[_.JCB=5]="JCB",_[_.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||(J={})),(w=t.PricingPlanBillingStrategy||(t.PricingPlanBillingStrategy={}))[w.BILLING_STRATEGY_NONE=0]="BILLING_STRATEGY_NONE",w[w.BILLING_STRATEGY_END_OF_PERIOD=1]="BILLING_STRATEGY_END_OF_PERIOD",w[w.BILLING_STRATEGY_START_OF_PERIOD=2]="BILLING_STRATEGY_START_OF_PERIOD",w[w.BILLING_STRATEGY_INSTANTLY=3]="BILLING_STRATEGY_INSTANTLY",w[w.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"}(j||(j={})),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"}(N||(N={})),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"}(U||(U={})),(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",(B=t.State||(t.State={}))[B.LIST_PURCHASE_REQUEST_STATE_ALL=0]="LIST_PURCHASE_REQUEST_STATE_ALL",B[B.LIST_PURCHASE_REQUEST_STATE_OVERDUE=1]="LIST_PURCHASE_REQUEST_STATE_OVERDUE",(k=t.ReferenceTypeEnum||(t.ReferenceTypeEnum={}))[k.PURCHASE=0]="PURCHASE",k[k.PURCHASE_ITEM=1]="PURCHASE_ITEM",k[k.INVOICE=2]="INVOICE",(F=t.RefundReasonEnum||(t.RefundReasonEnum={}))[F.REQUESTED_BY_CUSTOMER=0]="REQUESTED_BY_CUSTOMER",F[F.DUPLICATE=1]="DUPLICATE",F[F.FRAUDULENT=2]="FRAUDULENT",(x=t.RefundStatusEnum||(t.RefundStatusEnum={}))[x.SUCCEEDED=0]="SUCCEEDED",x[x.FAILED=1]="FAILED",x[x.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"}(L||(L={})),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"}(Y||(Y={})),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"}(q||(q={})),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={})),(W=t.SubscribeValidationStatus||(t.SubscribeValidationStatus={}))[W.SUBSCRIBE_VALIDATION_STATUS_UNSET=0]="SUBSCRIBE_VALIDATION_STATUS_UNSET",W[W.SUBSCRIBE_VALIDATION_STATUS_CANNOT_INSTANT_BILL=1]="SUBSCRIBE_VALIDATION_STATUS_CANNOT_INSTANT_BILL",W[W.SUBSCRIBE_VALIDATION_STATUS_MISSING_MERCHANT_INFO=2]="SUBSCRIBE_VALIDATION_STATUS_MISSING_MERCHANT_INFO",W[W.SUBSCRIBE_VALIDATION_STATUS_MISSING_PAYMENT_INFO=3]="SUBSCRIBE_VALIDATION_STATUS_MISSING_PAYMENT_INFO",W[W.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={}));var 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),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}(),z=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 K(t,e){return"number"==typeof e?e:t[e]}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.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}(),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),e.items&&(i.items=e.items.map(ut.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}(),Z=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}(),$=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=K(t.GeneratedFrequency,i.frequency)),i.nextRenewal&&(n.nextRenewal=new Date(i.nextRenewal)),i.customerAddress&&(n.customerAddress=et.fromProto(i.customerAddress)),i.customUnitPrice&&(n.customUnitPrice=parseInt(i.customUnitPrice,10)),i.retailFrequency&&(n.retailFrequency=K(t.GeneratedFrequency,i.retailFrequency)),i.nextRetailRenewal&&(n.nextRetailRenewal=new Date(i.nextRetailRenewal)),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),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)},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}(),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.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}(),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.sku&&(t.sku=this.sku),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.orderId&&(t.orderId=this.orderId),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.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}(),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.skus&&(t.skus=this.skus),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),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.item&&(i.item=$.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}(),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.subscriptionKeys&&(i.subscriptionKeys=e.subscriptionKeys.map(pt.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}(),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.subscriptions&&(i.subscriptions=e.subscriptions.map($.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}(),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.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}(),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.sku&&(t.sku=this.sku),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.orderId&&(t.orderId=this.orderId),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.filters&&(i.filters=ot.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=V.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}(),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.items&&(i.items=e.items.map($.fromProto)),e.pagingMetadata&&(i.pagingMetadata=z.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 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.type&&(o.type=(i=u,"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 mt(t,e){return"number"==typeof e?e:t[e]}var 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(ft.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}(),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.discountType&&(i.discountType=mt(u,e.discountType)),e.discountAmount&&(i.discountAmount=parseInt(e.discountAmount,10)),e.quantity&&(i.quantity=parseInt(e.quantity,10)),e.price&&(i.price=bt.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}(),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.prices&&(i.prices=e.prices.map(Tt.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}(),It=(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=vt.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}()),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)},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}(),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.bundles&&(i.bundles=Object.keys(e.bundles).reduce((function(t,i){return t[i]=vt.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}(),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.filters&&(i.filters=It.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=V.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}(),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.bundles&&(i.bundles=e.bundles.map(vt.fromProto)),e.pagingMetadata&&(i.pagingMetadata=z.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}(),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.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}(),Tt=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=mt(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}(),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.items&&(i.items=e.items.map(ft.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 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.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 Rt(t,e){return"number"==typeof e?e:t[e]}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.netD&&(i.netD=parseInt(e.netD,10)),e.created&&(i.created=new Date(e.created)),e.currency&&(i.currency=Rt(p,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=Rt(d,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}(),Ct=(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=Dt.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}()),_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.contract&&(i.contract=Dt.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}(),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=Dt.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.merchantIds&&(t.merchantIds=this.merchantIds),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.contracts&&(i.contracts=Object.keys(e.contracts).reduce((function(t,i){return t[i]=Dt.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}(),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.pagingOptions&&(i.pagingOptions=V.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}(),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.contracts&&(i.contracts=e.contracts.map(Dt.fromProto)),e.pagingMetadata&&(i.pagingMetadata=z.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}(),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.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}(),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),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.mutations&&(i.mutations=e.mutations.map(Bt.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}(),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.contract&&(i.contract=Dt.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}(),Lt=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=Rt(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 Yt=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=p,"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}(),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.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}(),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.customerSummaries&&(i.customerSummaries=e.customerSummaries.map(Yt.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 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.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}(),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.stripeToken&&(t.stripeToken=this.stripeToken),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),void 0!==this.bankAccountId&&(t.bankAccountId=this.bankAccountId),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)},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.bankAccount&&(i.bankAccount=e.bankAccount.map(Wt.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}(),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}();function Qt(t,e){return"number"==typeof e?e:t[e]}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),e.type&&(i.type=Qt(l,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}(),$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.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}(),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.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}(),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.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}(),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.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}(),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.results&&(i.results=e.results.map(ce.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}(),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.metricsByGroup&&(i.metricsByGroup=e.metricsByGroup.map(de.fromProto)),e.pagingMetadata&&(i.pagingMetadata=z.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}(),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.subscriptionMetrics&&(i.subscriptionMetrics=e.subscriptionMetrics.map(ue.fromProto)),e.pagingMetadata&&(i.pagingMetadata=z.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}(),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.filters&&(i.filters=$t.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=V.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}(),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.type&&(i.type=Qt(v,e.type)),e.rules&&(i.rules=e.rules.map(pe.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}(),ce=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=ae.fromProto(i.pricing)),i.discounts&&(n.discounts=i.discounts.map(Zt.fromProto)),i.billingStrategy&&(n.billingStrategy=Qt(t.ProductSummaryBillingStrategy,i.billingStrategy)),i.productType&&(n.productType=Qt(t.ProductType,i.productType)),i.frequency&&(n.frequency=Qt(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}(),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.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}(),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.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}(),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.subscriptionMetrics&&(i.subscriptionMetrics=e.subscriptionMetrics.map(ue.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 he(t,e){return"number"==typeof e?e:t[e]}var 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.discountType&&(i.discountType=he(u,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}(),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.discountId&&(i.discountId=parseInt(e.discountId,10)),e.discountType&&(i.discountType=he(u,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}(),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.id&&(t.id=this.id),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.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}(),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.filters&&(i.filters=fe.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=V.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}(),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.discounts&&(i.discounts=e.discounts.map(me.fromProto)),e.pagingMetadata&&(i.pagingMetadata=z.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}(),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.discountType&&(i.discountType=he(u,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 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.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 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.paths&&(t.paths=this.paths),t},t}();var 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)},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}(),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.customerId&&(t.customerId=this.customerId),void 0!==this.amount&&(t.amount=this.amount),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.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}(),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.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}(),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.includeArchived&&(t.includeArchived=this.includeArchived),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)},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}(),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.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}(),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.filters&&(i.filters=Ee.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=V.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}(),_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.taxRates&&(i.taxRates=e.taxRates.map(Je.fromProto)),e.pagingMetadata&&(i.pagingMetadata=z.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}(),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.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 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.bundleItems&&(i.bundleItems=e.bundleItems.map(Ne.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}(),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.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 Ue(t,e){return"number"==typeof e?e:t[e]}var 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.invoiceId&&(t.invoiceId=this.invoiceId),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.bundleId&&(t.bundleId=this.bundleId),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.invoice&&(i.invoice=$e.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}(),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.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}(),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.invoice&&(i.invoice=$e.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}(),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.invoiceId&&(t.invoiceId=this.invoiceId),void 0!==this.paymentMethodId&&(t.paymentMethodId=this.paymentMethodId),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.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}(),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.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)},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}(),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.dateField&&(i.dateField=Ue(f,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}(),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),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.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),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.invoice&&(i.invoice=$e.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)},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.invoiceId&&(t.invoiceId=this.invoiceId),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.statuses&&(i.statuses=e.statuses.map((function(t){return Ue(g,t)}))),e.dateFilter&&(i.dateFilter=Ge.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}(),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),e.invoice&&(i.invoice=$e.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}(),$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.status&&(i.status=Ue(g,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(ti.fromProto)),e.currency&&(i.currency=Ue(p,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(Ae.fromProto)),e.defaultTaxRates&&(i.defaultTaxRates=e.defaultTaxRates.map(Je.fromProto)),e.appliedBundles&&(i.appliedBundles=e.appliedBundles.map(je.fromProto)),e.amountDiscount&&(i.amountDiscount=parseInt(e.amountDiscount,10)),e.voided&&(i.voided=new Date(e.voided)),e.customerAddress&&(i.customerAddress=qe.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}(),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.amount&&(i.amount=parseInt(e.amount,10)),e.total&&(i.total=parseInt(e.total,10)),e.appliedTaxes&&(i.appliedTaxes=e.appliedTaxes.map(Ae.fromProto)),e.taxRates&&(i.taxRates=e.taxRates.map(Je.fromProto)),e.discounts&&(i.discounts=e.discounts.map(lt.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}(),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.filters&&(i.filters=Xe.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=V.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}(),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.invoices&&(i.invoices=e.invoices.map($e.fromProto)),e.pagingMetadata&&(i.pagingMetadata=z.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}(),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.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),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)},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}(),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.invoice&&(i.invoice=$e.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}(),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.emailAddresses&&(t.emailAddresses=this.emailAddresses),void 0!==this.languageCode&&(t.languageCode=this.languageCode),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.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}(),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=$e.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.invoiceId&&(t.invoiceId=this.invoiceId),void 0!==this.merchantId&&(t.merchantId=this.merchantId),void 0!==this.taxRateIds&&(t.taxRateIds=this.taxRateIds),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=$e.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}(),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=$e.fromProto(e.invoice)),e.fieldMask&&(i.fieldMask=Se.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}(),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.invoice&&(i.invoice=$e.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}(),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.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}(),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=$e.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}(),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.invoiceId&&(t.invoiceId=this.invoiceId),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.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 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.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 Ii(t,e){return"number"==typeof e?e:t[e]}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.arrivalDateRange&&(i.arrivalDateRange=gi.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}(),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.filters&&(i.filters=yi.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=V.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}(),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),e.payouts&&(i.payouts=e.payouts.map(Pi.fromProto)),e.pagingMetadata&&(i.pagingMetadata=z.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}(),Pi=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=Ii(p,i.currency)),i.status&&(n.status=Ii(t.PayoutStatus,i.status)),i.type&&(n.type=Ii(y,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}(),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.bankReconciliationId&&(t.bankReconciliationId=this.bankReconciliationId),void 0!==this.payoutId&&(t.payoutId=this.payoutId),void 0!==this.allowRetries&&(t.allowRetries=this.allowRetries),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.pipelineId&&(t.pipelineId=this.pipelineId),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.status&&(n.status=Ii(t.PayoutStatus,i.status)),i.type&&(n.type=Ii(y,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 Ei(t,e){return"number"==typeof e?e:t[e]}var 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.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}(),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.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}(),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.stripeUrl&&(t.stripeUrl=this.stripeUrl),void 0!==this.error&&(t.error=this.error),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.includeInFinancialRecords&&(i.includeInFinancialRecords=Wi.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}(),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)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),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.merchant&&(i.merchant=zi.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}(),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.merchantId&&(t.merchantId=this.merchantId),void 0!==this.retailGroupIds&&(t.retailGroupIds=this.retailGroupIds),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.retailConfigurations&&(i.retailConfigurations=Object.keys(e.retailConfigurations).reduce((function(t,i){return t[i]=Ki.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}(),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}(),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.outstandingBalance&&(i.outstandingBalance=parseInt(e.outstandingBalance,10)),e.currency&&(i.currency=Ei(p,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}(),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}(),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.balances&&(i.balances=e.balances.map(fi.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}(),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)},t.prototype.toApiJson=function(){var t={};return void 0!==this.merchantId&&(t.merchantId=this.merchantId),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.balances&&(i.balances=e.balances.map(fi.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}(),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)},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}(),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.payout&&(i.payout=Oi.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}(),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)},t.prototype.toApiJson=function(){var t={};return void 0!==this.includeInFinancialRecords&&(t.includeInFinancialRecords=this.includeInFinancialRecords),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.pagingOptions&&(i.pagingOptions=V.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}(),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.payouts&&(i.payouts=e.payouts.map(Oi.fromProto)),e.pagingMetadata&&(i.pagingMetadata=z.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}(),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.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}(),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.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}(),Xi=(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=Ki.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=Ei(S,e.sortBy)),e.sortDirection&&(i.sortDirection=Ei(A,e.sortDirection)),e.pagingOptions&&(i.pagingOptions=V.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}()),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.merchants&&(i.merchants=e.merchants.map(zi.fromProto)),e.pagingMetadata&&(i.pagingMetadata=z.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}(),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.autoChargeInvoices&&(t.autoChargeInvoices=this.autoChargeInvoices),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.shouldAutoPostInvoices&&(t.shouldAutoPostInvoices=this.shouldAutoPostInvoices),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.cardId&&(t.cardId=this.cardId),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.hasAlternativePaymentMethod&&(t.hasAlternativePaymentMethod=this.hasAlternativePaymentMethod),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.includeInFinancialRecords&&(t.includeInFinancialRecords=this.includeInFinancialRecords),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.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}(),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.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}(),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),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 an(t,e){return"number"==typeof e?e:t[e]}var 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.pagingOptions&&(i.pagingOptions=V.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}(),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.reports&&(i.reports=e.reports.map(pn.fromProto)),e.pagingMetadata&&(i.pagingMetadata=z.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}(),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.year&&(i.year=parseInt(e.year,10)),e.month&&(i.month=an(P,e.month)),e.created&&(i.created=new Date(e.created)),e.status&&(i.status=an(b,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 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.component&&(i.component=hn.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}(),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.componentId&&(t.componentId=this.componentId),void 0!==this.name&&(t.name=this.name),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.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 mn(t,e){return"number"==typeof e?e:t[e]}var 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.cardType&&(i.cardType=mn(T,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}(),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.disputeId&&(t.disputeId=this.disputeId),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.merchantId&&(t.merchantId=this.merchantId),void 0!==this.failureUrl&&(t.failureUrl=this.failureUrl),void 0!==this.successUrl&&(t.successUrl=this.successUrl),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.stripeUrl&&(t.stripeUrl=this.stripeUrl),void 0!==this.error&&(t.error=this.error),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.id&&(t.id=this.id),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.status&&(i.status=mn(O,e.status)),e.amount&&(i.amount=parseInt(e.amount,10)),e.created&&(i.created=new Date(e.created)),e.evidence&&(i.evidence=Sn.fromProto(e.evidence)),e.evidenceDetails&&(i.evidenceDetails=bn.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}(),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),e.customerCommunication&&(i.customerCommunication=Tn.fromProto(e.customerCommunication)),e.customerSignature&&(i.customerSignature=Tn.fromProto(e.customerSignature)),e.shippingDocumentation&&(i.shippingDocumentation=Tn.fromProto(e.shippingDocumentation)),e.receipt&&(i.receipt=Tn.fromProto(e.receipt)),e.uncategorizedFile&&(i.uncategorizedFile=Tn.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}(),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.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}(),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.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}(),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.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}(),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.disputeId&&(t.disputeId=this.disputeId),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.dispute&&(i.dispute=An.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}(),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),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.statementDescriptor&&(t.statementDescriptor=this.statementDescriptor),void 0!==this.stripeConnectId&&(t.stripeConnectId=this.stripeConnectId),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.paymentId&&(t.paymentId=this.paymentId),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.payment&&(i.payment=Gn.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}(),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.filters&&(i.filters=Jn.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=V.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}(),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.payments&&(i.payments=e.payments.map(xn.fromProto)),e.pagingMetadata&&(i.pagingMetadata=z.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}(),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.pagingOptions&&(i.pagingOptions=V.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}(),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.disputes&&(i.disputes=e.disputes.map(An.fromProto)),e.pagingMetadata&&(i.pagingMetadata=z.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}(),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.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}(),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=V.fromProto(e.pagingOptions)),e.filters&&(i.filters=Mn.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}(),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.payments&&(i.payments=e.payments.map(Gn.fromProto)),e.pagingMetadata&&(i.pagingMetadata=z.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}(),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.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}(),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.created&&(i.created=new Date(e.created)),e.currency&&(i.currency=mn(p,e.currency)),e.paymentSource&&(i.paymentSource=mn(R,e.paymentSource)),e.allocations&&(i.allocations=e.allocations.map(Ln.fromProto)),e.total&&(i.total=parseInt(e.total,10)),e.status&&(i.status=mn(D,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}(),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.amount&&(i.amount=parseInt(e.amount,10)),e.type&&(i.type=mn(E,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}(),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.order&&(i.order=Fn.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}(),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)},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}(),Gn=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=mn(t.RetailPaymentReferenceTypeEnum,i.referenceType)),i.status&&(n.status=mn(D,i.status)),i.applicationFee&&(n.applicationFee=parseInt(i.applicationFee,10)),i.dispute&&(n.dispute=An.fromProto(i.dispute)),i.cardDetails&&(n.cardDetails=vn.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}(),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.merchantId&&(t.merchantId=this.merchantId),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.enabled&&(t.enabled=this.enabled),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),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.requirements&&(i.requirements=Zn.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}(),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.evidence&&(i.evidence=Pn.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}(),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),void 0!==this.statementDescriptor&&(t.statementDescriptor=this.statementDescriptor),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)},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}(),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.error&&(i.error=e.error.map(Qn.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 $n(t,e){return"number"==typeof e?e:t[e]}var 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.stripeToken&&(t.stripeToken=this.stripeToken),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.cardId&&(t.cardId=this.cardId),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)},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}(),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.paymentCard&&(i.paymentCard=e.paymentCard.map(oo.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}(),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.cardType&&(n.cardType=$n(t.CARD_TYPE,i.cardType)),i.fundingType&&(n.fundingType=$n(J,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}(),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),void 0!==this.paymentMethodId&&(t.paymentMethodId=this.paymentMethodId),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.merchantId&&(t.merchantId=this.merchantId),void 0!==this.stripeToken&&(t.stripeToken=this.stripeToken),t},t}();function ao(t,e){return"number"==typeof e?e:t[e]}var 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),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}(),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.defaultBillingStrategy&&(n.defaultBillingStrategy=ao(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}(),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.id&&(t.id=this.id),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)},t.prototype.toApiJson=function(){var t={};return void 0!==this.pricingPlanIds&&(t.pricingPlanIds=this.pricingPlanIds),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.plans&&(i.plans=e.plans.map(mo.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}(),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.defaultBillingStrategy&&(n.defaultBillingStrategy=ao(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}(),vo=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=ao(j,i.type)),i.rules&&(n.rules=i.rules.map(fo.fromProto)),i.setupFee&&(n.setupFee=parseInt(i.setupFee,10)),i.frequency&&(n.frequency=ao(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}(),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.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(co.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}(),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.fieldMask&&(n.fieldMask=Se.fromProto(i.fieldMask)),i.defaultBillingStrategy&&(n.defaultBillingStrategy=ao(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}(),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)},t.prototype.toApiJson=function(){return{}},t}();function yo(t,e){return"number"==typeof e?e:t[e]}var 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.frequency&&(n.frequency=yo(t.GeneratedFrequency,i.frequency)),i.pricing&&(n.pricing=Object.keys(i.pricing).reduce((function(t,e){return t[e]=vo.fromProto(i.pricing[e]),t}),{})),i.commitment&&(n.commitment=Et.fromProto(i.commitment)),i.strategy&&(n.strategy=yo(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}(),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.sku&&(t.sku=this.sku),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)},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}(),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),e.pricingPlanProducts&&(i.pricingPlanProducts=e.pricingPlanProducts.map(_o.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}(),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 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=_o.fromProto(i.pricingPlanProduct)),i.pricingPlanDefaultStrategy&&(n.pricingPlanDefaultStrategy=yo(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}(),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.sku&&(t.sku=this.sku),void 0!==this.pricingPlanIds&&(t.pricingPlanIds=this.pricingPlanIds),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.pagingOptions&&(i.pagingOptions=V.fromProto(e.pagingOptions)),e.filters&&(i.filters=Ro.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}(),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),e.products&&(i.products=e.products.map(_o.fromProto)),e.pagingMetadata&&(i.pagingMetadata=z.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}(),_o=(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=vo.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=vo.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=vo.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=yo(t.GeneratedFrequency,i.frequency)),i.pricing&&(n.pricing=Object.keys(i.pricing).reduce((function(t,e){return t[e]=vo.fromProto(i.pricing[e]),t}),{})),i.commitment&&(n.commitment=Et.fromProto(i.commitment)),i.created&&(n.created=new Date(i.created)),i.modified&&(n.modified=new Date(i.modified)),i.strategy&&(n.strategy=yo(t.PricingPlanBillingStrategy,i.strategy)),i.volumeCommitment&&(n.volumeCommitment=parseInt(i.volumeCommitment,10)),i.pricingType&&(n.pricingType=yo(j,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=yo(t.GeneratedFrequency,i.frequency)),i.pricing&&(n.pricing=Object.keys(i.pricing).reduce((function(t,e){return t[e]=vo.fromProto(i.pricing[e]),t}),{})),i.commitment&&(n.commitment=Et.fromProto(i.commitment)),i.fieldMask&&(n.fieldMask=Se.fromProto(i.fieldMask)),i.strategy&&(n.strategy=yo(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}(),wo=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}(),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.pricing&&(n.pricing=i.pricing.map(vo.fromProto)),i.termCommitment&&(n.termCommitment=Et.fromProto(i.termCommitment)),i.strategy&&(n.strategy=yo(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 No(t,e){return"number"==typeof e?e:t[e]}var 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),e.productType&&(i.productType=No(N,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}(),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.sku&&(t.sku=this.sku),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)},t.prototype.toApiJson=function(){var t={};return void 0!==this.skus&&(t.skus=this.skus),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.products&&(i.products=Object.keys(e.products).reduce((function(t,i){return t[i]=Yo.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}(),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.productType&&(i.productType=e.productType.map((function(t){return No(N,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}(),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.filters&&(i.filters=Fo.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=V.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}(),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.products&&(i.products=e.products.map(Yo.fromProto)),e.pagingMetadata&&(i.pagingMetadata=z.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}(),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=No(N,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}(),qo=(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=Yo.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=No(N,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 Go(t,e){return"number"==typeof e?e:t[e]}var Wo=function(){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(Ho.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}(),Ho=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=Go(t.PricingPlanBillingStrategy,i.strategy)),i.pricingType&&(n.pricingType=Go(j,i.pricingType)),i.currency&&(n.currency=Go(p,i.currency)),i.frequency&&(n.frequency=Go(t.GeneratedFrequency,i.frequency)),i.pricingRules&&(n.pricingRules=i.pricingRules.map(fo.fromProto)),i.commitment&&(n.commitment=Et.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 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.appliedAmount&&(i.appliedAmount=parseInt(e.appliedAmount,10)),e.referenceType&&(i.referenceType=Vo(U,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}(),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.billingStrategy&&(n.billingStrategy=i.billingStrategy.map((function(e){return Vo(t.PricingPlanBillingStrategy,e)}))),n},e.prototype.toApiJson=function(){var t={};return void 0!==this.billingStrategy&&(t.billingStrategy=this.billingStrategy),t},e}(),Xo=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=Ko.fromProto(i.billingStrategyFilter)),i.state&&(n.state=Vo(t.State,i.state)),i.minPrice&&(n.minPrice=parseInt(i.minPrice,10)),i.status&&(n.status=Vo(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}(),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.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}(),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.filters&&(i.filters=Qo.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=V.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}(),$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.purchaseItems&&(i.purchaseItems=e.purchaseItems.map(nr.fromProto)),e.pagingMetadata&&(i.pagingMetadata=z.fromProto(e.pagingMetadata)),e.currency&&(i.currency=Vo(p,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}(),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=Xo.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=V.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}(),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.purchases&&(i.purchases=e.purchases.map(ir.fromProto)),e.pagingMetadata&&(i.pagingMetadata=z.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}(),ir=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=Vo(p,i.currency)),i.items&&(n.items=i.items.map(nr.fromProto)),i.billingStrategy&&(n.billingStrategy=Vo(t.PricingPlanBillingStrategy,i.billingStrategy)),i.dunningAttempt&&(n.dunningAttempt=parseInt(i.dunningAttempt,10)),i.voided&&(n.voided=new Date(i.voided)),i.status&&(n.status=Vo(t.PurchaseStatusEnum,i.status)),i.creditAmount&&(n.creditAmount=parseInt(i.creditAmount,10)),i.appliedCredits&&(n.appliedCredits=i.appliedCredits.map(zo.fromProto)),i.taxAmount&&(n.taxAmount=parseInt(i.taxAmount,10)),i.appliedTaxRates&&(n.appliedTaxRates=i.appliedTaxRates.map(Ae.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}(),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.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(lt.fromProto)),e.taxAmount&&(i.taxAmount=parseInt(e.taxAmount,10)),e.appliedTaxRates&&(i.appliedTaxRates=e.appliedTaxRates.map(Ae.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}(),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),void 0!==this.shouldEnterDunning&&(t.shouldEnterDunning=this.shouldEnterDunning),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)},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 sr(t,e){return"number"==typeof e?e:t[e]}var ar=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=sr(t.RefundReasonEnum,i.reason)),i.referenceType&&(n.referenceType=sr(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}(),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.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}(),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.refunds&&(i.refunds=e.refunds.map(pr.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}(),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=sr(t.RefundReasonEnum,i.reason)),i.status&&(n.status=sr(t.RefundStatusEnum,i.status)),i.created&&(n.created=new Date(i.created)),i.updated&&(n.updated=new Date(i.updated)),i.referenceType&&(n.referenceType=sr(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 dr(t,e){return"number"==typeof e?e:t[e]}var 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.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}(),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.statuses&&(i.statuses=e.statuses.map((function(t){return dr(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),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.filters&&(i.filters=lr.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=V.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}(),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.creditNote&&(i.creditNote=e.creditNote.map(fr.fromProto)),e.pagingMetadata&&(i.pagingMetadata=z.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}(),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.creditNoteDate&&(i.creditNoteDate=new Date(e.creditNoteDate)),e.dueDate&&(i.dueDate=new Date(e.dueDate)),e.currency&&(i.currency=dr(p,e.currency)),e.total&&(i.total=parseInt(e.total,10)),e.outstanding&&(i.outstanding=parseInt(e.outstanding,10)),e.status&&(i.status=dr(L,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 gr(t,e){return"number"==typeof e?e:t[e]}var 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)},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}(),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.invoice&&(i.invoice=Tr.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}(),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.statuses&&(i.statuses=e.statuses.map((function(t){return gr(q,t)}))),e.paymentStatuses&&(i.paymentStatuses=e.paymentStatuses.map((function(t){return gr(Y,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}(),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.filters&&(i.filters=Ar.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=V.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}(),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=e.invoice.map(Tr.fromProto)),e.pagingMetadata&&(i.pagingMetadata=z.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}(),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.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.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=gr(p,e.currency)),e.status&&(i.status=gr(q,e.status)),e.outstanding&&(i.outstanding=parseInt(e.outstanding,10)),e.type&&(i.type=gr(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}(),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}(),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.merchantId&&(t.merchantId=this.merchantId),void 0!==this.invoiceId&&(t.invoiceId=this.invoiceId),t},t}();var Rr=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 Dr(t,e){return"number"==typeof e?e:t[e]}var 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.sku&&(t.sku=this.sku),void 0!==this.customerId&&(t.customerId=this.customerId),void 0!==this.orderId&&(t.orderId=this.orderId),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.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(Lr.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(Yr.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}(),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.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}(),jr=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=Dr(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}(),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.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}(),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.billingStart&&(n.billingStart=new Date(i.billingStart)),i.proratedTo&&(n.proratedTo=new Date(i.proratedTo)),i.renewalState&&(n.renewalState=Dr(H,i.renewalState)),i.customUnitPrice&&(n.customUnitPrice=parseInt(i.customUnitPrice,10)),i.alignWith&&(n.alignWith=Cr.fromProto(i.alignWith)),i.frequency&&(n.frequency=Dr(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.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),t},e}(),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.subscriptions&&(i.subscriptions=e.subscriptions.map(xr.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}(),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.id&&(t.id=this.id),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)},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}(),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.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}(),xr=(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=Dr(H,i.renewalState)),i.proratedTo&&(n.proratedTo=new Date(i.proratedTo)),i.customUnitPrice&&(n.customUnitPrice=parseInt(i.customUnitPrice,10)),i.alignWith&&(n.alignWith=Cr.fromProto(i.alignWith)),i.frequency&&(n.frequency=Dr(t.GeneratedFrequency,i.frequency)),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),t},e}()),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.frequency&&(n.frequency=Dr(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}(),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.code&&(i.code=Rr.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 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.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}(),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),void 0!==this.id&&(t.id=this.id),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)},t.prototype.toApiJson=function(){var t={};return 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.filters&&(i.filters=Wr.fromProto(e.filters)),e.pagingOptions&&(i.pagingOptions=V.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}(),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.contractDocuments&&(i.contractDocuments=e.contractDocuments.map(qr.fromProto)),e.pagingMetadata&&(i.pagingMetadata=z.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 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.customerId&&(t.customerId=this.customerId),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.configuration&&(i.configuration=Xr.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}(),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.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}(),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.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 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),void 0!==this.idempotencyKey&&(t.idempotencyKey=this.idempotencyKey),void 0!==this.reason&&(t.reason=this.reason),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.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}(),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),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.creditBalance&&(i.creditBalance=$r.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 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)},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}(),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.invoiceTemplate&&(i.invoiceTemplate=ls.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.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}(),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.invoiceTemplate&&(i.invoiceTemplate=ls.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.merchantId&&(t.merchantId=this.merchantId),void 0!==this.customerId&&(t.customerId=this.customerId),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=ls.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}(),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),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),void 0!==this.id&&(t.id=this.id),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=ls.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),e.invoiceTemplate&&(i.invoiceTemplate=ls.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}(),ls=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(Ae.fromProto)),e.items&&(o.items=e.items.map(ms.fromProto)),e.currency&&(o.currency=(i=p,"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(je.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}(),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.total&&(i.total=parseInt(e.total,10)),e.appliedTaxes&&(i.appliedTaxes=e.appliedTaxes.map(Ae.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(lt.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}(),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.unitPrice&&(i.unitPrice=parseInt(e.unitPrice,10)),e.appliedDiscounts&&(i.appliedDiscounts=e.appliedDiscounts.map(lt.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}(),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),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}(),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.invoiceTemplate&&(i.invoiceTemplate=ls.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}(),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)},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}(),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=ls.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.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}(),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=ls.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),e.items&&(i.items=e.items.map(vs.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}(),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.invoiceTemplate&&(i.invoiceTemplate=ls.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 Ts(t,e){return"number"==typeof e?e:t[e]}var 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)},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}(),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.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}(),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.url&&(t.url=this.url),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.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}(),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.url&&(t.url=this.url),void 0!==this.bucket&&(t.bucket=this.bucket),void 0!==this.filename&&(t.filename=this.filename),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),void 0!==this.storeId&&(t.storeId=this.storeId),void 0!==this.bundleIds&&(t.bundleIds=this.bundleIds),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.prices&&(i.prices=Object.keys(e.prices).reduce((function(t,i){return t[i]=gt.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}(),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)},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}(),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.productPrices&&(i.productPrices=Object.keys(e.productPrices).reduce((function(t,i){return t[i]=Ho.fromProto(e.productPrices[i]),t}),{})),e.prices&&(i.prices=e.prices.map(Wo.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}(),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.currency&&(i.currency=Ts(p,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}(),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.productPrices&&(i.productPrices=Object.keys(e.productPrices).reduce((function(t,i){return t[i]=Ho.fromProto(e.productPrices[i]),t}),{})),e.prices&&(i.prices=e.prices.map(Wo.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}(),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.quantity&&(n.quantity=parseInt(i.quantity,10)),i.frequency&&(n.frequency=Ts(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}(),Bs=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=Ts(p,i.currency)),i.strategy&&(n.strategy=Ts(t.PricingPlanBillingStrategy,i.strategy)),i.commitment&&(n.commitment=Et.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}(),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.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}(),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.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}(),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.merchantId&&(t.merchantId=this.merchantId),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.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}(),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.sku&&(t.sku=this.sku),void 0!==this.currencyCode&&(t.currencyCode=this.currencyCode),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.filter&&(i.filter=Ys.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}(),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.results&&(i.results=e.results.map(Ws.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}(),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.productPricing&&(i.productPricing=Ho.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}(),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=gt.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=vo.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=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},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.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},t}(),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.strategy&&(n.strategy=Ts(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}(),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.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}(),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)},t.prototype.toApiJson=function(){return{}},t}(),$s=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=Ts(t.GeneratedFrequency,i.frequency)),i.pricing&&(n.pricing=Object.keys(i.pricing).reduce((function(t,e){return t[e]=vo.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}(),ta=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}();ta.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ta(e.ɵɵinject(n.EnvironmentService))},token:ta,providedIn:"root"}),ta.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ta.ctorParameters=function(){return[{type:n.EnvironmentService}]};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.listPayouts=function(t){var e=t.toApiJson?t:new Ai(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.BankReconciliationService/ListPayouts",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Si.fromProto(t)})),o.share())},t.prototype.reconcilePayout=function(t){var e=t.toApiJson?t:new bi(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.BankReconciliationService/ReconcilePayout",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ti.fromProto(t)})),o.share())},t}();ea.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ea(e.ɵɵinject(i.HttpClient),e.ɵɵinject(ta))},token:ea,providedIn:"root"}),ea.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ea.ctorParameters=function(){return[{type:i.HttpClient},{type:ta}]};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.canBillItem=function(t){var e=t.toApiJson?t:new tt(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 _r(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 Ur(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 Mr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/CreateSubscriptions",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Br.fromProto(t)})),o.share())},t.prototype.reverseSubscription=function(t){var e=t.toApiJson?t:new kr(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 Fr(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 X(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 Q(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/BillMultipleItems",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Z.fromProto(t)})),o.share())},t.prototype.getBillableItem=function(t){var e=t.toApiJson?t:new rt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GetBillableItem",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return st.fromProto(t)})),o.share())},t.prototype.getMultiSubscriptions=function(t){var e=t.toApiJson?t:new at(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GetMultiSubscriptions",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ct.fromProto(t)})),o.share())},t.prototype.listBillableItems=function(t){var e=t.toApiJson?t:new dt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/ListBillableItems",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ht.fromProto(t)})),o.share())},t.prototype.expireBillableItem=function(t){var e=t.toApiJson?t:new nt(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 it(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 cn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/ListMerchantBillingReports",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return un.fromProto(t)})),o.share())},t.prototype.listProductSummaries=function(t){var e=t.toApiJson?t:new ie(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/ListProductSummaries",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ne.fromProto(t)})),o.share())},t.prototype.getProductSummariesTotal=function(t){var e=t.toApiJson?t:new te(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GetProductSummariesTotal",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ee.fromProto(t)})),o.share())},t.prototype.generateBillableItemsCsv=function(t){var e=t.toApiJson?t:new Es(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GenerateBillableItemsCSV",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Rs.fromProto(t)})),o.share())},t.prototype.createPricingPlan=function(t){var e=t.toApiJson?t:new uo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/CreatePricingPlan",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return po.fromProto(t)})),o.share())},t.prototype.updatePricingPlan=function(t){var e=t.toApiJson?t:new go(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/UpdatePricingPlan",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Io.fromProto(t)})),o.share())},t.prototype.getMultiPricingPlan=function(t){var e=t.toApiJson?t:new ho(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GetMultiPricingPlan",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return lo.fromProto(t)})),o.share())},t.prototype.createPricingPlanProduct=function(t){var e=t.toApiJson?t:new Ao(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/CreatePricingPlanProduct",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return So.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 wo.fromProto(t)})),o.share())},t.prototype.deletePricingPlanProduct=function(t){var e=t.toApiJson?t:new Po(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 Do(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/ListPricingPlanProducts",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Co.fromProto(t)})),o.share())},t.prototype.getPricingPlanProduct=function(t){var e=t.toApiJson?t:new Oo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GetPricingPlanProduct",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Eo.fromProto(t)})),o.share())},t.prototype.getMultiPricingPlanProduct=function(t){var e=t.toApiJson?t:new bo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GetMultiPricingPlanProduct",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return To.fromProto(t)})),o.share())},t.prototype.getMultiProductPricing=function(t){var e=t.toApiJson?t:new ws(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GetMultiProductPricing",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return js.fromProto(t)})),o.share())},t.prototype.tickComponentUsage=function(t){var e=t.toApiJson?t:new ln(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 dn(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 Ut(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/ListContracts",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Mt.fromProto(t)})),o.share())},t.prototype.getMultiContract=function(t){var e=t.toApiJson?t:new jt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GetMultiContract",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Nt.fromProto(t)})),o.share())},t.prototype.listProducts=function(t){var e=t.toApiJson?t:new xo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/ListProducts",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Lo.fromProto(t)})),o.share())},t.prototype.getMultiProduct=function(t){var e=t.toApiJson?t:new Bo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GetMultiProduct",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ko.fromProto(t)})),o.share())},t.prototype.resetContractPricing=function(t){var e=t.toApiJson?t:new kt(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 Ms(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/GetPurchaseCost",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Bs.fromProto(t)})),o.share())},t.prototype.changeFrequency=function(t){var e=t.toApiJson?t:new jr(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 Nr(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 wr(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 Zs(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.Billing/StartRevRecTemplateBackfill",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t}();ia.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ia(e.ɵɵinject(i.HttpClient),e.ɵɵinject(ta))},token:ia,providedIn:"root"}),ia.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ia.ctorParameters=function(){return[{type:i.HttpClient},{type:ta}]};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.upsert=function(t){var e=t.toApiJson?t:new Ot(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 yt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.BundleService/GetMulti",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return At.fromProto(t)})),o.share())},t.prototype.list=function(t){var e=t.toApiJson?t:new St(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.BundleService/List",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Pt.fromProto(t)})),o.share())},t}();na.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new na(e.ɵɵinject(i.HttpClient),e.ɵɵinject(ta))},token:na,providedIn:"root"}),na.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],na.ctorParameters=function(){return[{type:i.HttpClient},{type:ta}]};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 Hr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.ContractDocumentService/List",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Vr.fromProto(t)})),o.share())},t.prototype.delete=function(t){var e=t.toApiJson?t:new Gr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.ContractDocumentService/Delete",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(ta))},token:oa,providedIn:"root"}),oa.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],oa.ctorParameters=function(){return[{type:i.HttpClient},{type:ta}]};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.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 wt.fromProto(t)})),o.share())},t.prototype.updateSubscription=function(t){var e=t.toApiJson?t:new Lt(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 Ct(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.ContractService/Create",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return _t.fromProto(t)})),o.share())},t.prototype.update=function(t){var e=t.toApiJson?t:new Ft(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.ContractService/Update",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return xt.fromProto(t)})),o.share())},t}();ra.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ra(e.ɵɵinject(i.HttpClient),e.ɵɵinject(ta))},token:ra,providedIn:"root"}),ra.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ra.ctorParameters=function(){return[{type:i.HttpClient},{type:ta}]};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.add=function(t){var e=t.toApiJson?t:new Zr(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 ts(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.CreditService/GetBalance",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return es.fromProto(t)})),o.share())},t}();sa.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new sa(e.ɵɵinject(i.HttpClient),e.ɵɵinject(ta))},token:sa,providedIn:"root"}),sa.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],sa.ctorParameters=function(){return[{type:i.HttpClient},{type:ta}]};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.list=function(t){var e=t.toApiJson?t:new ge(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.DiscountService/List",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ie.fromProto(t)})),o.share())},t.prototype.create=function(t){var e=t.toApiJson?t:new le(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 ye(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 ve(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.DiscountService/Expire",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(ta))},token:aa,providedIn:"root"}),aa.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],aa.ctorParameters=function(){return[{type:i.HttpClient},{type:ta}]};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 Me(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/AddBundle",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Be.fromProto(t)})),o.share())},t.prototype.addLineItem=function(t){var e=t.toApiJson?t:new ke(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/AddLineItem",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Fe.fromProto(t)})),o.share())},t.prototype.charge=function(t){var e=t.toApiJson?t:new xe(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 Le(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/Create",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ye.fromProto(t)})),o.share())},t.prototype.delete=function(t){var e=t.toApiJson?t:new We(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 He(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/DeleteLineItem",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ve.fromProto(t)})),o.share())},t.prototype.get=function(t){var e=t.toApiJson?t:new Qe(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/Get",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ze.fromProto(t)})),o.share())},t.prototype.removeBundle=function(t){var e=t.toApiJson?t:new oi(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/RemoveBundle",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ri.fromProto(t)})),o.share())},t.prototype.send=function(t){var e=t.toApiJson?t:new si(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 ei(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/List",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ii.fromProto(t)})),o.share())},t.prototype.update=function(t){var e=t.toApiJson?t:new di(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/Update",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return hi.fromProto(t)})),o.share())},t.prototype.pay=function(t){var e=t.toApiJson?t:new ni(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 ui(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/UpdateDefaultTaxRates",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return pi.fromProto(t)})),o.share())},t.prototype.updateLineItem=function(t){var e=t.toApiJson?t:new li(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/UpdateLineItem",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return mi.fromProto(t)})),o.share())},t.prototype.void=function(t){var e=t.toApiJson?t:new vi(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 ze(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/Duplicate",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ke.fromProto(t)})),o.share())},t.prototype.updateBundle=function(t){var e=t.toApiJson?t:new ai(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceService/UpdateBundle",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ci.fromProto(t)})),o.share())},t}();ca.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ca(e.ɵɵinject(i.HttpClient),e.ɵɵinject(ta))},token:ca,providedIn:"root"}),ca.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ca.ctorParameters=function(){return[{type:i.HttpClient},{type:ta}]};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.addBundle=function(t){var e=t.toApiJson?t:new is(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceTemplateService/AddBundle",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ns.fromProto(t)})),o.share())},t.prototype.addLineItem=function(t){var e=t.toApiJson?t:new os(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceTemplateService/AddLineItem",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return rs.fromProto(t)})),o.share())},t.prototype.create=function(t){var e=t.toApiJson?t:new ss(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceTemplateService/Create",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return as.fromProto(t)})),o.share())},t.prototype.upsert=function(t){var e=t.toApiJson?t:new Ps(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceTemplateService/Upsert",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return bs.fromProto(t)})),o.share())},t.prototype.get=function(t){var e=t.toApiJson?t:new ds(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceTemplateService/Get",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return hs.fromProto(t)})),o.share())},t.prototype.delete=function(t){var e=t.toApiJson?t:new cs(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 us(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceTemplateService/DeleteLineItem",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ps.fromProto(t)})),o.share())},t.prototype.updateBundle=function(t){var e=t.toApiJson?t:new fs(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceTemplateService/UpdateBundle",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return gs.fromProto(t)})),o.share())},t.prototype.updateLineItem=function(t){var e=t.toApiJson?t:new As(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceTemplateService/UpdateLineItem",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ss.fromProto(t)})),o.share())},t.prototype.updateTemplateDefaultTaxRates=function(t){var e=t.toApiJson?t:new Is(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.InvoiceTemplateService/UpdateTemplateDefaultTaxRates",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ys.fromProto(t)})),o.share())},t}();ua.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ua(e.ɵɵinject(i.HttpClient),e.ɵɵinject(ta))},token:ua,providedIn:"root"}),ua.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ua.ctorParameters=function(){return[{type:i.HttpClient},{type:ta}]};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.create=function(t){var e=t.toApiJson?t:new _i(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 wi(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/Get",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ji.fromProto(t)})),o.share())},t.prototype.getOutstandingBalance=function(t){var e=t.toApiJson?t:new Mi(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/GetOutstandingBalance",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Bi.fromProto(t)})),o.share())},t.prototype.update=function(t){var e=t.toApiJson?t:new on(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 to(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 tn(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 io(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/ListPaymentCards",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return no.fromProto(t)})),o.share())},t.prototype.updatePaymentCard=function(t){var e=t.toApiJson?t:new so(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 xs(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/GetStatistics",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ls.fromProto(t)})),o.share())},t.prototype.search=function(t){var e=t.toApiJson?t:new Xi(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/Search",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Qi.fromProto(t)})),o.share())},t.prototype.setAutoPostInvoices=function(t){var e=t.toApiJson?t:new $i(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 Zi(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 nn(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 en(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 Or(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 Ri(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 Er(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 Ht(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 zt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/ListBankAccounts",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Kt.fromProto(t)})),o.share())},t.prototype.setDefaultBankAccount=function(t){var e=t.toApiJson?t:new Xt(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 Vt(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 Ni(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/GetMultiRetailConfigurations",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Ui.fromProto(t)})),o.share())},t.prototype.upsertRetailConfiguration=function(t){var e=t.toApiJson?t:new sn(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 rn(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 xi(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/GetRetailBalance",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Li.fromProto(t)})),o.share())},t.prototype.getPayoutSummary=function(t){var e=t.toApiJson?t:new ki(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/GetPayoutSummary",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Fi.fromProto(t)})),o.share())},t.prototype.listRetailPayouts=function(t){var e=t.toApiJson?t:new Hi(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/ListRetailPayouts",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Vi.fromProto(t)})),o.share())},t.prototype.getRetailPayout=function(t){var e=t.toApiJson?t:new Yi(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.MerchantService/GetRetailPayout",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return qi.fromProto(t)})),o.share())},t}();pa.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new pa(e.ɵɵinject(i.HttpClient),e.ɵɵinject(ta))},token:pa,providedIn:"root"}),pa.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],pa.ctorParameters=function(){return[{type:i.HttpClient},{type:ta}]};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.listPaymentCards=function(t){var e=t.toApiJson?t:new io(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentMethodService/ListPaymentCards",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return no.fromProto(t)})),o.share())},t.prototype.deletePaymentCard=function(t){var e=t.toApiJson?t:new eo(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 ro(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentMethodService/SetDefaultPaymentMethod",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(ta))},token:da,providedIn:"root"}),da.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],da.ctorParameters=function(){return[{type:i.HttpClient},{type:ta}]};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.list=function(t){var e=t.toApiJson?t:new wn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/List",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return jn.fromProto(t)})),o.share())},t.prototype.getRetail=function(t){var e=t.toApiJson?t:new Cn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/GetRetail",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return _n.fromProto(t)})),o.share())},t.prototype.listRetail=function(t){var e=t.toApiJson?t:new Bn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/ListRetail",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return kn.fromProto(t)})),o.share())},t.prototype.listRetailDisputes=function(t){var e=t.toApiJson?t:new Nn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/ListRetailDisputes",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Un.fromProto(t)})),o.share())},t.prototype.getRetailDispute=function(t){var e=t.toApiJson?t:new On(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/GetRetailDispute",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return En.fromProto(t)})),o.share())},t.prototype.closeRetailDispute=function(t){var e=t.toApiJson?t:new fn(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 Yn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/PrepareRetail",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return qn.fromProto(t)})),o.share())},t.prototype.confirmRetail=function(t){var e=t.toApiJson?t:new yn(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 Vn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/RetailStatus",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return zn.fromProto(t)})),o.share())},t.prototype.retailPaymentsEnabled=function(t){var e=t.toApiJson?t:new Wn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/RetailPaymentsEnabled",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Hn.fromProto(t)})),o.share())},t.prototype.configureRetailProvider=function(t){var e=t.toApiJson?t:new gn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/ConfigureRetailProvider",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return In.fromProto(t)})),o.share())},t.prototype.updateRetailProvider=function(t){var e=t.toApiJson?t:new Xn(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 Rn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/GetRetailProvider",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Dn.fromProto(t)})),o.share())},t.prototype.submitEvidence=function(t){var e=t.toApiJson?t:new Kn(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PaymentService/SubmitEvidence",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(ta))},token:ha,providedIn:"root"}),ha.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ha.ctorParameters=function(){return[{type:i.HttpClient},{type:ta}]};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.getMultiRetail=function(t){var e=t.toApiJson?t:new Ns(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PricingService/GetMultiRetail",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Us.fromProto(t)})),o.share())},t.prototype.upsertRetail=function(t){var e=t.toApiJson?t:new $s(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 Os(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 _s(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PricingService/GetMultiBundleRetail",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Js.fromProto(t)})),o.share())},t.prototype.getWholesaleComparison=function(t){var e=t.toApiJson?t:new qs(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PricingService/GetWholesaleComparison",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Gs.fromProto(t)})),o.share())},t.prototype.setWholesaleProductStrategy=function(t){var e=t.toApiJson?t:new Xs(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 Qs(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 Ms(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PricingService/GetPurchaseCost",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Bs.fromProto(t)})),o.share())},t.prototype.upsertWholesale=function(t){var e=t.toApiJson?t:new jo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PricingService/UpsertWholesale",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(ta))},token:la,providedIn:"root"}),la.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],la.ctorParameters=function(){return[{type:i.HttpClient},{type:ta}]};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.create=function(t){var e=t.toApiJson?t:new Uo(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 qo(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 Mo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.ProductService/Delete",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(ta))},token:ma,providedIn:"root"}),ma.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ma.ctorParameters=function(){return[{type:i.HttpClient},{type:ta}]};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.listSubscriptionRetentionByGroup=function(t){var e=t.toApiJson?t:new se(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.ProductSummaryService/ListSubscriptionRetentionByGroup",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return oe.fromProto(t)})),o.share())},t.prototype.listSubscriptionRetentionBySku=function(t){var e=t.toApiJson?t:new se(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.ProductSummaryService/ListSubscriptionRetentionBySKU",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return re.fromProto(t)})),o.share())},t}();va.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new va(e.ɵɵinject(i.HttpClient),e.ɵɵinject(ta))},token:va,providedIn:"root"}),va.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],va.ctorParameters=function(){return[{type:i.HttpClient},{type:ta}]};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.list=function(t){var e=t.toApiJson?t:new tr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PurchaseService/List",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return er.fromProto(t)})),o.share())},t.prototype.getMultiCustomerSummaries=function(t){var e=t.toApiJson?t:new qt(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PurchaseService/GetMultiCustomerSummaries",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Gt.fromProto(t)})),o.share())},t.prototype.listPurchaseItems=function(t){var e=t.toApiJson?t:new Zo(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PurchaseService/ListPurchaseItems",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return $o.fromProto(t)})),o.share())},t.prototype.retry=function(t){var e=t.toApiJson?t:new or(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 rr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.PurchaseService/Void",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t}();fa.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new fa(e.ɵɵinject(i.HttpClient),e.ɵɵinject(ta))},token:fa,providedIn:"root"}),fa.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],fa.ctorParameters=function(){return[{type:i.HttpClient},{type:ta}]};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.create=function(t){var e=t.toApiJson?t:new ar(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 cr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.RefundService/List",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return ur.fromProto(t)})),o.share())},t}();ga.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ga(e.ɵɵinject(i.HttpClient),e.ɵɵinject(ta))},token:ga,providedIn:"root"}),ga.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ga.ctorParameters=function(){return[{type:i.HttpClient},{type:ta}]};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 zr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.RetailCustomerConfigurationService/Get",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Kr.fromProto(t)})),o.share())},t.prototype.upsert=function(t){var e=t.toApiJson?t:new Qr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.RetailCustomerConfigurationService/Upsert",e.toApiJson(),Object.assign(Object.assign({},this.apiOptions()),{observe:"response"}))},t}();Ia.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Ia(e.ɵɵinject(i.HttpClient),e.ɵɵinject(ta))},token:Ia,providedIn:"root"}),Ia.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Ia.ctorParameters=function(){return[{type:i.HttpClient},{type:ta}]};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.create=function(t){var e=t.toApiJson?t:new hr(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 mr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.SalesCreditNoteService/List",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return vr.fromProto(t)})),o.share())},t}();ya.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ya(e.ɵɵinject(i.HttpClient),e.ɵɵinject(ta))},token:ya,providedIn:"root"}),ya.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ya.ctorParameters=function(){return[{type:i.HttpClient},{type:ta}]};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.list=function(t){var e=t.toApiJson?t:new Sr(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.SalesInvoiceService/List",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Pr.fromProto(t)})),o.share())},t.prototype.post=function(t){var e=t.toApiJson?t:new br(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 Ir(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.SalesInvoiceService/Get",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return yr.fromProto(t)})),o.share())},t}();Aa.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Aa(e.ɵɵinject(i.HttpClient),e.ɵɵinject(ta))},token:Aa,providedIn:"root"}),Aa.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Aa.ctorParameters=function(){return[{type:i.HttpClient},{type:ta}]};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.calculate=function(t){var e=t.toApiJson?t:new be(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.TaxService/Calculate",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Te.fromProto(t)})),o.share())},t.prototype.create=function(t){var e=t.toApiJson?t:new Oe(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 Re(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.TaxService/GetMulti",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return De.fromProto(t)})),o.share())},t.prototype.update=function(t){var e=t.toApiJson?t:new we(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 Ce(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.TaxService/List",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return _e.fromProto(t)})),o.share())},t.prototype.archive=function(t){var e=t.toApiJson?t:new Pe(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.TaxService/Archive",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(ta))},token:Sa,providedIn:"root"}),Sa.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Sa.ctorParameters=function(){return[{type:i.HttpClient},{type:ta}]};var Pa,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 Ds(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.VendorService/GenerateReport",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Cs.fromProto(t)})),o.share())},t.prototype.getRevenueStats=function(t){var e=t.toApiJson?t:new ks(t);return this.http.post(this.hostService.hostWithScheme()+"/billing.v1.VendorService/GetRevenueStats",e.toApiJson(),this.apiOptions()).pipe(o.map((function(t){return Fs.fromProto(t)})),o.share())},t}();function Ta(e){switch(e){case u.DISCOUNT_TYPE_FIXED_AMOUNT_PER_UNIT:return t.AppliedDiscountType.FIXED_AMOUNT_PER_UNIT;case u.DISCOUNT_TYPE_FIXED_NUMBER_OF_UNITS:return t.AppliedDiscountType.FIXED_NUMBER_OF_UNITS;case u.DISCOUNT_TYPE_PERCENT_AMOUNT:return t.AppliedDiscountType.PERCENT_AMOUNT}return t.AppliedDiscountType.FIXED_AMOUNT}function Oa(e){switch(e){case t.AppliedDiscountType.FIXED_AMOUNT_PER_UNIT:return u.DISCOUNT_TYPE_FIXED_AMOUNT_PER_UNIT;case t.AppliedDiscountType.FIXED_NUMBER_OF_UNITS:return u.DISCOUNT_TYPE_FIXED_NUMBER_OF_UNITS;case t.AppliedDiscountType.PERCENT_AMOUNT:return u.DISCOUNT_TYPE_PERCENT_AMOUNT}return u.DISCOUNT_TYPE_FIXED_AMOUNT}function Ea(t){return{type:Ta(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(ta))},token:ba,providedIn:"root"}),ba.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ba.ctorParameters=function(){return[{type:i.HttpClient},{type:ta}]},(Pa=t.AppliedDiscountType||(t.AppliedDiscountType={})).FIXED_AMOUNT="FIXED_AMOUNT",Pa.PERCENT_AMOUNT="PERCENT_AMOUNT",Pa.FIXED_NUMBER_OF_UNITS="FIXED_NUMBER_OF_UNITS",Pa.FIXED_AMOUNT_PER_UNIT="FIXED_AMOUNT_PER_UNIT";var Ra=function(){function t(t){this.merchantApi=t}return t.prototype.listBankAccounts=function(t){return this.merchantApi.listBankAccounts(new zt({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 Xt({merchantId:t,bankAccountId:e});return this.merchantApi.setDefaultBankAccount(i)},t.prototype.deleteBankAccount=function(t,e){var i=new Vt({merchantId:t,bankAccountId:e});return this.merchantApi.deleteBankAccount(i)},t}();function Da(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 Ca(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 _a(e){switch(e){case p.USD:return t.Currency.USD;case p.CAD:return t.Currency.CAD;case p.EUR:return t.Currency.EUR;case p.AUD:return t.Currency.AUD;case p.GBP:return t.Currency.GBP;case p.NZD:return t.Currency.NZD;case p.BRL:return t.Currency.BRL;case p.CHF:return t.Currency.CHF;case p.CNY:return t.Currency.CNY;case p.CZK:return t.Currency.CZK;case p.INR:return t.Currency.INR;case p.JPY:return t.Currency.JPY;case p.KHR:return t.Currency.KHR;case p.KRW:return t.Currency.KRW;case p.MXN:return t.Currency.MXN;case p.NOK:return t.Currency.NOK;case p.RUB:return t.Currency.RUB;case p.SEK:return t.Currency.SEK;case p.SGD:return t.Currency.SGD;case p.TRY:return t.Currency.TRY;case p.ZAR:return t.Currency.ZAR;case p.DZD:return t.Currency.DZD;case p.AWG:return t.Currency.AWG;case p.FJD:return t.Currency.FJD;case p.KYD:return t.Currency.KYD;default:return t.Currency.USD}}function Ja(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 ja(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 Na(t){return t?t.map((function(t){return{price:t.price||0,minUnits:t.minUnits,maxUnits:t.maxUnits}})):null}function Ua(e){switch(e){case j.PRODUCT_PRICING_TYPE_STANDARD:return t.ProductPricingType.Standard;case j.PRODUCT_PRICING_TYPE_STAIRSTEP:return t.ProductPricingType.Stairstep;case j.PRODUCT_PRICING_TYPE_TIERED:return t.ProductPricingType.Tiered}return t.ProductPricingType.Invalid}function Ma(e){switch(e){case t.ProductPricingType.Standard:return j.PRODUCT_PRICING_TYPE_STANDARD;case t.ProductPricingType.Stairstep:return j.PRODUCT_PRICING_TYPE_STAIRSTEP;case t.ProductPricingType.Tiered:return j.PRODUCT_PRICING_TYPE_TIERED}return j.PRODUCT_PRICING_TYPE_INVALID}function Ba(t){return{initial:t.initial,recurring:t.recurring}}function ka(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:Ja(t.billingFrequency),currency:_a(t.currency),strategy:Da(t.strategy),commitment:Ba(t.commitment),isStartingPrice:t.isStartingPrice,setupFee:o}}function Fa(t){return{strategy:Da(t.strategy),pricingType:Ua(t.pricingType),currency:_a(t.currency),frequency:wa(t.frequency),pricingRules:Na(t.pricingRules),commitment:Ba(t.commitment),volumeCommitment:t.volumeCommitment,isStartingPrice:t.isStartingPrice,resolvedFrom:t.resolvedFrom,setupFee:t.setupFee}}function xa(t){return null==t?void 0:t.map((function(t){return t&&{sku:t.sku,prices:t.prices.map((function(t){return t&&Fa(t)}))}}))}function La(t){var e={};for(var i in t.pricing)if(t.pricing.hasOwnProperty(i)){var n=t.pricing[i];e[i]={type:Ua(n.type),rules:Na(n.rules),setupFee:n.setupFee||0}}return{pricingPlanId:t.pricingPlanId,sku:t.sku,frequency:wa(t.frequency),pricing:e,commitment:Ba(t.commitment),created:t.created,modified:t.modified,strategy:Da(t.strategy),volumeCommitment:t.volumeCommitment}}function Ya(e){return Object.keys(e).filter((function(e){return e in t.Currency})).reduce((function(t,i){return t[i]=Ga(e[i]),t}),{})}function qa(t){return t.map((function(t){return new fo(t)}))}function Ga(t){return new vo({type:Ma(t.type),rules:qa(t.rules),setupFee:t.setupFee,frequency:ja(t.frequency),currencyCode:t.currencyCode})}Ra.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Ra(e.ɵɵinject(pa))},token:Ra,providedIn:"root"}),Ra.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Ra.ctorParameters=function(){return[{type:pa}]},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 Wa,Ha=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=Ca(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 ka(t)})))},t.prototype.getMultiWholesalePrices=function(t,e,i){return this.billingApi.getMultiProductPricing({merchantId:t,skus:e,pricingPlanId:i}).pipe(o.map((function(t){return xa(t.prices)})))},t.prototype.upsertPricing=function(t,e,i,n,o,r){var s=new jo({pricingPlanId:t,sku:e,pricing:(i||[]).map((function(t){return Ga(t)})),strategy:Ca(o),termCommitment:n,volumeCommitment:r});return this.pricingService.upsertWholesale(s)},t}();function Va(t){return{id:t.id,name:t.name,defaultStrategy:Da(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,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)}}
|
|
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
|
-
***************************************************************************** */Ha.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Ha(e.ɵɵinject(ta),e.ɵɵinject(i.HttpClient),e.ɵɵinject(la),e.ɵɵinject(ia))},token:Ha,providedIn:"root"}),Ha.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Ha.ctorParameters=function(){return[{type:ta},{type:i.HttpClient},{type:la},{type:ia}]},(Wa=t.Distribution||(t.Distribution={})).Retail="Retail",Wa.Wholesale="Wholesale";Object.create;function za(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 Ka(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 Xa(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Ka(arguments[e]));return t}Object.create;var Qa,Za=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 ac.get(i);case t.Distribution.Wholesale:return sc.get(i)}return rc.get(i)||[]},e.prototype.isDefault=function(t){return t===this.list().find((function(t){return t.name===$a.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:Ca(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 Va(t)}))})))},e}();Za.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Za(e.ɵɵinject(n.EnvironmentService),e.ɵɵinject(ia))},token:Za,providedIn:"root"}),Za.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Za.ctorParameters=function(){return[{type:n.EnvironmentService},{type:ia}]},function(t){t.MSRP="MSRP"}(Qa||(Qa={}));var $a,tc=[{id:"PP-5049b4b2-fe28-473f-96d6-84d4ea91ada9",name:Qa.MSRP,subscriptionName:"msrp",defaultStrategy:t.BillingStrategy.Invalid}],ec=[{id:"PP-148b6d8c-6222-4fce-9cd2-f0587f0db563",name:Qa.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"}($a||($a={}));var ic,nc=[{id:"PP-587f8f25-b278-4727-b7c4-3ce60e542c8b",name:$a.VBPFree,subscriptionName:"free_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-a5ad2825-8225-4bbe-a868-c1b2a7d2a2e3",name:$a.VBPStarter,subscriptionName:"starter_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-438ccc87-eaff-4180-ad79-f5d3d51e1bc0",name:$a.VBPBasic,subscriptionName:"vbp_basic_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-7201f892-3d44-44b8-b9db-4b23dd34d112",name:$a.VBPProfessional,subscriptionName:"vbp_professional_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-3cc1ec9f-17a8-46c8-9e79-b337e4ea651b",name:$a.VBPEnterprise,subscriptionName:"vbp_enterprise_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-7ffa4745-4ea1-4603-983b-81a1404faa3b",name:$a.VBPEnterprisePilot,subscriptionName:"vbp_enterprise_pilot_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-02895bb5-ff6b-4f37-ae1e-8473b895a59d",name:$a.VBP2Startup,subscriptionName:"vbp2_startup_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-c69f1724-d380-432f-8f50-5778da6ea250",name:$a.VBP2Essentials,subscriptionName:"vbp2_essentials_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-8abe2c53-be4a-43d5-bd2c-a8d9be1c82db",name:$a.VBP2Growth,subscriptionName:"vbp2_growth_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-0a872f89-e582-420a-90b0-c98e19b174a4",name:$a.VBP2Scale,subscriptionName:"vbp2_scale_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-7abd1cb2-317b-40d2-9fdc-d2b365d645b7",name:$a.VBP2Premium,subscriptionName:"vbp2_premium_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-a7eca7c3-84fd-4fc2-86a5-87a743f6c3d1",name:$a.BasicSubscription,subscriptionName:"basic_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-7d0053b8-fab4-407d-ae69-33c67d5314eb",name:$a.ProfessionalSubscription,subscriptionName:"professional_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-e85cdb56-2944-4fe0-9e78-a98520eb1489",name:$a.EnterpriseSubscription,subscriptionName:"enterprise_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-9a0d6430-5e73-41d2-bd3d-dc3645664bb9",name:$a.EliteSubscription,subscriptionName:"elite_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-a03a1c1e-d03e-4c77-8132-34908012a65c",name:$a.PremiumSubscription,subscriptionName:"premium_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-cf943a15-3eea-40cf-8d3e-e7ea5a5a9817",name:$a.Default,subscriptionName:null,defaultStrategy:t.BillingStrategy.Invalid}],oc=[{id:"PP-77912c15-00af-4a56-bfc0-e8e6c27c7a53",name:$a.VBPFree,subscriptionName:"free_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-1cc75309-ddff-4d8b-aedf-88a7472e2b4e",name:$a.VBPStarter,subscriptionName:"starter_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-52f98211-bd1e-4112-88cd-e78040173198",name:$a.VBPBasic,subscriptionName:"vbp_basic_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-c278bcc6-bd5d-43e5-9ff5-a27e70b48ba9",name:$a.VBPProfessional,subscriptionName:"vbp_professional_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-4133fc94-a58a-4fcd-91cd-9ed111182e77",name:$a.VBPEnterprise,subscriptionName:"vbp_enterprise_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-dbbac61e-132f-468f-aa62-7a691b59bb74",name:$a.VBPEnterprisePilot,subscriptionName:"vbp_enterprise_pilot_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-45f8099f-d3f3-4302-83bf-bbf64f431e31",name:$a.VBP2Startup,subscriptionName:"vbp2_startup_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-d44c5a8b-f3b6-4b63-b203-8b7253060984",name:$a.VBP2Essentials,subscriptionName:"vbp2_essentials_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-c1761320-62df-41d7-8df3-008554a4b592",name:$a.VBP2Growth,subscriptionName:"vbp2_growth_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-b6607aae-606f-4fd5-84e4-c48f38b59892",name:$a.VBP2Scale,subscriptionName:"vbp2_scale_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-7375d567-8890-4cb1-930c-5673ea89acba",name:$a.VBP2Premium,subscriptionName:"vbp2_premium_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-38a06671-526b-4d28-b425-bbce3be34699",name:$a.BasicSubscription,subscriptionName:"basic_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-d9717300-f1c3-4471-8433-c3ac7baf003d",name:$a.ProfessionalSubscription,subscriptionName:"professional_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-f6a60130-878b-4a33-9a10-d5bdeac0cdef",name:$a.EnterpriseSubscription,subscriptionName:"enterprise_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-dff68124-2223-4c88-91dc-b638a3135fc5",name:$a.EliteSubscription,subscriptionName:"elite_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-15641015-560e-4cd7-977b-b1fc627b18d1",name:$a.PremiumSubscription,subscriptionName:"premium_subscription",defaultStrategy:t.BillingStrategy.Invalid},{id:"PP-0e9ac148-a2d0-42d0-9250-8c42189bf432",name:$a.Default,subscriptionName:null,defaultStrategy:t.BillingStrategy.Invalid}],rc=new Map([[n.Environment.DEMO,Xa(nc,tc)],[n.Environment.PROD,Xa(oc,ec)]]),sc=new Map([[n.Environment.DEMO,Xa(nc)],[n.Environment.PROD,Xa(oc)]]),ac=new Map([[n.Environment.DEMO,Xa(tc)],[n.Environment.PROD,Xa(ec)]]);(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 cc,uc=t.PayoutStatusType.NOT_SET,pc=t.PayoutStatusType.PAID,dc=t.PayoutStatusType.PENDING,hc=t.PayoutStatusType.IN_TRANSIT,lc=t.PayoutStatusType.CANCELED,mc=t.PayoutStatusType.FAILED,vc=new Map([[t.PayoutStatus.PAYOUT_STATUS_NOT_SET,{id:uc,value:"Unknown"}],[t.PayoutStatus.PAYOUT_STATUS_PAID,{id:pc,value:"Paid"}],[t.PayoutStatus.PAYOUT_STATUS_PENDING,{id:dc,value:"Pending"}],[t.PayoutStatus.PAYOUT_STATUS_IN_TRANSIT,{id:hc,value:"In Transit"}],[t.PayoutStatus.PAYOUT_STATUS_CANCELED,{id:lc,value:"Canceled"}],[t.PayoutStatus.PAYOUT_STATUS_FAILED,{id:mc,value:"Failed"}]]);function fc(t){return vc.get(t)}(cc=t.PayoutTypeType||(t.PayoutTypeType={}))[cc.NOT_SET=0]="NOT_SET",cc[cc.BANK_ACCOUNT=1]="BANK_ACCOUNT",cc[cc.CARD=2]="CARD";var gc=t.PayoutTypeType.NOT_SET,Ic=t.PayoutTypeType.BANK_ACCOUNT,yc=t.PayoutTypeType.CARD,Ac=new Map([[y.PAYOUT_TYPE_NOT_SET,{id:gc,value:"Unknown"}],[y.PAYOUT_TYPE_BANK_ACCOUNT,{id:Ic,value:"Bank Account"}],[y.PAYOUT_TYPE_CARD,{id:yc,value:"Card"}]]);!function(t){t[t.Ascending=0]="Ascending",t[t.Descending=1]="Descending"}(t.SortDirection||(t.SortDirection={}));var Sc=function(t,e,i){this.results=t,this.nextCursor=e,this.hasMore=i},Pc=function(){function t(t){this.apiService=t}return t.prototype.reconcilePayout=function(t,e){return this.apiService.reconcilePayout(new bi({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 Ai({filters:new yi({arrivalDateRange:new gi({start:t,end:e})}),pagingOptions:new V({cursor:n,pageSize:i})})).pipe(o.map((function(t){if(!t)return new Sc([],"",!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,Ac.get(i)),status:fc(e.status),currency:_a(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 Sc(e,i,n)})))},t}();function bc(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}}Pc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Pc(e.ɵɵinject(ea))},token:Pc,providedIn:"root"}),Pc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Pc.ctorParameters=function(){return[{type:ea}]};var Tc=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}();Tc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Tc(e.ɵɵinject(ta),e.ɵɵinject(i.HttpClient))},token:Tc,providedIn:"root"}),Tc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Tc.ctorParameters=function(){return[{type:ta},{type:i.HttpClient}]};var Oc=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 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 download csv")}function Rc(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")}Oc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Oc(e.ɵɵinject(n.EnvironmentService))},token:Oc,providedIn:"root"}),Oc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Oc.ctorParameters=function(){return[{type:n.EnvironmentService}]};var Dc=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(Ec))},t.prototype.apiOptions=function(){return{responseType:"blob",withCredentials:!0}},t}();Dc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Dc(e.ɵɵinject(ta),e.ɵɵinject(i.HttpClient))},token:Dc,providedIn:"root"}),Dc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Dc.ctorParameters=function(){return[{type:ta},{type:i.HttpClient}]};var Cc,_c=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(Ec))},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(Ec))},t.prototype.apiOptions=function(){return{responseType:"blob",withCredentials:!0}},t}();function Jc(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 wc(e){return{merchantId:e.merchantId||"",timestamp:e.timestamp?new Date(e.timestamp):null,purchaseId:e.purchaseId||"",total:e.total||0,currency:e.currency?_a(e.currency):t.Currency.USD,renewal:e.renewal||!1,items:e.items?e.items.map((function(t){return jc(t)})):[],billingStrategy:Da(e.billingStrategy),isDunning:e.isDunning||!1,dunningAttempt:e.dunningAttempt||0,voided:e.voided?new Date(e.voided):null,paid:e.paid||!1,status:Jc(e.status),creditAmount:e.creditAmount||0,appliedCredits:e.appliedCredits?e.appliedCredits.map((function(t){return Nc(t)})):[],taxAmount:e.taxAmount||0,appliedTaxRates:(e.appliedTaxRates||[]).map((function(t){return Mc(t)}))}}function jc(e,i){var n;return void 0!==i&&(n=_a(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 Ea(t)})):[],merchantId:e.merchantId,purchaseDay:e.day,purchaseId:e.purchaseId,taxAmount:e.taxAmount||0,appliedTaxRates:(e.appliedTaxRates||[]).map((function(t){return Mc(t)})),setupFee:e.setupFee||0}}function Nc(t){return{appliedAmount:t.appliedAmount,referenceId:t.referenceId,referenceType:Uc(t.referenceType)}}function Uc(e){switch(e){case U.CREDIT_TYPE_CREDIT_NOTE:return t.AppliedCreditType.CREDIT_TYPE_CREDIT_NOTE;case U.CREDIT_TYPE_PROMOTIONAL:return t.AppliedCreditType.CREDIT_TYPE_PROMOTIONAL}return t.AppliedCreditType.CREDIT_TYPE_UNSET}function Mc(t){return{amount:t.amount||0,name:t.name||"",percentage:t.percentage||0,taxRateId:t.taxRateId||""}}_c.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new _c(e.ɵɵinject(ta),e.ɵɵinject(i.HttpClient))},token:_c,providedIn:"root"}),_c.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],_c.ctorParameters=function(){return[{type:ta},{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={})),(Cc=t.AppliedCreditType||(t.AppliedCreditType={})).CREDIT_TYPE_CREDIT_NOTE="Credit note",Cc.CREDIT_TYPE_PROMOTIONAL="Promotional",Cc.CREDIT_TYPE_UNSET="";var Bc=function(t){this.dimensionId=t,this.name=kc[t]||""},kc={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)"},Fc=new Bc("agency"),xc=new Bc("new_enterprise"),Lc=new Bc("existing_enterprise"),Yc=new Bc("CP_unassisted"),qc=new Bc("CP_growth_MT"),Gc=new Bc("CP_growth_HT");function Wc(t){return{merchantId:t.merchantId||"",netD:t.netD||0,created:t.created||null,subscriptionId:t.subscriptionId||"",dimension:new Bc(t.dimension),currency:_a(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 Hc,Vc,zc=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 Wc(t.contract)})))},t.prototype.update=function(t,e){return this.api.update({merchantId:t,mutations:e}).pipe(o.map((function(t){return Wc(t.contract)})))},t}();function Kc(e){switch(e){case t.ProductPricingType.Stairstep:return t.BillingModel.Stairstep;case t.ProductPricingType.Tiered:return t.BillingModel.Tiered;case t.ProductPricingType.Standard:return t.BillingModel.Standard}return t.BillingModel.Standard}function Xc(t){return t.map((function(t){return{rangeMin:t.minUnits,rangeMax:t.maxUnits,price:t.price||0}}))}function Qc(e){switch(e){case t.Frequency.OneTime:return s.MarketplaceBillingFrequency.OneTime;case t.Frequency.Monthly:return s.MarketplaceBillingFrequency.Monthly;case t.Frequency.Yearly:return s.MarketplaceBillingFrequency.Yearly}}zc.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new zc(e.ɵɵinject(ra))},token:zc,providedIn:"root"}),zc.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],zc.ctorParameters=function(){return[{type:ra}]},(Hc=t.BillingModel||(t.BillingModel={})).Standard="Standard",Hc.Stairstep="Stairstep",Hc.Tiered="Tiered",(Vc=t.ProductCategory||(t.ProductCategory={})).BUNDLE="bundle",Vc.VENDASTA="vendasta_product",Vc.PRODUCT="product",Vc.SUBSCRIPTION="subscription",Vc.FEE="fee";var Zc;function $c(t){return{name:t.name||"",sku:t.sku||"",iconUrl:t.iconUrl||"",hasPricingOverride:t.hasPricingOverride||!1,hasDiscount:t.hasDiscount||!1}}function tu(t){return Object.assign(Object.assign({},t),{productType:(t.productType||[]).map((function(t){return function(t){switch(t){case Zc.Standard:return N.PRODUCT_TYPE_STANDARD_PRODUCT;case Zc.Vendasta:return N.PRODUCT_TYPE_VENDASTA_PRODUCT;case Zc.Subscription:return N.PRODUCT_TYPE_SUBSCRIPTION;case Zc.Fee:return N.PRODUCT_TYPE_FEE;case Zc.PartnerSupportSales:return N.PRODUCT_TYPE_PARTNER_SUPPORT_SALES}return N.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"}(Zc||(Zc={}));var eu=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 Ms({merchantId:t,sku:e,quantity:i});return this.billingApi.getPurchaseCost(n).pipe(o.map((function(t){return t.currency||(t.currency=p.USD),t})))},e.prototype.canCreateSubscriptions=function(t,e){var i=new _r({merchantId:t,skus:e});return this.billingApi.canCreateSubscriptions(i)},e.prototype.canCreateSubscriptionsWithFrequencies=function(t,e){var i=new _r({merchantId:t,items:e&&e.map((function(t){return t?{sku:t.sku,frequency:ja(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 cn({merchantId:t,pagingOptions:new V({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:b[t.status||0]}}));return new Sc(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 Ao({pricingPlanId:t,sku:e,volumeCommitment:a});return c.frequency=ja(i),c.pricing=Ya(n),c.commitment=new Et(r),c.strategy=Ca(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 Se({paths:[]}),p=new Jo({pricingPlanId:t,sku:e});return null!==n&&(p.frequency=ja(n),u.paths.push("frequency")),null!==r&&(p.pricing=Ya(r),u.paths.push("pricing")),null!==s&&(p.commitment=new Et(s),u.paths.push("commitment")),null!==a&&(p.strategy=Ca(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 Po({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=za(Object.keys(n)),s=r.next();!s.done;s=r.next()){var a=s.value,c=n[a];o[a]=Fa(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=za(Object.keys(n)),s=r.next();!s.done;s=r.next()){var a=s.value,c=n[a];o[a]=Fa(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 Do({filters:t,pagingOptions:new V({cursor:e,pageSize:i})});return this.billingApi.listPricingPlanProducts(n).pipe(o.map((function(t){var e=(t.products||[]).map((function(t){return La(t)}));return new Sc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},e.prototype.getPricingPlanProduct=function(t,e){var i=new Oo({pricingPlanId:t,sku:e});return this.billingApi.getPricingPlanProduct(i).pipe(o.map((function(t){var e=La(t.pricingPlanProduct);return e.defaultStrategy=Da(t.pricingPlanDefaultStrategy),e})))},e.prototype.listPurchases=function(t,e,i){var n=new tr({filters:t,pagingOptions:new V({cursor:e,pageSize:i})});return this.purchaseApi.list(n).pipe(o.map((function(t){var e=(t.purchases||[]).map((function(t){return wc(t)}));return new Sc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},e.prototype.voidPurchase=function(t,e,i){var n=new rr({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 tr({filters:t,pagingOptions:new V({cursor:e,pageSize:i})});return this.purchaseApi.listPurchaseItems(n).pipe(o.map((function(t){var e=(t.purchaseItems||[]).map((function(e){return jc(e,t.currency)}));return new Sc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},e.prototype.retryPurchase=function(t,e,i){var n=new or({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 qt({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=_a(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=za(Object.keys(n)),s=r.next();!s.done;s=r.next()){var a=s.value,c=n[a];o[a]=Wc(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 Ds({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 ks({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 Ut({pagingOptions:new V({cursor:t,pageSize:e})});return this.billingApi.listContracts(i).pipe(o.map((function(t){var e=(t.contracts||[]).map((function(t){return Wc(t)}));return new Sc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},e.prototype.listProducts=function(t,e,i,n,r){var s=tu(i),a=new xo({merchantId:t,searchTerm:e,filters:s,pagingOptions:new V({cursor:n,pageSize:r})});return this.billingApi.listProducts(a).pipe(o.map((function(t){var e=(t.products||[]).map((function(t){return $c(t)}));return new Sc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},e.prototype.getMultiProduct=function(t){var e=new Bo({skus:t});return this.billingApi.getMultiProduct(e).pipe(o.map((function(e){var i=new Map;return t.forEach((function(t){i[t]=$c(e.products[t])})),i})))},e.prototype.getBillableItem=function(t,e,i,n){var r=new rt({merchantId:t,sku:e,customerId:i,orderId:n});return this.billingApi.getBillableItem(r).pipe(o.map((function(t){return bc(t.item)})))},e.prototype.changeBillableItemFrequency=function(t,e,i,n,o){var r=new jr({merchantId:t,sku:e,customerId:i,orderId:n,frequency:ja(o)});return this.billingApi.changeFrequency(r)},e.prototype.changeBillableItemNextRenewalDate=function(t,e,i,n,o){var r=new Nr({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 wr({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 dt({searchTerm:t,filters:e,pagingOptions:new V({cursor:i,pageSize:n})});return this.billingApi.listBillableItems(r).pipe(o.map((function(t){var e=(t.items||[]).map((function(t){return bc(t)}));return new Sc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},e.prototype.startRevRecBackfillWorkflow=function(){return this.billingApi.startRevRecTemplateBackfill({})},e}();function iu(e){switch(e){case u.DISCOUNT_TYPE_FIXED_AMOUNT_PER_UNIT:return t.DiscountType.FIXED_AMOUNT_PER_UNIT;case u.DISCOUNT_TYPE_FIXED_NUMBER_OF_UNITS:return t.DiscountType.FIXED_NUMBER_OF_UNITS;case u.DISCOUNT_TYPE_PERCENT_AMOUNT:return t.DiscountType.PERCENT_AMOUNT}return t.DiscountType.FIXED_AMOUNT}function nu(e){switch(e){case t.DiscountType.FIXED_AMOUNT_PER_UNIT:return u.DISCOUNT_TYPE_FIXED_AMOUNT_PER_UNIT;case t.DiscountType.FIXED_NUMBER_OF_UNITS:return u.DISCOUNT_TYPE_FIXED_NUMBER_OF_UNITS;case t.DiscountType.PERCENT_AMOUNT:return u.DISCOUNT_TYPE_PERCENT_AMOUNT}return u.DISCOUNT_TYPE_FIXED_AMOUNT}function ou(t){if(!t)return null;var e=(t.items||[]).map((function(t){return{productId:(e=t).productId,discountType:iu(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}}eu.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new eu(e.ɵɵinject(ia),e.ɵɵinject(Dc),e.ɵɵinject(_c),e.ɵɵinject(la),e.ɵɵinject(fa),e.ɵɵinject(ba))},token:eu,providedIn:"root"}),eu.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],eu.ctorParameters=function(){return[{type:ia},{type:Dc},{type:_c},{type:la},{type:fa},{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 ru=function(){function t(t){this.bundleApiService=t}return t.prototype.upsert=function(t,e,i,n,r){var s=new Ot({merchantId:t,bundleId:e,name:i,hideBundleDetails:n,items:(r||[]).map((function(t){return{productId:(e=t).productId,discountType:nu(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 yt({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,ou(t.bundles[e]))})),i})))},t.prototype.list=function(t,e,i,n){var r=new St({filters:t,searchTerm:e,pagingOptions:new V({cursor:i,pageSize:n})});return this.bundleApiService.list(r).pipe(o.map((function(t){var e=(t.bundles||[]).map((function(t){return ou(t)}));return new Sc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t}();ru.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new ru(e.ɵɵinject(na))},token:ru,providedIn:"root"}),ru.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],ru.ctorParameters=function(){return[{type:na}]};var su=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 Hr({filters:t,pagingOptions:new V({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 Sc(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 Gr({merchantId:t,id:e});return this.contractDocumentApi.delete(i).pipe(o.mapTo(!0))},t}();su.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new su(e.ɵɵinject(oa),e.ɵɵinject(ta),e.ɵɵinject(i.HttpClient))},token:su,providedIn:"root"}),su.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],su.ctorParameters=function(){return[{type:oa},{type:ta},{type:i.HttpClient}]};var au=function(){function t(t){this.creditApi=t}return t.prototype.getBalance=function(t){return this.creditApi.getBalance(new ts({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 Zr({merchantId:t,currency:e,amount:i,idempotencyKey:n,reason:r})).pipe(o.map((function(){return null})))},t}();au.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new au(e.ɵɵinject(sa))},token:au,providedIn:"root"}),au.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],au.ctorParameters=function(){return[{type:sa}]};var cu,uu=function(){function t(t){this.discountApi=t}return t.prototype.list=function(t,e,i){var n=new ge({filters:t,pagingOptions:new V({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:iu(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 Sc(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=nu(i);var p=new le({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=nu(i);var p=new ye({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 ve({merchantId:t,id:e}))},t}();function pu(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 du(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 hu(t){return{merchantId:t.merchantId||"",customerId:t.customerId||"",contactId:t.contactId||"",autoPost:t.autoPost||!1,autoGenerate:t.autoGenerate||!1,useTemplateInvoice:t.useTemplateInvoice||!1,collectionMethod:du(t.collectionMethod),invoiceDay:t.invoiceDay||0}}uu.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new uu(e.ɵɵinject(aa))},token:uu,providedIn:"root"}),uu.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],uu.ctorParameters=function(){return[{type:aa}]},(cu=t.CollectionMethod||(t.CollectionMethod={})).UNSET="Unset",cu.MANUAL_COLLECTION="Manual Collection",cu.CHARGE_AUTOMATICALLY="Charge Automatically",cu.SEND_EMAIL="Send Email";var lu,mu=function(){function t(t){this.configApiService=t}return t.prototype.get=function(t,e){var i=new zr({merchantId:t,customerId:e});return this.configApiService.get(i).pipe(o.map((function(t){return hu(t.configuration)})))},t.prototype.upsert=function(t,e,i,n,r,s,a,c){var u=new Qr({merchantId:t,customerId:e,contactId:i,autoPost:n,autoGenerate:r,collectionMethod:pu(s),invoiceDay:a,useTemplateInvoice:c});return this.configApiService.upsert(u).pipe(o.mapTo(null))},t}();function vu(e){switch(e){case g.DUE:return t.InvoiceStatus.DUE;case g.PAID:return t.InvoiceStatus.PAID;case g.VOID:return t.InvoiceStatus.VOID;default:return t.InvoiceStatus.DRAFT}}function fu(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 gu(t){return t?{amount:t.amount||0,taxRateId:t.taxRateId||"",percentage:t.percentage||0,name:t.name||""}:null}function Iu(t){return t?{id:t.id||"",name:t.name||"",description:t.description||"",percentage:t.percentage||0}:null}function yu(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 gu(t)})),i=(t.taxRates||[]).map((function(t){return Iu(t)})),n=(t.discounts||[]).map((function(t){return Ea(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 gu(t)})),r=(t.defaultTaxRates||[]).map((function(t){return Iu(t)})),s=(t.appliedBundles||[]).map((function(t){return a(t)}));return{id:t.id||"",number:t.number||"",customerId:t.customerId||"",customerName:t.customerName||"",contactId:t.contactId||"",status:vu(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:_a(t.currency),orderId:t.orderId||"",appliedTaxes:o||[],defaultTaxRates:r||[],appliedBundles:s||[],origin:fu(t.origin),collectionMethod:du(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 Au(e){var i,n,o;return new Xe(Object.assign(Object.assign({},e),{statuses:(e.statuses||[]).map((function(e){return function(e){switch(e){case t.InvoiceStatus.DUE:return g.DUE;case t.InvoiceStatus.PAID:return g.PAID;case t.InvoiceStatus.VOID:return g.VOID;default:return g.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,f.CREATED)}}))}mu.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new mu(e.ɵɵinject(Ia))},token:mu,providedIn:"root"}),mu.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],mu.ctorParameters=function(){return[{type:Ia}]},function(t){t.DRAFT="Draft",t.DUE="Due",t.PAID="Paid",t.VOID="Void"}(t.InvoiceStatus||(t.InvoiceStatus={})),(t.InvoiceDateField||(t.InvoiceDateField={})).CREATED="Created",(lu=t.InvoiceOrigin||(t.InvoiceOrigin={})).MANUAL="Manual",lu.SALES_ORDER="Sales Order",lu.RENEWAL="Renewal",lu.UNSET="Unset";var Su=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 Me({merchantId:t,invoiceId:e,bundleId:i})).pipe(o.map((function(t){return yu(t.invoice)})))},t.prototype.addLineItem=function(t,e,i,n,r,s,a){return this.invoiceApiService.addLineItem(new ke({merchantId:t,invoiceId:e,sku:i,amount:n,quantity:r,description:s,taxRates:a})).pipe(o.map((function(t){return yu(t.invoice)})))},t.prototype.charge=function(t,e,i,n){return this.invoiceApiService.charge(new xe({merchantId:t,customerId:e,invoiceId:i,paymentMethodId:n}))},t.prototype.create=function(t,e,i,n){return this.invoiceApiService.create(new Le({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 We({merchantId:t,invoiceId:e}))},t.prototype.deleteLineItem=function(t,e,i){return this.invoiceApiService.deleteLineItem(new He({merchantId:t,invoiceId:e,id:i})).pipe(o.map((function(t){return yu(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 Qe({merchantId:t,invoiceId:e})).pipe(o.map((function(t){return yu(t.invoice)})))},t.prototype.list=function(t,e,i){var n=new ei({filters:Au(t),pagingOptions:new V({cursor:e,pageSize:i})});return this.invoiceApiService.list(n).pipe(o.map((function(t){var e=(t.invoices||[]).map((function(t){return yu(t)}));return new Sc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.pay=function(t,e){return this.invoiceApiService.pay(new ni({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 oi({merchantId:t,invoiceId:e,bundleId:i,bundleInstanceId:n})).pipe(o.map((function(t){return yu(t.invoice)})))},t.prototype.send=function(t,e,i){return this.invoiceApiService.send(new si({merchantId:t,invoiceId:e,emailAddresses:i}))},t.prototype.updateBundle=function(t,e,i,n,r){return this.invoiceApiService.updateBundle(new ai({merchantId:t,invoiceId:e,bundleId:i,hideBundleItems:n,bundleInstanceId:r})).pipe(o.map((function(t){return yu(t.invoice)})))},t.prototype.updateCurrency=function(t,e,i){var n=new $e({merchantId:t,id:e,currency:_a(i)}),o=new Se({paths:["currency"]});return this.update(n,o)},t.prototype.updateDueDate=function(t,e,i){var n=new $e({merchantId:t,id:e,due:i}),o=new Se({paths:["due"]});return this.update(n,o)},t.prototype.updateContact=function(t,e,i){var n=new $e({merchantId:t,id:e,contactId:i}),o=new Se({paths:["contactId"]});return this.update(n,o)},t.prototype.updateCollectionMethod=function(t,e,i){var n=pu(i),o=new $e({merchantId:t,id:e,collectionMethod:n}),r=new Se({paths:["collectionMethod"]});return this.update(o,r)},t.prototype.updateMemo=function(t,e,i){var n=new $e({merchantId:t,id:e,memo:i}),o=new Se({paths:["memo"]});return this.update(n,o)},t.prototype.updateDefaultPaymentMethod=function(t,e,i){var n=new $e({merchantId:t,id:e,defaultPaymentMethod:i}),o=new Se({paths:["defaultPaymentMethod"]});return this.update(n,o)},t.prototype.updateDefaultTaxes=function(t,e,i){return this.invoiceApiService.updateDefaultTaxRates(new ui({merchantId:t,invoiceId:e,taxRateIds:i})).pipe(o.map((function(t){return yu(t.invoice)})))},t.prototype.updateLineItem=function(t,e,i,n,r,s,a,c){return this.invoiceApiService.updateLineItem(new li({merchantId:t,invoiceId:e,id:i,sku:n,amount:r,quantity:s,description:a,taxRates:c})).pipe(o.map((function(t){return yu(t.invoice)})))},t.prototype.update=function(t,e){return this.invoiceApiService.update(new di({invoice:t,fieldMask:e})).pipe(o.map((function(t){return yu(t.invoice)})))},t.prototype.void=function(t,e){return this.invoiceApiService.void(new vi({merchantId:t,invoiceId:e}))},t.prototype.duplicate=function(t,e){return this.invoiceApiService.duplicate(new ze({merchantId:t,invoiceId:e})).pipe(o.map((function(t){return t?t.invoiceId:""})))},t}();function Pu(t){var e=new Date("0001-01-01T00:00:00Z").valueOf(),i=((null==t?void 0:t.appliedBundles)||[]).map((function(t){return a(t)}));return{merchantId:t.merchantId,customerId:t.customerId,currency:_a(t.currency),items:(t.items||[]).map((function(t){return function(t){var e=((null==t?void 0:t.discounts)||[]).map((function(t){return Ea(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 gu(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 Iu(t)})),appliedBundles:i||[],discountTotal:t.amountDiscount||0}}Su.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Su(e.ɵɵinject(ta),e.ɵɵinject(i.HttpClient),e.ɵɵinject(ca))},token:Su,providedIn:"root"}),Su.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Su.ctorParameters=function(){return[{type:ta},{type:i.HttpClient},{type:ca}]};var bu,Tu,Ou,Eu=function(){function t(t){this.invoiceTemplateApiService=t}return t.prototype.upsert=function(t,e,i,n,r){var s=(i||[]).map((function(t){var e=(t.appliedDiscounts||[]).map((function(t){return function(t){return{type:Oa(t.type),value:t.value||0,totalAmount:t.totalAmount||0,description:t.description||""}}(t)}));return new vs({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})})),a=new Ps({merchantId:t,customerId:e,items:s||[],defaultTaxRates:n,currencyCode:r});return this.invoiceTemplateApiService.upsert(a).pipe(o.map((function(t){return Pu(null==t?void 0:t.invoiceTemplate)})))},t.prototype.get=function(t,e){var i=new ds({merchantId:t,customerId:e});return this.invoiceTemplateApiService.get(i).pipe(o.map((function(t){return Pu(null==t?void 0:t.invoiceTemplate)})))},t.prototype.delete=function(t,e){var i=new cs({merchantId:t,customerId:e});return this.invoiceTemplateApiService.delete(i)},t.prototype.updateDefaultTaxRates=function(t,e,i){var n=new Is({customerId:e,merchantId:t,taxRateIds:i});return this.invoiceTemplateApiService.updateTemplateDefaultTaxRates(n).pipe(o.map((function(t){return Pu(null==t?void 0:t.invoiceTemplate)})))},t.prototype.addBundle=function(t,e,i){return this.invoiceTemplateApiService.addBundle(new is({merchantId:t,customerId:e,bundleId:i})).pipe(o.map((function(t){return Pu(null==t?void 0:t.invoiceTemplate)})))},t.prototype.updateBundle=function(t,e,i,n){return this.invoiceTemplateApiService.updateBundle(new fs({merchantId:t,customerId:e,bundleId:i,hideBundleItems:n})).pipe(o.map((function(t){return Pu(null==t?void 0:t.invoiceTemplate)})))},t}();function Ru(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 Du(e){switch(e){case"daily":return t.PayoutInterval.Daily;case"weekly":return t.PayoutInterval.Weekly;case"monthly":return t.PayoutInterval.Monthly}return null}function Cu(e){switch(e){case t.GenerateMethod.SUBSCRIPTION:return"subscription";case t.GenerateMethod.TEMPLATE:return"template";default:return""}}function _u(e){switch(e){case"subscription":return t.GenerateMethod.SUBSCRIPTION;case"template":return t.GenerateMethod.TEMPLATE;default:return t.GenerateMethod.UNSET}}function Ju(t){return t?{generateMethod:_u(t.generateMethod),collectionMethod:du(t.collectionMethod),invoiceDay:t.invoiceDay}:null}Eu.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Eu(e.ɵɵinject(ua))},token:Eu,providedIn:"root"}),Eu.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Eu.ctorParameters=function(){return[{type:ua}]},(bu=t.PayoutInterval||(t.PayoutInterval={})).Daily="daily",bu.Weekly="weekly",bu.Monthly="monthly",(Tu=t.GenerateMethod||(t.GenerateMethod={})).UNSET="Unset",Tu.SUBSCRIPTION="Subscription",Tu.TEMPLATE="Template",(Ou=t.SortMerchantsBy||(t.SortMerchantsBy={}))[Ou.merchantId=0]="merchantId",Ou[Ou.companyName=1]="companyName",Ou[Ou.contactName=2]="contactName",Ou[Ou.emailAddress=3]="emailAddress",Ou[Ou.country=4]="country",Ou[Ou.state=5]="state",Ou[Ou.created=6]="created",Ou[Ou.updated=7]="updated";var wu=function(){function t(t,e,i){this.merchantApi=t,this.hostService=e,this.http=i}return t.prototype.get=function(t){var e=new wi({merchantId:t});return this.merchantApi.get(e).pipe(o.map((function(t){return Ru(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 Mi({merchantId:t});return this.merchantApi.getOutstandingBalance(e).pipe(o.map((function(t){return{outstanding:t.outstandingBalance||0,currency:_a(t.currency)}})))},t.prototype.getStatistics=function(t){var e=new xs({merchantId:t});return this.merchantApi.getStatistics(e)},t.prototype.search=function(t,e,i,n){return this.merchantApi.search({searchTerm:t,sortBy:S[S[e]],sortDirection:A[A[i]],pagingOptions:new V(n)}).pipe(o.map((function(t){return new Sc(t.merchants.map((function(t){return Ru(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(Ec))},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 Ht({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(Ec))},t.prototype.getMultiRetailConfigurations=function(t,e){var i=new Ni({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:Ju(n.defaultCustomerConfiguration)})})),i})))},t.prototype.upsertRetailConfiguration=function(t,e,i,n){var r=new sn({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 ki({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:Du(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 Yi({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 Hi({merchantId:t,pagingOptions:new V({cursor:e,pageSize:i})})).pipe(o.map((function(t){var e=t.payouts||[];return new Sc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.upsertDefaultRetailCustomerConfiguration=function(t,e,i){return this.merchantApi.upsertDefaultRetailCustomerConfiguration(new rn({merchantId:t,retailGroupId:e,defaultCustomerConfiguration:(n=i,n?{generateMethod:Cu(n.generateMethod),collectionMethod:pu(n.collectionMethod),invoiceDay:n.invoiceDay}:null)}));var n},t}();function ju(t){return t?{id:t.id||"",paymentId:t.paymentId||"",status:Bu(t.status),amount:t.amount||0,created:t.created,currencyCode:t.currencyCode,evidence:Nu(t.evidence),evidenceDetails:Mu(t.evidenceDetails),isChargeRefundable:t.isChargeRefundable||!1,reason:t.reason||"",fee:t.fee,feeCurrencyCode:t.feeCurrencyCode}:null}function Nu(t){return t?{customerCommunication:Uu(t.customerCommunication),customerSignature:Uu(t.customerSignature),shippingDocumentation:Uu(t.shippingDocumentation),receipt:Uu(t.receipt),uncategorizedFile:Uu(t.uncategorizedFile),billingAddress:t.billingAddress||"",customerEmailAddress:t.customerEmailAddress||"",customerName:t.customerName||"",productDescription:t.productDescription||""}:null}function Uu(t){return t?{id:t.id||"",created:t.created,filename:t.filename||"",url:t.url||""}:null}function Mu(t){return t?{dueBy:t.dueBy,hasEvidence:t.hasEvidence,pastDue:t.pastDue,submissionCount:t.submissionCount}:null}function Bu(e){switch(e){case O.DISPUTE_STATUS_WARNING_NEEDS_RESPONSE:return t.DisputeStatus.WARNING_NEEDS_RESPONSE;case O.DISPUTE_STATUS_WARNING_UNDER_REVIEW:return t.DisputeStatus.WARNING_UNDER_REVIEW;case O.DISPUTE_STATUS_WARNING_CLOSED:return t.DisputeStatus.WARNING_CLOSED;case O.DISPUTE_STATUS_NEEDS_RESPONSE:return t.DisputeStatus.NEEDS_RESPONSE;case O.DISPUTE_STATUS_UNDER_REVIEW:return t.DisputeStatus.UNDER_REVIEW;case O.DISPUTE_STATUS_CHARGE_REFUNDED:return t.DisputeStatus.CHARGE_REFUNDED;case O.DISPUTE_STATUS_LOST:return t.DisputeStatus.LOST;case O.DISPUTE_STATUS_WON:return t.DisputeStatus.WON;default:return null}}function ku(e){switch(e){case R.PAYMENT_SOURCE_STRIPE:return t.PaymentSource.STRIPE;case R.PAYMENT_SOURCE_VCASH:return t.PaymentSource.VCASH;default:return t.PaymentSource.UNSET}}function Fu(e){switch(e){case D.PAYMENT_STATUS_FAILED:return t.PaymentStatus.Failed;case D.PAYMENT_STATUS_SUCCEEDED:return t.PaymentStatus.Succeeded}return t.PaymentStatus.Unset}function xu(e){switch(e){case E.PAYMENT_ALLOCATION_TYPE_INVOICE:return t.PaymentAllocationType.INVOICE;case E.PAYMENT_ALLOCATION_TYPE_PURCHASE:return t.PaymentAllocationType.PURCHASE;default:return t.PaymentAllocationType.UNSET}}function Lu(e){return{merchantId:e.merchantId||"",created:e.created?new Date(e.created):null,currency:e.currency?_a(e.currency):t.Currency.USD,paymentSource:ku(e.paymentSource),allocations:e.allocations?e.allocations.map((function(t){return Yu(t)})):[],total:e.total||0,description:e.description||"",externalReferenceId:e.externalReferenceId||"",status:Fu(e.status)}}function Yu(e){return{referenceId:e.referenceId||"",amount:e.amount||0,type:e.type?xu(e.type):t.PaymentAllocationType.UNSET}}wu.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new wu(e.ɵɵinject(pa),e.ɵɵinject(ta),e.ɵɵinject(i.HttpClient))},token:wu,providedIn:"root"}),wu.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],wu.ctorParameters=function(){return[{type:pa},{type:ta},{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 qu,Gu,Wu=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."}]]);(qu=t.FundingType||(t.FundingType={})).PREPAID="Pre-paid",qu.DEBIT="Debit",qu.CREDIT="Credit",qu.UNKNOWN="Unknown",(Gu=t.PaymentCardType||(t.PaymentCardType={})).AMEX="American Express",Gu.VISA="Visa",Gu.MASTERCARD="Mastercard",Gu.JCB="JCB",Gu.DINERS_CLUB="Diners Club",Gu.DISCOVER="Discover",Gu.UNKNOWN="Unknown";var Hu=t.PaymentCardType.AMEX,Vu=t.PaymentCardType.VISA,zu=t.PaymentCardType.MASTERCARD,Ku=t.PaymentCardType.JCB,Xu=t.PaymentCardType.DINERS_CLUB,Qu=t.PaymentCardType.DISCOVER,Zu=t.PaymentCardType.UNKNOWN,$u=new Map([[t.CARD_TYPE.AMEX,{id:Hu,value:"American Express"}],[t.CARD_TYPE.VISA,{id:Vu,value:"Visa"}],[t.CARD_TYPE.MASTERCARD,{id:zu,value:"Mastercard"}],[t.CARD_TYPE.JCB,{id:Ku,value:"JCB"}],[t.CARD_TYPE.DINERS_CLUB,{id:Xu,value:"Diners Club"}],[t.CARD_TYPE.DISCOVER,{id:Qu,value:"Discover"}],[t.CARD_TYPE.UNKNOWN,{id:Zu,value:"Unknown"}]]);var tp=t.FundingType.DEBIT,ep=t.FundingType.CREDIT,ip=t.FundingType.PREPAID,np=t.FundingType.UNKNOWN,op=new Map([[J.FUNDING_TYPE_DEBIT,{id:tp,value:"Debit"}],[J.FUNDING_TYPE_CREDIT,{id:ep,value:"Credit"}],[J.FUNDING_TYPE_PREPAID,{id:ip,value:"Pre-paid"}],[J.FUNDING_TYPE_UNKNOWN,{id:np,value:"Unknown"}]]);function rp(t){return op.get(t)}function sp(t){return{cardType:(e=t.cardType,$u.get(e)),fundingType:rp(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 ap,cp,up=function(){function t(t){this.apiService=t}return t.prototype.setDefaultCard=function(t,e){var i=new tn({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 io({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 sp(t)}))})))},t.prototype.update=function(t,e){var i=new so({merchantId:t,stripeToken:e});return this.apiService.updatePaymentCard(new so(i))},t.prototype.create=function(t,e){var i=new to({merchantId:t,stripeToken:e});return this.apiService.createPaymentCard(new to(i))},t}();function pp(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:hp(t.status,t.disputed),failureCode:t.failureCode,failureMessage:t.failureMessage,applicationFee:t.applicationFee,dispute:ju(t.dispute),cardDetails:(e=t.cardDetails,{lastFourDigits:e.lastFourDigits,cardType:dp(e.cardType)})};var e}function dp(e){switch(e){case T.CARD_TYPE_VISA:return t.PaymentCardType.VISA;case T.CARD_TYPE_MASTERCARD:return t.PaymentCardType.MASTERCARD;case T.CARD_TYPE_AMEX:return t.PaymentCardType.AMEX;case T.CARD_TYPE_DISCOVER:return t.PaymentCardType.DISCOVER;case T.CARD_TYPE_JCB:return t.PaymentCardType.JCB;case T.CARD_TYPE_DINERS_CLUB:return t.PaymentCardType.UNKNOWN}}function hp(e,i){if(i)return t.RetailPaymentStatus.Disputed;switch(e){case D.PAYMENT_STATUS_SUCCEEDED:return t.RetailPaymentStatus.Succeeded;case D.PAYMENT_STATUS_FAILED:return t.RetailPaymentStatus.Failed;case D.PAYMENT_STATUS_REFUNDED:return t.RetailPaymentStatus.Refunded;case D.PAYMENT_STATUS_PARTIALLY_REFUNDED:return t.RetailPaymentStatus.PartialyRefunded;default:return null}}function lp(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 mp(t){return{supportedRegion:t.supportedRegion||!1,canAcceptPayment:t.canAcceptPayment||!1,disabledReason:lp(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}up.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new up(e.ɵɵinject(pa))},token:up,providedIn:"root"}),up.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],up.ctorParameters=function(){return[{type:pa}]},(ap=t.RetailPaymentStatus||(t.RetailPaymentStatus={})).Failed="Failed",ap.Succeeded="Succeeded",ap.Refunded="Refunded",ap.PartialyRefunded="Partially refunded",ap.Disputed="Disputed",(cp=t.DisabledReason||(t.DisabledReason={})).FIELDS_NEEDED="fields needed",cp.LISTED="listed",cp.REJECTED="rejected",cp.UNDER_REVIEW="under review",cp.OTHER="other";var vp=function(){function t(t){this.paymentApi=t}return t.prototype.listPayments=function(t,e,i){var n=new wn({filters:t,pagingOptions:new V({cursor:e,pageSize:i})});return this.paymentApi.list(n).pipe(o.map((function(t){var e=(t.payments||[]).map((function(t){return Lu(t)}));return new Sc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.prepareRetailPayment=function(t,e){var i=new Yn({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 pp(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 Mn({payoutId:n||"",customerId:r||""});return s&&s.valueOf()!==c&&(u.createdDateGte=s),a&&a.valueOf()!==c&&(u.createdDateLte=a),this.paymentApi.listRetail(new Bn({merchantId:t,filters:u,pagingOptions:new V({cursor:e,pageSize:i})})).pipe(o.map((function(t){var e=(t.payments||[]).map((function(t){return pp(t)}));return new Sc(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 ju(t.dispute)})))},t.prototype.listRetailDisputes=function(t,e,i){return void 0===e&&(e=""),void 0===i&&(i=10),this.paymentApi.listRetailDisputes(new Nn({merchantId:t,pagingOptions:new V({cursor:e,pageSize:i})})).pipe(o.map((function(t){var e=(t.disputes||[]).map((function(t){return ju(t)}));return new Sc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.retailStatus=function(t){var e=new Vn({merchantId:t});return this.paymentApi.retailStatus(e).pipe(o.map((function(t){return mp(t)})))},t.prototype.retailPaymentsEnabled=function(t){var e=new Wn({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}();vp.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new vp(e.ɵɵinject(ha))},token:vp,providedIn:"root"}),vp.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],vp.ctorParameters=function(){return[{type:ha}]};var fp=function(){function t(t){this.apiService=t}return t.prototype.listPaymentCards=function(t,e){var i=new io({merchantId:t,customerId:e});return this.apiService.listPaymentCards(i).pipe(o.map((function(t){return(t&&t.paymentCard?t.paymentCard:[]).map((function(t){return sp(t)}))})))},t.prototype.deletePaymentCard=function(t,e){var i=new eo({merchantId:t,cardId:e});return this.apiService.deletePaymentCard(i).pipe(o.mapTo(!0))},t.prototype.setDefaultPaymentCard=function(t,e,i){var n=new ro({merchantId:t,customerId:e,paymentMethodId:i});return this.apiService.setDefaultPaymentMethod(n).pipe(o.mapTo(!0))},t}();function gp(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 Ip(t){var e=(t.subscriptionMetrics||[]).map((function(t){return gp(t)}));return{groupID:t.groupId||"",metrics:e||[]}}fp.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new fp(e.ɵɵinject(da))},token:fp,providedIn:"root"}),fp.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],fp.ctorParameters=function(){return[{type:da}]};var yp=function(){function t(t){this.productSummaryApi=t}return t.prototype.listSubscriptionRetentionBySKU=function(t,e,i,n){var r=new se({merchantId:t,filters:e,pagingOptions:new V({cursor:i,pageSize:n})});return this.productSummaryApi.listSubscriptionRetentionBySku(r).pipe(o.map((function(t){var e=(t.subscriptionMetrics||[]).map((function(t){return gp(t)}));return new Sc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.listSubscriptionRetentionByGroup=function(t,e,i,n){var r=new se({merchantId:t,filters:e,pagingOptions:new V({cursor:i,pageSize:n})});return this.productSummaryApi.listSubscriptionRetentionByGroup(r).pipe(o.map((function(t){var e=(t.metricsByGroup||[]).map((function(t){return Ip(t)}));return new Sc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t}();yp.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new yp(e.ɵɵinject(va))},token:yp,providedIn:"root"}),yp.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],yp.ctorParameters=function(){return[{type:va}]};var Ap=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 Sp(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 Pp(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 bp(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 Tp(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 Op(t){return{merchantId:t.merchantId||"",chargeId:t.chargeId||"",refundId:t.refundId||"",amount:t.amount||0,reason:Pp(t.reason),status:bp(t.status),created:t.created?new Date(t.created):null,updated:t.updated?new Date(t.updated):null,referenceType:Tp(t.referenceType),referenceId:t.referenceId||""}}Ap.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Ap(e.ɵɵinject(ta),e.ɵɵinject(i.HttpClient))},token:Ap,providedIn:"root"}),Ap.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Ap.ctorParameters=function(){return[{type:ta},{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 Ep=function(){function t(t){this.refundApiService=t}return t.prototype.create=function(t,e,i,n){var r=new ar({merchantId:t,paymentId:e,amount:i,reason:Sp(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 cr({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 Op(t)}));return new Sc(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 Rp(e){return new lr(Object.assign(Object.assign({},e),{statuses:(e.statuses||[]).map((function(e){return function(e){switch(e){case t.SalesCreditNoteStatus.ReadyToPost:return L.SALES_CREDIT_NOTE_STATUS_READY_TO_POST;case t.SalesCreditNoteStatus.Complete:return L.SALES_CREDIT_NOTE_STATUS_COMPLETE;case t.SalesCreditNoteStatus.Discarded:return L.SALES_CREDIT_NOTE_STATUS_DISCARDED}return L.SALES_CREDIT_NOTE_STATUS_IN_PROGRESS}(e)}))}))}function Dp(e){switch(e){case L.SALES_CREDIT_NOTE_STATUS_READY_TO_POST:return t.SalesCreditNoteStatus.ReadyToPost;case L.SALES_CREDIT_NOTE_STATUS_COMPLETE:return t.SalesCreditNoteStatus.Complete;case L.SALES_CREDIT_NOTE_STATUS_DISCARDED:return t.SalesCreditNoteStatus.Discarded}return t.SalesCreditNoteStatus.InProgress}Ep.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Ep(e.ɵɵinject(ga))},token:Ep,providedIn:"root"}),Ep.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Ep.ctorParameters=function(){return[{type:ga}]},function(t){t.InProgress="IN_PROGRESS",t.ReadyToPost="READY_TO_POST",t.Complete="COMPLETE",t.Discarded="DISCARDED"}(t.SalesCreditNoteStatus||(t.SalesCreditNoteStatus={}));var Cp,_p=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 hr({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 mr({filters:Rp(t),pagingOptions:new V({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:_a(e.currency),total:e.total||0,outstanding:e.outstanding||0,invoiceId:e.invoiceId,invoiceNumber:e.invoiceNumber,status:Dp(e.status),paymentStatus:e.paymentStatus};var e}));return new Sc(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 Jp(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:_a(t.currency),status:jp(t.status),type:Np(t.type),total:t.total||0,paymentStatus:t.paymentStatus,outstanding:t.outstanding||0}}function wp(e){return new Ar(Object.assign(Object.assign({},e),{statuses:(e.statuses||[]).map((function(e){return function(e){switch(e){case t.SalesInvoiceStatus.ReadyToPost:return q.SALES_INVOICE_STATUS_READY_TO_POST;case t.SalesInvoiceStatus.Complete:return q.SALES_INVOICE_STATUS_COMPLETE;case t.SalesInvoiceStatus.Discarded:return q.SALES_INVOICE_STATUS_DISCARDED}return q.SALES_INVOICE_STATUS_IN_PROGRESS}(e)})),paymentStatuses:(e.paymentStatuses||[]).map((function(e){return function(e){switch(e){case t.PaymentStatusType.Paid:return Y.PAYMENT_STATUSES_PAID;case t.PaymentStatusType.Part_Paid:return Y.PAYMENT_STATUSES_PART_PAID;case t.PaymentStatusType.Unpaid:return Y.PAYMENT_STATUSES_UNPAID;case t.PaymentStatusType.Not_Applicable:return Y.PAYMENT_STATUSES_NOT_APPLICABLE}return Y.PAYMENT_STATUSES_NOT_SET}(e)}))}))}function jp(e){switch(e){case q.SALES_INVOICE_STATUS_READY_TO_POST:return t.SalesInvoiceStatus.ReadyToPost;case q.SALES_INVOICE_STATUS_COMPLETE:return t.SalesInvoiceStatus.Complete;case q.SALES_INVOICE_STATUS_DISCARDED:return t.SalesInvoiceStatus.Discarded}return t.SalesInvoiceStatus.InProgress}function Np(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}_p.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new _p(e.ɵɵinject(ta),e.ɵɵinject(i.HttpClient),e.ɵɵinject(ya))},token:_p,providedIn:"root"}),_p.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],_p.ctorParameters=function(){return[{type:ta},{type:i.HttpClient},{type:ya}]},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={})),(Cp=t.PaymentStatusType||(t.PaymentStatusType={})).Not_Applicable="Not Applicable",Cp.Unpaid="Unpaid",Cp.Paid="Paid",Cp.Part_Paid="Part Paid";var Up=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(Mp))},t.prototype.listSalesInvoices=function(t,e,i,n){var r=new Sr({filters:wp(t),pagingOptions:new V({cursor:e,pageSize:i}),searchTerm:n||""});return this.salesInvoiceApi.list(r).pipe(o.map((function(t){var e=(t.invoice||[]).map((function(t){return Jp(t)}));return new Sc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.postSalesInvoice=function(t){var e=new br({invoiceId:t});return this.salesInvoiceApi.post(e).pipe(o.mapTo(!0))},t.prototype.getSalesInvoice=function(t,e){var i=new Ir({invoiceId:t,merchantId:e});return this.salesInvoiceApi.get(i).pipe(o.map((function(t){return Jp(t.invoice)})))},t}();function Mp(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")}Up.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new Up(e.ɵɵinject(ta),e.ɵɵinject(i.HttpClient),e.ɵɵinject(Aa))},token:Up,providedIn:"root"}),Up.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],Up.ctorParameters=function(){return[{type:ta},{type:i.HttpClient},{type:Aa}]};var Bp,kp=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(Rc))},t.prototype.apiOptions=function(){return{withCredentials:!0}},t}();function Fp(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||""}}kp.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new kp(e.ɵɵinject(ta),e.ɵɵinject(i.HttpClient))},token:kp,providedIn:"root"}),kp.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],kp.ctorParameters=function(){return[{type:ta},{type:i.HttpClient}]},(Bp=t.FilePurpose||(t.FilePurpose={})).ACCOUNT_REQUIREMENT="account_requirement",Bp.ADDITIONAL_VERIFICATION="additional_verification",Bp.BUSINESS_ICON="business_icon",Bp.BUSINESS_LOGO="business_logo",Bp.CUSTOMER_SIGNATURE="customer_signature",Bp.DISPUTE_EVIDENCE="dispute_evidence",Bp.IDENTITY_DOCUMENT="identity_document",Bp.PCI_DOCUMENT="pci_document",Bp.TAX_DOCUMENT_USER_UPLOAD="tax_document_user_upload";var xp=function(){function t(t){this.taxRateApi=t}return t.prototype.calculate=function(t,e,i){var n=new be({merchantId:t,customerId:e,amount:i});return this.taxRateApi.calculate(n).pipe(o.map((function(t){var e=(t.taxRates||[]).map((function(t){return Fp(t)}));return{taxableAmount:t.taxableAmount||0,taxRates:e}})))},t.prototype.create=function(t,e,i,n,o,r,s){var a=new Oe({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 we({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 Ce({filters:t,pagingOptions:new V({cursor:e,pageSize:i})});return this.taxRateApi.list(n).pipe(o.map((function(t){var e=(t.taxRates||[]).map((function(t){return Fp(t)}));return new Sc(e,t.pagingMetadata.nextCursor,t.pagingMetadata.hasMore)})))},t.prototype.getMulti=function(t,e){var i=new Re({merchantId:t,ids:e});return this.taxRateApi.getMulti(i).pipe(o.map((function(t){return(t.taxRates||[]).map((function(t){return Fp(t)}))})))},t.prototype.archive=function(t,e){var i=new Pe({merchantId:t,id:e});return this.taxRateApi.archive(i)},t}();xp.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new xp(e.ɵɵinject(Sa))},token:xp,providedIn:"root"}),xp.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],xp.ctorParameters=function(){return[{type:Sa}]},t.AddLineItemRequest=ke,t.AddLineItemResponse=Fe,t.Agency=Fc,t.BankAccountService=Ra,t.BankReconciliationService=Pc,t.BillingApiService=ia,t.BillingHostService=Oc,t.BillingService=eu,t.BundleService=ru,t.CanCreateSubscriptionsResponse=Jr,t.ChannelPartnersGrowthHighTouch=Gc,t.ChannelPartnersGrowthMediumTouch=qc,t.ChannelPartnersUnassistedPLG=Yc,t.ConnectStripeAccountRequest=Di,t.ConnectStripeAccountResponse=Ci,t.ContractDocumentService=su,t.ContractService=zc,t.CreateDiscountRequest=le,t.CreateInvoiceRequest=Le,t.CreateInvoiceResponse=Ye,t.CreateMerchantRequest=_i,t.CreatePaymentCardRequest=to,t.CreateProductRequest=Uo,t.CreateRefundRequest=ar,t.CreateTaxRequest=Oe,t.CreditService=au,t.DeclineReasons=Wu,t.DeleteBankAccountRequest=Vt,t.DeleteContractDocumentRequest=Gr,t.DeleteInvoiceRequest=We,t.DeleteLineItemRequest=He,t.DeleteLineItemResponse=Ve,t.DeleteProductRequest=Mo,t.DeleteRetailPricingRequest=Os,t.Dimension=Bc,t.DiscountService=uu,t.ExistingEnterprise=Lc,t.ExpireDiscountRequest=ve,t.GenerateBillableItemsCSVRequest=Es,t.GenerateBillableItemsCSVResponse=Rs,t.GenerateVendorReportRequest=Ds,t.GenerateVendorReportResponse=Cs,t.GetBalanceRequest=ts,t.GetBalanceResponse=es,t.GetInvoiceRequest=Qe,t.GetInvoiceResponse=Ze,t.GetMerchantRequest=wi,t.GetMerchantResponse=ji,t.GetMultiBundleRetailPricingRequest=_s,t.GetMultiBundleRetailPricingResponse=Js,t.GetMultiBundleRetailPricingResponsePricesEntry=Hs,t.GetMultiContractsRequest=jt,t.GetMultiContractsResponse=Nt,t.GetMultiProductPricingRequest=ws,t.GetMultiProductPricingResponse=js,t.GetMultiProductPricingResponseProductPricesEntry=Ks,t.GetMultiProductRequest=Bo,t.GetMultiProductResponse=ko,t.GetMultiRetailPricingRequest=Ns,t.GetMultiRetailPricingResponse=Us,t.GetMultiRetailPricingResponseProductPricesEntry=zs,t.GetMultiTaxRequest=Re,t.GetMultiTaxResponse=De,t.GetOutstandingBalanceRequest=Mi,t.GetOutstandingBalanceResponse=Bi,t.GetPurchaseCostRequest=Ms,t.GetPurchaseCostResponse=Bs,t.GetRevenueStatsRequest=ks,t.GetRevenueStatsResponse=Fs,t.GetStatisticsRequest=xs,t.GetStatisticsResponse=Ls,t.GetWholesaleComparisonRequest=qs,t.GetWholesaleComparisonRequestGetWholesaleComparisonFilters=Ys,t.GetWholesaleComparisonResponse=Gs,t.GetWholesaleComparisonResponseGetWholesaleComparisonResult=Ws,t.InvoiceService=Su,t.InvoiceTemplateService=Eu,t.ListBankAccountsRequest=zt,t.ListBankAccountsResponse=Kt,t.ListBillableItemsRequestFilters=ot,t.ListContractDocumentsRequest=Hr,t.ListContractDocumentsResponse=Vr,t.ListContractsRequest=Ut,t.ListContractsResponse=Mt,t.ListDiscountsRequest=ge,t.ListDiscountsResponse=Ie,t.ListInvoicesRequest=ei,t.ListInvoicesResponse=ii,t.ListMerchantBillingReportsRequest=cn,t.ListMerchantBillingReportsResponse=un,t.ListPaymentCardsRequest=io,t.ListPaymentCardsResponse=no,t.ListPaymentRequest=wn,t.ListPaymentResponse=jn,t.ListProductsRequest=xo,t.ListProductsResponse=Lo,t.ListPurchaseItemsFilters=Qo,t.ListPurchaseItemsRequest=Zo,t.ListPurchaseItemsResponse=$o,t.ListPurchaseRequest=tr,t.ListPurchaseResponse=er,t.ListRefundsRequest=cr,t.ListRefundsResponse=ur,t.ListRetailPaymentsRequest=Bn,t.ListRetailPaymentsResponse=kn,t.ListSalesCreditNoteRequest=mr,t.ListSalesCreditNoteResponse=vr,t.ListTaxRequest=Ce,t.ListTaxResponse=_e,t.MerchantApiService=pa,t.MerchantReportApiService=_c,t.MerchantService=wu,t.NewEnterprise=xc,t.PagedResponse=Sc,t.PayInvoiceRequest=ni,t.PaymentCardService=up,t.PaymentMethodService=fp,t.PaymentService=vp,t.PrepareRetailPaymentRequest=Yn,t.PrepareRetailPaymentResponse=qn,t.PricingPlanService=Za,t.ProductSummary=ce,t.ProductSummaryService=yp,t.PurchaseService=Ap,t.REPUTATION_MANGEMENT_SKU="RM",t.RefundApiService=ga,t.RefundService=Ep,t.ResetContractPricingRequest=kt,t.RetailCustomerConfigurationService=mu,t.RetailPayout=Oi,t.RetryPurchaseRequest=or,t.RevenueApiService=Dc,t.SNAPSHOT_REPORT_REFRESH_SKU="snapshotreportrefresh",t.SNAPSHOT_REPORT_SKU="ST",t.SalesCreditNoteService=_p,t.SalesInvoiceService=Up,t.SearchMerchantsRequest=Xi,t.SearchMerchantsResponse=Qi,t.SendInvoiceRequest=si,t.SetAutoChargeInvoicesRequest=Zi,t.SetAutoPostInvoicesRequest=$i,t.SetDefaultBankAccountRequest=Xt,t.SetDefaultPaymentCardRequest=tn,t.SetHasAlternativePaymentMethodRequest=en,t.SetIncludeInFinancialRecordsRequest=nn,t.SetWholesaleProductStrategyRequest=Xs,t.SetWholesaleProductVolumeCommitmentRequest=Qs,t.StartRevRecTemplateBackfillRequest=Zs,t.StripeFileService=kp,t.SubscriptionService=Tc,t.TaxRateService=xp,t.UpdateInvoiceRequest=di,t.UpdateInvoiceResponse=hi,t.UpdateLineItemRequest=li,t.UpdateLineItemResponse=mi,t.UpdateMerchantRequest=on,t.UpdatePaymentCardRequest=so,t.UpdateProductRequest=qo,t.UpdateTaxRequest=we,t.UpsertRetailPricingRequest=$s,t.UpsertRetailPricingRequestPricingEntry=Vs,t.ValidateResponse=Yr,t.VoidInvoiceRequest=vi,t.VoidPurchaseRequest=rr,t.WholesalePricingService=Ha,t.appliedCreditFromAPI=Nc,t.appliedCreditTypeFromAPI=Uc,t.appliedDiscountFromApi=Ea,t.appliedTaxRateFromAPI=Mc,t.billingStrategyFromAPI=Da,t.billingStrategyToAPI=Ca,t.buildBilledProductFromProductPricingAndAddon=function(t,e){return{productName:t.productName,productId:t.addonId,billingModel:Kc(e.pricingType),price:void 0,notes:[],iconURL:t.productIcon,currency:e.currency,billingFrequency:Qc(e.frequency),pricingTiers:Xc(e.pricingRules),productCategory:void 0,commitment:e.commitment,setupFee:e.setupFee}},t.collectionMethodFromApi=du,t.collectionMethodToApi=pu,t.contractFromApi=Wc,t.convertApiAppliedBundle=a,t.currencyFromApi=_a,t.currencyPricingMapToApi=Ya,t.disputeFromApi=ju,t.disputeStatusFromApi=Bu,t.enumStringToValue=Ts,t.frequencyFromApi=wa,t.frequencyFromLegacyApi=Ja,t.frequencyToApi=ja,t.isBillingStrategyInstant=function(e){return e===t.BillingStrategy.Instantly||e===t.BillingStrategy.EndOfDay},t.listProductsFilterToApi=tu,t.mapFrequency=Qc,t.paymentAllocationFromApi=Yu,t.paymentAllocationTypeFromApi=xu,t.paymentFromApi=Lu,t.paymentSourceFromApi=ku,t.paymentStatusFromApi=Fu,t.pricesFromApi=xa,t.pricingPlanFromAPI=Va,t.pricingPlanProductFromApi=La,t.pricingPlanProductPricingToApi=Ga,t.pricingRulesToTiers=Xc,t.pricingTypeToBillingModel=Kc,t.productFromApi=$c,t.productPricingFromApi=Fa,t.productPricingRulesFromApi=Na,t.productPricingRulesToApi=qa,t.productPricingTypeFromApi=Ua,t.productPricingTypeToApi=Ma,t.purchaseCostFromAPI=ka,t.purchaseFromApi=wc,t.purchaseItemFromApi=jc,t.purchaseStatusFromApi=Jc,t.reasonFromApi=Pp,t.reasonToApi=Sp,t.referenceFromApi=Tp,t.refundFromApi=Op,t.retailCustomerConfigurationFromApi=hu,t.retailPaymentFromApi=pp,t.retailPaymentStatusFromApi=hp,t.retailResponseFromAPI=mp,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=bp,t.subscriptionMetricByGroupFromAPI=Ip,t.subscriptionMetricFromAPI=gp,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
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})}));
|
|
16
16
|
//# sourceMappingURL=vendasta-billing.umd.min.js.map
|