@unimaze/billing 0.2.9 → 0.3.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/customer/index.d.ts +4 -3
- package/lib/common/components/customer/index.js +1 -0
- 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 +7 -5
- package/lib/src/common/components/customer/index.d.ts +4 -3
- 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 (
|
|
@@ -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,7 +133,7 @@ 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);
|
|
@@ -145,6 +146,7 @@ var CreateInvoice = function (props) {
|
|
|
145
146
|
form.resetFields();
|
|
146
147
|
// Clear the billing line dataSource
|
|
147
148
|
setChosenCustomer(undefined);
|
|
149
|
+
setChosenCustomerApiKey(undefined);
|
|
148
150
|
setBillingLinesDataSource([__assign({}, initialBillingLineData, { key: 0 })]);
|
|
149
151
|
setBillingLinesEditableIndex(0);
|
|
150
152
|
})
|
|
@@ -183,7 +185,7 @@ var CreateInvoice = function (props) {
|
|
|
183
185
|
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 } },
|
|
184
186
|
react_1.default.createElement(components_1.Supplier, { billingLinesDataSource: billingLinesDataSource })),
|
|
185
187
|
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 })),
|
|
188
|
+
react_1.default.createElement(components_1.Customer, { formInstance: form, customers: props.customers, chosenCustomer: chosenCustomer, setChosenCustomer: setChosenCustomer, setChosenCustomerApiKey: setChosenCustomerApiKey })),
|
|
187
189
|
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 24 } },
|
|
188
190
|
react_1.default.createElement(components_1.BillingLines, { setBillingLineMetadata: handleSetBillingLineMetadata, formInstance: form, dataSource: billingLinesDataSource, editableIndex: billingLinesEditableIndex, handleAdd: handleBillingLinesAdd, initialBillingLineData: initialBillingLineData, handleDelete: handleBillingLinesDelete, handleSave: handleBillingLinesSave })),
|
|
189
191
|
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;
|
|
@@ -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
|