@medipass/utils 11.58.1 → 11.58.2-fix-prod-issues.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/package.json +2 -2
- package/service-items.js +15 -49
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medipass/utils",
|
|
3
|
-
"version": "11.58.
|
|
3
|
+
"version": "11.58.2-fix-prod-issues.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"redux-thunk": "^2.2.0",
|
|
48
48
|
"rimraf": "^2.6.2"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "bf8ffaaa47a36e0a4dd4f6b263102828925e37f4"
|
|
51
51
|
}
|
package/service-items.js
CHANGED
|
@@ -33,11 +33,9 @@ var calculateTotalAmount = function calculateTotalAmount(serviceItems, opts) {
|
|
|
33
33
|
includeQuantity = false;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
var prices =
|
|
36
|
+
var prices = calculateAmounts({
|
|
37
37
|
isTaxable: Boolean(opts.includeGST && item.isTaxable),
|
|
38
|
-
isGross: item.isGross,
|
|
39
38
|
initialFeeAmount: (item == null ? void 0 : item.feeAmount) ? parseFloat((item == null ? void 0 : item.feeAmount) || 0) : parseFloat((item == null ? void 0 : item.initialFeeAmount) || 0),
|
|
40
|
-
isExtendedPrice: item == null ? void 0 : item.isExtendedPrice,
|
|
41
39
|
quantity: includeQuantity ? item.quantity : 1
|
|
42
40
|
});
|
|
43
41
|
var itemTotal = undefined;
|
|
@@ -74,11 +72,9 @@ var calculateTotalGSTAmount = function calculateTotalGSTAmount(serviceItems, opt
|
|
|
74
72
|
includeQuantity = false;
|
|
75
73
|
}
|
|
76
74
|
|
|
77
|
-
var prices =
|
|
75
|
+
var prices = calculateAmounts({
|
|
78
76
|
isTaxable: item.isTaxable,
|
|
79
|
-
isGross: item.isGross,
|
|
80
77
|
initialFeeAmount: (item == null ? void 0 : item.feeAmount) ? parseFloat((item == null ? void 0 : item.feeAmount) || 0) : parseFloat((item == null ? void 0 : item.initialFeeAmount) || 0),
|
|
81
|
-
isExtendedPrice: item == null ? void 0 : item.isExtendedPrice,
|
|
82
78
|
quantity: includeQuantity ? item.quantity : 1
|
|
83
79
|
});
|
|
84
80
|
var gstAmount = prices == null ? void 0 : prices.taxAmount;
|
|
@@ -196,64 +192,34 @@ function mapItemsToClaimItems(transaction) {
|
|
|
196
192
|
});
|
|
197
193
|
return newItems;
|
|
198
194
|
}
|
|
199
|
-
|
|
200
|
-
var round2DecimalPlaces = function round2DecimalPlaces(num) {
|
|
201
|
-
return Math.round((num + Number.EPSILON) * 100) / 100;
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
var calculatePrices = function calculatePrices(_ref3) {
|
|
195
|
+
var calculateAmounts = function calculateAmounts(_ref3) {
|
|
205
196
|
var isTaxable = _ref3.isTaxable,
|
|
206
|
-
isGross = _ref3.isGross,
|
|
207
197
|
initialFeeAmount = _ref3.initialFeeAmount,
|
|
208
198
|
isExtendedPrice = _ref3.isExtendedPrice,
|
|
209
|
-
_ref3$quantity = _ref3.quantity
|
|
210
|
-
quantity = _ref3$quantity === void 0 ? 1 : _ref3$quantity;
|
|
211
|
-
|
|
212
|
-
function getTotalsWithQuantity(_ref4) {
|
|
213
|
-
var taxAmount = _ref4.taxAmount,
|
|
214
|
-
feeAmount = _ref4.feeAmount,
|
|
215
|
-
grossAmount = _ref4.grossAmount;
|
|
216
|
-
if (isExtendedPrice) return {
|
|
217
|
-
taxAmount: taxAmount,
|
|
218
|
-
feeAmount: feeAmount,
|
|
219
|
-
grossAmount: grossAmount
|
|
220
|
-
};
|
|
221
|
-
return {
|
|
222
|
-
grossAmount: grossAmount * quantity,
|
|
223
|
-
feeAmount: feeAmount * quantity,
|
|
224
|
-
taxAmount: taxAmount * quantity
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
|
|
199
|
+
_ref3$quantity = _ref3.quantity;
|
|
228
200
|
var grossAmount = parseFloat(initialFeeAmount || 0);
|
|
229
201
|
var feeAmount = parseFloat(initialFeeAmount || 0);
|
|
230
202
|
var taxAmount = 0;
|
|
231
203
|
|
|
232
204
|
if (!isTaxable) {
|
|
233
|
-
return
|
|
234
|
-
|
|
205
|
+
return {
|
|
206
|
+
taxAmount: taxAmount,
|
|
235
207
|
feeAmount: feeAmount,
|
|
236
|
-
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
if (isGross) {
|
|
241
|
-
taxAmount = parseFloat(round2DecimalPlaces(grossAmount / 11).toFixed(2) || 0);
|
|
242
|
-
feeAmount = grossAmount - taxAmount;
|
|
243
|
-
} else {
|
|
244
|
-
taxAmount = parseFloat((feeAmount * 1.1).toFixed(6)) - feeAmount;
|
|
245
|
-
grossAmount = feeAmount + taxAmount;
|
|
208
|
+
grossAmount: grossAmount
|
|
209
|
+
};
|
|
246
210
|
}
|
|
247
211
|
|
|
248
|
-
|
|
249
|
-
|
|
212
|
+
taxAmount = parseFloat((feeAmount * 1.1).toFixed(6)) - feeAmount;
|
|
213
|
+
grossAmount = feeAmount + taxAmount;
|
|
214
|
+
return {
|
|
215
|
+
taxAmount: taxAmount,
|
|
250
216
|
feeAmount: feeAmount,
|
|
251
|
-
|
|
252
|
-
}
|
|
217
|
+
grossAmount: grossAmount
|
|
218
|
+
};
|
|
253
219
|
};
|
|
254
220
|
|
|
255
221
|
exports.applyDiscountToServiceItems = applyDiscountToServiceItems;
|
|
256
|
-
exports.
|
|
222
|
+
exports.calculateAmounts = calculateAmounts;
|
|
257
223
|
exports.calculateTotalAmount = calculateTotalAmount;
|
|
258
224
|
exports.calculateTotalDiscountAmount = calculateTotalDiscountAmount;
|
|
259
225
|
exports.calculateTotalGSTAmount = calculateTotalGSTAmount;
|