From 586ae376a31deeed98674a19655b8870dbbca488 Mon Sep 17 00:00:00 2001 From: Tara Zou Date: Fri, 10 May 2024 15:09:12 -0400 Subject: [PATCH] update pricing UPAPI properties --- src/SelfServe/SqlX/SqlX.rp.ts | 22 +++++++++++----------- src/SelfServe/SqlX/SqlX.tsx | 2 +- src/SelfServe/SqlX/SqlxTypes.ts | 6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/SelfServe/SqlX/SqlX.rp.ts b/src/SelfServe/SqlX/SqlX.rp.ts index 2765cc11a..620f4c911 100644 --- a/src/SelfServe/SqlX/SqlX.rp.ts +++ b/src/SelfServe/SqlX/SqlX.rp.ts @@ -195,7 +195,7 @@ export const getPriceMapAndCurrencyCode = async (map: OfferingIdMap): Promise>(); - let pricingCurrency; + let billingCurrency; for (const region of map.keys()) { const regionPriceMap = new Map(); const regionShortName = await getRegionShortName(region); @@ -213,30 +213,30 @@ export const getPriceMapAndCurrencyCode = async (map: OfferingIdMap): Promise x.type === "Consumption")?.unitPrice; - regionPriceMap.set(skuName, unitPrice); + const unitEffectivePriceInBillingCurrency = item.prices.find((x) => x.type === "Consumption")?.unitEffectivePriceInBillingCurrency; + regionPriceMap.set(skuName, unitEffectivePriceInBillingCurrency); } priceMap.set(region, regionPriceMap); } selfServeTraceSuccess(telemetryData, getPriceMapAndCurrencyCodeTimestamp); - return { priceMap: priceMap, pricingCurrency: pricingCurrency }; + return { priceMap: priceMap, billingCurrency: billingCurrency }; } catch (err) { const failureTelemetry = { err, selfServeClassName: SqlX.name }; selfServeTraceFailure(failureTelemetry, getPriceMapAndCurrencyCodeTimestamp); - return { priceMap: undefined, pricingCurrency: undefined }; + return { priceMap: undefined, billingCurrency: undefined }; } }; diff --git a/src/SelfServe/SqlX/SqlX.tsx b/src/SelfServe/SqlX/SqlX.tsx index 6b5f75df0..cbac4ef04 100644 --- a/src/SelfServe/SqlX/SqlX.tsx +++ b/src/SelfServe/SqlX/SqlX.tsx @@ -374,7 +374,7 @@ export default class SqlX extends SelfServeBaseClass { const offeringIdMap = await getOfferingIds(regions); const priceMapAndCurrencyCode = await getPriceMapAndCurrencyCode(offeringIdMap); priceMap = priceMapAndCurrencyCode.priceMap; - currencyCode = priceMapAndCurrencyCode.pricingCurrency; + currencyCode = priceMapAndCurrencyCode.billingCurrency; const response = await getCurrentProvisioningState(); if (response.status && response.status !== "Deleting") { diff --git a/src/SelfServe/SqlX/SqlxTypes.ts b/src/SelfServe/SqlX/SqlxTypes.ts index 9c5467eb9..aba2e61d7 100644 --- a/src/SelfServe/SqlX/SqlxTypes.ts +++ b/src/SelfServe/SqlX/SqlxTypes.ts @@ -35,13 +35,13 @@ export type FetchPricesResponse = Array; export type PriceItem = { prices: Array; id: string; - pricingCurrency: string; + billingCurrency: string; error: PriceError; }; export type PriceType = { type: string; - unitPrice: number; + unitEffectivePriceInBillingCurrency: number; }; export type PriceError = { @@ -51,7 +51,7 @@ export type PriceError = { export type PriceMapAndCurrencyCode = { priceMap: Map>; - pricingCurrency: string; + billingCurrency: string; }; export type GetOfferingIdsResponse = {