@unimaze/billing 0.2.9 → 0.3.1
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/customer/index.d.ts +4 -3
- package/lib/common/components/customer/index.js +1 -0
- package/lib/common/components/editable-cell/index.js +0 -2
- package/lib/common/types/AppConfiguration.d.ts +5 -3
- package/lib/common/types/CommonProps.d.ts +0 -1
- package/lib/create-invoice/index.d.ts +2 -2
- package/lib/create-invoice/index.js +12 -5
- package/lib/src/common/components/customer/index.d.ts +4 -3
- package/lib/src/common/components/form-item/index.d.ts +1 -1
- package/lib/src/create-invoice/index.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { InjectedIntlProps } from "react-intl";
|
|
3
|
-
import { ProfileOutput } from "@unimaze/api-clients/lib/wapi2";
|
|
4
3
|
import { FormInstance } from "antd/es/form";
|
|
5
4
|
import { PartyMetadata } from "@unimaze/api-clients/lib/mapi";
|
|
5
|
+
import { ProfileOutputWithApiKey } from "../../types/AppConfiguration";
|
|
6
6
|
interface Props extends InjectedIntlProps {
|
|
7
|
-
customers:
|
|
7
|
+
customers: ProfileOutputWithApiKey[];
|
|
8
8
|
formInstance: FormInstance;
|
|
9
9
|
chosenCustomer: PartyMetadata | undefined;
|
|
10
10
|
setChosenCustomer: (chosenCustomer: PartyMetadata) => void;
|
|
11
|
+
setChosenCustomerApiKey: (chosenCustomerApiKey: string) => void;
|
|
11
12
|
}
|
|
12
|
-
declare const CustomerIntl: React.ComponentClass<Pick<Props, "formInstance" | "customers" | "chosenCustomer" | "setChosenCustomer">, any> & {
|
|
13
|
+
declare const CustomerIntl: React.ComponentClass<Pick<Props, "formInstance" | "customers" | "chosenCustomer" | "setChosenCustomer" | "setChosenCustomerApiKey">, any> & {
|
|
13
14
|
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
14
15
|
};
|
|
15
16
|
export default CustomerIntl;
|
|
@@ -71,6 +71,7 @@ var Customer = function (props) {
|
|
|
71
71
|
var prevValues = props.formInstance.getFieldsValue();
|
|
72
72
|
var newFormValues = __assign({}, prevValues, { invoice: __assign({}, prevValues.invoice, { customer: __assign({}, prevValues.invoice.customer, customerPartyMetadata) }) });
|
|
73
73
|
setChosenCustomer(__assign({}, prevValues.invoice.customer, customerPartyMetadata));
|
|
74
|
+
props.setChosenCustomerApiKey(props.customers[customerIndex].apiKey);
|
|
74
75
|
props.formInstance.setFieldsValue(newFormValues);
|
|
75
76
|
};
|
|
76
77
|
return (
|
|
@@ -96,8 +96,6 @@ var EditableCell = function (props) {
|
|
|
96
96
|
return [3 /*break*/, 3];
|
|
97
97
|
case 2:
|
|
98
98
|
errInfo_1 = _a.sent();
|
|
99
|
-
// tslint:disable-next-line:no-console
|
|
100
|
-
console.log('Save failed:', errInfo_1);
|
|
101
99
|
return [3 /*break*/, 3];
|
|
102
100
|
case 3: return [2 /*return*/];
|
|
103
101
|
}
|
|
@@ -5,10 +5,12 @@ interface AppConfiguration {
|
|
|
5
5
|
rapiUrl: string;
|
|
6
6
|
env: HostConfiguration[];
|
|
7
7
|
}
|
|
8
|
+
interface ProfileOutputWithApiKey extends ProfileOutput {
|
|
9
|
+
apiKey: string;
|
|
10
|
+
}
|
|
8
11
|
interface HostConfiguration {
|
|
9
12
|
host: string;
|
|
10
13
|
legalIdentifier: string;
|
|
11
|
-
|
|
12
|
-
customer: ProfileOutput[];
|
|
14
|
+
customers: ProfileOutputWithApiKey[];
|
|
13
15
|
}
|
|
14
|
-
export { AppConfiguration, HostConfiguration };
|
|
16
|
+
export { AppConfiguration, HostConfiguration, ProfileOutputWithApiKey };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "../style/index.css";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { ProfileOutput } from "@unimaze/api-clients/lib/wapi2";
|
|
4
3
|
import { CommonProps } from "../common/types/CommonProps";
|
|
4
|
+
import { ProfileOutputWithApiKey } from "../common/types/AppConfiguration";
|
|
5
5
|
interface Props extends CommonProps {
|
|
6
|
-
customers:
|
|
6
|
+
customers: ProfileOutputWithApiKey[];
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Component for creating a form for creating an invoice and submitting it to the MAPI transaction services
|
|
@@ -44,7 +44,8 @@ var CreateInvoice = function (props) {
|
|
|
44
44
|
var form = antd_1.Form.useForm()[0];
|
|
45
45
|
var _a = react_1.useState(false), submitting = _a[0], setSubmitting = _a[1];
|
|
46
46
|
var _b = react_1.useState(/*profileOutputToPartyMetadata(props.customers[0])*/ undefined), chosenCustomer = _b[0], setChosenCustomer = _b[1];
|
|
47
|
-
var _c = react_1.useState(
|
|
47
|
+
var _c = react_1.useState(), chosenCustomerApiKey = _c[0], setChosenCustomerApiKey = _c[1];
|
|
48
|
+
var _d = react_1.useState(1), billingLinesEditableIndex = _d[0], setBillingLinesEditableIndex = _d[1];
|
|
48
49
|
var initialBillingLineData = {
|
|
49
50
|
key: billingLinesEditableIndex,
|
|
50
51
|
itemNo: "Item No.",
|
|
@@ -58,7 +59,7 @@ var CreateInvoice = function (props) {
|
|
|
58
59
|
taxableAmount: 0,
|
|
59
60
|
taxPercentage: null
|
|
60
61
|
};
|
|
61
|
-
var
|
|
62
|
+
var _e = react_1.useState([__assign({}, initialBillingLineData, { key: 0 })]), billingLinesDataSource = _e[0], setBillingLinesDataSource = _e[1];
|
|
62
63
|
// BILLING LINES
|
|
63
64
|
var handleBillingLinesDelete = function (index) {
|
|
64
65
|
var newDataSource = billingLinesDataSource.slice();
|
|
@@ -117,7 +118,7 @@ var CreateInvoice = function (props) {
|
|
|
117
118
|
processingMode: mapi_1.TransactionProcessingMode.Device
|
|
118
119
|
// processingMode: TransactionProcessingMode.DeviceRouted
|
|
119
120
|
};
|
|
120
|
-
utils_1.submitInvoice(createSubmitInvoice, props.mapiBaseUrl,
|
|
121
|
+
utils_1.submitInvoice(createSubmitInvoice, props.mapiBaseUrl, chosenCustomerApiKey, "submitInvoice", props.language)
|
|
121
122
|
.then(function (resp) {
|
|
122
123
|
antd_1.message.success("successfully submitted the invoice");
|
|
123
124
|
var messageId = resp.data.uniqueId;
|
|
@@ -132,10 +133,14 @@ var CreateInvoice = function (props) {
|
|
|
132
133
|
name: nextFileDescription // nextFile.name,
|
|
133
134
|
};
|
|
134
135
|
setSubmitting(true);
|
|
135
|
-
utils_1.submitDocument(nextFile, createAttachDocument, props.mapiBaseUrl,
|
|
136
|
+
utils_1.submitDocument(nextFile, createAttachDocument, props.mapiBaseUrl, chosenCustomerApiKey)
|
|
136
137
|
.then(function (submitDocumentResponse) {
|
|
137
138
|
antd_1.message.success("successfully uploaded attachment " + nextFileDescription);
|
|
138
139
|
setSubmitting(false);
|
|
140
|
+
})
|
|
141
|
+
.catch(function (documentSendingErrorMessage) {
|
|
142
|
+
antd_1.message.error("error uploaded attachment " + nextFileDescription + " - " + documentSendingErrorMessage.message);
|
|
143
|
+
setSubmitting(false);
|
|
139
144
|
});
|
|
140
145
|
};
|
|
141
146
|
while (attachments.length > 0) {
|
|
@@ -145,10 +150,12 @@ var CreateInvoice = function (props) {
|
|
|
145
150
|
form.resetFields();
|
|
146
151
|
// Clear the billing line dataSource
|
|
147
152
|
setChosenCustomer(undefined);
|
|
153
|
+
setChosenCustomerApiKey(undefined);
|
|
148
154
|
setBillingLinesDataSource([__assign({}, initialBillingLineData, { key: 0 })]);
|
|
149
155
|
setBillingLinesEditableIndex(0);
|
|
150
156
|
})
|
|
151
157
|
.catch(function (error) {
|
|
158
|
+
setSubmitting(false);
|
|
152
159
|
antd_1.message.error(error.message);
|
|
153
160
|
});
|
|
154
161
|
};
|
|
@@ -183,7 +190,7 @@ var CreateInvoice = function (props) {
|
|
|
183
190
|
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 } },
|
|
184
191
|
react_1.default.createElement(components_1.Supplier, { billingLinesDataSource: billingLinesDataSource })),
|
|
185
192
|
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 } },
|
|
186
|
-
react_1.default.createElement(components_1.Customer, { formInstance: form, customers: props.customers, chosenCustomer: chosenCustomer, setChosenCustomer: setChosenCustomer })),
|
|
193
|
+
react_1.default.createElement(components_1.Customer, { formInstance: form, customers: props.customers, chosenCustomer: chosenCustomer, setChosenCustomer: setChosenCustomer, setChosenCustomerApiKey: setChosenCustomerApiKey })),
|
|
187
194
|
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 24 } },
|
|
188
195
|
react_1.default.createElement(components_1.BillingLines, { setBillingLineMetadata: handleSetBillingLineMetadata, formInstance: form, dataSource: billingLinesDataSource, editableIndex: billingLinesEditableIndex, handleAdd: handleBillingLinesAdd, initialBillingLineData: initialBillingLineData, handleDelete: handleBillingLinesDelete, handleSave: handleBillingLinesSave })),
|
|
189
196
|
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 8 } },
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { InjectedIntlProps } from "react-intl";
|
|
3
|
-
import { ProfileOutput } from "@unimaze/api-clients/lib/wapi2";
|
|
4
3
|
import { FormInstance } from "antd/es/form";
|
|
5
4
|
import { PartyMetadata } from "@unimaze/api-clients/lib/mapi";
|
|
5
|
+
import { ProfileOutputWithApiKey } from "../../types/AppConfiguration";
|
|
6
6
|
interface Props extends InjectedIntlProps {
|
|
7
|
-
customers:
|
|
7
|
+
customers: ProfileOutputWithApiKey[];
|
|
8
8
|
formInstance: FormInstance;
|
|
9
9
|
chosenCustomer: PartyMetadata | undefined;
|
|
10
10
|
setChosenCustomer: (chosenCustomer: PartyMetadata) => void;
|
|
11
|
+
setChosenCustomerApiKey: (chosenCustomerApiKey: string) => void;
|
|
11
12
|
}
|
|
12
|
-
declare const CustomerIntl: React.ComponentClass<Pick<Props, "chosenCustomer" | "setChosenCustomer" | "customers" | "formInstance">, any> & {
|
|
13
|
+
declare const CustomerIntl: React.ComponentClass<Pick<Props, "chosenCustomer" | "setChosenCustomer" | "setChosenCustomerApiKey" | "customers" | "formInstance">, any> & {
|
|
13
14
|
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
14
15
|
};
|
|
15
16
|
export default CustomerIntl;
|
|
@@ -17,7 +17,7 @@ interface Props extends InjectedIntlProps {
|
|
|
17
17
|
onlyLabelOnFirstInList?: boolean;
|
|
18
18
|
index?: number;
|
|
19
19
|
}
|
|
20
|
-
declare const _default: React.ComponentClass<Pick<Props, "style" | "initialValue" | "
|
|
20
|
+
declare const _default: React.ComponentClass<Pick<Props, "style" | "initialValue" | "fieldName" | "receiverRequirementsKey" | "defaultLabel" | "defaultIsRequired" | "additionalRules" | "verticalLabels" | "onlyLabelOnFirstInList" | "index">, any> & {
|
|
21
21
|
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
22
22
|
};
|
|
23
23
|
export default _default;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "../style/index.css";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { ProfileOutput } from "@unimaze/api-clients/lib/wapi2";
|
|
4
3
|
import { CommonProps } from "../common/types/CommonProps";
|
|
4
|
+
import { ProfileOutputWithApiKey } from "../common/types/AppConfiguration";
|
|
5
5
|
interface Props extends CommonProps {
|
|
6
|
-
customers:
|
|
6
|
+
customers: ProfileOutputWithApiKey[];
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Component for creating a form for creating an invoice and submitting it to the MAPI transaction services
|