@unimaze/billing 0.1.2-rc.10 → 0.1.2-rc.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/README.md +3 -11
- package/lib/common/components/attachments/Attachment.d.ts +2 -8
- package/lib/common/components/attachments/Attachment.js +7 -33
- package/lib/common/components/attachments/index.d.ts +2 -9
- package/lib/common/components/attachments/index.js +6 -15
- package/lib/common/components/base-information/index.d.ts +3 -6
- package/lib/common/components/base-information/index.js +81 -100
- package/lib/common/components/billing-lines/index.d.ts +20 -6
- package/lib/common/components/billing-lines/index.js +22 -106
- package/lib/common/components/component-container/style/index.d.ts +1 -0
- package/lib/common/components/component-container/style/index.js +3 -0
- package/lib/common/components/delivery-location/index.d.ts +2 -5
- package/lib/common/components/delivery-location/index.js +11 -43
- package/lib/common/components/editable-cell/index.js +9 -7
- package/lib/common/components/index.d.ts +5 -10
- package/lib/common/components/index.js +8 -20
- package/lib/common/components/issuer/index.d.ts +7 -0
- package/lib/common/components/{customer/hardCoddedCustomer.js → issuer/index.js} +8 -5
- package/lib/common/components/payer/index.d.ts +3 -0
- package/lib/common/components/payer/index.js +51 -0
- package/lib/common/components/payment-method/index.d.ts +3 -6
- package/lib/common/components/payment-method/index.js +17 -57
- package/lib/common/consts/validationRules.js +7 -0
- package/lib/common/enums/index.d.ts +1 -1
- package/lib/common/enums/index.js +4 -2
- package/lib/common/types/ReceiverRequirements.d.ts +17 -72
- package/lib/common/types/ReceiverRequirements.js +14 -350
- package/lib/create-credit-note/index.d.ts +2 -1
- package/lib/create-credit-note/index.js +11 -5
- package/lib/create-invoice/index.d.ts +2 -1
- package/lib/create-invoice/index.js +17 -77
- package/lib/example/src/index.d.ts +1 -1
- package/lib/index.js +0 -5
- package/lib/src/common/components/base-information/index.d.ts +3 -6
- package/lib/src/common/components/billing-lines/index.d.ts +20 -6
- package/lib/src/common/components/delivery-location/index.d.ts +2 -5
- package/lib/src/common/components/issuer/index.d.ts +7 -0
- package/lib/src/common/components/payer/index.d.ts +3 -0
- package/lib/src/common/components/payment-method/index.d.ts +3 -6
- package/lib/src/common/types/ReceiverRequirements.d.ts +17 -72
- package/lib/src/create-invoice/index.d.ts +2 -1
- package/lib/src/utils/ApiUtility.d.ts +1 -8
- package/lib/src/utils/ConversionUtility.d.ts +2 -3
- package/lib/src/utils/index.d.ts +1 -1
- package/lib/style/index.css +1222 -0
- package/lib/style/index.d.ts +1 -0
- package/lib/style/index.js +3 -0
- package/lib/utils/ApiUtility.d.ts +1 -8
- package/lib/utils/ApiUtility.js +1 -17
- package/lib/utils/ConversionUtility.d.ts +2 -3
- package/lib/utils/ConversionUtility.js +62 -116
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +0 -1
- package/package.json +7 -12
- package/lib/common/components/base-information/ReferenceIdentifiers.d.ts +0 -6
- package/lib/common/components/base-information/ReferenceIdentifiers.js +0 -40
- package/lib/common/components/billing-lines/BillingCalculations.d.ts +0 -11
- package/lib/common/components/billing-lines/BillingCalculations.js +0 -61
- package/lib/common/components/billing-lines/BillingTaxSummary.d.ts +0 -10
- package/lib/common/components/billing-lines/BillingTaxSummary.js +0 -51
- package/lib/common/components/billing-lines/billingLIneFormData.d.ts +0 -7
- package/lib/common/components/billing-lines/billingLIneFormData.js +0 -63
- package/lib/common/components/customer/hardCoddedCustomer.d.ts +0 -7
- package/lib/common/components/customer/index.d.ts +0 -6
- package/lib/common/components/customer/index.js +0 -93
- package/lib/common/components/form-item/index.d.ts +0 -21
- package/lib/common/components/form-item/index.js +0 -27
- package/lib/common/components/locale-intl/index.d.ts +0 -10
- package/lib/common/components/locale-intl/index.js +0 -45
- package/lib/common/components/supplier/index.d.ts +0 -6
- package/lib/common/components/supplier/index.js +0 -93
- package/lib/src/common/components/attachments/Attachment.d.ts +0 -21
- package/lib/src/common/components/attachments/index.d.ts +0 -10
- package/lib/src/common/components/base-information/ReferenceIdentifiers.d.ts +0 -6
- package/lib/src/common/components/billing-lines/BillingCalculations.d.ts +0 -11
- package/lib/src/common/components/billing-lines/BillingTaxSummary.d.ts +0 -10
- package/lib/src/common/components/billing-lines/billingLIneFormData.d.ts +0 -7
- package/lib/src/common/components/customer/index.d.ts +0 -6
- package/lib/src/common/components/form-item/index.d.ts +0 -21
- package/lib/src/common/components/index.d.ts +0 -10
- package/lib/src/common/components/locale-intl/index.d.ts +0 -10
- package/lib/src/common/components/supplier/index.d.ts +0 -6
- package/lib/src/translations/locales.d.ts +0 -74
- package/lib/src/utils/BillingLineUtility.d.ts +0 -8
- package/lib/src/utils/RequirementsUtility.d.ts +0 -5
- package/lib/src/utils/billingLineFormData.d.ts +0 -7
- package/lib/translations/locales/is.json +0 -70
- package/lib/translations/locales.d.ts +0 -74
- package/lib/translations/locales.js +0 -10
- package/lib/utils/BillingLineUtility.d.ts +0 -8
- package/lib/utils/BillingLineUtility.js +0 -66
- package/lib/utils/RequirementsUtility.d.ts +0 -5
- package/lib/utils/RequirementsUtility.js +0 -23
- package/lib/utils/billingLineFormData.d.ts +0 -7
- package/lib/utils/billingLineFormData.js +0 -63
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
en: {};
|
|
3
|
-
is: {
|
|
4
|
-
"attachment_labels_Reference": string;
|
|
5
|
-
"attachment_labels_Reference_requiredMessage": string;
|
|
6
|
-
"attachment_labels_Description": string;
|
|
7
|
-
"attachment_labels_Description_requiredMessage": string;
|
|
8
|
-
"attachment_labels_File": string;
|
|
9
|
-
"attachment_title": string;
|
|
10
|
-
"baseInformation_title": string;
|
|
11
|
-
"baseInformation_invoiceNo": string;
|
|
12
|
-
"baseInformation_issueDate": string;
|
|
13
|
-
"baseInformation_dueDate": string;
|
|
14
|
-
"baseInformation_orderReference_documentNo": string;
|
|
15
|
-
"baseInformation_notes": string;
|
|
16
|
-
"baseInformation_currencyCode": string;
|
|
17
|
-
"billingCalculations_labels_TaxAmountWithoutVat": string;
|
|
18
|
-
"billingCalculations_labels_TotalVatAmount": string;
|
|
19
|
-
"billingCalculations_labels_TotalAmountWithVat": string;
|
|
20
|
-
"billingTaxSummary_taxOverview": string;
|
|
21
|
-
"billingTaxSummary_taxableAmount": string;
|
|
22
|
-
"billingTaxSummary_taxAmount": string;
|
|
23
|
-
"billingLines_title": string;
|
|
24
|
-
"billingLines_itemNo": string;
|
|
25
|
-
"billingLines_name": string;
|
|
26
|
-
"billingLines_quantity": string;
|
|
27
|
-
"billingLines_unitOfMeasure": string;
|
|
28
|
-
"billingLines_unitPriceAmount": string;
|
|
29
|
-
"billingLines_taxCategoryType": string;
|
|
30
|
-
"billingLines_taxCategoryPercentage": string;
|
|
31
|
-
"billingLines_discount": string;
|
|
32
|
-
"billingLines_lineAmount": string;
|
|
33
|
-
"billingLines_taxAmount": string;
|
|
34
|
-
"billingLines_button_addRow": string;
|
|
35
|
-
"deliveryLocation_title": string;
|
|
36
|
-
"deliveryLocation_partyName": string;
|
|
37
|
-
"deliveryLocation_streetNameAndNumber": string;
|
|
38
|
-
"deliveryLocation_postalZone": string;
|
|
39
|
-
"deliveryLocation_city": string;
|
|
40
|
-
"deliveryLocation_countryCode": string;
|
|
41
|
-
"formItem_required_errorMessage": string;
|
|
42
|
-
"paymentMethod_labels_domesticTransfer_bankNo": string;
|
|
43
|
-
"paymentMethod_labels_domesticTransfer_typeNo": string;
|
|
44
|
-
"paymentMethod_labels_domesticTransfer_accountNo": string;
|
|
45
|
-
"paymentMethod_labels_domesticTransfer_paymentReference": string;
|
|
46
|
-
"paymentMethod_labels_icelandicClaim_bankNo": string;
|
|
47
|
-
"paymentMethod_labels_icelandicClaim_claimNo": string;
|
|
48
|
-
"paymentMethod_labels_methods_undefined": string;
|
|
49
|
-
"paymentMethod_labels_methods_mutuallyAgreed": string;
|
|
50
|
-
"paymentMethod_labels_methods_domesticTransfer": string;
|
|
51
|
-
"paymentMethod_labels_methods_domesticClaim": string;
|
|
52
|
-
"supplier_title": string;
|
|
53
|
-
"supplier_name": string;
|
|
54
|
-
"supplier_identifier": string;
|
|
55
|
-
"supplier_vatNumber": string;
|
|
56
|
-
"supplier_address_streetNameAndNumber": string;
|
|
57
|
-
"supplier_address_zip_postalCode": string;
|
|
58
|
-
"supplier_address_city": string;
|
|
59
|
-
"supplier_address_countryCode": string;
|
|
60
|
-
"supplier_contact_email": string;
|
|
61
|
-
"supplier_contact_name": string;
|
|
62
|
-
"supplier_notValidEmail": string;
|
|
63
|
-
"customer_title": string;
|
|
64
|
-
"customer_name": string;
|
|
65
|
-
"customer_identifier": string;
|
|
66
|
-
"customer_address_streetNameAndNumber": string;
|
|
67
|
-
"customer_address_zip_postalCode": string;
|
|
68
|
-
"customer_address_city": string;
|
|
69
|
-
"customer_address_countryCode": string;
|
|
70
|
-
"customer_contact_email": string;
|
|
71
|
-
"customer_contact_name": string;
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
export default _default;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var is_json_1 = __importDefault(require("./locales/is.json"));
|
|
7
|
-
// English is the default message in each of our source files, so no need for a separate en.json file
|
|
8
|
-
var en = {};
|
|
9
|
-
// If we add more than just spanish, just import the files and export it below: export default { en, es, de }
|
|
10
|
-
exports.default = { en: en, is: is_json_1.default };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { BillingLineMetadata } from '@unimaze/api-clients/lib/mapi';
|
|
2
|
-
import { FormInstance } from "antd/es/form";
|
|
3
|
-
import { TaxCategoryTypeEnum } from "@unimaze/api-clients/lib/mapi/api";
|
|
4
|
-
export declare const billingLinesFieldsMetadata: (formInstance: FormInstance) => BillingLineMetadata[];
|
|
5
|
-
export declare const calculateTaxableAmount: (discountValue: string | null | undefined, quantity: number | null, unitPriceAmount: number | null) => number;
|
|
6
|
-
export declare const calculateTaxAmount: (taxableAmount: number, taxPercentage: number) => number;
|
|
7
|
-
export declare const calculateTaxPercentage: (taxCategoryType: TaxCategoryTypeEnum) => number;
|
|
8
|
-
export declare const generateTaxCategoryLabel: (taxCategoryType: TaxCategoryTypeEnum) => string;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
var api_1 = require("@unimaze/api-clients/lib/mapi/api");
|
|
15
|
-
exports.billingLinesFieldsMetadata = function (formInstance) {
|
|
16
|
-
var billingLinesMetadata = formInstance.getFieldValue("billingLinesMetadata");
|
|
17
|
-
return billingLinesMetadata.map(function (billingLine) {
|
|
18
|
-
var taxableAmount = exports.calculateTaxableAmount(billingLine.discountValue, billingLine.quantity, billingLine.unitPriceAmount);
|
|
19
|
-
var taxPercentage = exports.calculateTaxPercentage(billingLine.taxCategoryType);
|
|
20
|
-
var taxAmount = exports.calculateTaxAmount(taxableAmount, taxPercentage);
|
|
21
|
-
var mappedBillingLine = __assign({}, billingLine, { taxableAmount: taxableAmount,
|
|
22
|
-
taxAmount: taxAmount,
|
|
23
|
-
taxPercentage: taxPercentage });
|
|
24
|
-
if (mappedBillingLine.discountValue === "0" || mappedBillingLine.discountValue === "0%") {
|
|
25
|
-
delete mappedBillingLine.discountValue;
|
|
26
|
-
}
|
|
27
|
-
return mappedBillingLine;
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
exports.calculateTaxableAmount = function (discountValue, quantity, unitPriceAmount) {
|
|
31
|
-
if (!quantity || !unitPriceAmount) {
|
|
32
|
-
return 0;
|
|
33
|
-
}
|
|
34
|
-
if (discountValue) {
|
|
35
|
-
if (discountValue.endsWith("%")) {
|
|
36
|
-
// (quantity * unitPriceAmount) * ((100 - discountValue) / 100)
|
|
37
|
-
return ((quantity * unitPriceAmount) * ((100 - parseFloat(discountValue)) / 100));
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
// (quantity * unitPriceAmount) - discountValue
|
|
41
|
-
return ((quantity * unitPriceAmount) - parseFloat(discountValue));
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
return (quantity * unitPriceAmount);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
exports.calculateTaxAmount = function (taxableAmount, taxPercentage) {
|
|
49
|
-
// taxableAmount * (taxPercentage / 100)
|
|
50
|
-
return (taxableAmount * (taxPercentage / 100));
|
|
51
|
-
};
|
|
52
|
-
exports.calculateTaxPercentage = function (taxCategoryType) {
|
|
53
|
-
// inferred from the taxCategoryType? what is the mapping? ZeroRated/Exempt = 0, StandardRated = 24, ReducedRate = 11
|
|
54
|
-
switch (taxCategoryType) {
|
|
55
|
-
case api_1.TaxCategoryTypeEnum.StandardRated:
|
|
56
|
-
return 24;
|
|
57
|
-
case api_1.TaxCategoryTypeEnum.ReducedRated:
|
|
58
|
-
return 11;
|
|
59
|
-
case api_1.TaxCategoryTypeEnum.ZeroRated:
|
|
60
|
-
case api_1.TaxCategoryTypeEnum.Exempt:
|
|
61
|
-
return 0;
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
exports.generateTaxCategoryLabel = function (taxCategoryType) {
|
|
65
|
-
return exports.calculateTaxPercentage(taxCategoryType) + "% (" + taxCategoryType + ")";
|
|
66
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { AvailableFields, FieldRequirement, ReceiverRequirements } from "../common/types/ReceiverRequirements";
|
|
3
|
-
export declare const getReceiverRequirements: (recRequirements: ReceiverRequirements, key: AvailableFields) => FieldRequirement;
|
|
4
|
-
export declare const getReceiverRequirementsIsRequired: (recRequirements: ReceiverRequirements, key: AvailableFields, defaultIsRequired: boolean) => boolean;
|
|
5
|
-
export declare const getReceiverRequirementsLabelWithDefault: (recRequirements: ReceiverRequirements, key: AvailableFields, defaultLabel: React.ReactNode) => React.ReactNode;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getReceiverRequirements = function (recRequirements, key) {
|
|
4
|
-
return recRequirements[key];
|
|
5
|
-
};
|
|
6
|
-
exports.getReceiverRequirementsIsRequired = function (recRequirements, key, defaultIsRequired) {
|
|
7
|
-
if (recRequirements.hasOwnProperty(key)) {
|
|
8
|
-
var recRequirement = recRequirements[key];
|
|
9
|
-
if (recRequirement) {
|
|
10
|
-
return recRequirement.isRequired;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
return defaultIsRequired;
|
|
14
|
-
};
|
|
15
|
-
exports.getReceiverRequirementsLabelWithDefault = function (recRequirements, key, defaultLabel) {
|
|
16
|
-
if (recRequirements.hasOwnProperty(key)) {
|
|
17
|
-
var recRequirement = recRequirements[key];
|
|
18
|
-
if (recRequirement && recRequirement.label) {
|
|
19
|
-
return recRequirement.label;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return defaultLabel;
|
|
23
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { BillingLineMetadata } from '@unimaze/api-clients/lib/mapi';
|
|
2
|
-
import { FormInstance } from "antd/es/form";
|
|
3
|
-
import { TaxCategoryTypeEnum } from "@unimaze/api-clients/lib/mapi/api";
|
|
4
|
-
export declare const billingLinesFieldsMetadata: (formInstance: FormInstance) => BillingLineMetadata[];
|
|
5
|
-
export declare const calculateTaxableAmount: (discountValue: string | null | undefined, quantity: number | null, unitPriceAmount: number | null) => number;
|
|
6
|
-
export declare const calculateTaxAmount: (taxableAmount: number, taxPercentage: number) => number;
|
|
7
|
-
export declare const calculateTaxPercentage: (taxCategoryType: TaxCategoryTypeEnum) => number;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
var api_1 = require("@unimaze/api-clients/lib/mapi/api");
|
|
15
|
-
exports.billingLinesFieldsMetadata = function (formInstance) {
|
|
16
|
-
var billingLinesMetadata = formInstance.getFieldValue("billingLinesMetadata");
|
|
17
|
-
return billingLinesMetadata.map(function (billingLine) {
|
|
18
|
-
var taxableAmount = exports.calculateTaxableAmount(billingLine.discountValue, billingLine.quantity, billingLine.unitPriceAmount);
|
|
19
|
-
var taxPercentage = exports.calculateTaxPercentage(billingLine.taxCategoryType);
|
|
20
|
-
var taxAmount = exports.calculateTaxAmount(taxableAmount, taxPercentage);
|
|
21
|
-
var mappedBillingLine = __assign({}, billingLine, { taxableAmount: taxableAmount,
|
|
22
|
-
taxAmount: taxAmount,
|
|
23
|
-
taxPercentage: taxPercentage });
|
|
24
|
-
if (mappedBillingLine.discountValue === "0" || mappedBillingLine.discountValue === "0%") {
|
|
25
|
-
delete mappedBillingLine.discountValue;
|
|
26
|
-
}
|
|
27
|
-
return mappedBillingLine;
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
exports.calculateTaxableAmount = function (discountValue, quantity, unitPriceAmount) {
|
|
31
|
-
if (!quantity || !unitPriceAmount) {
|
|
32
|
-
return 0;
|
|
33
|
-
}
|
|
34
|
-
if (discountValue) {
|
|
35
|
-
if (discountValue.endsWith("%")) {
|
|
36
|
-
// (quantity * unitPriceAmount) * ((100 - discountValue) / 100)
|
|
37
|
-
return ((quantity * unitPriceAmount) * ((100 - parseFloat(discountValue)) / 100));
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
// (quantity * unitPriceAmount) - discountValue
|
|
41
|
-
return ((quantity * unitPriceAmount) - parseFloat(discountValue));
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
return (quantity * unitPriceAmount);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
exports.calculateTaxAmount = function (taxableAmount, taxPercentage) {
|
|
49
|
-
// taxableAmount * (taxPercentage / 100)
|
|
50
|
-
return (taxableAmount * (taxPercentage / 100));
|
|
51
|
-
};
|
|
52
|
-
exports.calculateTaxPercentage = function (taxCategoryType) {
|
|
53
|
-
// inferred from the taxCategoryType? what is the mapping? ZeroRated/Exempt = 0, StandardRated = 24, ReducedRate = 11
|
|
54
|
-
switch (taxCategoryType) {
|
|
55
|
-
case api_1.TaxCategoryTypeEnum.StandardRated:
|
|
56
|
-
return 24;
|
|
57
|
-
case api_1.TaxCategoryTypeEnum.ReducedRated:
|
|
58
|
-
return 11;
|
|
59
|
-
case api_1.TaxCategoryTypeEnum.ZeroRated:
|
|
60
|
-
case api_1.TaxCategoryTypeEnum.Exempt:
|
|
61
|
-
return 0;
|
|
62
|
-
}
|
|
63
|
-
};
|