@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
|
@@ -1,11 +1,57 @@
|
|
|
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
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var
|
|
14
|
+
var mapi_1 = require("@unimaze/api-clients/lib/mapi");
|
|
15
|
+
var removeEmpty = function (obj) {
|
|
16
|
+
return Object.keys(obj)
|
|
17
|
+
.filter(function (k) { return obj[k] != null; }) // Remove undef. and null.
|
|
18
|
+
.reduce(function (newObj, k) {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
return typeof obj[k] === "object"
|
|
21
|
+
? __assign({}, newObj, (_a = {}, _a[k] = removeEmpty(obj[k]), _a)) : __assign({}, newObj, (_b = {}, _b[k] = obj[k], _b));
|
|
22
|
+
}, // Copy value.
|
|
23
|
+
{});
|
|
24
|
+
};
|
|
25
|
+
var convertDates = function (date) {
|
|
26
|
+
return date ? date.utc().toDate() : undefined;
|
|
27
|
+
};
|
|
28
|
+
var isEmpty = function (map) {
|
|
29
|
+
for (var key in map) {
|
|
30
|
+
if (map.hasOwnProperty(key)) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
};
|
|
36
|
+
var convertToInvoiceMetadataInput = function (formValues, billingLines, customer) {
|
|
37
|
+
var issueDate = convertDates(formValues.invoice.issueDate);
|
|
38
|
+
var dueDate = convertDates(formValues.invoice.dueDate);
|
|
39
|
+
// tslint:disable-next-line:no-console
|
|
40
|
+
console.log(issueDate);
|
|
41
|
+
var cleanedFormValues = removeEmpty(formValues);
|
|
42
|
+
var invoice = cleanedFormValues.invoice;
|
|
43
|
+
// fix delivery
|
|
44
|
+
var delivery = invoice.delivery;
|
|
45
|
+
if (delivery) {
|
|
46
|
+
if (isEmpty(delivery.address)) {
|
|
47
|
+
delete delivery.address;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
4
50
|
var resp = {
|
|
5
51
|
messageHandling: {
|
|
6
|
-
receiverIdentifier:
|
|
7
|
-
fallbackEmailAddress:
|
|
8
|
-
fallbackContactName:
|
|
52
|
+
receiverIdentifier: customer.participantLegalIsoIdentifier,
|
|
53
|
+
fallbackEmailAddress: customer.email,
|
|
54
|
+
fallbackContactName: customer.name,
|
|
9
55
|
},
|
|
10
56
|
invoice: {
|
|
11
57
|
customer: {
|
|
@@ -15,71 +61,73 @@ var convertToInvoiceMetadataInput = function (formValues, customer) {
|
|
|
15
61
|
postalZone: customer.participantLegalAddressPostalCode,
|
|
16
62
|
city: customer.participantLegalAddressCity,
|
|
17
63
|
countryCode: customer.country,
|
|
18
|
-
countrySubEntity: "",
|
|
19
|
-
addressLine2: "",
|
|
20
|
-
addressLine3: ""
|
|
21
64
|
},
|
|
22
65
|
name: customer.name,
|
|
23
66
|
contact: {
|
|
24
67
|
electronicMail: customer.email,
|
|
25
|
-
fax: "",
|
|
26
|
-
name: "",
|
|
27
68
|
telephone: customer.phoneNumber
|
|
69
|
+
// fax: "",
|
|
70
|
+
// name: "",
|
|
28
71
|
}
|
|
29
72
|
},
|
|
30
|
-
// Supplier is pre filled, doesnt exist in the form || will be passed to already filled up form
|
|
31
73
|
supplier: {
|
|
32
|
-
identifier:
|
|
74
|
+
identifier: invoice.supplier.identifier,
|
|
33
75
|
address: {
|
|
34
|
-
streetNameAndNumber:
|
|
35
|
-
postalZone:
|
|
36
|
-
city:
|
|
37
|
-
countryCode:
|
|
38
|
-
countrySubEntity: "",
|
|
39
|
-
addressLine2: "",
|
|
40
|
-
addressLine3: ""
|
|
41
|
-
// last 3 fileds in address are missing in form
|
|
76
|
+
streetNameAndNumber: invoice.supplier.address.streetNameAndNumber,
|
|
77
|
+
postalZone: invoice.supplier.address.postalZone,
|
|
78
|
+
city: invoice.supplier.address.city,
|
|
79
|
+
countryCode: invoice.supplier.address.countryCode,
|
|
42
80
|
},
|
|
43
|
-
vatNumber:
|
|
44
|
-
name:
|
|
81
|
+
vatNumber: invoice.supplier.vatNumber,
|
|
82
|
+
name: invoice.supplier.name,
|
|
45
83
|
contact: {
|
|
46
|
-
electronicMail:
|
|
47
|
-
|
|
48
|
-
name: formValues.invoice.supplier.contact.name,
|
|
49
|
-
telephone: ""
|
|
50
|
-
// fax, telephone do not exist in form
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
delivery: {
|
|
54
|
-
actualDeliveryDate: null,
|
|
55
|
-
address: {
|
|
56
|
-
streetNameAndNumber: formValues.invoice.delivery.address.address,
|
|
57
|
-
postalZone: "",
|
|
58
|
-
city: formValues.invoice.delivery.address.city,
|
|
59
|
-
countryCode: "",
|
|
60
|
-
countrySubEntity: "",
|
|
61
|
-
addressLine2: "",
|
|
62
|
-
addressLine3: ""
|
|
63
|
-
// Country code, postalZone, country sub entry, address2 and 3 missing from the form
|
|
84
|
+
electronicMail: invoice.supplier.contact.electronicMail,
|
|
85
|
+
name: invoice.supplier.contact.name,
|
|
64
86
|
},
|
|
65
|
-
locationIdentifier: formValues.invoice.delivery.locationIdentifier,
|
|
66
|
-
partyName: ""
|
|
67
|
-
// partyName and actualDeliveryData are missing from the form
|
|
68
|
-
// Description is missing from convertToInvoiceMetadataInput but present in the form
|
|
69
87
|
},
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
88
|
+
delivery: delivery,
|
|
89
|
+
// delivery: {
|
|
90
|
+
// actualDeliveryDate: null,
|
|
91
|
+
// address: {
|
|
92
|
+
// streetNameAndNumber: invoice.delivery!.address!.streetNameAndNumber,
|
|
93
|
+
// postalZone: invoice.delivery!.address!.postalZone,
|
|
94
|
+
// city: invoice.delivery!.address!.city,
|
|
95
|
+
// countryCode: invoice.delivery!.address!.countryCode,
|
|
96
|
+
// // countrySubEntity: "",
|
|
97
|
+
// // addressLine2: "",
|
|
98
|
+
// // addressLine3: ""
|
|
99
|
+
// },
|
|
100
|
+
// locationIdentifier: invoice.delivery!.locationIdentifier,
|
|
101
|
+
// partyName: ""
|
|
102
|
+
// // partyName and actualDeliveryData are missing from the form
|
|
103
|
+
// // Description is missing from convertToInvoiceMetadataInput but present in the form
|
|
104
|
+
// },
|
|
105
|
+
invoiceNo: invoice.invoiceNo,
|
|
106
|
+
issueDate: issueDate,
|
|
107
|
+
dueDate: dueDate,
|
|
108
|
+
notes: invoice.notes,
|
|
109
|
+
currencyCode: invoice.currencyCode,
|
|
73
110
|
paymentTerms: {
|
|
74
111
|
note: ""
|
|
75
112
|
},
|
|
76
113
|
// Payment terms doesnt exist in form
|
|
77
|
-
|
|
78
|
-
invoiceLines: [
|
|
79
|
-
|
|
114
|
+
// invoiceLines: billingLines.billingLineMetadata,
|
|
115
|
+
invoiceLines: [{
|
|
116
|
+
quantity: 1,
|
|
117
|
+
unitPriceAmount: 123,
|
|
118
|
+
taxCategoryType: mapi_1.TaxCategoryTypeEnum.Exempt,
|
|
119
|
+
itemNo: "asd",
|
|
120
|
+
name: "asdasd",
|
|
121
|
+
unitOfMeasure: {
|
|
122
|
+
code: "asd"
|
|
123
|
+
},
|
|
124
|
+
taxableAmount: 123,
|
|
125
|
+
taxAmount: 0,
|
|
126
|
+
taxPercentage: 0
|
|
127
|
+
}],
|
|
80
128
|
payableAmount: 0,
|
|
81
129
|
orderReference: {
|
|
82
|
-
documentNo:
|
|
130
|
+
documentNo: invoice.orderReference.documentNo,
|
|
83
131
|
},
|
|
84
132
|
}
|
|
85
133
|
};
|
|
@@ -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;
|
|
@@ -3,11 +3,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getReceiverRequirements = function (recRequirements, key) {
|
|
4
4
|
return recRequirements[key];
|
|
5
5
|
};
|
|
6
|
-
exports.
|
|
7
|
-
if (recRequirements
|
|
8
|
-
|
|
6
|
+
exports.getReceiverRequirementsIsRequired = function (recRequirements, key, defaultIsRequired) {
|
|
7
|
+
if (recRequirements.hasOwnProperty(key)) {
|
|
8
|
+
var recRequirement = recRequirements[key];
|
|
9
|
+
if (recRequirement) {
|
|
10
|
+
return recRequirement.isRequired;
|
|
11
|
+
}
|
|
9
12
|
}
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
return defaultIsRequired;
|
|
14
|
+
};
|
|
15
|
+
exports.getReceiverRequirementsLabelWithDefault = function (recRequirements, key, defaultLabel) {
|
|
16
|
+
if (recRequirements.hasOwnProperty(key)) {
|
|
17
|
+
var recRequirement = recRequirements[key];
|
|
18
|
+
if (recRequirement) {
|
|
19
|
+
return recRequirement.label;
|
|
20
|
+
}
|
|
12
21
|
}
|
|
22
|
+
return defaultLabel;
|
|
13
23
|
};
|
package/lib/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";
|
package/lib/utils/index.js
CHANGED
|
@@ -4,3 +4,4 @@ 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 +0,0 @@
|
|
|
1
|
-
import "./index.css";
|
|
@@ -1,28 +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 = __importStar(require("react"));
|
|
14
|
-
var component_container_1 = __importDefault(require("../component-container"));
|
|
15
|
-
var Issuer = function (props) {
|
|
16
|
-
var _a = props.issuer, participantLegalIsoIdentifier = _a.participantLegalIsoIdentifier, participantLegalAddressPostalCode = _a.participantLegalAddressPostalCode, participantLegalAddressCity = _a.participantLegalAddressCity, participantLegalAddressStreet = _a.participantLegalAddressStreet, email = _a.email, name = _a.name, country = _a.country;
|
|
17
|
-
return (React.createElement(component_container_1.default, { title: "Issuer" },
|
|
18
|
-
React.createElement("div", null,
|
|
19
|
-
React.createElement("strong", null, name),
|
|
20
|
-
" (",
|
|
21
|
-
participantLegalIsoIdentifier,
|
|
22
|
-
")"),
|
|
23
|
-
React.createElement("div", null, participantLegalAddressPostalCode + " " + participantLegalAddressCity),
|
|
24
|
-
React.createElement("div", null, participantLegalAddressStreet),
|
|
25
|
-
React.createElement("div", null, country),
|
|
26
|
-
React.createElement("div", null, email)));
|
|
27
|
-
};
|
|
28
|
-
exports.default = Issuer;
|
|
@@ -1,51 +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 = __importStar(require("react"));
|
|
14
|
-
var component_container_1 = __importDefault(require("../component-container"));
|
|
15
|
-
var antd_1 = require("antd");
|
|
16
|
-
var ReceiverRequirements_1 = require("../../types/ReceiverRequirements");
|
|
17
|
-
var Payer = function () {
|
|
18
|
-
return (React.createElement(component_container_1.default, { title: "Invoice issuer" },
|
|
19
|
-
React.createElement(antd_1.Form.Item, { label: ReceiverRequirements_1.getReceiverRequirementsLabelWithDefault(ReceiverRequirements_1.receiverRequirementsObject, ReceiverRequirements_1.AvailableFields["payer.name"], "Name/identifier"), style: { marginBottom: 0 } },
|
|
20
|
-
React.createElement(antd_1.Form.Item, { style: { display: 'inline-block', width: "50%" }, name: ["invoice", "customer", "name"], rules: [
|
|
21
|
-
{
|
|
22
|
-
required: ReceiverRequirements_1.getReceiverRequirements(ReceiverRequirements_1.receiverRequirementsObject, ReceiverRequirements_1.AvailableFields["payer.name"]).isRequired,
|
|
23
|
-
message: 'Please input payer name',
|
|
24
|
-
},
|
|
25
|
-
] },
|
|
26
|
-
React.createElement(antd_1.Input, null)),
|
|
27
|
-
React.createElement(antd_1.Form.Item, { style: { display: 'inline-block', width: "50%", paddingLeft: "3px" }, name: ["invoice", "customer", "isoIdentifier"], rules: [
|
|
28
|
-
{
|
|
29
|
-
required: true,
|
|
30
|
-
message: 'Please input payer identifier',
|
|
31
|
-
},
|
|
32
|
-
] },
|
|
33
|
-
React.createElement(antd_1.Input, null))),
|
|
34
|
-
React.createElement(antd_1.Form.Item, { label: "Address", name: ["invoice", "customer", "address", "address"] },
|
|
35
|
-
React.createElement(antd_1.Input, null)),
|
|
36
|
-
React.createElement(antd_1.Form.Item, { label: "Zip/City" },
|
|
37
|
-
React.createElement(antd_1.Form.Item, { style: { display: 'inline-block', width: "30%" }, name: ["invoice", "customer", "address", "zip"] },
|
|
38
|
-
React.createElement(antd_1.Input, null)),
|
|
39
|
-
React.createElement(antd_1.Form.Item, { style: { display: 'inline-block', width: "70%", paddingLeft: "3px" }, name: ["invoice", "customer", "address", "city"] },
|
|
40
|
-
React.createElement(antd_1.Input, null))),
|
|
41
|
-
React.createElement(antd_1.Form.Item, { label: "Country", name: ["invoice", "customer", "address", "country"] },
|
|
42
|
-
React.createElement(antd_1.Input, null)),
|
|
43
|
-
React.createElement(antd_1.Form.Item, { label: "E-mail", name: ["invoice", "customer", "contact", "email"], rules: [
|
|
44
|
-
{
|
|
45
|
-
type: 'email',
|
|
46
|
-
message: 'The input is not valid E-mail!',
|
|
47
|
-
}
|
|
48
|
-
] },
|
|
49
|
-
React.createElement(antd_1.Input, null))));
|
|
50
|
-
};
|
|
51
|
-
exports.default = Payer;
|
package/lib/style/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "./index.css";
|
package/lib/style/index.js
DELETED