@unimaze/billing 0.1.2-rc.9 → 0.2.0-rc.0
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 +6 -5
- package/lib/common/components/attachments/Attachment.js +69 -18
- package/lib/common/components/attachments/index.d.ts +5 -6
- package/lib/common/components/attachments/index.js +18 -6
- package/lib/common/components/base-information/ReferenceIdentifiers.d.ts +17 -0
- package/lib/common/components/base-information/ReferenceIdentifiers.js +54 -0
- package/lib/common/components/base-information/index.d.ts +6 -3
- package/lib/common/components/base-information/index.js +70 -9
- package/lib/common/components/billing-lines/BillingCalculations.d.ts +11 -0
- package/lib/common/components/billing-lines/BillingCalculations.js +63 -0
- package/lib/common/components/billing-lines/BillingTaxSummary.d.ts +10 -0
- package/lib/common/components/billing-lines/BillingTaxSummary.js +53 -0
- package/lib/common/components/billing-lines/NewBillingLines.d.ts +10 -0
- package/lib/common/components/billing-lines/NewBillingLines.js +77 -0
- package/lib/common/components/billing-lines/index.d.ts +7 -15
- package/lib/common/components/billing-lines/index.js +173 -62
- package/lib/common/components/customer/hardCoddedCustomer.d.ts +7 -0
- package/lib/common/components/customer/hardCoddedCustomer.js +25 -0
- package/lib/common/components/customer/index.d.ts +5 -6
- package/lib/common/components/customer/index.js +101 -12
- package/lib/common/components/delivery-location/index.d.ts +5 -2
- package/lib/common/components/delivery-location/index.js +57 -8
- package/lib/common/components/editable-cell/index.js +7 -9
- package/lib/common/components/form-item/index.d.ts +12 -7
- package/lib/common/components/form-item/index.js +31 -7
- package/lib/common/components/locale-intl/index.d.ts +10 -0
- package/lib/common/components/locale-intl/index.js +45 -0
- package/lib/common/components/payment-method/index.d.ts +6 -3
- package/lib/common/components/payment-method/index.js +107 -15
- package/lib/common/components/payment-method/paymentMethodForConversion.d.ts +9 -0
- package/lib/common/components/payment-method/paymentMethodForConversion.js +44 -0
- package/lib/common/components/supplier/index.d.ts +5 -2
- package/lib/common/components/supplier/index.js +99 -25
- package/lib/common/consts/formLayout.d.ts +44 -0
- package/lib/common/consts/formLayout.js +35 -0
- package/lib/common/consts/validationRules.js +0 -7
- package/lib/common/types/ReceiverRequirements.d.ts +1 -1
- package/lib/common/types/ReceiverRequirements.js +4 -66
- package/lib/create-credit-note/index.js +1 -2
- package/lib/create-invoice/index.js +104 -40
- package/lib/src/common/components/attachments/Attachment.d.ts +6 -5
- package/lib/src/common/components/attachments/index.d.ts +5 -6
- package/lib/src/common/components/base-information/ReferenceIdentifiers.d.ts +17 -0
- package/lib/src/common/components/base-information/index.d.ts +6 -3
- package/lib/src/common/components/billing-lines/BillingCalculations.d.ts +11 -0
- package/lib/src/common/components/billing-lines/BillingTaxSummary.d.ts +10 -0
- package/lib/src/common/components/billing-lines/NewBillingLines.d.ts +10 -0
- package/lib/src/common/components/billing-lines/index.d.ts +7 -15
- package/lib/src/common/components/customer/index.d.ts +5 -6
- package/lib/src/common/components/delivery-location/index.d.ts +5 -2
- package/lib/src/common/components/form-item/index.d.ts +12 -7
- package/lib/src/common/components/locale-intl/index.d.ts +10 -0
- package/lib/src/common/components/payment-method/index.d.ts +6 -3
- package/lib/src/common/components/payment-method/paymentMethodForConversion.d.ts +9 -0
- package/lib/src/common/components/supplier/index.d.ts +5 -2
- package/lib/src/common/consts/formLayout.d.ts +44 -0
- package/lib/src/common/types/ReceiverRequirements.d.ts +1 -1
- package/lib/src/translations/locales.d.ts +75 -0
- package/lib/src/utils/BillingLineUtility.d.ts +10 -0
- package/lib/src/utils/ConversionUtility.d.ts +4 -4
- package/lib/translations/locales/is.json +71 -0
- package/lib/translations/locales.d.ts +75 -0
- package/lib/translations/locales.js +10 -0
- package/lib/utils/ApiUtility.js +1 -1
- package/lib/utils/BillingLineUtility.d.ts +10 -0
- package/lib/utils/BillingLineUtility.js +90 -0
- package/lib/utils/ConversionUtility.d.ts +4 -4
- package/lib/utils/ConversionUtility.js +38 -54
- package/lib/utils/RequirementsUtility.js +1 -1
- package/package.json +8 -5
- package/lib/common/components/billing-lines/BillingLIneFormData.d.ts +0 -6
- package/lib/common/components/billing-lines/BillingLIneFormData.js +0 -6
- package/lib/src/common/components/billing-lines/BillingLIneFormData.d.ts +0 -6
|
@@ -11,7 +11,6 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
var mapi_1 = require("@unimaze/api-clients/lib/mapi");
|
|
15
14
|
var removeEmpty = function (obj) {
|
|
16
15
|
return Object.keys(obj)
|
|
17
16
|
.filter(function (k) { return obj[k] != null; }) // Remove undef. and null.
|
|
@@ -33,11 +32,18 @@ var isEmpty = function (map) {
|
|
|
33
32
|
}
|
|
34
33
|
return true;
|
|
35
34
|
};
|
|
36
|
-
var
|
|
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, paymentMethod, customer) {
|
|
37
44
|
var issueDate = convertDates(formValues.invoice.issueDate);
|
|
38
45
|
var dueDate = convertDates(formValues.invoice.dueDate);
|
|
39
|
-
|
|
40
|
-
console.log(issueDate);
|
|
46
|
+
var referenceIdentifiersArray = formValues.invoice.referenceIdentifiers;
|
|
41
47
|
var cleanedFormValues = removeEmpty(formValues);
|
|
42
48
|
var invoice = cleanedFormValues.invoice;
|
|
43
49
|
// fix delivery
|
|
@@ -46,7 +52,18 @@ var convertToInvoiceMetadataInput = function (formValues, billingLines, customer
|
|
|
46
52
|
if (isEmpty(delivery.address)) {
|
|
47
53
|
delete delivery.address;
|
|
48
54
|
}
|
|
55
|
+
if (Object.keys(delivery).length === 0 && delivery.constructor === Object) {
|
|
56
|
+
delivery = undefined;
|
|
57
|
+
}
|
|
49
58
|
}
|
|
59
|
+
var referenceIdentifiers = referenceIdentifiersArray
|
|
60
|
+
? referenceIdentifiersArray.length === 0
|
|
61
|
+
? null
|
|
62
|
+
: referenceIdentifiersArray.map(function (referenceId) { return ({
|
|
63
|
+
code: referenceId.code.value,
|
|
64
|
+
value: referenceId.value
|
|
65
|
+
}); })
|
|
66
|
+
: null;
|
|
50
67
|
var resp = {
|
|
51
68
|
messageHandling: {
|
|
52
69
|
receiverIdentifier: customer.participantLegalIsoIdentifier,
|
|
@@ -57,21 +74,19 @@ var convertToInvoiceMetadataInput = function (formValues, billingLines, customer
|
|
|
57
74
|
customer: {
|
|
58
75
|
identifier: customer.participantLegalIsoIdentifier,
|
|
59
76
|
address: {
|
|
60
|
-
streetNameAndNumber: customer.
|
|
61
|
-
postalZone: customer.
|
|
62
|
-
city: customer.
|
|
63
|
-
countryCode: customer.
|
|
77
|
+
streetNameAndNumber: invoice.customer.address.streetNameAndNumber,
|
|
78
|
+
postalZone: invoice.customer.address.postalZone,
|
|
79
|
+
city: invoice.customer.address.city,
|
|
80
|
+
countryCode: invoice.customer.address.countryCode
|
|
64
81
|
},
|
|
65
|
-
name: customer.name,
|
|
82
|
+
name: invoice.customer.name,
|
|
66
83
|
contact: {
|
|
67
|
-
electronicMail: customer.
|
|
68
|
-
telephone: customer.
|
|
69
|
-
// fax: "",
|
|
70
|
-
// name: "",
|
|
84
|
+
electronicMail: invoice.customer.contact.electronicMail,
|
|
85
|
+
telephone: invoice.customer.contact.telephone,
|
|
71
86
|
}
|
|
72
87
|
},
|
|
73
88
|
supplier: {
|
|
74
|
-
identifier: invoice.supplier.identifier,
|
|
89
|
+
identifier: getIdentifierWithPrefix(invoice.supplier.identifier),
|
|
75
90
|
address: {
|
|
76
91
|
streetNameAndNumber: invoice.supplier.address.streetNameAndNumber,
|
|
77
92
|
postalZone: invoice.supplier.address.postalZone,
|
|
@@ -86,53 +101,22 @@ var convertToInvoiceMetadataInput = function (formValues, billingLines, customer
|
|
|
86
101
|
},
|
|
87
102
|
},
|
|
88
103
|
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
104
|
invoiceNo: invoice.invoiceNo,
|
|
106
105
|
issueDate: issueDate,
|
|
107
106
|
dueDate: dueDate,
|
|
108
107
|
notes: invoice.notes,
|
|
109
108
|
currencyCode: invoice.currencyCode,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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
|
-
}],
|
|
128
|
-
payableAmount: 0,
|
|
129
|
-
orderReference: {
|
|
130
|
-
documentNo: invoice.orderReference.documentNo,
|
|
131
|
-
},
|
|
109
|
+
invoiceLines: billingLines,
|
|
110
|
+
// invoiceLines: invoice.invoiceLines, // FOR NEW BILLING LINES
|
|
111
|
+
// payableAmount: 0, // Calculated? either doesnt exist or part of the Billing/Invoice Lines
|
|
112
|
+
buyerReference: invoice.buyerReference,
|
|
113
|
+
paymentMeans: paymentMethod,
|
|
114
|
+
referenceIdentifiers: referenceIdentifiers,
|
|
132
115
|
}
|
|
133
116
|
};
|
|
134
|
-
|
|
135
|
-
|
|
117
|
+
if (resp.invoice && resp.invoice.delivery && resp.invoice.delivery === {}) {
|
|
118
|
+
delete resp.invoice.delivery;
|
|
119
|
+
}
|
|
136
120
|
return resp;
|
|
137
121
|
};
|
|
138
122
|
exports.convertToInvoiceMetadataInput = convertToInvoiceMetadataInput;
|
|
@@ -15,7 +15,7 @@ exports.getReceiverRequirementsIsRequired = function (recRequirements, key, defa
|
|
|
15
15
|
exports.getReceiverRequirementsLabelWithDefault = function (recRequirements, key, defaultLabel) {
|
|
16
16
|
if (recRequirements.hasOwnProperty(key)) {
|
|
17
17
|
var recRequirement = recRequirements[key];
|
|
18
|
-
if (recRequirement) {
|
|
18
|
+
if (recRequirement && recRequirement.label) {
|
|
19
19
|
return recRequirement.label;
|
|
20
20
|
}
|
|
21
21
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unimaze/billing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-rc.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@types/lodash": "^4.14.149",
|
|
19
19
|
"@types/react": "16.9.34",
|
|
20
20
|
"@types/react-dom": "16.9.7",
|
|
21
|
-
"@types/react-intl": "
|
|
21
|
+
"@types/react-intl": "2.3.18",
|
|
22
22
|
"@types/uuid": "latest",
|
|
23
23
|
"antd": "4.3.3",
|
|
24
24
|
"awesome-typescript-loader": "^5.2.1",
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
"react": "16.13.1",
|
|
38
38
|
"react-dom": "16.13.1",
|
|
39
39
|
"react-intl": "^2.9.0",
|
|
40
|
-
"react-intl.macro": "^0.3.7",
|
|
41
40
|
"rimraf": "^3.0.2",
|
|
42
41
|
"style-loader": "^1.1.3",
|
|
43
42
|
"tslint": "^6.1.1",
|
|
@@ -53,8 +52,7 @@
|
|
|
53
52
|
"axios": "^0.19.2",
|
|
54
53
|
"react": "16.13.1",
|
|
55
54
|
"react-dom": "16.13.1",
|
|
56
|
-
"react-intl": "^2.9.0"
|
|
57
|
-
"react-intl.macro": "^0.3.7"
|
|
55
|
+
"react-intl": "^2.9.0"
|
|
58
56
|
},
|
|
59
57
|
"resolutions": {
|
|
60
58
|
"@types/react": "16.9.34",
|
|
@@ -85,6 +83,11 @@
|
|
|
85
83
|
"examples:build": "webpack -d --mode development --config example/webpack.config.js",
|
|
86
84
|
"start": "yarn run examples"
|
|
87
85
|
},
|
|
86
|
+
"babelMacros": {
|
|
87
|
+
"react-intl": {
|
|
88
|
+
"pure": true
|
|
89
|
+
}
|
|
90
|
+
},
|
|
88
91
|
"author": "",
|
|
89
92
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
90
93
|
"repository": {
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { BillingLineMetadata } from '@unimaze/api-clients/lib/mapi';
|
|
2
|
-
import { FormInstance } from "antd/es/form";
|
|
3
|
-
export interface IBillingLinesMetadata {
|
|
4
|
-
billingLineMetadata: BillingLineMetadata[];
|
|
5
|
-
}
|
|
6
|
-
export declare const BillingLinesFieldsMetadata: (formInstance: FormInstance) => IBillingLinesMetadata;
|
|
@@ -1,6 +0,0 @@
|
|
|
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;
|