@unimaze/billing 0.1.2-rc.10 → 0.1.2-rc.2

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 (101) 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 +8 -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 +23 -9
  9. package/lib/common/components/billing-lines/index.js +38 -116
  10. package/lib/common/components/delivery-location/index.d.ts +2 -5
  11. package/lib/common/components/delivery-location/index.js +11 -43
  12. package/lib/common/components/editable-cell/index.d.ts +1 -1
  13. package/lib/common/components/editable-cell/index.js +10 -76
  14. package/lib/common/components/editable-row/index.d.ts +5 -5
  15. package/lib/common/components/editable-row/index.js +6 -8
  16. package/lib/common/components/index.d.ts +5 -10
  17. package/lib/common/components/index.js +8 -20
  18. package/lib/common/components/issuer/index.d.ts +7 -0
  19. package/lib/common/components/{customer/hardCoddedCustomer.js → issuer/index.js} +8 -5
  20. package/lib/common/components/payer/index.d.ts +3 -0
  21. package/lib/common/components/payer/index.js +50 -0
  22. package/lib/common/components/payment-method/index.d.ts +3 -6
  23. package/lib/common/components/payment-method/index.js +17 -57
  24. package/lib/common/consts/validationRules.d.ts +3 -2
  25. package/lib/common/consts/validationRules.js +7 -0
  26. package/lib/common/enums/index.d.ts +1 -1
  27. package/lib/common/enums/index.js +4 -2
  28. package/lib/common/types/BillingLineMetadataOverride.d.ts +0 -1
  29. package/lib/create-credit-note/index.d.ts +2 -1
  30. package/lib/create-credit-note/index.js +14 -6
  31. package/lib/create-invoice/index.d.ts +2 -1
  32. package/lib/create-invoice/index.js +21 -79
  33. package/lib/example/src/index.d.ts +1 -1
  34. package/lib/index.js +0 -5
  35. package/lib/src/common/components/attachments/Attachment.d.ts +2 -8
  36. package/lib/src/common/components/attachments/index.d.ts +2 -9
  37. package/lib/src/common/components/base-information/index.d.ts +3 -6
  38. package/lib/src/common/components/billing-lines/index.d.ts +23 -9
  39. package/lib/src/common/components/delivery-location/index.d.ts +2 -5
  40. package/lib/src/common/components/editable-cell/index.d.ts +1 -1
  41. package/lib/src/common/components/editable-row/index.d.ts +5 -5
  42. package/lib/src/common/components/issuer/index.d.ts +7 -0
  43. package/lib/src/common/components/payer/index.d.ts +3 -0
  44. package/lib/src/common/components/payment-method/index.d.ts +3 -6
  45. package/lib/src/common/consts/validationRules.d.ts +3 -2
  46. package/lib/src/create-credit-note/index.d.ts +9 -0
  47. package/lib/src/create-invoice/index.d.ts +2 -1
  48. package/lib/src/index.d.ts +4 -0
  49. package/lib/style/index.css +1222 -0
  50. package/lib/utils/ApiUtility.d.ts +1 -8
  51. package/lib/utils/ApiUtility.js +1 -17
  52. package/lib/utils/ConversionUtility.d.ts +4 -5
  53. package/lib/utils/ConversionUtility.js +133 -121
  54. package/lib/utils/index.d.ts +2 -2
  55. package/lib/utils/index.js +2 -2
  56. package/package.json +7 -12
  57. package/lib/common/components/base-information/ReferenceIdentifiers.d.ts +0 -6
  58. package/lib/common/components/base-information/ReferenceIdentifiers.js +0 -40
  59. package/lib/common/components/billing-lines/BillingCalculations.d.ts +0 -11
  60. package/lib/common/components/billing-lines/BillingCalculations.js +0 -61
  61. package/lib/common/components/billing-lines/BillingTaxSummary.d.ts +0 -10
  62. package/lib/common/components/billing-lines/BillingTaxSummary.js +0 -51
  63. package/lib/common/components/billing-lines/billingLIneFormData.d.ts +0 -7
  64. package/lib/common/components/billing-lines/billingLIneFormData.js +0 -63
  65. package/lib/common/components/customer/hardCoddedCustomer.d.ts +0 -7
  66. package/lib/common/components/customer/index.d.ts +0 -6
  67. package/lib/common/components/customer/index.js +0 -93
  68. package/lib/common/components/form-item/index.d.ts +0 -21
  69. package/lib/common/components/form-item/index.js +0 -27
  70. package/lib/common/components/locale-intl/index.d.ts +0 -10
  71. package/lib/common/components/locale-intl/index.js +0 -45
  72. package/lib/common/components/supplier/index.d.ts +0 -6
  73. package/lib/common/components/supplier/index.js +0 -93
  74. package/lib/common/types/ReceiverRequirements.d.ts +0 -81
  75. package/lib/common/types/ReceiverRequirements.js +0 -379
  76. package/lib/src/common/components/base-information/ReferenceIdentifiers.d.ts +0 -6
  77. package/lib/src/common/components/billing-lines/BillingCalculations.d.ts +0 -11
  78. package/lib/src/common/components/billing-lines/BillingTaxSummary.d.ts +0 -10
  79. package/lib/src/common/components/billing-lines/billingLIneFormData.d.ts +0 -7
  80. package/lib/src/common/components/customer/index.d.ts +0 -6
  81. package/lib/src/common/components/form-item/index.d.ts +0 -21
  82. package/lib/src/common/components/index.d.ts +0 -10
  83. package/lib/src/common/components/locale-intl/index.d.ts +0 -10
  84. package/lib/src/common/components/supplier/index.d.ts +0 -6
  85. package/lib/src/common/types/ReceiverRequirements.d.ts +0 -81
  86. package/lib/src/translations/locales.d.ts +0 -74
  87. package/lib/src/utils/ApiUtility.d.ts +0 -21
  88. package/lib/src/utils/BillingLineUtility.d.ts +0 -8
  89. package/lib/src/utils/ConversionUtility.d.ts +0 -5
  90. package/lib/src/utils/RequirementsUtility.d.ts +0 -5
  91. package/lib/src/utils/billingLineFormData.d.ts +0 -7
  92. package/lib/src/utils/index.d.ts +0 -2
  93. package/lib/translations/locales/is.json +0 -70
  94. package/lib/translations/locales.d.ts +0 -74
  95. package/lib/translations/locales.js +0 -10
  96. package/lib/utils/BillingLineUtility.d.ts +0 -8
  97. package/lib/utils/BillingLineUtility.js +0 -66
  98. package/lib/utils/RequirementsUtility.d.ts +0 -5
  99. package/lib/utils/RequirementsUtility.js +0 -23
  100. package/lib/utils/billingLineFormData.d.ts +0 -7
  101. package/lib/utils/billingLineFormData.js +0 -63
