@unimaze/billing 0.12.5 → 0.12.7
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 +6 -2
- package/lib/common/components/customer/index.js +1 -1
- package/lib/common/components/supplier/index.js +14 -3
- package/lib/create-invoice/IntlLoader.d.ts +1 -0
- package/lib/create-invoice/IntlLoader.js +13 -13
- package/lib/create-invoice/index.js +2 -2
- package/lib/translations/locales/is.json +1 -0
- package/lib/translations/locales.d.ts +1 -0
- package/lib/utils/ApiUtility.d.ts +2 -2
- package/lib/utils/ApiUtility.js +14 -3
- package/package.json +1 -1
|
@@ -131,7 +131,9 @@ var ReferenceIdentifiers = function (props) {
|
|
|
131
131
|
});
|
|
132
132
|
}, 500);
|
|
133
133
|
var getReferenceIdentifierValueFormItemInput = function (value, receiverRequirements, rapiBaseUrl, legalIdentifier, field) {
|
|
134
|
-
var fieldProps = __assign({}, field, { name: [field.name, "value"],
|
|
134
|
+
var fieldProps = __assign({}, field, { name: [field.name, "value"],
|
|
135
|
+
// fieldKey: [field.fieldKey, "value"],
|
|
136
|
+
rules: [{ required: false }] });
|
|
135
137
|
if (value && value.key) {
|
|
136
138
|
var options = ReferenceIdentifierUtility_1.getReferenceIdentifierOptions(receiverRequirements);
|
|
137
139
|
var fieldDefinition_1 = options.find(function (el) { return el.key.endsWith(value.key); });
|
|
@@ -239,7 +241,9 @@ var ReferenceIdentifiers = function (props) {
|
|
|
239
241
|
return (react_1.default.createElement(antd_1.Form.Item, __assign({ key: "referenceIdentifier-" + index }, (index === 0 ? formLayout_1.formItemLayout : formLayout_1.formItemLayoutWithOutLabel), { label: index === 0 ? referenceIdentifierLabelNode : "" }),
|
|
240
242
|
react_1.default.createElement(antd_1.Row, { gutter: [16, 0] },
|
|
241
243
|
react_1.default.createElement(antd_1.Col, { span: 12 },
|
|
242
|
-
react_1.default.createElement(antd_1.Form.Item, __assign({}, field, { name: [field.name, "code"],
|
|
244
|
+
react_1.default.createElement(antd_1.Form.Item, __assign({}, field, { name: [field.name, "code"],
|
|
245
|
+
// fieldKey={[field.fieldKey, "code"]}
|
|
246
|
+
rules: [{ required: false }] }),
|
|
243
247
|
react_1.default.createElement(antd_1.Select, { labelInValue: true, allowClear: true, style: { width: "100%" }, dropdownMatchSelectWidth: false, onChange: function (a) {
|
|
244
248
|
var newState = referenceIdentifierValue.slice();
|
|
245
249
|
newState.splice(index, 1, a);
|
|
@@ -79,7 +79,7 @@ var Customer = function (props) {
|
|
|
79
79
|
react_1.default.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, defaultLabel: props.intl.formatMessage(translationMessages.customer_selectTheCustomer), defaultIsRequired: true, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["customer.identifier"], fieldName: ["invoice", "customer", "name"] },
|
|
80
80
|
react_1.default.createElement(antd_1.Select, { onChange: function (value) {
|
|
81
81
|
onCustomerChange(value);
|
|
82
|
-
}, dropdownMatchSelectWidth: false }, props.customers.map(function (customer, index) { return (react_1.default.createElement(antd_1.Select.Option, { key: index, value: index }, customer.name)); }))),
|
|
82
|
+
}, dropdownMatchSelectWidth: false, disabled: props.customers.length === 1 }, props.customers.map(function (customer, index) { return (react_1.default.createElement(antd_1.Select.Option, { key: index, value: index }, customer.name)); }))),
|
|
83
83
|
react_1.default.createElement(antd_1.Form.Item, __assign({}, formLayout_1.formItemLayout, { label: props.intl.formatMessage(translationMessages.customer_name), style: { display: "none" } }), chosenCustomer && chosenCustomer.name),
|
|
84
84
|
react_1.default.createElement(antd_1.Form.Item, __assign({}, formLayout_1.formItemLayout, { label: props.intl.formatMessage(translationMessages.customer_identifier) }), chosenCustomer && ConversionUtility_1.convertToReadableKennitala(chosenCustomer.identifier)),
|
|
85
85
|
react_1.default.createElement(antd_1.Form.Item, __assign({}, formLayout_1.formItemLayout, { label: props.intl.formatMessage(translationMessages.customer_address_streetNameAndNumber) }), chosenCustomer && chosenCustomer.address
|
|
@@ -15,11 +15,12 @@ var react_1 = require("react");
|
|
|
15
15
|
var components_1 = require("../../components");
|
|
16
16
|
var antd_1 = require("antd");
|
|
17
17
|
var ReceiverRequirements_1 = require("../../types/ReceiverRequirements");
|
|
18
|
-
var form_item_1 =
|
|
18
|
+
var form_item_1 = __importDefault(require("../form-item"));
|
|
19
19
|
var react_intl_1 = require("react-intl");
|
|
20
20
|
var icons_1 = require("@ant-design/icons");
|
|
21
21
|
// import {defineMessages} from "react-intl.macro"
|
|
22
22
|
var payment_method_1 = require("../payment-method");
|
|
23
|
+
var form_item_2 = require("../form-item");
|
|
23
24
|
var antd_mask_input_1 = require("antd-mask-input");
|
|
24
25
|
var axios_1 = __importDefault(require("axios"));
|
|
25
26
|
var lodash_1 = require("lodash");
|
|
@@ -73,6 +74,10 @@ var translationMessages = react_intl_1.defineMessages({
|
|
|
73
74
|
id: "supplier_contact_name",
|
|
74
75
|
defaultMessage: "Contact name"
|
|
75
76
|
},
|
|
77
|
+
supplier_contact_phoneNumber: {
|
|
78
|
+
id: "supplier_contact_phoneNumber",
|
|
79
|
+
defaultMessage: "Phone number"
|
|
80
|
+
},
|
|
76
81
|
supplier_notValidEmail: {
|
|
77
82
|
id: "supplier_notValidEmail",
|
|
78
83
|
defaultMessage: "This is not a valid E-Mail"
|
|
@@ -177,6 +182,9 @@ var Supplier = function (props) {
|
|
|
177
182
|
getParticipantInfoWithIdentifier(rapiUrl, rapiApiKey, strippedSearchValue);
|
|
178
183
|
}
|
|
179
184
|
}, 500);
|
|
185
|
+
var getCustomerTelephoneFieldDefinitions = function (receiverRequirements) {
|
|
186
|
+
return receiverRequirements && receiverRequirements.fieldDefinitions.find(function (fieldRequirement) { return fieldRequirement.key === "customer.contact.telephone"; });
|
|
187
|
+
};
|
|
180
188
|
return (React.createElement(components_1.ComponentContainer, { title: props.intl.formatMessage(translationMessages.supplier_title) },
|
|
181
189
|
React.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["supplier.identifier"], defaultLabel: props.intl.formatMessage(translationMessages.supplier_identifier), defaultIsRequired: true, fieldName: ["invoice", "supplier", "identifier"], hasFeedback: isLoadingParticipantInfo, validateStatus: isLoadingParticipantInfo ? "validating" : undefined, rules: [
|
|
182
190
|
{
|
|
@@ -185,7 +193,7 @@ var Supplier = function (props) {
|
|
|
185
193
|
},
|
|
186
194
|
{
|
|
187
195
|
required: true,
|
|
188
|
-
message: props.intl.formatMessage(
|
|
196
|
+
message: props.intl.formatMessage(form_item_2.translationMessages.formItem_required_errorMessage),
|
|
189
197
|
}
|
|
190
198
|
] },
|
|
191
199
|
React.createElement(antd_mask_input_1.MaskedInput, { mask: "111111-1111", onChange: function (value) { return debouncerSearch(props.rapiBaseUrl, props.rapiApiKey, value.target.value); } })),
|
|
@@ -225,7 +233,10 @@ var Supplier = function (props) {
|
|
|
225
233
|
] },
|
|
226
234
|
React.createElement(antd_1.Input, { disabled: isLoadingParticipantInfo })),
|
|
227
235
|
React.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["supplier.contact.name"], defaultLabel: props.intl.formatMessage(translationMessages.supplier_contact_name), defaultIsRequired: false, fieldName: ["invoice", "supplier", "contact", "name"] },
|
|
228
|
-
React.createElement(antd_1.Input, { disabled: isLoadingParticipantInfo }))
|
|
236
|
+
React.createElement(antd_1.Input, { disabled: isLoadingParticipantInfo })),
|
|
237
|
+
getCustomerTelephoneFieldDefinitions(props.receiverRequirements) ? (React.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["supplier.contact.telephone"], defaultLabel: props.intl.formatMessage(translationMessages.supplier_contact_phoneNumber), defaultIsRequired: false, fieldName: ["invoice", "supplier", "contact", "telephone"] },
|
|
238
|
+
React.createElement(antd_1.Input, null)))
|
|
239
|
+
: null));
|
|
229
240
|
};
|
|
230
241
|
var SupplierIntl = react_intl_1.injectIntl(Supplier);
|
|
231
242
|
exports.default = SupplierIntl;
|
|
@@ -2,6 +2,7 @@ import "../style/index.css";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { CommonProps } from "../common/types/CommonProps";
|
|
4
4
|
import { ProfileOutputWithApiKey } from "../common/types/AppConfiguration";
|
|
5
|
+
import "moment/locale/is";
|
|
5
6
|
interface Props extends CommonProps {
|
|
6
7
|
customers: ProfileOutputWithApiKey[];
|
|
7
8
|
referenceIdentifiersHelpText?: string;
|
|
@@ -12,38 +12,38 @@ var locales_1 = __importDefault(require("../translations/locales"));
|
|
|
12
12
|
var moment_1 = __importDefault(require("moment"));
|
|
13
13
|
var react_intl_1 = require("react-intl");
|
|
14
14
|
var en_1 = __importDefault(require("react-intl/locale-data/en"));
|
|
15
|
-
var sr_1 = __importDefault(require("react-intl/locale-data/sr"));
|
|
16
15
|
var is_1 = __importDefault(require("react-intl/locale-data/is"));
|
|
17
16
|
var index_1 = __importDefault(require("./index"));
|
|
17
|
+
require("moment/locale/is");
|
|
18
18
|
/**
|
|
19
19
|
* Component for creating a form for creating an invoice and submitting it to the MAPI transaction services
|
|
20
20
|
*
|
|
21
21
|
* @component
|
|
22
22
|
*/
|
|
23
23
|
var CreateInvoice = function (props) {
|
|
24
|
-
var
|
|
25
|
-
var languageString;
|
|
24
|
+
var antLocale = is_IS_1.default;
|
|
25
|
+
var languageString = "is";
|
|
26
26
|
switch (props.language) {
|
|
27
|
-
case "en":
|
|
28
|
-
andLocale = en_US_1.default;
|
|
29
|
-
moment_1.default.locale("en");
|
|
30
|
-
languageString = "en";
|
|
31
|
-
break;
|
|
32
27
|
case "is":
|
|
33
|
-
|
|
28
|
+
antLocale = is_IS_1.default;
|
|
34
29
|
moment_1.default.locale("is");
|
|
35
30
|
languageString = "is";
|
|
36
31
|
break;
|
|
32
|
+
case "en":
|
|
33
|
+
antLocale = en_US_1.default;
|
|
34
|
+
moment_1.default.locale("en");
|
|
35
|
+
languageString = "en";
|
|
36
|
+
break;
|
|
37
37
|
default:
|
|
38
|
-
|
|
38
|
+
antLocale = is_IS_1.default;
|
|
39
39
|
moment_1.default.locale("is");
|
|
40
40
|
languageString = "is";
|
|
41
41
|
break;
|
|
42
42
|
}
|
|
43
43
|
localStorage.setItem("languageString", languageString);
|
|
44
|
-
react_intl_1.addLocaleData(en_1.default.concat(
|
|
45
|
-
return (react_1.default.createElement(antd_1.ConfigProvider, { locale:
|
|
46
|
-
react_1.default.createElement(react_intl_1.IntlProvider, { locale: languageString, defaultLocale: "
|
|
44
|
+
react_intl_1.addLocaleData(en_1.default.concat(is_1.default));
|
|
45
|
+
return (react_1.default.createElement(antd_1.ConfigProvider, { locale: antLocale, componentSize: "small" },
|
|
46
|
+
react_1.default.createElement(react_intl_1.IntlProvider, { locale: languageString, defaultLocale: "is", key: languageString, messages: locales_1.default[languageString] },
|
|
47
47
|
react_1.default.createElement(index_1.default, { customers: props.customers, language: languageString, mapiBaseUrl: props.mapiBaseUrl, rapiBaseUrl: props.rapiBaseUrl, rapiApiKey: props.rapiApiKey, receiverRequirements: props.receiverRequirements, getReceiverRequirements: props.getReceiverRequirements, updateReceiverRequirementsProp: props.updateReceiverRequirementsProp, legalIdentifier: props.legalIdentifier, uploadSizeLimit: props.uploadSizeLimit, attachmentTooltipText: props.attachmentTooltipText, referenceIdentifiersHelpText: props.referenceIdentifiersHelpText, referenceIdentifiersLabelText: props.referenceIdentifiersLabelText }))));
|
|
48
48
|
};
|
|
49
49
|
exports.default = CreateInvoice;
|
|
@@ -71,7 +71,7 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
71
71
|
var _a = react_1.useState(false), submitting = _a[0], setSubmitting = _a[1];
|
|
72
72
|
var _b = react_1.useState(true), isSubmitDisabled = _b[0], setIsSubmitDisabled = _b[1];
|
|
73
73
|
var _c = react_1.useState(ConversionUtility_1.profileOutputToPartyMetadata(props.customers[0])), chosenCustomer = _c[0], setChosenCustomer = _c[1];
|
|
74
|
-
var _d = react_1.useState(), chosenCustomerApiKey = _d[0], setChosenCustomerApiKey = _d[1];
|
|
74
|
+
var _d = react_1.useState(props.customers[0].apiKey), chosenCustomerApiKey = _d[0], setChosenCustomerApiKey = _d[1];
|
|
75
75
|
// const [billingLinesEditableIndex, setBillingLinesEditableIndex] = useState<number>(1)
|
|
76
76
|
var _e = react_1.useState(false), outsideVatScope = _e[0], setOutsideVatScope = _e[1];
|
|
77
77
|
react_1.useEffect(function () {
|
|
@@ -242,7 +242,7 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
242
242
|
form.resetFields();
|
|
243
243
|
// Clear the billing line dataSource
|
|
244
244
|
setChosenCustomer(ConversionUtility_1.profileOutputToPartyMetadata(props.customers[0]));
|
|
245
|
-
setChosenCustomerApiKey(
|
|
245
|
+
setChosenCustomerApiKey(props.customers[0].apiKey);
|
|
246
246
|
// setBillingLinesDataSource([{...initialBillingLineData, key: 0}])
|
|
247
247
|
// setBillingLinesEditableIndex(0);
|
|
248
248
|
// TODO: remove this as soon as possible
|
|
@@ -86,6 +86,7 @@
|
|
|
86
86
|
"supplier_contact_email": "Netfang",
|
|
87
87
|
"supplier_contact_email_title": "Send verður greiðslutilkynning á þetta netfang",
|
|
88
88
|
"supplier_contact_name": "Nafn tengiliðs",
|
|
89
|
+
"supplier_contact_phoneNumber": "Símanúmer",
|
|
89
90
|
"supplier_notValidEmail": "Þetta er ekki gilt netfang",
|
|
90
91
|
"validationRule_kennitalaPattern": "Kennitala verður að passa við mynstur 111111-1111",
|
|
91
92
|
"customer_title": "Viðskiptavinur",
|
|
@@ -88,6 +88,7 @@ declare const _default: {
|
|
|
88
88
|
"supplier_contact_email": string;
|
|
89
89
|
"supplier_contact_email_title": string;
|
|
90
90
|
"supplier_contact_name": string;
|
|
91
|
+
"supplier_contact_phoneNumber": string;
|
|
91
92
|
"supplier_notValidEmail": string;
|
|
92
93
|
"validationRule_kennitalaPattern": string;
|
|
93
94
|
"customer_title": string;
|
|
@@ -17,7 +17,7 @@ interface AttachDocument {
|
|
|
17
17
|
more: boolean;
|
|
18
18
|
}
|
|
19
19
|
declare const submitDocument: (data: any, attachDocument: AttachDocument, mapiBaseUrl: string, apiKey?: string | undefined) => AxiosPromise<mapi.MessageOutput>;
|
|
20
|
-
declare const submitDocumentFetch: (data: any, attachDocument: AttachDocument, mapiBaseUrl: string, apiKey
|
|
21
|
-
declare const submitInvoice: (createSubmitInvoice: CreateSubmitInvoice, mapiBaseUrl: string, apiKey
|
|
20
|
+
declare const submitDocumentFetch: (data: any, attachDocument: AttachDocument, mapiBaseUrl: string, apiKey: string) => Promise<Response>;
|
|
21
|
+
declare const submitInvoice: (createSubmitInvoice: CreateSubmitInvoice, mapiBaseUrl: string, apiKey: string, callName?: string | undefined, language?: LanguageProp) => AxiosPromise<mapi.MessageOutput>;
|
|
22
22
|
export declare const getCancelToken: (callName: string) => CancelToken;
|
|
23
23
|
export { submitInvoice, CreateSubmitInvoice, submitDocument, AttachDocument, submitDocumentFetch };
|
package/lib/utils/ApiUtility.js
CHANGED
|
@@ -59,7 +59,11 @@ var submitDocument = function (data, attachDocument, mapiBaseUrl, apiKey) {
|
|
|
59
59
|
exports.submitDocument = submitDocument;
|
|
60
60
|
var submitDocumentFetch = function (data, attachDocument, mapiBaseUrl, apiKey) {
|
|
61
61
|
var messageId = attachDocument.messageId, name = attachDocument.name, contentType = attachDocument.contentType, more = attachDocument.more;
|
|
62
|
-
var headers =
|
|
62
|
+
var headers = {
|
|
63
|
+
Authorization: "Bearer " + window.btoa(apiKey),
|
|
64
|
+
"Content-Type": "application/octet-stream",
|
|
65
|
+
"X-test": "test",
|
|
66
|
+
};
|
|
63
67
|
var responsePromise = fetch(mapiBaseUrl + "/api/v1/messages/" + messageId + "/documents?Name=" + name + "&ContentType=" + contentType + "&More=" + more, {
|
|
64
68
|
method: "POST",
|
|
65
69
|
headers: headers,
|
|
@@ -75,10 +79,17 @@ var submitInvoice = function (createSubmitInvoice, mapiBaseUrl, apiKey, callName
|
|
|
75
79
|
};
|
|
76
80
|
exports.submitInvoice = submitInvoice;
|
|
77
81
|
var createOptions = function (apiKey, callName, language) {
|
|
78
|
-
return __assign({ headers:
|
|
82
|
+
return __assign({ headers: {
|
|
83
|
+
"Accept-Language": language ? language : "en",
|
|
84
|
+
Authorization: "Bearer " + window.btoa(apiKey)
|
|
85
|
+
} }, (callName && { cancelToken: exports.getCancelToken(callName) }));
|
|
79
86
|
};
|
|
80
87
|
var createOptionsData = function (data, apiKey, callName, language) {
|
|
81
|
-
var options = __assign({}, (callName && { cancelToken: exports.getCancelToken(callName) }), { data: data, headers:
|
|
88
|
+
var options = __assign({}, (callName && { cancelToken: exports.getCancelToken(callName) }), { data: data, headers: {
|
|
89
|
+
"Accept-Language": language ? language : "en",
|
|
90
|
+
Authorization: "Bearer " + window.btoa(apiKey),
|
|
91
|
+
"Content-Type": "application/octet-stream"
|
|
92
|
+
} });
|
|
82
93
|
// tslint:disable-next-line:no-console
|
|
83
94
|
console.log(options);
|
|
84
95
|
return options;
|