{ "version": 3, "sources": ["apps/partner-center-client/src/app/core/billing/purchase-cost.ts", "apps/partner-center-client/src/app/core/billing/billing-api.service.ts"], "sourcesContent": ["import { Currency, PurchaseCost as PurchaseCostResponse } from '@galaxy/billing';\n\nexport class PurchaseCost {\n billingFrequency: string;\n totalCost: number;\n subtotalCost: number;\n setupFee: number;\n currency: string;\n initialCommitment: number;\n recurringCommitment: number;\n isStartingPrice: boolean;\n discountAmount: number;\n\n public static fromGetPurchaseCostResponse(response: PurchaseCostResponse): PurchaseCost {\n if (!response) {\n return null;\n }\n const purchaseCost = new PurchaseCost();\n purchaseCost.billingFrequency = response.billingFrequency.replace('_', ' ').toLowerCase();\n purchaseCost.totalCost = response.total || 0;\n purchaseCost.subtotalCost = response.subtotal || 0;\n purchaseCost.setupFee = response.setupFee || 0;\n purchaseCost.currency = Currency[response.currency] || 'USD';\n purchaseCost.isStartingPrice = response.isStartingPrice;\n purchaseCost.discountAmount = response.discountTotal || 0;\n if (response.commitment) {\n purchaseCost.initialCommitment = response.commitment.initial;\n purchaseCost.recurringCommitment = response.commitment.recurring;\n }\n return purchaseCost;\n }\n}\n", "import { Injectable } from '@angular/core';\nimport { BillingService, WholesalePricingService } from '@galaxy/billing';\nimport { Observable, of as observableOf } from 'rxjs';\nimport { catchError, map } from 'rxjs/operators';\nimport { PurchaseCost } from './purchase-cost';\n\n@Injectable({ providedIn: 'root' })\nexport class BillingApiService {\n constructor(\n private billingService: BillingService,\n private wholesalePricingService: WholesalePricingService,\n ) {}\n\n public getPurchaseCost(merchantId: string, sku: string, quantity: number): Observable {\n return this.wholesalePricingService.getPurchaseCost(merchantId, sku, quantity).pipe(\n catchError(() => observableOf(null)),\n map((response) => PurchaseCost.fromGetPurchaseCostResponse(response)),\n );\n }\n\n public canBillCreateSnapshotStatusCode(merchantId: string): Observable {\n return this.billingService.canBillCreateSnapshot(merchantId).pipe(\n catchError(() => observableOf(null)),\n map((response) => response.status),\n );\n }\n\n public canBillRefreshSnapshotStatusCode(merchantId: string): Observable {\n return this.billingService.canBillRefreshSnapshot(merchantId).pipe(\n catchError(() => observableOf(null)),\n map((response) => response.status),\n );\n }\n}\n"], "mappings": "6JAEM,IAAOA,EAAP,MAAOA,CAAY,CAWhB,OAAOC,4BAA4BC,EAA8B,CACtE,GAAI,CAACA,EACH,OAAO,KAET,IAAMC,EAAe,IAAIH,EACzBG,OAAAA,EAAaC,iBAAmBF,EAASE,iBAAiBC,QAAQ,IAAK,GAAG,EAAEC,YAAW,EACvFH,EAAaI,UAAYL,EAASM,OAAS,EAC3CL,EAAaM,aAAeP,EAASQ,UAAY,EACjDP,EAAaQ,SAAWT,EAASS,UAAY,EAC7CR,EAAaS,SAAWC,EAASX,EAASU,QAAQ,GAAK,MACvDT,EAAaW,gBAAkBZ,EAASY,gBACxCX,EAAaY,eAAiBb,EAASc,eAAiB,EACpDd,EAASe,aACXd,EAAae,kBAAoBhB,EAASe,WAAWE,QACrDhB,EAAaiB,oBAAsBlB,EAASe,WAAWI,WAElDlB,CACT,GCvBF,IAAamB,GAAiB,IAAA,CAAxB,IAAOA,EAAP,MAAOA,CAAiB,CAC5BC,YACUC,EACAC,EAAgD,CADhD,KAAAD,eAAAA,EACA,KAAAC,wBAAAA,CACP,CAEIC,gBAAgBC,EAAoBC,EAAaC,EAAgB,CACtE,OAAO,KAAKJ,wBAAwBC,gBAAgBC,EAAYC,EAAKC,CAAQ,EAAEC,KAC7EC,EAAW,IAAMC,EAAa,IAAI,CAAC,EACnCC,EAAKC,GAAaC,EAAaC,4BAA4BF,CAAQ,CAAC,CAAC,CAEzE,CAEOG,gCAAgCV,EAAkB,CACvD,OAAO,KAAKH,eAAec,sBAAsBX,CAAU,EAAEG,KAC3DC,EAAW,IAAMC,EAAa,IAAI,CAAC,EACnCC,EAAKC,GAAaA,EAASK,MAAM,CAAC,CAEtC,CAEOC,iCAAiCb,EAAkB,CACxD,OAAO,KAAKH,eAAeiB,uBAAuBd,CAAU,EAAEG,KAC5DC,EAAW,IAAMC,EAAa,IAAI,CAAC,EACnCC,EAAKC,GAAaA,EAASK,MAAM,CAAC,CAEtC,yCAzBWjB,GAAiBoB,EAAAC,CAAA,EAAAD,EAAAE,CAAA,CAAA,CAAA,wBAAjBtB,EAAiBuB,QAAjBvB,EAAiBwB,UAAAC,WADJ,MAAM,CAAA,EAC1B,IAAOzB,EAAP0B,SAAO1B,CAAiB,GAAA", "names": ["PurchaseCost", "fromGetPurchaseCostResponse", "response", "purchaseCost", "billingFrequency", "replace", "toLowerCase", "totalCost", "total", "subtotalCost", "subtotal", "setupFee", "currency", "Currency", "isStartingPrice", "discountAmount", "discountTotal", "commitment", "initialCommitment", "initial", "recurringCommitment", "recurring", "BillingApiService", "constructor", "billingService", "wholesalePricingService", "getPurchaseCost", "merchantId", "sku", "quantity", "pipe", "catchError", "observableOf", "map", "response", "PurchaseCost", "fromGetPurchaseCostResponse", "canBillCreateSnapshotStatusCode", "canBillCreateSnapshot", "status", "canBillRefreshSnapshotStatusCode", "canBillRefreshSnapshot", "\u0275\u0275inject", "BillingService", "WholesalePricingService", "factory", "\u0275fac", "providedIn", "_BillingApiService"] }