@@ -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";
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;
5
- export { /*convertToCreditNoteMetadataInput,*/ convertToInvoiceMetadataInput };
1
+ import { CreditNoteMetadataInput, InvoiceMetadataInput } from "@unimaze/api-clients/lib/mapi";
2
+ declare const convertToInvoiceMetadataInput: (formValues: any) => InvoiceMetadataInput;
3
+ declare const convertToCreditNoteMetadataInput: (formValues: any) => CreditNoteMetadataInput;
4
+ export { convertToCreditNoteMetadataInput, convertToInvoiceMetadataInput };
@@ -1,146 +1,158 @@
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
- }
57
- var resp = {
3
+ var convertToInvoiceMetadataInput = function (formValues) {
4
+ return {
58
5
  messageHandling: {
59
- receiverIdentifier: customer.participantLegalIsoIdentifier,
60
- fallbackEmailAddress: customer.email,
61
- fallbackContactName: customer.name,
6
+ receiverIdentifier: "",
7
+ fallbackEmailAddress: "",
8
+ fallbackContactName: "",
62
9
  },
63
10
  invoice: {
64
- customer: {
65
- identifier: getIdentifierWithPrefix(invoice.customer.identifier),
11
+ supplier: {
12
+ identifier: "",
66
13
  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: ""
14
+ streetNameAndNumber: "",
15
+ postalZone: "",
16
+ city: "",
17
+ countryCode: "",
18
+ countrySubEntity: "",
19
+ addressLine2: "",
20
+ addressLine3: ""
74
21
  },
75
- name: invoice.customer.name,
22
+ name: "",
23
+ vatNumber: "",
76
24
  contact: {
77
- electronicMail: invoice.customer.contact.electronicMail,
78
- telephone: invoice.customer.contact.telephone,
25
+ electronicMail: "",
26
+ fax: "",
27
+ name: "",
28
+ telephone: ""
79
29
  }
80
30
  },
81
- supplier: {
82
- identifier: getIdentifierWithPrefix(invoice.supplier.identifier),
31
+ customer: {
32
+ identifier: "",
83
33
  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,
34
+ streetNameAndNumber: "",
35
+ postalZone: "",
36
+ city: "",
37
+ countryCode: "",
38
+ countrySubEntity: "",
39
+ addressLine2: "",
40
+ addressLine3: ""
88
41
  },
89
- vatNumber: invoice.supplier.vatNumber,
90
- name: invoice.supplier.name,
42
+ name: "",
91
43
  contact: {
92
- electronicMail: invoice.supplier.contact.electronicMail,
93
- name: invoice.supplier.contact.name,
44
+ electronicMail: "",
45
+ fax: "",
46
+ name: "",
47
+ telephone: ""
48
+ },
49
+ },
50
+ delivery: {
51
+ actualDeliveryDate: null,
52
+ address: {
53
+ streetNameAndNumber: "",
54
+ postalZone: "",
55
+ city: "",
56
+ countryCode: "",
57
+ countrySubEntity: "",
58
+ addressLine2: "",
59
+ addressLine3: ""
94
60
  },
61
+ locationIdentifier: "",
62
+ partyName: ""
95
63
  },
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,
64
+ issueDate: new Date(),
65
+ dueDate: null,
66
+ invoiceNo: "",
118
67
  paymentTerms: {
119
68
  note: ""
120
69
  },
121
- // 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
- // }],
70
+ currencyCode: "",
71
+ invoiceLines: [],
72
+ notes: "",
136
73
  payableAmount: 0,
137
74
  orderReference: {
138
- documentNo: invoice.orderReference.documentNo,
75
+ documentNo: "",
139
76
  },
140
77
  }
141
78
  };
142
- // tslint:disable-next-line:no-console
143
- console.log(resp);
144
- return resp;
145
79
  };
146
80
  exports.convertToInvoiceMetadataInput = convertToInvoiceMetadataInput;
81
+ var convertToCreditNoteMetadataInput = function (formValues) {
82
+ return {
83
+ messageHandling: {
84
+ receiverIdentifier: "",
85
+ fallbackEmailAddress: "",
86
+ fallbackContactName: "",
87
+ },
88
+ creditNote: {
89
+ supplier: {
90
+ identifier: "",
91
+ address: {
92
+ streetNameAndNumber: "",
93
+ postalZone: "",
94
+ city: "",
95
+ countryCode: "",
96
+ countrySubEntity: "",
97
+ addressLine2: "",
98
+ addressLine3: ""
99
+ },
100
+ name: "",
101
+ vatNumber: "",
102
+ contact: {
103
+ electronicMail: "",
104
+ fax: "",
105
+ name: "",
106
+ telephone: ""
107
+ }
108
+ },
109
+ customer: {
110
+ identifier: "",
111
+ address: {
112
+ streetNameAndNumber: "",
113
+ postalZone: "",
114
+ city: "",
115
+ countryCode: "",
116
+ countrySubEntity: "",
117
+ addressLine2: "",
118
+ addressLine3: ""
119
+ },
120
+ name: "",
121
+ contact: {
122
+ electronicMail: "",
123
+ fax: "",
124
+ name: "",
125
+ telephone: ""
126
+ },
127
+ },
128
+ delivery: {
129
+ actualDeliveryDate: null,
130
+ address: {
131
+ streetNameAndNumber: "",
132
+ postalZone: "",
133
+ city: "",
134
+ countryCode: "",
135
+ countrySubEntity: "",
136
+ addressLine2: "",
137
+ addressLine3: ""
138
+ },
139
+ locationIdentifier: "",
140
+ partyName: ""
141
+ },
142
+ issueDate: new Date(),
143
+ creditNoteNo: "",
144
+ currencyCode: "",
145
+ creditNoteLines: [],
146
+ notes: "",
147
+ payableAmount: 0,
148
+ orderReference: {
149
+ documentNo: "",
150
+ },
151
+ billingReferences: {
152
+ invoices: [],
153
+ creditNotes: [],
154
+ }
155
+ }
156
+ };
157
+ };
158
+ exports.convertToCreditNoteMetadataInput = convertToCreditNoteMetadataInput;
@@ -1,2 +1,2 @@
1
- export { convertToInvoiceMetadataInput } from "./ConversionUtility";
2
- export { submitInvoice, CreateSubmitInvoice, submitDocument, AttachDocument } from "./ApiUtility";
1
+ export { convertToInvoiceMetadataInput, convertToCreditNoteMetadataInput } from "./ConversionUtility";
2
+ export { submitInvoice, CreateSubmitInvoice } from "./ApiUtility";
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var ConversionUtility_1 = require("./ConversionUtility");
4
- exports.convertToInvoiceMetadataInput = ConversionUtility_1.convertToInvoiceMetadataInput; /*, convertToCreditNoteMetadataInput*/
4
+ exports.convertToInvoiceMetadataInput = ConversionUtility_1.convertToInvoiceMetadataInput;
5
+ exports.convertToCreditNoteMetadataInput = ConversionUtility_1.convertToCreditNoteMetadataInput;
5
6
  var ApiUtility_1 = require("./ApiUtility");
6
7
  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.2",
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;