@unimaze/billing 0.21.2 → 0.21.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.
@@ -74,7 +74,11 @@ var BillingCalculations = function (props) {
74
74
  var taxAmount = (0, BillingLineUtility_1.calculateTaxAmount)((0, BillingLineUtility_1.calculateTaxableAmount)(billingLine.discountValue, billingLine.quantity, billingLine.unitPriceAmount, billingLine.discountType), (0, BillingLineUtility_1.calculateTaxPercentage)(billingLine.taxCategoryType ? api_1.TaxCategoryTypeEnum[billingLine.taxCategoryType] : undefined));
75
75
  var taxableAmount = (0, BillingLineUtility_1.calculateTaxableAmount)(billingLine.discountValue, billingLine.quantity, billingLine.unitPriceAmount, billingLine.discountType);
76
76
  var taxInclusiveAmount = taxableAmount + taxAmount;
77
- var discountAmount = billingLine.discountType === "PERCENTAGE" ? (0, BillingLineUtility_1.calculateDiscountAmount)(billingLine.discountValue, billingLine.quantity, billingLine.unitPriceAmount) : billingLine.discountValue ? parseFloat(billingLine.discountValue) : 0;
77
+ var discountAmount = billingLine.discountType === "PERCENTAGE"
78
+ ? (0, BillingLineUtility_1.calculateDiscountAmount)(billingLine.discountValue, billingLine.quantity, billingLine.unitPriceAmount)
79
+ : billingLine.discountValue
80
+ ? parseFloat(billingLine.discountValue)
81
+ : 0;
78
82
  totals = {
79
83
  totalTaxAmount: totals.totalTaxAmount + taxAmount,
80
84
  totalTaxableAmount: totals.totalTaxableAmount + taxableAmount,
@@ -218,7 +218,7 @@ var CreateInvoiceConstructor = function (props) {
218
218
  paymentMeans: {
219
219
  type: getDefaultPaymentType(props.defaultPaymentType),
220
220
  },
221
- referenceIdentifiers: [{}],
221
+ referenceIdentifiers: [{ code: undefined }],
222
222
  singleReferenceIdentifier: {
223
223
  code: undefined,
224
224
  },
@@ -39,7 +39,19 @@ var billingLinesFieldsMetadata = function (formInstance) {
39
39
  var taxableAmount = (0, exports.calculateTaxableAmount)(restBillingLines.discountValue, restBillingLines.quantity, restBillingLines.unitPriceAmount, discountType);
40
40
  var taxPercentage = (0, exports.calculateTaxPercentage)(restBillingLines.taxCategoryType);
41
41
  var taxAmount = (0, exports.calculateTaxAmount)(taxableAmount, taxPercentage);
42
- var mappedBillingLine = __assign(__assign({}, restBillingLines), { discountValue: discountType === "PERCENTAGE" ? "".concat(restBillingLines.discountValue, "%") : restBillingLines.discountValue, taxableAmount: taxableAmount, taxAmount: taxAmount, taxPercentage: taxPercentage });
42
+ var discountValue;
43
+ if (restBillingLines.discountValue) {
44
+ if (discountType === "PERCENTAGE") {
45
+ discountValue = "".concat(restBillingLines.discountValue, "%");
46
+ }
47
+ else {
48
+ discountValue = restBillingLines.discountValue;
49
+ }
50
+ }
51
+ else {
52
+ discountValue = restBillingLines.discountValue;
53
+ }
54
+ var mappedBillingLine = __assign(__assign({}, restBillingLines), { discountValue: discountValue, taxableAmount: taxableAmount, taxAmount: taxAmount, taxPercentage: taxPercentage });
43
55
  if (mappedBillingLine.discountValue === "0" || mappedBillingLine.discountValue === "0%") {
44
56
  delete mappedBillingLine.discountValue;
45
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unimaze/billing",
3
- "version": "0.21.2",
3
+ "version": "0.21.3",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",