@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.
Files changed (95) hide show
  1. package/README.md +3 -11
  2. package/lib/common/components/attachments/Attachment.d.ts +2 -8
  3. package/lib/common/components/attachments/Attachment.js +7 -33
  4. package/lib/common/components/attachments/index.d.ts +2 -9
  5. package/lib/common/components/attachments/index.js +6 -15
  6. package/lib/common/components/base-information/index.d.ts +3 -6
  7. package/lib/common/components/base-information/index.js +81 -100
  8. package/lib/common/components/billing-lines/index.d.ts +20 -6
  9. package/lib/common/components/billing-lines/index.js +22 -106
  10. package/lib/common/components/component-container/style/index.d.ts +1 -0
  11. package/lib/common/components/component-container/style/index.js +3 -0
  12. package/lib/common/components/delivery-location/index.d.ts +2 -5
  13. package/lib/common/components/delivery-location/index.js +11 -43
  14. package/lib/common/components/editable-cell/index.js +9 -7
  15. package/lib/common/components/index.d.ts +5 -10
  16. package/lib/common/components/index.js +8 -20
  17. package/lib/common/components/issuer/index.d.ts +7 -0
  18. package/lib/common/components/{customer/hardCoddedCustomer.js → issuer/index.js} +8 -5
  19. package/lib/common/components/payer/index.d.ts +3 -0
  20. package/lib/common/components/payer/index.js +51 -0
  21. package/lib/common/components/payment-method/index.d.ts +3 -6
  22. package/lib/common/components/payment-method/index.js +17 -57
  23. package/lib/common/consts/validationRules.js +7 -0
  24. package/lib/common/enums/index.d.ts +1 -1
  25. package/lib/common/enums/index.js +4 -2
  26. package/lib/common/types/ReceiverRequirements.d.ts +17 -72
  27. package/lib/common/types/ReceiverRequirements.js +14 -350
  28. package/lib/create-credit-note/index.d.ts +2 -1
  29. package/lib/create-credit-note/index.js +11 -5
  30. package/lib/create-invoice/index.d.ts +2 -1
  31. package/lib/create-invoice/index.js +17 -77
  32. package/lib/example/src/index.d.ts +1 -1
  33. package/lib/index.js +0 -5
  34. package/lib/src/common/components/base-information/index.d.ts +3 -6
  35. package/lib/src/common/components/billing-lines/index.d.ts +20 -6
  36. package/lib/src/common/components/delivery-location/index.d.ts +2 -5
  37. package/lib/src/common/components/issuer/index.d.ts +7 -0
  38. package/lib/src/common/components/payer/index.d.ts +3 -0
  39. package/lib/src/common/components/payment-method/index.d.ts +3 -6
  40. package/lib/src/common/types/ReceiverRequirements.d.ts +17 -72
  41. package/lib/src/create-invoice/index.d.ts +2 -1
  42. package/lib/src/utils/ApiUtility.d.ts +1 -8
  43. package/lib/src/utils/ConversionUtility.d.ts +2 -3
  44. package/lib/src/utils/index.d.ts +1 -1
  45. package/lib/style/index.css +1222 -0
  46. package/lib/style/index.d.ts +1 -0
  47. package/lib/style/index.js +3 -0
  48. package/lib/utils/ApiUtility.d.ts +1 -8
  49. package/lib/utils/ApiUtility.js +1 -17
  50. package/lib/utils/ConversionUtility.d.ts +2 -3
  51. package/lib/utils/ConversionUtility.js +62 -116
  52. package/lib/utils/index.d.ts +1 -1
  53. package/lib/utils/index.js +0 -1
  54. package/package.json +7 -12
  55. package/lib/common/components/base-information/ReferenceIdentifiers.d.ts +0 -6
  56. package/lib/common/components/base-information/ReferenceIdentifiers.js +0 -40
  57. package/lib/common/components/billing-lines/BillingCalculations.d.ts +0 -11
  58. package/lib/common/components/billing-lines/BillingCalculations.js +0 -61
  59. package/lib/common/components/billing-lines/BillingTaxSummary.d.ts +0 -10
  60. package/lib/common/components/billing-lines/BillingTaxSummary.js +0 -51
  61. package/lib/common/components/billing-lines/billingLIneFormData.d.ts +0 -7
  62. package/lib/common/components/billing-lines/billingLIneFormData.js +0 -63
  63. package/lib/common/components/customer/hardCoddedCustomer.d.ts +0 -7
  64. package/lib/common/components/customer/index.d.ts +0 -6
  65. package/lib/common/components/customer/index.js +0 -93
  66. package/lib/common/components/form-item/index.d.ts +0 -21
  67. package/lib/common/components/form-item/index.js +0 -27
  68. package/lib/common/components/locale-intl/index.d.ts +0 -10
  69. package/lib/common/components/locale-intl/index.js +0 -45
  70. package/lib/common/components/supplier/index.d.ts +0 -6
  71. package/lib/common/components/supplier/index.js +0 -93
  72. package/lib/src/common/components/attachments/Attachment.d.ts +0 -21
  73. package/lib/src/common/components/attachments/index.d.ts +0 -10
  74. package/lib/src/common/components/base-information/ReferenceIdentifiers.d.ts +0 -6
  75. package/lib/src/common/components/billing-lines/BillingCalculations.d.ts +0 -11
  76. package/lib/src/common/components/billing-lines/BillingTaxSummary.d.ts +0 -10
  77. package/lib/src/common/components/billing-lines/billingLIneFormData.d.ts +0 -7
  78. package/lib/src/common/components/customer/index.d.ts +0 -6
  79. package/lib/src/common/components/form-item/index.d.ts +0 -21
  80. package/lib/src/common/components/index.d.ts +0 -10
  81. package/lib/src/common/components/locale-intl/index.d.ts +0 -10
  82. package/lib/src/common/components/supplier/index.d.ts +0 -6
  83. package/lib/src/translations/locales.d.ts +0 -74
  84. package/lib/src/utils/BillingLineUtility.d.ts +0 -8
  85. package/lib/src/utils/RequirementsUtility.d.ts +0 -5
  86. package/lib/src/utils/billingLineFormData.d.ts +0 -7
  87. package/lib/translations/locales/is.json +0 -70
  88. package/lib/translations/locales.d.ts +0 -74
  89. package/lib/translations/locales.js +0 -10
  90. package/lib/utils/BillingLineUtility.d.ts +0 -8
  91. package/lib/utils/BillingLineUtility.js +0 -66
  92. package/lib/utils/RequirementsUtility.d.ts +0 -5
  93. package/lib/utils/RequirementsUtility.js +0 -23
  94. package/lib/utils/billingLineFormData.d.ts +0 -7
  95. package/lib/utils/billingLineFormData.js +0 -63
