@medipass/utils 11.55.1 → 11.55.3

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/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [11.55.3](https://github.com/medipass/web/compare/@medipass/utils@11.55.2...@medipass/utils@11.55.3) (2021-11-04)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * default quantity to 1 for calculating service item totals ([0718df9](https://github.com/medipass/web/commit/0718df9))
12
+
13
+
14
+
15
+
16
+
17
+ ## [11.55.2](https://github.com/medipass/web/compare/@medipass/utils@11.55.1...@medipass/utils@11.55.2) (2021-11-04)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * service items quantity totals ([#581](https://github.com/medipass/web/issues/581)) ([b27ccae](https://github.com/medipass/web/commit/b27ccae))
23
+
24
+
25
+
26
+
27
+
6
28
  ## [11.55.1](https://github.com/medipass/web/compare/@medipass/utils@11.55.0...@medipass/utils@11.55.1) (2021-10-29)
7
29
 
8
30
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medipass/utils",
3
- "version": "11.55.1",
3
+ "version": "11.55.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -44,10 +44,10 @@
44
44
  },
45
45
  "devDependencies": {
46
46
  "@babel/plugin-transform-runtime": "7.8.3",
47
- "@medipass/web-sdk": "^11.18.7",
47
+ "@medipass/web-sdk": "^11.18.9",
48
48
  "redux-mock-store": "^1.3.0",
49
49
  "redux-thunk": "^2.2.0",
50
50
  "rimraf": "^2.6.2"
51
51
  },
52
- "gitHead": "31512948e6b2e351037d9b12fe006aa8abf44bb1"
52
+ "gitHead": "a2693bc4afd35fab5f0185559c3683d90dac9754"
53
53
  }
package/service-items.js CHANGED
@@ -206,17 +206,35 @@ var calculatePrices = function calculatePrices(_ref3) {
206
206
  isGross = _ref3.isGross,
207
207
  initialFeeAmount = _ref3.initialFeeAmount,
208
208
  isExtendedPrice = _ref3.isExtendedPrice,
209
- quantity = _ref3.quantity;
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
+
210
228
  var grossAmount = parseFloat(initialFeeAmount || 0);
211
229
  var feeAmount = parseFloat(initialFeeAmount || 0);
212
230
  var taxAmount = 0;
213
231
 
214
232
  if (!isTaxable) {
215
- return {
233
+ return getTotalsWithQuantity({
216
234
  grossAmount: grossAmount,
217
235
  feeAmount: feeAmount,
218
236
  taxAmount: taxAmount
219
- };
237
+ });
220
238
  }
221
239
 
222
240
  if (isGross) {
@@ -227,17 +245,11 @@ var calculatePrices = function calculatePrices(_ref3) {
227
245
  grossAmount = feeAmount + taxAmount;
228
246
  }
229
247
 
230
- if (!isExtendedPrice) {
231
- taxAmount = taxAmount * quantity;
232
- feeAmount = feeAmount * quantity;
233
- grossAmount = grossAmount * quantity;
234
- }
235
-
236
- return {
248
+ return getTotalsWithQuantity({
237
249
  grossAmount: grossAmount,
238
250
  feeAmount: feeAmount,
239
251
  taxAmount: taxAmount
240
- };
252
+ });
241
253
  };
242
254
 
243
255
  exports.applyDiscountToServiceItems = applyDiscountToServiceItems;