pds-dev-kit-web 2.2.319-alpha.1 → 2.2.319-alpha.2
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.
|
@@ -35,18 +35,20 @@ function buildCurrencyPolicy(code, input) {
|
|
|
35
35
|
*/
|
|
36
36
|
function normalizeExchangeRates(baseCurrency, altCurrencies, input) {
|
|
37
37
|
var _a;
|
|
38
|
-
var _b;
|
|
39
38
|
var rates = input !== null && input !== void 0 ? input : {};
|
|
40
|
-
|
|
39
|
+
// API가 Decimal을 문자열("1500.0000000000")로 내려주는 경우가 있어 숫자로 강제 변환한다
|
|
40
|
+
var baseRateRaw = rates[baseCurrency];
|
|
41
|
+
var baseRate = baseRateRaw === undefined ? 1 : Number(baseRateRaw);
|
|
41
42
|
if (!Number.isFinite(baseRate) || baseRate <= 0) {
|
|
42
43
|
throw new Error("createPricingPolicy: invalid exchange rate for ".concat(baseCurrency));
|
|
43
44
|
}
|
|
44
45
|
var normalized = (_a = {}, _a[baseCurrency] = 1, _a);
|
|
45
46
|
altCurrencies.forEach(function (code) {
|
|
46
|
-
var
|
|
47
|
-
if (
|
|
47
|
+
var rateRaw = rates[code];
|
|
48
|
+
if (rateRaw === undefined || rateRaw === null) {
|
|
48
49
|
throw new Error("createPricingPolicy: missing exchange rate for ".concat(code));
|
|
49
50
|
}
|
|
51
|
+
var rate = Number(rateRaw);
|
|
50
52
|
if (!Number.isFinite(rate) || rate <= 0) {
|
|
51
53
|
throw new Error("createPricingPolicy: invalid exchange rate for ".concat(code));
|
|
52
54
|
}
|