@@ -0,0 +1 @@
1
+ import "./index.css";
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ require("./index.css");
@@ -10,12 +10,5 @@ interface CreateSubmitInvoice {
10
10
  services?: string[];
11
11
  invoiceMetadataInput?: InvoiceMetadataInput;
12
12
  }
13
- interface AttachDocument {
14
- messageId: string;
15
- name: string;
16
- contentType: string;
17
- more: boolean;
18
- }
19
- declare const submitDocument: (data: any, attachDocument: AttachDocument, mapiBaseUrl: string, apiKey?: string | undefined) => AxiosPromise<mapi.MessageOutput>;
20
13
  declare const submitInvoice: (createSubmitInvoice: CreateSubmitInvoice, mapiBaseUrl: string, apiKey?: string | undefined, callName?: string | undefined, language?: LanguageProp) => AxiosPromise<mapi.MessageOutput>;
21
- export { submitInvoice, CreateSubmitInvoice, submitDocument, AttachDocument };
14
+ export { submitInvoice, CreateSubmitInvoice };
@@ -24,19 +24,6 @@ var initialiseTransactionApi = function (mapiBaseUrl) {
24
24
  var initiatedConfig = new mapi_1.Configuration(apiConfig);
25
25
  return new api_clients_1.mapi.TransactionApi(initiatedConfig);
26
26
  };
