@unimaze/billing 0.20.11 → 0.20.13
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/lib/common/components/base-information/ReferenceIdentifiers.js +0 -4
- package/lib/common/components/billing-lines/BillingTaxSummary.js +0 -1
- package/lib/common/components/billing-lines/index.js +0 -2
- package/lib/common/components/customer/CostCenter.js +0 -2
- package/lib/common/components/editable-cell/index.js +0 -2
- package/lib/common/components/locale-intl/index.js +0 -2
- package/lib/common/components/supplier/index.js +0 -4
- package/lib/create-invoice/index.js +16 -10
- package/lib/utils/ApiUtility.js +0 -2
- package/lib/utils/BillingLineUtility.js +5 -3
- package/lib/utils/ConversionUtility.d.ts +1 -0
- package/lib/utils/ConversionUtility.js +15 -6
- package/lib/utils/RequirementsUtility.js +0 -2
- package/package.json +2 -1
|
@@ -112,8 +112,6 @@ var ReferenceIdentifiers = function (props) {
|
|
|
112
112
|
})
|
|
113
113
|
.catch(function (error) {
|
|
114
114
|
setLoadingReferenceIdentifierValues(false);
|
|
115
|
-
// tslint:disable-next-line:no-console
|
|
116
|
-
console.log(error);
|
|
117
115
|
});
|
|
118
116
|
}
|
|
119
117
|
}, 500);
|
|
@@ -130,8 +128,6 @@ var ReferenceIdentifiers = function (props) {
|
|
|
130
128
|
response.data ? setReferenceIdentifierValidateStatus("success") : setReferenceIdentifierValidateStatus("error");
|
|
131
129
|
})
|
|
132
130
|
.catch(function (error) {
|
|
133
|
-
// tslint:disable-next-line:no-console
|
|
134
|
-
console.log(error);
|
|
135
131
|
setReferenceIdentifierValidateStatus("error");
|
|
136
132
|
});
|
|
137
133
|
}
|
|
@@ -225,7 +225,6 @@ var BillingLines = /** @class */ (function (_super) {
|
|
|
225
225
|
BillingLines.prototype.render = function () {
|
|
226
226
|
// const dataSource = this.props.formInstance.getFieldValue(["invoice", "invoiceLines"]);
|
|
227
227
|
// const {dataSource} = this.props;
|
|
228
|
-
// console.log(dataSource);
|
|
229
228
|
// const components = {
|
|
230
229
|
// body: {
|
|
231
230
|
// row: EditableRow,
|
|
@@ -254,7 +253,6 @@ var BillingLines = /** @class */ (function (_super) {
|
|
|
254
253
|
React.createElement(icons_1.QuestionCircleOutlined, null))));
|
|
255
254
|
var currencyCode = this.props.formInstance.getFieldValue(["invoice", "currencyCode"]) ? this.props.formInstance.getFieldValue(["invoice", "currencyCode"]) : "";
|
|
256
255
|
var billingLinesFormValues = this.props.formInstance.getFieldsValue(["invoice", "invoiceLines"]);
|
|
257
|
-
// console.log(billingLinesFormValues)
|
|
258
256
|
return (React.createElement(components_1.ComponentContainer, { title: billingLinesLabelNode },
|
|
259
257
|
React.createElement(NewBillingLines_1.default, { formInstance: this.props.formInstance, receiverRequirements: this.props.receiverRequirements, outsideVatScope: this.props.outsideVatScope }),
|
|
260
258
|
React.createElement(antd_1.Row, { style: { marginTop: "1em" }, align: "top", justify: "space-between", gutter: [16, 16] },
|
|
@@ -24,8 +24,6 @@ var HotIntlProvider = function (props) {
|
|
|
24
24
|
var languageString = props.languageString, initialLocale = props.initialLocale;
|
|
25
25
|
// const language: string = languageString ? languageString : "en";
|
|
26
26
|
var language = initialLocale;
|
|
27
|
-
// console.log(language);
|
|
28
|
-
// console.log(localeData);
|
|
29
27
|
switch (language.toLowerCase()) {
|
|
30
28
|
case "en":
|
|
31
29
|
antLocale = en_US_1.default;
|
|
@@ -161,16 +161,12 @@ var Supplier = function (props) {
|
|
|
161
161
|
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
|
|
162
162
|
// http.ClientRequest in node.js
|
|
163
163
|
var request = error.request;
|
|
164
|
-
// tslint:disable-next-line:no-console
|
|
165
|
-
console.log(error.request);
|
|
166
164
|
antd_1.message.error(request.responseText);
|
|
167
165
|
}
|
|
168
166
|
else {
|
|
169
167
|
// Something happened in setting up the request that triggered an Error
|
|
170
168
|
antd_1.message.error(error.message);
|
|
171
169
|
}
|
|
172
|
-
// tslint:disable-next-line:no-console
|
|
173
|
-
console.log(error.config);
|
|
174
170
|
setParticipantInfo({});
|
|
175
171
|
setIsLoadingParticipantInfo(false);
|
|
176
172
|
});
|
|
@@ -152,7 +152,6 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
152
152
|
}
|
|
153
153
|
}, [supplierEmailValue]);
|
|
154
154
|
var handleSubmit = function (values) {
|
|
155
|
-
// console.log("values at the start of submit", values);
|
|
156
155
|
setSubmitting(true);
|
|
157
156
|
if (referenceIdentifierValidateStatus !== "" && referenceIdentifierValidateStatus !== "success") {
|
|
158
157
|
form.scrollToField(["invoice", "referenceIdentifiers", 0, "value"]);
|
|
@@ -215,7 +214,6 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
215
214
|
_loop_1();
|
|
216
215
|
}
|
|
217
216
|
setSubmitting(false);
|
|
218
|
-
// console.log("values after successful submit", values);
|
|
219
217
|
form.resetFields();
|
|
220
218
|
form.setFields([
|
|
221
219
|
{
|
|
@@ -253,26 +251,34 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
253
251
|
if (error.response) {
|
|
254
252
|
// The request was made and the server responded with a status code
|
|
255
253
|
// that falls out of the range of 2xx
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
254
|
+
if (error.response.data) {
|
|
255
|
+
var errorData = error.response.data;
|
|
256
|
+
if (errorData.hasOwnProperty("message")) {
|
|
257
|
+
antd_1.message.error(errorData.message);
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
for (var errorMessageKey in errorData) {
|
|
261
|
+
if (errorData.hasOwnProperty(errorMessageKey)) {
|
|
262
|
+
antd_1.message.error(react_1.default.createElement(react_1.default.Fragment, null,
|
|
263
|
+
react_1.default.createElement("strong", null, errorMessageKey),
|
|
264
|
+
react_1.default.createElement("br", null),
|
|
265
|
+
errorData[errorMessageKey]));
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
260
270
|
}
|
|
261
271
|
else if (error.request) {
|
|
262
272
|
// The request was made but no response was received
|
|
263
273
|
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
|
|
264
274
|
// http.ClientRequest in node.js
|
|
265
275
|
var request = error.request;
|
|
266
|
-
// tslint:disable-next-line:no-console
|
|
267
|
-
console.log(error.request);
|
|
268
276
|
antd_1.message.error(request.responseText);
|
|
269
277
|
}
|
|
270
278
|
else {
|
|
271
279
|
// Something happened in setting up the request that triggered an Error
|
|
272
280
|
antd_1.message.error(error.message);
|
|
273
281
|
}
|
|
274
|
-
// tslint:disable-next-line:no-console
|
|
275
|
-
console.log(error.config);
|
|
276
282
|
});
|
|
277
283
|
if (recaptchaRef) {
|
|
278
284
|
if (recaptchaRef.current) {
|
package/lib/utils/ApiUtility.js
CHANGED
|
@@ -90,8 +90,6 @@ var createOptionsData = function (data, apiKey, callName, language) {
|
|
|
90
90
|
Authorization: "Bearer " + window.btoa(apiKey),
|
|
91
91
|
"Content-Type": "application/octet-stream"
|
|
92
92
|
} });
|
|
93
|
-
// tslint:disable-next-line:no-console
|
|
94
|
-
console.log(options);
|
|
95
93
|
return options;
|
|
96
94
|
};
|
|
97
95
|
exports.getCancelToken = function (callName) {
|
|
@@ -18,13 +18,15 @@ var api_1 = require("@unimaze/api-clients/lib/mapi/api");
|
|
|
18
18
|
var react_1 = __importDefault(require("react"));
|
|
19
19
|
var antd_1 = require("antd");
|
|
20
20
|
var CommonTranslations_1 = require("../common/components/CommonTranslations");
|
|
21
|
+
var ConversionUtility_1 = require("./ConversionUtility");
|
|
21
22
|
exports.billingLinesFieldsMetadata = function (formInstance) {
|
|
22
23
|
var billingLinesMetadata = formInstance.getFieldValue(["invoice", "invoiceLines"]);
|
|
23
24
|
return billingLinesMetadata.map(function (billingLine) {
|
|
24
|
-
var
|
|
25
|
-
var
|
|
25
|
+
var cleanBillingLine = ConversionUtility_1.removeEmpty(billingLine);
|
|
26
|
+
var taxableAmount = exports.calculateTaxableAmount(cleanBillingLine.discountValue, cleanBillingLine.quantity, cleanBillingLine.unitPriceAmount);
|
|
27
|
+
var taxPercentage = exports.calculateTaxPercentage(cleanBillingLine.taxCategoryType);
|
|
26
28
|
var taxAmount = exports.calculateTaxAmount(taxableAmount, taxPercentage);
|
|
27
|
-
var mappedBillingLine = __assign({},
|
|
29
|
+
var mappedBillingLine = __assign({}, cleanBillingLine, { taxableAmount: taxableAmount,
|
|
28
30
|
taxAmount: taxAmount,
|
|
29
31
|
taxPercentage: taxPercentage });
|
|
30
32
|
if (mappedBillingLine.discountValue === "0" || mappedBillingLine.discountValue === "0%") {
|
|
@@ -2,6 +2,7 @@ import { BillingLineMetadata, InvoiceMetadataInput, PartyMetadata } from "@unima
|
|
|
2
2
|
import { Store } from "antd/es/form/interface";
|
|
3
3
|
import { ProfileOutput } from "@unimaze/api-clients/lib/wapi2";
|
|
4
4
|
import { PaymentMeansMetadata } from "@unimaze/api-clients/lib/mapi/api";
|
|
5
|
+
export declare const removeEmpty: (obj: any) => any;
|
|
5
6
|
declare const convertToInvoiceMetadataInput: (formValues: Store, invoiceLinesWithCalculations: BillingLineMetadata[], paymentMethod: PaymentMeansMetadata, chosenCustomer: PartyMetadata) => InvoiceMetadataInput;
|
|
6
7
|
declare const profileOutputToPartyMetadata: (profileOutput: ProfileOutput) => PartyMetadata;
|
|
7
8
|
declare const convertToReadableKennitala: (isoIdentifier: string) => string;
|
|
@@ -12,15 +12,24 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
var antd_1 = require("antd");
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
exports.removeEmpty = function (obj) {
|
|
16
|
+
var listOfKeys = Object.keys(obj);
|
|
17
|
+
var filteredObject = listOfKeys.filter(function (k) {
|
|
18
|
+
var value = obj[k];
|
|
19
|
+
var valueIsNotNull = value != null;
|
|
20
|
+
var valueIsNotUndefined = value !== undefined;
|
|
21
|
+
var valueIsNotEmptyString = value !== '';
|
|
22
|
+
return valueIsNotNull
|
|
23
|
+
&& valueIsNotUndefined
|
|
24
|
+
&& valueIsNotEmptyString;
|
|
25
|
+
}); // Remove undef. and null.
|
|
26
|
+
var reducedObject = filteredObject.reduce(function (newObj, k) {
|
|
19
27
|
var _a, _b;
|
|
20
28
|
return typeof obj[k] === "object"
|
|
21
|
-
? __assign({}, newObj, (_a = {}, _a[k] = removeEmpty(obj[k]), _a)) : __assign({}, newObj, (_b = {}, _b[k] = obj[k], _b));
|
|
29
|
+
? __assign({}, newObj, (_a = {}, _a[k] = exports.removeEmpty(obj[k]), _a)) : __assign({}, newObj, (_b = {}, _b[k] = obj[k], _b));
|
|
22
30
|
}, // Copy value.
|
|
23
31
|
{});
|
|
32
|
+
return reducedObject;
|
|
24
33
|
};
|
|
25
34
|
var convertDates = function (date) {
|
|
26
35
|
return date ? date.utc().toDate() : undefined;
|
|
@@ -56,7 +65,7 @@ var convertToInvoiceMetadataInput = function (formValues, invoiceLinesWithCalcul
|
|
|
56
65
|
value: formValues.invoice.singleReferenceIdentifier.value
|
|
57
66
|
}]
|
|
58
67
|
: formValues.invoice.referenceIdentifiers;
|
|
59
|
-
var cleanedFormValues = removeEmpty(formValues);
|
|
68
|
+
var cleanedFormValues = exports.removeEmpty(formValues);
|
|
60
69
|
var invoice = cleanedFormValues.invoice;
|
|
61
70
|
// fix delivery
|
|
62
71
|
var delivery = invoice.delivery;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unimaze/billing",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.13",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"@ant-design/compatible": "latest",
|
|
12
12
|
"@unimaze/api-clients": "3.1.1",
|
|
13
13
|
"antd-mask-input": "^0.1.13",
|
|
14
|
+
"lodash": "^4.17.21",
|
|
14
15
|
"react-hot-loader": "^4.12.20",
|
|
15
16
|
"react-intl": "2.9.0",
|
|
16
17
|
"reaptcha": "^1.7.2",
|