@unimaze/billing 0.1.2-rc.8 → 0.1.2-rc.9
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/attachments/Attachment.d.ts +4 -1
- package/lib/common/components/attachments/Attachment.js +5 -2
- package/lib/common/components/attachments/index.d.ts +5 -1
- package/lib/common/components/attachments/index.js +4 -3
- package/lib/common/components/base-information/index.js +68 -78
- package/lib/common/components/billing-lines/BillingLIneFormData.d.ts +6 -0
- package/lib/common/components/billing-lines/BillingLIneFormData.js +6 -0
- package/lib/common/components/delivery-location/index.js +13 -7
- package/lib/common/components/form-item/index.d.ts +18 -0
- package/lib/common/components/form-item/index.js +20 -0
- package/lib/common/components/supplier/index.js +31 -25
- package/lib/common/types/ReceiverRequirements.d.ts +71 -72
- package/lib/common/types/ReceiverRequirements.js +74 -29
- package/lib/create-credit-note/index.js +1 -2
- package/lib/create-invoice/index.js +47 -6
- package/lib/src/common/components/attachments/Attachment.d.ts +4 -1
- package/lib/src/common/components/attachments/index.d.ts +5 -1
- package/lib/src/common/components/billing-lines/BillingLIneFormData.d.ts +6 -0
- package/lib/src/common/components/form-item/index.d.ts +18 -0
- package/lib/src/common/types/ReceiverRequirements.d.ts +71 -72
- package/lib/src/utils/ApiUtility.d.ts +8 -1
- package/lib/src/utils/ConversionUtility.d.ts +2 -1
- package/lib/src/utils/RequirementsUtility.d.ts +3 -1
- package/lib/src/utils/index.d.ts +1 -1
- package/lib/utils/ApiUtility.d.ts +8 -1
- package/lib/utils/ApiUtility.js +17 -1
- package/lib/utils/ConversionUtility.d.ts +2 -1
- package/lib/utils/ConversionUtility.js +98 -50
- package/lib/utils/RequirementsUtility.d.ts +3 -1
- package/lib/utils/RequirementsUtility.js +15 -5
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +1 -0
- package/package.json +1 -1
- package/lib/common/components/component-container/style/index.d.ts +0 -1
- package/lib/common/components/component-container/style/index.js +0 -3
- package/lib/common/components/issuer/index.d.ts +0 -7
- package/lib/common/components/issuer/index.js +0 -28
- package/lib/common/components/payer/index.d.ts +0 -3
- package/lib/common/components/payer/index.js +0 -51
- package/lib/src/common/components/issuer/index.d.ts +0 -7
- package/lib/src/common/components/payer/index.d.ts +0 -3
- package/lib/style/index.d.ts +0 -1
- package/lib/style/index.js +0 -3
|
@@ -18,6 +18,7 @@ var AvailableFields;
|
|
|
18
18
|
AvailableFields["referenceIdentifiers.type"] = "referenceIdentifiers.type";
|
|
19
19
|
AvailableFields["referenceIdentifiers.code"] = "referenceIdentifiers.code";
|
|
20
20
|
AvailableFields["referenceIdentifiers.value"] = "referenceIdentifiers.value";
|
|
21
|
+
AvailableFields["referenceIdentifiers"] = "referenceIdentifiers";
|
|
21
22
|
AvailableFields["supplier.vatNumber"] = "supplier.vatNumber";
|
|
22
23
|
AvailableFields["supplier.address.streetNameAndNumber"] = "supplier.address.streetNameAndNumber";
|
|
23
24
|
AvailableFields["supplier.address.city"] = "supplier.address.city";
|
|
@@ -92,7 +93,11 @@ exports.receiverRequirementsObject = {
|
|
|
92
93
|
currencyCode: {
|
|
93
94
|
isRequired: true,
|
|
94
95
|
key: "",
|
|
95
|
-
label: "Currency code"
|
|
96
|
+
label: "Currency code",
|
|
97
|
+
values: [{
|
|
98
|
+
key: "ISK",
|
|
99
|
+
label: "Icelandic krona (ISK)"
|
|
100
|
+
}]
|
|
96
101
|
},
|
|
97
102
|
notes: {
|
|
98
103
|
isRequired: false,
|
|
@@ -102,7 +107,8 @@ exports.receiverRequirementsObject = {
|
|
|
102
107
|
accountingCost: {
|
|
103
108
|
isRequired: false,
|
|
104
109
|
key: "",
|
|
105
|
-
label: "Accounting cost"
|
|
110
|
+
label: "Accounting cost",
|
|
111
|
+
values: [{ key: "asdfasd", label: "asdf" },]
|
|
106
112
|
},
|
|
107
113
|
buyerReference: {
|
|
108
114
|
isRequired: false,
|
|
@@ -112,7 +118,7 @@ exports.receiverRequirementsObject = {
|
|
|
112
118
|
"orderReference.documentNo": {
|
|
113
119
|
isRequired: true,
|
|
114
120
|
key: "",
|
|
115
|
-
label: "Order
|
|
121
|
+
label: "Order no"
|
|
116
122
|
},
|
|
117
123
|
"billingReferences.invoices": {
|
|
118
124
|
isRequired: false,
|
|
@@ -134,65 +140,104 @@ exports.receiverRequirementsObject = {
|
|
|
134
140
|
key: "",
|
|
135
141
|
label: "Billing References Credit notes"
|
|
136
142
|
},
|
|
137
|
-
"referenceIdentifiers.type": {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
},
|
|
142
|
-
"referenceIdentifiers.code": {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
},
|
|
147
|
-
"referenceIdentifiers.value": {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
143
|
+
// "referenceIdentifiers.type": {
|
|
144
|
+
// isRequired: false,
|
|
145
|
+
// key: "",
|
|
146
|
+
// label: "Reference identifier type"
|
|
147
|
+
// },
|
|
148
|
+
// "referenceIdentifiers.code": {
|
|
149
|
+
// isRequired: false,
|
|
150
|
+
// key: "",
|
|
151
|
+
// label: "Reference identifier code"
|
|
152
|
+
// },
|
|
153
|
+
// "referenceIdentifiers.value": {
|
|
154
|
+
// isRequired: true,
|
|
155
|
+
// key: "",
|
|
156
|
+
// label: "Reference identifier value"
|
|
157
|
+
// },
|
|
158
|
+
"referenceIdentifiers": {
|
|
159
|
+
"isRequired": true,
|
|
160
|
+
"key": "",
|
|
161
|
+
"values": [
|
|
162
|
+
{
|
|
163
|
+
"key": "AKY",
|
|
164
|
+
"label": "Bílnúmer",
|
|
165
|
+
"values": [
|
|
166
|
+
{
|
|
167
|
+
"key": "NY753",
|
|
168
|
+
"label": "NY753"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"key": "IS123"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"key": "RR888"
|
|
175
|
+
},
|
|
176
|
+
]
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"key": "SSN",
|
|
180
|
+
"label": "Kennitala" // "Social security number"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"key": "LOC",
|
|
184
|
+
"label": "Fasteignanúmer",
|
|
185
|
+
"values": [{
|
|
186
|
+
"key": "30909",
|
|
187
|
+
"label": "Mýrargata 26 (30909)"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"key": "34344",
|
|
191
|
+
"label": "Aragata 1 (34344)"
|
|
192
|
+
},
|
|
193
|
+
]
|
|
194
|
+
}
|
|
195
|
+
]
|
|
151
196
|
},
|
|
152
197
|
"supplier.vatNumber": {
|
|
153
198
|
isRequired: true,
|
|
154
199
|
key: "",
|
|
155
|
-
label: "
|
|
200
|
+
label: "VAT number"
|
|
156
201
|
},
|
|
157
202
|
"supplier.address.streetNameAndNumber": {
|
|
158
203
|
isRequired: true,
|
|
159
204
|
key: "",
|
|
160
|
-
label: "
|
|
205
|
+
label: "Street name and number"
|
|
161
206
|
},
|
|
162
207
|
"supplier.address.city": {
|
|
163
208
|
isRequired: false,
|
|
164
209
|
key: "",
|
|
165
|
-
label: "
|
|
210
|
+
label: "City"
|
|
166
211
|
},
|
|
167
212
|
"supplier.address.postalZone": {
|
|
168
213
|
isRequired: false,
|
|
169
214
|
key: "",
|
|
170
|
-
label: "
|
|
215
|
+
label: "Postal zone"
|
|
171
216
|
},
|
|
172
217
|
"supplier.address.countryCode": {
|
|
173
218
|
isRequired: true,
|
|
174
219
|
key: "",
|
|
175
|
-
label: "
|
|
220
|
+
label: "Country code"
|
|
176
221
|
},
|
|
177
222
|
"supplier.contact.name": {
|
|
178
223
|
isRequired: false,
|
|
179
224
|
key: "",
|
|
180
|
-
label: "
|
|
225
|
+
label: "Contact name"
|
|
181
226
|
},
|
|
182
227
|
"supplier.contact.electronicMail": {
|
|
183
228
|
isRequired: false,
|
|
184
229
|
key: "",
|
|
185
|
-
label: "
|
|
230
|
+
label: "E-mail"
|
|
186
231
|
},
|
|
187
232
|
"supplier.contact.telephone": {
|
|
188
233
|
isRequired: false,
|
|
189
234
|
key: "",
|
|
190
|
-
label: "
|
|
235
|
+
label: "Contact phone"
|
|
191
236
|
},
|
|
192
237
|
"supplier.name": {
|
|
193
238
|
isRequired: true,
|
|
194
239
|
key: "",
|
|
195
|
-
label: "
|
|
240
|
+
label: "Name"
|
|
196
241
|
},
|
|
197
242
|
"supplier.identifier": {
|
|
198
243
|
isRequired: true,
|
|
@@ -355,14 +400,14 @@ exports.receiverRequirementsObject = {
|
|
|
355
400
|
label: "Location Identifier"
|
|
356
401
|
},
|
|
357
402
|
"delivery.address.streetNameAndNumber": {
|
|
358
|
-
isRequired:
|
|
403
|
+
isRequired: false,
|
|
359
404
|
key: "",
|
|
360
405
|
label: "Street name and number"
|
|
361
406
|
},
|
|
362
407
|
"delivery.address.city": {
|
|
363
408
|
isRequired: false,
|
|
364
409
|
key: "",
|
|
365
|
-
label: "
|
|
410
|
+
label: "Town/city"
|
|
366
411
|
},
|
|
367
412
|
"delivery.address.postalZone": {
|
|
368
413
|
isRequired: false,
|
|
@@ -370,7 +415,7 @@ exports.receiverRequirementsObject = {
|
|
|
370
415
|
label: "Postal zone"
|
|
371
416
|
},
|
|
372
417
|
"delivery.address.countryCode": {
|
|
373
|
-
isRequired:
|
|
418
|
+
isRequired: false,
|
|
374
419
|
key: "",
|
|
375
420
|
label: "Country code"
|
|
376
421
|
},
|
|
@@ -58,8 +58,7 @@ var CreateInvoice = function (props) {
|
|
|
58
58
|
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 }, xl: { span: 8 } },
|
|
59
59
|
react_1.default.createElement(components_1.BaseInformation, { form: form, documentType: "creditNote" })),
|
|
60
60
|
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 24 }, xl: { span: 16 } }),
|
|
61
|
-
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 24 }, xl: { span: 24 } },
|
|
62
|
-
react_1.default.createElement(components_1.Attachments, null)),
|
|
61
|
+
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 24 }, xl: { span: 24 } }),
|
|
63
62
|
react_1.default.createElement(antd_1.Col, { span: 24 },
|
|
64
63
|
react_1.default.createElement(antd_1.Button, { type: "primary", htmlType: "submit" }, "Submit")))));
|
|
65
64
|
};
|
|
@@ -10,18 +10,27 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
14
|
+
if (mod && mod.__esModule) return mod;
|
|
15
|
+
var result = {};
|
|
16
|
+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
17
|
+
result["default"] = mod;
|
|
18
|
+
return result;
|
|
19
|
+
};
|
|
13
20
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
21
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
22
|
};
|
|
16
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
24
|
require("../style/index.css");
|
|
18
|
-
var react_1 =
|
|
25
|
+
var react_1 = __importStar(require("react"));
|
|
19
26
|
var antd_1 = require("antd");
|
|
20
27
|
var is_IS_1 = __importDefault(require("antd/es/locale-provider/is_IS"));
|
|
21
28
|
var en_US_1 = __importDefault(require("antd/es/locale-provider/en_US"));
|
|
22
29
|
var components_1 = require("../common/components");
|
|
23
30
|
var utils_1 = require("../utils");
|
|
24
31
|
var uuid_1 = require("uuid");
|
|
32
|
+
var BillingLIneFormData_1 = require("../common/components/billing-lines/BillingLIneFormData");
|
|
33
|
+
var mapi_1 = require("@unimaze/api-clients/lib/mapi");
|
|
25
34
|
/**
|
|
26
35
|
* Component for creating a form for creating an invoice and submitting it to the MAPI transaction services
|
|
27
36
|
*
|
|
@@ -30,6 +39,7 @@ var uuid_1 = require("uuid");
|
|
|
30
39
|
var CreateInvoice = function (props) {
|
|
31
40
|
// const [submitInvoiceRequest, setSubmitInvoiceRequest] = React.useState<CreateSubmitInvoiceRequest>();
|
|
32
41
|
var form = antd_1.Form.useForm()[0];
|
|
42
|
+
var _a = react_1.useState([]), files = _a[0], setFiles = _a[1];
|
|
33
43
|
var formItemLayout = {
|
|
34
44
|
labelCol: {
|
|
35
45
|
xs: { span: 24 },
|
|
@@ -40,22 +50,52 @@ var CreateInvoice = function (props) {
|
|
|
40
50
|
sm: { span: 16 },
|
|
41
51
|
},
|
|
42
52
|
};
|
|
53
|
+
var handleAddFile = function (file) {
|
|
54
|
+
if (file.status === "removed") {
|
|
55
|
+
var remainingFiles = files.filter(function (existingFile) { return existingFile.uid !== file.uid; });
|
|
56
|
+
setFiles(remainingFiles);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
setFiles(files.concat([file]));
|
|
60
|
+
}
|
|
61
|
+
};
|
|
43
62
|
var handleSetBillingLineMetadata = function (formInstance, billingLineMetadata) {
|
|
44
63
|
formInstance.setFieldsValue({
|
|
45
64
|
"billingLinesMetadata": billingLineMetadata
|
|
46
65
|
});
|
|
47
66
|
};
|
|
48
67
|
var handleSubmit = function (values) {
|
|
49
|
-
var invoiceMetadataInput = utils_1.convertToInvoiceMetadataInput(values, props.customer);
|
|
68
|
+
var invoiceMetadataInput = utils_1.convertToInvoiceMetadataInput(values, BillingLIneFormData_1.BillingLinesFieldsMetadata(form), props.customer);
|
|
50
69
|
var createSubmitInvoice = {
|
|
51
70
|
invoiceMetadataInput: invoiceMetadataInput,
|
|
52
|
-
more:
|
|
71
|
+
more: files.length > 0,
|
|
53
72
|
messageId: uuid_1.v4(),
|
|
73
|
+
processingMode: mapi_1.TransactionProcessingMode.Device
|
|
54
74
|
};
|
|
55
75
|
utils_1.submitInvoice(createSubmitInvoice, props.mapiBaseUrl, props.apiKey, "submitInvoice", props.language)
|
|
56
|
-
.then(
|
|
76
|
+
.then(function (resp) {
|
|
77
|
+
antd_1.message.success("successfully submitted the invoice");
|
|
78
|
+
var messageId = resp.data.uniqueId;
|
|
79
|
+
var _loop_1 = function () {
|
|
80
|
+
var nextFileArray = files.splice(0, 1);
|
|
81
|
+
var nextFile = nextFileArray[0];
|
|
82
|
+
var createAttachDocument = {
|
|
83
|
+
messageId: messageId,
|
|
84
|
+
contentType: nextFile.type,
|
|
85
|
+
more: files.length > 0,
|
|
86
|
+
name: nextFile.name,
|
|
87
|
+
};
|
|
88
|
+
utils_1.submitDocument(nextFile, createAttachDocument, props.mapiBaseUrl, props.apiKey)
|
|
89
|
+
.then(function (submitDocumentResponse) {
|
|
90
|
+
antd_1.message.success("successfully uploaded attachment " + nextFile.name);
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
while (files.length > 0) {
|
|
94
|
+
_loop_1();
|
|
95
|
+
}
|
|
96
|
+
})
|
|
57
97
|
.catch(function (error) {
|
|
58
|
-
antd_1.message.error(error);
|
|
98
|
+
antd_1.message.error(error.message);
|
|
59
99
|
});
|
|
60
100
|
};
|
|
61
101
|
var setLocale = function (language) {
|
|
@@ -84,7 +124,8 @@ var CreateInvoice = function (props) {
|
|
|
84
124
|
react_1.default.createElement(components_1.BillingLines, { setBillingLineMetadata: handleSetBillingLineMetadata, formInstance: form })),
|
|
85
125
|
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 8 }, xl: { span: 8 } },
|
|
86
126
|
react_1.default.createElement(components_1.PaymentMethod, null)),
|
|
87
|
-
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 16 }, xl: { span: 16 } }
|
|
127
|
+
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 16 }, xl: { span: 16 } },
|
|
128
|
+
react_1.default.createElement(components_1.Attachments, { handleAddFile: handleAddFile })),
|
|
88
129
|
react_1.default.createElement(antd_1.Col, { span: 24 },
|
|
89
130
|
react_1.default.createElement(antd_1.Form.Item, null,
|
|
90
131
|
react_1.default.createElement(antd_1.Button, { type: "primary", htmlType: "submit" }, "Submit")))))));
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import '@ant-design/compatible/assets/index.css';
|
|
3
|
+
import { UploadFile } from "antd/lib/upload/interface";
|
|
3
4
|
interface Props {
|
|
4
5
|
fieldName: string;
|
|
6
|
+
handleAddFile: (file: UploadFile) => void;
|
|
5
7
|
}
|
|
6
8
|
interface States {
|
|
7
9
|
file: any[];
|
|
@@ -12,4 +14,5 @@ declare class Attachment extends React.Component<Props, States> {
|
|
|
12
14
|
normFile: (e: any) => any;
|
|
13
15
|
render(): JSX.Element;
|
|
14
16
|
}
|
|
15
|
-
|
|
17
|
+
declare const _default: React.MemoExoticComponent<typeof Attachment>;
|
|
18
|
+
export default _default;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
2
|
+
import { UploadFile } from "antd/lib/upload/interface";
|
|
3
|
+
interface Props {
|
|
4
|
+
handleAddFile: (file: UploadFile) => void;
|
|
5
|
+
}
|
|
6
|
+
declare const AttachmentsGroup: React.FC<Props>;
|
|
3
7
|
export default AttachmentsGroup;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BillingLineMetadata } from '@unimaze/api-clients/lib/mapi';
|
|
2
|
+
import { FormInstance } from "antd/es/form";
|
|
3
|
+
export interface IBillingLinesMetadata {
|
|
4
|
+
billingLineMetadata: Array<BillingLineMetadata>;
|
|
5
|
+
}
|
|
6
|
+
export declare const BillingLinesFieldsMetadata: (formInstance: FormInstance) => IBillingLinesMetadata;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AvailableFields, ReceiverRequirements } from "../../types/ReceiverRequirements";
|
|
3
|
+
import { Rule } from "rc-field-form/lib/interface";
|
|
4
|
+
interface StringMap {
|
|
5
|
+
[key: string]: string;
|
|
6
|
+
}
|
|
7
|
+
interface Props {
|
|
8
|
+
receiverRequirements: ReceiverRequirements;
|
|
9
|
+
receiverRequirementsKey: AvailableFields;
|
|
10
|
+
defaultLabel: React.ReactNode;
|
|
11
|
+
defaultIsRequired: boolean;
|
|
12
|
+
fieldName: string | string[];
|
|
13
|
+
additionalRules?: Rule[];
|
|
14
|
+
style?: React.CSSProperties;
|
|
15
|
+
initialValue?: StringMap;
|
|
16
|
+
}
|
|
17
|
+
declare const FormItem: React.FC<Props>;
|
|
18
|
+
export default FormItem;
|
|
@@ -1,82 +1,81 @@
|
|
|
1
|
-
interface
|
|
2
|
-
key
|
|
3
|
-
value: string;
|
|
4
|
-
}
|
|
5
|
-
interface FieldRequirement {
|
|
1
|
+
interface Values {
|
|
2
|
+
key?: string;
|
|
6
3
|
label?: string;
|
|
7
|
-
|
|
4
|
+
values?: Values[];
|
|
5
|
+
}
|
|
6
|
+
interface FieldRequirement extends Values {
|
|
8
7
|
isRequired: boolean;
|
|
9
|
-
values?: KeyValuePair[];
|
|
10
8
|
}
|
|
11
9
|
declare type ReceiverRequirements = {
|
|
12
10
|
[key in AvailableFields]?: FieldRequirement;
|
|
13
11
|
};
|
|
14
12
|
export declare enum AvailableFields {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
13
|
+
"invoiceNo" = "invoiceNo",
|
|
14
|
+
"issueDate" = "issueDate",
|
|
15
|
+
"dueDate" = "dueDate",
|
|
16
|
+
"graceDate" = "graceDate",
|
|
17
|
+
"currencyCode" = "currencyCode",
|
|
18
|
+
"notes" = "notes",
|
|
19
|
+
"accountingCost" = "accountingCost",
|
|
20
|
+
"buyerReference" = "buyerReference",
|
|
21
|
+
"orderReference.documentNo" = "orderReference.documentNo",
|
|
22
|
+
"billingReferences.invoices" = "billingReferences.invoices",
|
|
23
|
+
"billingReferences.documentNo" = "billingReferences.documentNo",
|
|
24
|
+
"billingReferences.issueDate" = "billingReferences.issueDate",
|
|
25
|
+
"billingReferences.creditNotes" = "billingReferences.creditNotes",
|
|
26
|
+
"referenceIdentifiers.type" = "referenceIdentifiers.type",
|
|
27
|
+
"referenceIdentifiers.code" = "referenceIdentifiers.code",
|
|
28
|
+
"referenceIdentifiers.value" = "referenceIdentifiers.value",
|
|
29
|
+
"referenceIdentifiers" = "referenceIdentifiers",
|
|
30
|
+
"supplier.vatNumber" = "supplier.vatNumber",
|
|
31
|
+
"supplier.address.streetNameAndNumber" = "supplier.address.streetNameAndNumber",
|
|
32
|
+
"supplier.address.city" = "supplier.address.city",
|
|
33
|
+
"supplier.address.postalZone" = "supplier.address.postalZone",
|
|
34
|
+
"supplier.address.countryCode" = "supplier.address.countryCode",
|
|
35
|
+
"supplier.contact.name" = "supplier.contact.name",
|
|
36
|
+
"supplier.contact.electronicMail" = "supplier.contact.electronicMail",
|
|
37
|
+
"supplier.contact.telephone" = "supplier.contact.telephone",
|
|
38
|
+
"supplier.name" = "supplier.name",
|
|
39
|
+
"supplier.identifier" = "supplier.identifier",
|
|
40
|
+
"customer.address.streetNameAndNumber" = "customer.address.streetNameAndNumber",
|
|
41
|
+
"customer.address.city" = "customer.address.city",
|
|
42
|
+
"customer.address.postalZone" = "customer.address.postalZone",
|
|
43
|
+
"customer.address.countryCode" = "customer.address.countryCode",
|
|
44
|
+
"customer.contact.name" = "customer.contact.name",
|
|
45
|
+
"customer.contact.electronicMail" = "customer.contact.electronicMail",
|
|
46
|
+
"customer.contact.telephone" = "customer.contact.telephone",
|
|
47
|
+
"customer.name" = "customer.name",
|
|
48
|
+
"customer.identifier" = "customer.identifier",
|
|
49
|
+
"customer.locationIdentifier" = "customer.locationIdentifier",
|
|
50
|
+
"payee.name" = "payee.name",
|
|
51
|
+
"payee.identifier" = "payee.identifier",
|
|
52
|
+
"payee.sepaBankIdentification" = "payee.sepaBankIdentification",
|
|
53
|
+
"invoiceLines.itemNo" = "invoiceLines.itemNo",
|
|
54
|
+
"invoiceLines.name" = "invoiceLines.name",
|
|
55
|
+
"invoiceLines.quantity" = "invoiceLines.quantity",
|
|
56
|
+
"invoiceLines.uniteOfMeasure.unit" = "invoiceLines.unitOfMeasure.unit",
|
|
57
|
+
"invoiceLines.uniteOfMeasure.code" = "invoiceLines.unitOfMeasure.code",
|
|
58
|
+
"invoiceLines.priceAmount" = "invoiceLines.priceAmount",
|
|
59
|
+
"invoiceLines.taxCategoryType" = "invoiceLines.taxCategoryType",
|
|
60
|
+
"invoiceLines.taxableAmount" = "invoiceLines.taxableAmount",
|
|
61
|
+
"invoiceLines.taxAmount" = "invoiceLines.taxAmount",
|
|
62
|
+
"invoiceLines.taxPercentage" = "invoiceLines.taxPercentage",
|
|
63
|
+
"invoiceLines.discountValue" = "invoiceLines.discountValue",
|
|
64
|
+
"paymentTerms.note" = "paymentTerms.note",
|
|
65
|
+
"paymentMeans.type" = "paymentMeans.type",
|
|
66
|
+
"paymentMeans.internationalTransfer" = "paymentMeans.internationalTransfer",
|
|
67
|
+
"paymentMeans.domesticTransfer" = "paymentMeans.domesticTransfer",
|
|
68
|
+
"paymentMeans.domesticClaim" = "paymentMeans.domesticClaim",
|
|
69
|
+
"delivery.partyName" = "delivery.partyName",
|
|
70
|
+
"delivery.locationIdentifier" = "delivery.locationIdentifier",
|
|
71
|
+
"delivery.address.streetNameAndNumber" = "delivery.address.streetNameAndNumber",
|
|
72
|
+
"delivery.address.city" = "delivery.address.city",
|
|
73
|
+
"delivery.address.postalZone" = "delivery.address.postalZone",
|
|
74
|
+
"delivery.address.countryCode" = "delivery.address.countryCode",
|
|
75
|
+
"delivery.actualDeliveryDate" = "delivery.actualDeliveryDate",
|
|
76
|
+
"prepaidAmount" = "prepaidAmount",
|
|
77
|
+
"payableAmount" = "payableAmount",
|
|
78
|
+
"payableRoundingAmount" = "payableRoundingAmount"
|
|
80
79
|
}
|
|
81
80
|
export { ReceiverRequirements, FieldRequirement };
|
|
82
81
|
export declare const receiverRequirementsObject: ReceiverRequirements;
|
|
@@ -10,5 +10,12 @@ 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>;
|
|
13
20
|
declare const submitInvoice: (createSubmitInvoice: CreateSubmitInvoice, mapiBaseUrl: string, apiKey?: string | undefined, callName?: string | undefined, language?: LanguageProp) => AxiosPromise<mapi.MessageOutput>;
|
|
14
|
-
export { submitInvoice, CreateSubmitInvoice };
|
|
21
|
+
export { submitInvoice, CreateSubmitInvoice, submitDocument, AttachDocument };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { InvoiceMetadataInput } from "@unimaze/api-clients/lib/mapi";
|
|
2
2
|
import { Store } from "antd/es/form/interface";
|
|
3
3
|
import { ProfileOutput } from "@unimaze/api-clients/lib/wapi2";
|
|
4
|
-
|
|
4
|
+
import { IBillingLinesMetadata } from "../common/components/billing-lines/BillingLIneFormData";
|
|
5
|
+
declare const convertToInvoiceMetadataInput: (formValues: Store, billingLines: IBillingLinesMetadata, customer: ProfileOutput) => InvoiceMetadataInput;
|
|
5
6
|
export { /*convertToCreditNoteMetadataInput,*/ convertToInvoiceMetadataInput };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { AvailableFields, FieldRequirement, ReceiverRequirements } from "../common/types/ReceiverRequirements";
|
|
2
3
|
export declare const getReceiverRequirements: (recRequirements: ReceiverRequirements, key: AvailableFields) => FieldRequirement;
|
|
3
|
-
export declare const
|
|
4
|
+
export declare const getReceiverRequirementsIsRequired: (recRequirements: ReceiverRequirements, key: AvailableFields, defaultIsRequired: boolean) => boolean;
|
|
5
|
+
export declare const getReceiverRequirementsLabelWithDefault: (recRequirements: ReceiverRequirements, key: AvailableFields, defaultLabel: React.ReactNode) => React.ReactNode;
|
package/lib/src/utils/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { convertToInvoiceMetadataInput } from "./ConversionUtility";
|
|
2
|
-
export { submitInvoice, CreateSubmitInvoice } from "./ApiUtility";
|
|
2
|
+
export { submitInvoice, CreateSubmitInvoice, submitDocument, AttachDocument } from "./ApiUtility";
|
|
@@ -10,5 +10,12 @@ 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>;
|
|
13
20
|
declare const submitInvoice: (createSubmitInvoice: CreateSubmitInvoice, mapiBaseUrl: string, apiKey?: string | undefined, callName?: string | undefined, language?: LanguageProp) => AxiosPromise<mapi.MessageOutput>;
|
|
14
|
-
export { submitInvoice, CreateSubmitInvoice };
|
|
21
|
+
export { submitInvoice, CreateSubmitInvoice, submitDocument, AttachDocument };
|
package/lib/utils/ApiUtility.js
CHANGED
|
@@ -24,6 +24,19 @@ 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;
|
|
27
40
|
var submitInvoice = function (createSubmitInvoice, mapiBaseUrl, apiKey, callName, language) {
|
|
28
41
|
var transactionApi = initialiseTransactionApi(mapiBaseUrl);
|
|
29
42
|
var messageId = createSubmitInvoice.messageId, more = createSubmitInvoice.more, conversationIdentifier = createSubmitInvoice.conversationIdentifier, processingMode = createSubmitInvoice.processingMode, services = createSubmitInvoice.services, invoiceMetadataInput = createSubmitInvoice.invoiceMetadataInput;
|
|
@@ -31,7 +44,10 @@ var submitInvoice = function (createSubmitInvoice, mapiBaseUrl, apiKey, callName
|
|
|
31
44
|
};
|
|
32
45
|
exports.submitInvoice = submitInvoice;
|
|
33
46
|
var createOptions = function (apiKey, callName, language) {
|
|
34
|
-
return __assign({ headers: __assign({ "Accept-Language": language ? language : "en" }, (apiKey && { Authorization: "Bearer
|
|
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 apikey-" + window.btoa(apiKey) }), { 'Content-Type': 'application/octet-stream' }) }, (callName && { cancelToken: getCancelToken(callName) }), { data: data });
|
|
35
51
|
};
|
|
36
52
|
var getCancelToken = function (callName) {
|
|
37
53
|
var cancelTokenSource = window[callName];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { InvoiceMetadataInput } from "@unimaze/api-clients/lib/mapi";
|
|
2
2
|
import { Store } from "antd/es/form/interface";
|
|
3
3
|
import { ProfileOutput } from "@unimaze/api-clients/lib/wapi2";
|
|
4
|
-
|
|
4
|
+
import { IBillingLinesMetadata } from "../common/components/billing-lines/BillingLIneFormData";
|
|
5
|
+
declare const convertToInvoiceMetadataInput: (formValues: Store, billingLines: IBillingLinesMetadata, customer: ProfileOutput) => InvoiceMetadataInput;
|
|
5
6
|
export { /*convertToCreditNoteMetadataInput,*/ convertToInvoiceMetadataInput };
|