27
- var initialiseMessageApi = function (mapiBaseUrl) {
28
- var apiConfig = {
29
- basePath: mapiBaseUrl,
30
- };
31
- var initiatedConfig = new mapi_1.Configuration(apiConfig);
32
- return new api_clients_1.mapi.MessageApi(initiatedConfig);
33
- };
34
- var submitDocument = function (data, attachDocument, mapiBaseUrl, apiKey) {
35
- var messageApi = initialiseMessageApi(mapiBaseUrl);
36
- var messageId = attachDocument.messageId, name = attachDocument.name, contentType = attachDocument.contentType, more = attachDocument.more;
37
- return messageApi.addDocuments(messageId, name, contentType, more, undefined, undefined, undefined, createOptionsData(data, apiKey));
38
- };
39
- exports.submitDocument = submitDocument;
40
27
  var submitInvoice = function (createSubmitInvoice, mapiBaseUrl, apiKey, callName, language) {
41
28
  var transactionApi = initialiseTransactionApi(mapiBaseUrl);
42
29
  var messageId = createSubmitInvoice.messageId, more = createSubmitInvoice.more, conversationIdentifier = createSubmitInvoice.conversationIdentifier, processingMode = createSubmitInvoice.processingMode, services = createSubmitInvoice.services, invoiceMetadataInput = createSubmitInvoice.invoiceMetadataInput;
@@ -44,10 +31,7 @@ var submitInvoice = function (createSubmitInvoice, mapiBaseUrl, apiKey, callName
44
31
  };
45
32
  exports.submitInvoice = submitInvoice;
46
33
  var createOptions = function (apiKey, callName, language) {
47
- return __assign({ headers: __assign({ "Accept-Language": language ? language : "en" }, (apiKey && { Authorization: "Bearer " + window.btoa(apiKey) })) }, (callName && { cancelToken: getCancelToken(callName) }));
48
- };
49
- var createOptionsData = function (data, apiKey, callName, language) {
50
- return __assign({ headers: __assign({ "Accept-Language": language ? language : "en" }, (apiKey && { Authorization: "Bearer " + window.btoa(apiKey) }), { 'Content-Type': 'application/octet-stream' }) }, (callName && { cancelToken: getCancelToken(callName) }), { data: data });
34
+ return __assign({ headers: __assign({ "Accept-Language": language ? language : "en" }, (apiKey && { Authorization: "Bearer apikey-" + apiKey })) }, (callName && { cancelToken: getCancelToken(callName) }));
51
35
  };
52
36
  var getCancelToken = function (callName) {
53
37
  var cancelTokenSource = window[callName];
@@ -1,5 +1,4 @@
1
- import { BillingLineMetadata, InvoiceMetadataInput } from "@unimaze/api-clients/lib/mapi";
1
+ import { InvoiceMetadataInput } from "@unimaze/api-clients/lib/mapi";
2
2
  import { Store } from "antd/es/form/interface";
3
- import { ProfileOutput } from "@unimaze/api-clients/lib/wapi2";
4
- declare const convertToInvoiceMetadataInput: (formValues: Store, billingLines: BillingLineMetadata[], customer?: ProfileOutput | undefined) => InvoiceMetadataInput;
3
+ declare const convertToInvoiceMetadataInput: (formValues: Store) => InvoiceMetadataInput;
5
4
  export { /*convertToCreditNoteMetadataInput,*/ convertToInvoiceMetadataInput };
@@ -1,141 +1,87 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
14
- var removeEmpty = function (obj) {
15
- return Object.keys(obj)
16
- .filter(function (k) { return obj[k] != null; }) // Remove undef. and null.
17
- .reduce(function (newObj, k) {
18
- var _a, _b;
19
- return typeof obj[k] === "object"
20
- ? __assign({}, newObj, (_a = {}, _a[k] = removeEmpty(obj[k]), _a)) : __assign({}, newObj, (_b = {}, _b[k] = obj[k], _b));
21
- }, // Copy value.
22
- {});
23
- };
24
- var convertDates = function (date) {
25
- return date ? date.utc().toDate() : undefined;
26
- };
27
- var isEmpty = function (map) {
28
- for (var key in map) {
29
- if (map.hasOwnProperty(key)) {
30
- return false;
31
- }
32
- }
33
- return true;
34
- };
35
- var getIdentifierWithPrefix = function (identifier) {
36
- if (!identifier.startsWith("0196:")) {
37
- return "0196:" + identifier;
38
- }
39
- else {
40
- return identifier;
41
- }
42
- };
43
- var convertToInvoiceMetadataInput = function (formValues, billingLines, customer) {
44
- var issueDate = convertDates(formValues.invoice.issueDate);
45
- var dueDate = convertDates(formValues.invoice.dueDate);
46
- // tslint:disable-next-line:no-console
47
- console.log(issueDate);
48
- var cleanedFormValues = removeEmpty(formValues);
49
- var invoice = cleanedFormValues.invoice;
50
- // fix delivery
51
- var delivery = invoice.delivery;
52
- if (delivery) {
53
- if (isEmpty(delivery.address)) {
54
- delete delivery.address;
55
- }
56
- }
3
+ var convertToInvoiceMetadataInput = function (formValues) {
57
4
  var resp = {
58
5
  messageHandling: {
59
- receiverIdentifier: customer.participantLegalIsoIdentifier,
60
- fallbackEmailAddress: customer.email,
61
- fallbackContactName: customer.name,
6
+ receiverIdentifier: "",
7
+ fallbackEmailAddress: "",
8
+ fallbackContactName: "",
62
9
  },
10
+ // MessageHandling is not part of the form
63
11
  invoice: {
64
- customer: {
65
- identifier: getIdentifierWithPrefix(invoice.customer.identifier),
12
+ supplier: {
13
+ identifier: "",
66
14
  address: {
67
- streetNameAndNumber: invoice.customer.address.streetNameAndNumber,
68
- postalZone: invoice.customer.address.postalZone,
69
- city: invoice.customer.address.city,
70
- countryCode: invoice.customer.address.countryCode // customer.country!,
71
- // countrySubEntity: "",
72
- // addressLine2: "",
73
- // addressLine3: ""
15
+ streetNameAndNumber: "",
16
+ postalZone: "",
17
+ city: "",
18
+ countryCode: "",
19
+ countrySubEntity: "",
20
+ addressLine2: "",
21
+ addressLine3: ""
74
22
  },
75
- name: invoice.customer.name,
23
+ name: "",
24
+ vatNumber: "",
76
25
  contact: {
77
- electronicMail: invoice.customer.contact.electronicMail,
78
- telephone: invoice.customer.contact.telephone,
26
+ electronicMail: "",
27
+ fax: "",
28
+ name: "",
29
+ telephone: ""
79
30
  }
80
31
  },
81
- supplier: {
82
- identifier: getIdentifierWithPrefix(invoice.supplier.identifier),
32
+ // Supplier is pre filled, doesnt exist in the form || will be passed to already filled up form
33
+ customer: {
34
+ identifier: formValues.invoice.customer.identifier,
83
35
  address: {
84
- streetNameAndNumber: invoice.supplier.address.streetNameAndNumber,
85
- postalZone: invoice.supplier.address.postalZone,
86
- city: invoice.supplier.address.city,
87
- countryCode: invoice.supplier.address.countryCode,
36
+ streetNameAndNumber: formValues.invoice.customer.address.address,
37
+ postalZone: formValues.invoice.customer.address.zip,
38
+ city: formValues.invoice.customer.address.city,
39
+ countryCode: formValues.invoice.customer.address.country,
40
+ countrySubEntity: "",
41
+ addressLine2: "",
42
+ addressLine3: ""
43
+ // last 3 fileds in address are missing in form
88
44
  },
89
- vatNumber: invoice.supplier.vatNumber,
90
- name: invoice.supplier.name,
45
+ name: formValues.invoice.customer.name,
91
46
  contact: {
92
- electronicMail: invoice.supplier.contact.electronicMail,
93
- name: invoice.supplier.contact.name,
47
+ electronicMail: formValues.invoice.customer.contact.email,
48
+ fax: "",
49
+ name: formValues.invoice.customer.contact.name,
50
+ telephone: ""
51
+ // fax, telephone do not exist in form
52
+ },
53
+ },
54
+ delivery: {
55
+ actualDeliveryDate: null,
56
+ address: {
57
+ streetNameAndNumber: formValues.invoice.delivery.address.address,
58
+ postalZone: "",
59
+ city: formValues.invoice.delivery.address.city,
60
+ countryCode: "",
61
+ countrySubEntity: "",
62
+ addressLine2: "",
63
+ addressLine3: ""
64
+ // Country code, postalZone, country sub entry, address2 and 3 missing from the form
94
65
  },
66
+ locationIdentifier: formValues.invoice.delivery.locationIdentifier,
67
+ partyName: ""
68
+ // partyName and actualDeliveryData are missing from the form
69
+ // Description is missing from convertToInvoiceMetadataInput but present in the form
95
70
  },
96
- delivery: delivery,
97
- // delivery: {
98
- // actualDeliveryDate: null,
99
- // address: {
100
- // streetNameAndNumber: invoice.delivery!.address!.streetNameAndNumber,
101
- // postalZone: invoice.delivery!.address!.postalZone,
102
- // city: invoice.delivery!.address!.city,
103
- // countryCode: invoice.delivery!.address!.countryCode,
104
- // // countrySubEntity: "",
105
- // // addressLine2: "",
106
- // // addressLine3: ""
107
- // },
108
- // locationIdentifier: invoice.delivery!.locationIdentifier,
109
- // partyName: ""
110
- // // partyName and actualDeliveryData are missing from the form
111
- // // Description is missing from convertToInvoiceMetadataInput but present in the form
112
- // },
113
- invoiceNo: invoice.invoiceNo,
114
- issueDate: issueDate,
115
- dueDate: dueDate,
116
- notes: invoice.notes,
117
- currencyCode: invoice.currencyCode,
71
+ issueDate: formValues.invoice.issueDate,
72
+ dueDate: null,
73
+ invoiceNo: formValues.invoice.invoiceNo,
118
74
  paymentTerms: {
119
75
  note: ""
120
76
  },
121
77
  // Payment terms doesnt exist in form
122
- invoiceLines: billingLines,
123
- // invoiceLines: [{
124
- // quantity: 1,
125
- // unitPriceAmount: 123,
126
- // taxCategoryType: TaxCategoryTypeEnum.Exempt,
127
- // itemNo: "asd",
128
- // name: "asdasd",
129
- // unitOfMeasure: {
130
- // code: "asd"
131
- // },
132
- // taxableAmount: 123,
133
- // taxAmount: 0,
134
- // taxPercentage: 0
135
- // }],
78
+ currencyCode: formValues.invoice.currency,
79
+ invoiceLines: [],
80
+ notes: formValues.invoice.notes,
136
81
  payableAmount: 0,
137
82
  orderReference: {
138
- documentNo: invoice.orderReference.documentNo,
83
+ documentNo: "",
84
+ issueDate: undefined,
139
85
  },
140
86
  }
141
87
  };
@@ -1,2 +1,2 @@
1
1
  export { convertToInvoiceMetadataInput } from "./ConversionUtility";
2
- export { submitInvoice, CreateSubmitInvoice, submitDocument, AttachDocument } from "./ApiUtility";
2
+ export { submitInvoice, CreateSubmitInvoice } from "./ApiUtility";
@@ -4,4 +4,3 @@ var ConversionUtility_1 = require("./ConversionUtility");
4
4
  exports.convertToInvoiceMetadataInput = ConversionUtility_1.convertToInvoiceMetadataInput; /*, convertToCreditNoteMetadataInput*/
5
5
  var ApiUtility_1 = require("./ApiUtility");
6
6
  exports.submitInvoice = ApiUtility_1.submitInvoice;
7
- exports.submitDocument = ApiUtility_1.submitDocument;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unimaze/billing",
3
- "version": "0.1.2-rc.10",
3
+ "version": "0.1.2-rc.3",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -10,16 +10,14 @@
10
10
  "dependencies": {
11
11
  "@ant-design/compatible": "latest",
12
12
  "@unimaze/api-clients": "^1.1.0",
13
- "react-hot-loader": "^4.12.20",
14
- "uuid": "latest"
13
+ "react-hot-loader": "^4.12.20"
15
14
  },
16
15
  "devDependencies": {
17
16
  "@hot-loader/react-dom": "^16.13.0+4.12.20",
18
17
  "@types/lodash": "^4.14.149",
19
18
  "@types/react": "16.9.34",
20
19
  "@types/react-dom": "16.9.7",
21
- "@types/react-intl": "2.3.18",
22
- "@types/uuid": "latest",
20
+ "@types/react-intl": "^3.0.0",
23
21
  "antd": "4.3.3",
24
22
  "awesome-typescript-loader": "^5.2.1",
25
23
  "axios": "^0.19.2",
@@ -37,6 +35,7 @@
37
35
  "react": "16.13.1",
38
36
  "react-dom": "16.13.1",
39
37
  "react-intl": "^2.9.0",
38
+ "react-intl.macro": "^0.3.7",
40
39
  "rimraf": "^3.0.2",
41
40
  "style-loader": "^1.1.3",
42
41
  "tslint": "^6.1.1",
@@ -52,7 +51,8 @@
52
51
  "axios": "^0.19.2",
53
52
  "react": "16.13.1",
54
53
  "react-dom": "16.13.1",
55
- "react-intl": "^2.9.0"
54
+ "react-intl": "^2.9.0",
55
+ "react-intl.macro": "^0.3.7"
56
56
  },
57
57
  "resolutions": {
58
58
  "@types/react": "16.9.34",
@@ -83,15 +83,10 @@
83
83
  "examples:build": "webpack -d --mode development --config example/webpack.config.js",
84
84
  "start": "yarn run examples"
85
85
  },
86
- "babelMacros": {
87
- "react-intl": {
88
- "pure": true
89
- }
90
- },
91
86
  "author": "",
92
87
  "license": "SEE LICENSE IN LICENSE.txt",
93
88
  "repository": {
94
89
  "type": "git",
95
- "url": "https://bitbucket.org/unimaze/unimaze-billing.git"
90
+ "url": "https://bitbucket.org/unimaze/npm-unimaze-billing.git"
96
91
  }
97
92
  }
@@ -1,6 +0,0 @@
1
- import React from "react";
2
- import { InjectedIntlProps } from "react-intl";
3
- declare const _default: React.ComponentClass<Pick<InjectedIntlProps, never>, any> & {
4
- WrappedComponent: React.ComponentType<InjectedIntlProps>;
5
- };
6
- export default _default;
@@ -1,40 +0,0 @@
1
- "use strict";
2
- var __importStar = (this && this.__importStar) || function (mod) {
3
- if (mod && mod.__esModule) return mod;
4
- var result = {};
5
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
6
- result["default"] = mod;
7
- return result;
8
- };
9
- var __importDefault = (this && this.__importDefault) || function (mod) {
10
- return (mod && mod.__esModule) ? mod : { "default": mod };
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- var react_1 = __importStar(require("react"));
14
- var react_intl_1 = require("react-intl");
15
- var antd_1 = require("antd");
16
- var ReceiverRequirements_1 = require("../../types/ReceiverRequirements");
17
- var form_item_1 = __importDefault(require("../form-item"));
18
- // interface Props extends InjectedIntlProps {
19
- //
20
- // }
21
- var translationMessages = react_intl_1.defineMessages({
22
- referenceIdentifiers_labels_type: {
23
- id: "referenceIdentifiers_labels_type",
24
- defaultMessage: "Reference identifier type",
25
- },
26
- });
27
- var ReferenceIdentifiers = function (props) {
28
- var _a = react_1.useState(null), referenceIdentifierType = _a[0], setReferenceIdentifierType = _a[1];
29
- var handleOnChange = function (value, option) {
30
- // console.log("value", value)
31
- // console.log("option", option)
32
- };
33
- return (react_1.default.createElement(react_1.default.Fragment, null,
34
- react_1.default.createElement(form_item_1.default, { receiverRequirements: ReceiverRequirements_1.receiverRequirementsObject, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.currencyCode, defaultLabel: props.intl.formatMessage(translationMessages.referenceIdentifiers_labels_type), defaultIsRequired: true, fieldName: "code" },
35
- react_1.default.createElement(antd_1.Select, { onChange: function (value, option) { return handleOnChange(value, option); } },
36
- react_1.default.createElement(antd_1.Select.Option, { value: "AKY" }, "B\u00EDln\u00FAmer"),
37
- react_1.default.createElement(antd_1.Select.Option, { value: "SSN" }, "Kennitala"),
38
- react_1.default.createElement(antd_1.Select.Option, { value: "LOC" }, "Fasteignan\u00FAmer")))));
39
- };
40
- exports.default = react_intl_1.injectIntl(ReferenceIdentifiers);
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import { BillingLineMetadataOverride } from "../../types/BillingLineMetadataOverride";
3
- import { InjectedIntlProps } from "react-intl";
4
- interface Props extends InjectedIntlProps {
5
- billingLinesMetadata: BillingLineMetadataOverride[];
6
- renderCurrencyColumn: (text: string | number) => string;
7
- }
8
- declare const _default: React.ComponentClass<Pick<Props, "billingLinesMetadata" | "renderCurrencyColumn">, any> & {
9
- WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
10
- };
11
- export default _default;
@@ -1,61 +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 react_1 = __importDefault(require("react"));
7
- var antd_1 = require("antd");
8
- var BillingLineUtility_1 = require("../../../utils/BillingLineUtility");
9
- var api_1 = require("@unimaze/api-clients/lib/mapi/api");
10
- var react_intl_1 = require("react-intl");
11
- var translationMessages = react_intl_1.defineMessages({
12
- billingCalculations_labels_TaxAmountWithoutVat: {
13
- id: "billingCalculations_labels_TaxAmountWithoutVat",
14
- defaultMessage: "Total amount without VAT",
15
- },
16
- billingCalculations_labels_TotalVatAmount: {
17
- id: "billingCalculations_labels_TotalVatAmount",
18
- defaultMessage: "Total VAT amount",
19
- },
20
- billingCalculations_labels_TotalAmountWithVat: {
21
- id: "billingCalculations_labels_TotalAmountWithVat",
22
- defaultMessage: "Total amount with VAT",
23
- },
24
- });
25
- var BillingCalculations = function (props) {
26
- var billingLinesMetadata = props.billingLinesMetadata;
27
- var totals = {
28
- totalTaxableAmount: 0,
29
- totalTaxAmount: 0,
30
- totalTaxInclusiveAmount: 0,
31
- };
32
- billingLinesMetadata.map(function (billingLine) {
33
- var taxAmount = BillingLineUtility_1.calculateTaxAmount(BillingLineUtility_1.calculateTaxableAmount(billingLine.discountValue, billingLine.quantity, billingLine.unitPriceAmount), BillingLineUtility_1.calculateTaxPercentage(api_1.TaxCategoryTypeEnum[billingLine.taxCategoryType])); // BillingLineMetadataTaxCategoryTypeEnum -> TaxCategoryTypeEnum
34
- var taxableAmount = BillingLineUtility_1.calculateTaxableAmount(billingLine.discountValue, billingLine.quantity, billingLine.unitPriceAmount);
35
- var taxInclusiveAmount = taxableAmount + taxAmount;
36
- totals = {
37
- totalTaxAmount: totals.totalTaxAmount + taxAmount,
38
- totalTaxableAmount: totals.totalTaxableAmount + taxableAmount,
39
- totalTaxInclusiveAmount: totals.totalTaxInclusiveAmount + taxInclusiveAmount,
40
- };
41
- });
42
- return (react_1.default.createElement(react_1.default.Fragment, null,
43
- react_1.default.createElement(antd_1.Row, null,
44
- react_1.default.createElement(antd_1.Col, { span: 18, style: { textAlign: "right" } },
45
- props.intl.formatMessage(translationMessages.billingCalculations_labels_TaxAmountWithoutVat),
46
- ":"),
47
- react_1.default.createElement(antd_1.Col, { span: 6, style: { textAlign: "right" } }, props.renderCurrencyColumn(Math.round(totals.totalTaxableAmount)))),
48
- react_1.default.createElement(antd_1.Row, null,
49
- react_1.default.createElement(antd_1.Col, { span: 18, style: { textAlign: "right" } },
50
- props.intl.formatMessage(translationMessages.billingCalculations_labels_TotalVatAmount),
51
- ":"),
52
- react_1.default.createElement(antd_1.Col, { span: 6, style: { textAlign: "right" } }, props.renderCurrencyColumn(Math.round(totals.totalTaxAmount)))),
53
- react_1.default.createElement(antd_1.Row, null,
54
- react_1.default.createElement(antd_1.Col, { span: 18, style: { textAlign: "right" } },
55
- react_1.default.createElement("span", { style: { fontWeight: 600 } },
56
- props.intl.formatMessage(translationMessages.billingCalculations_labels_TotalAmountWithVat),
57
- ":")),
58
- react_1.default.createElement(antd_1.Col, { span: 6, style: { textAlign: "right" } },
59
- react_1.default.createElement("span", { style: { fontWeight: 600 } }, props.renderCurrencyColumn(Math.round(totals.totalTaxInclusiveAmount)))))));
60
- };
61
- exports.default = react_intl_1.injectIntl(BillingCalculations);
@@ -1,10 +0,0 @@
1
- import React from "react";
2
- import { BillingLineMetadataOverride } from "../../types/BillingLineMetadataOverride";
3
- import { InjectedIntlProps } from "react-intl";
4
- interface Props extends InjectedIntlProps {
5
- billingLines: BillingLineMetadataOverride[];
6
- }
7
- declare const _default: React.ComponentClass<Pick<Props, "billingLines">, any> & {
8
- WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
9
- };
10
- export default _default;
@@ -1,51 +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 react_1 = __importDefault(require("react"));
7
- var antd_1 = require("antd");
8
- var BillingLineUtility_1 = require("../../../utils/BillingLineUtility");
9
- var api_1 = require("@unimaze/api-clients/lib/mapi/api");
10
- var react_intl_1 = require("react-intl");
11
- var translationMessages = react_intl_1.defineMessages({
12
- billingTaxSummary_taxOverview: {
13
- id: "billingTaxSummary_taxOverview",
14
- defaultMessage: "Tax overview"
15
- },
16
- billingTaxSummary_taxableAmount: {
17
- id: "billingTaxSummary_taxableAmount",
18
- defaultMessage: "Taxable amount"
19
- },
20
- billingTaxSummary_taxAmount: {
21
- id: "billingTaxSummary_taxAmount",
22
- defaultMessage: "Tax"
23
- },
24
- });
25
- var BillingTaxSummary = function (props) {
26
- var dataSource = props.billingLines.map(function (billingLine) {
27
- return {
28
- taxOverview: BillingLineUtility_1.generateTaxCategoryLabel(billingLine.taxCategoryType),
29
- taxableAmount: BillingLineUtility_1.calculateTaxableAmount(billingLine.discountValue, billingLine.quantity, billingLine.unitPriceAmount),
30
- taxAmount: BillingLineUtility_1.calculateTaxAmount(BillingLineUtility_1.calculateTaxableAmount(billingLine.discountValue, billingLine.quantity, billingLine.unitPriceAmount), BillingLineUtility_1.calculateTaxPercentage(api_1.TaxCategoryTypeEnum[billingLine.taxCategoryType]))
31
- };
32
- });
33
- var columns = [
34
- {
35
- title: props.intl.formatMessage(translationMessages.billingTaxSummary_taxOverview),
36
- dataIndex: "taxOverview",
37
- },
38
- {
39
- title: props.intl.formatMessage(translationMessages.billingTaxSummary_taxableAmount),
40
- dataIndex: "taxableAmount",
41
- },
42
- {
43
- title: props.intl.formatMessage(translationMessages.billingTaxSummary_taxAmount),
44
- dataIndex: "taxAmount",
45
- },
46
- ];
47
- return (react_1.default.createElement(antd_1.Table, { style: { minHeight: "170px" },
48
- // showHeader={false}
49
- columns: columns, dataSource: dataSource, pagination: false, rowKey: (function (record, index) { return index.toString(); }) }));
50
- };
51
- exports.default = react_intl_1.injectIntl(BillingTaxSummary);
@@ -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
- };
@@ -1,7 +0,0 @@
1
- import * as React from 'react';
2
- import { wapi2 } from "@unimaze/api-clients";
3
- interface Props {
4
- customer: wapi2.ProfileOutput;
5
- }
6
- declare const Customer: React.FC<Props>;
7
- export default Customer;
@@ -1,6 +0,0 @@
1
- import * as React from 'react';
2
- import { InjectedIntlProps } from "react-intl";
3
- declare const CustomerIntl: React.ComponentClass<Pick<InjectedIntlProps, never>, any> & {
4
- WrappedComponent: React.ComponentType<InjectedIntlProps>;
5
- };
6
- export default CustomerIntl;