@unimaze/billing 0.1.0 → 0.1.2-rc.10

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.
Files changed (101) hide show
  1. package/README.md +11 -3
  2. package/lib/common/components/attachments/Attachment.d.ts +8 -2
  3. package/lib/common/components/attachments/Attachment.js +33 -8
  4. package/lib/common/components/attachments/index.d.ts +9 -2
  5. package/lib/common/components/attachments/index.js +15 -6
  6. package/lib/common/components/base-information/ReferenceIdentifiers.d.ts +6 -0
  7. package/lib/common/components/base-information/ReferenceIdentifiers.js +40 -0
  8. package/lib/common/components/base-information/index.d.ts +6 -3
  9. package/lib/common/components/base-information/index.js +100 -81
  10. package/lib/common/components/billing-lines/BillingCalculations.d.ts +11 -0
  11. package/lib/common/components/billing-lines/BillingCalculations.js +61 -0
  12. package/lib/common/components/billing-lines/BillingTaxSummary.d.ts +10 -0
  13. package/lib/common/components/billing-lines/BillingTaxSummary.js +51 -0
  14. package/lib/common/components/billing-lines/billingLIneFormData.d.ts +7 -0
  15. package/lib/common/components/billing-lines/billingLIneFormData.js +63 -0
  16. package/lib/common/components/billing-lines/index.d.ts +10 -24
  17. package/lib/common/components/billing-lines/index.js +117 -39
  18. package/lib/common/components/customer/hardCoddedCustomer.d.ts +7 -0
  19. package/lib/common/components/{issuer/index.js → customer/hardCoddedCustomer.js} +5 -8
  20. package/lib/common/components/customer/index.d.ts +6 -0
  21. package/lib/common/components/customer/index.js +93 -0
  22. package/lib/common/components/delivery-location/index.d.ts +5 -2
  23. package/lib/common/components/delivery-location/index.js +43 -11
  24. package/lib/common/components/editable-cell/index.d.ts +1 -1
  25. package/lib/common/components/editable-cell/index.js +77 -11
  26. package/lib/common/components/editable-row/index.d.ts +5 -5
  27. package/lib/common/components/editable-row/index.js +8 -6
  28. package/lib/common/components/form-item/index.d.ts +21 -0
  29. package/lib/common/components/form-item/index.js +27 -0
  30. package/lib/common/components/index.d.ts +10 -5
  31. package/lib/common/components/index.js +20 -8
  32. package/lib/common/components/locale-intl/index.d.ts +10 -0
  33. package/lib/common/components/locale-intl/index.js +45 -0
  34. package/lib/common/components/payment-method/index.d.ts +6 -3
  35. package/lib/common/components/payment-method/index.js +67 -27
  36. package/lib/common/components/supplier/index.d.ts +6 -0
  37. package/lib/common/components/supplier/index.js +93 -0
  38. package/lib/common/consts/validationRules.d.ts +2 -3
  39. package/lib/common/consts/validationRules.js +1 -8
  40. package/lib/common/enums/index.d.ts +1 -1
  41. package/lib/common/enums/index.js +2 -4
  42. package/lib/common/types/BillingLineMetadataOverride.d.ts +2 -1
  43. package/lib/common/types/ReceiverRequirements.d.ts +81 -0
  44. package/lib/common/types/ReceiverRequirements.js +379 -0
  45. package/lib/create-credit-note/index.d.ts +2 -3
  46. package/lib/create-credit-note/index.js +17 -28
  47. package/lib/create-invoice/index.d.ts +1 -2
  48. package/lib/create-invoice/index.js +79 -21
  49. package/lib/example/src/index.d.ts +1 -1
  50. package/lib/index.d.ts +2 -3
  51. package/lib/index.js +8 -5
  52. package/lib/src/common/components/attachments/Attachment.d.ts +21 -0
  53. package/lib/src/common/components/attachments/index.d.ts +10 -0
  54. package/lib/src/common/components/base-information/ReferenceIdentifiers.d.ts +6 -0
  55. package/lib/src/common/components/base-information/index.d.ts +12 -0
  56. package/lib/src/common/components/billing-lines/BillingCalculations.d.ts +11 -0
  57. package/lib/src/common/components/billing-lines/BillingTaxSummary.d.ts +10 -0
  58. package/lib/src/common/components/billing-lines/billingLIneFormData.d.ts +7 -0
  59. package/lib/src/common/components/billing-lines/index.d.ts +13 -0
  60. package/lib/src/common/components/component-container/Content.d.ts +7 -0
  61. package/lib/src/common/components/component-container/Header.d.ts +9 -0
  62. package/lib/src/common/components/component-container/index.d.ts +10 -0
  63. package/lib/src/common/components/customer/index.d.ts +6 -0
  64. package/lib/src/common/components/delivery-location/index.d.ts +6 -0
  65. package/lib/src/common/components/editable-cell/index.d.ts +11 -0
  66. package/lib/src/common/components/editable-row/index.d.ts +6 -0
  67. package/lib/src/common/components/form-item/index.d.ts +21 -0
  68. package/lib/src/common/components/index.d.ts +10 -0
  69. package/lib/src/common/components/locale-intl/index.d.ts +10 -0
  70. package/lib/src/common/components/payment-method/index.d.ts +6 -0
  71. package/lib/src/common/components/supplier/index.d.ts +6 -0
  72. package/lib/src/common/consts/validationRules.d.ts +6 -0
  73. package/lib/src/common/types/ReceiverRequirements.d.ts +81 -0
  74. package/lib/src/create-invoice/index.d.ts +14 -0
  75. package/lib/src/translations/locales.d.ts +74 -0
  76. package/lib/src/utils/ApiUtility.d.ts +21 -0
  77. package/lib/src/utils/BillingLineUtility.d.ts +8 -0
  78. package/lib/src/utils/ConversionUtility.d.ts +5 -0
  79. package/lib/src/utils/RequirementsUtility.d.ts +5 -0
  80. package/lib/src/utils/billingLineFormData.d.ts +7 -0
  81. package/lib/src/utils/index.d.ts +2 -0
  82. package/lib/style/index.css +0 -1222
  83. package/lib/translations/locales/is.json +70 -0
  84. package/lib/translations/locales.d.ts +74 -0
  85. package/lib/translations/locales.js +10 -0
  86. package/lib/utils/ApiUtility.d.ts +21 -0
  87. package/lib/utils/ApiUtility.js +59 -0
  88. package/lib/utils/BillingLineUtility.d.ts +8 -0
  89. package/lib/utils/BillingLineUtility.js +66 -0
  90. package/lib/utils/ConversionUtility.d.ts +5 -0
  91. package/lib/utils/ConversionUtility.js +146 -0
  92. package/lib/utils/RequirementsUtility.d.ts +5 -0
  93. package/lib/utils/RequirementsUtility.js +23 -0
  94. package/lib/utils/billingLineFormData.d.ts +7 -0
  95. package/lib/utils/billingLineFormData.js +63 -0
  96. package/lib/utils/index.d.ts +2 -5
  97. package/lib/utils/index.js +5 -162
  98. package/package.json +22 -7
  99. package/lib/common/components/issuer/index.d.ts +0 -7
  100. package/lib/common/components/payer/index.d.ts +0 -3
  101. package/lib/common/components/payer/index.js +0 -50
@@ -10,31 +10,36 @@ 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
- require("antd/dist/antd.compact.css");
18
24
  require("../style/index.css");
19
- var react_1 = __importDefault(require("react"));
25
+ var react_1 = __importStar(require("react"));
20
26
  var antd_1 = require("antd");
21
27
  var is_IS_1 = __importDefault(require("antd/es/locale-provider/is_IS"));
22
28
  var en_US_1 = __importDefault(require("antd/es/locale-provider/en_US"));
23
- var payer_1 = __importDefault(require("../common/components/payer"));
24
- var issuer_1 = __importDefault(require("../common/components/issuer"));
25
- var delivery_location_1 = __importDefault(require("../common/components/delivery-location"));
26
- var payment_method_1 = __importDefault(require("../common/components/payment-method"));
27
- var attachments_1 = __importDefault(require("../common/components/attachments"));
28
- var base_information_1 = __importDefault(require("../common/components/base-information"));
29
- var billing_lines_1 = __importDefault(require("../common/components/billing-lines"));
29
+ var components_1 = require("../common/components");
30
+ var utils_1 = require("../utils");
31
+ var uuid_1 = require("uuid");
32
+ var BillingLineUtility_1 = require("../utils/BillingLineUtility");
33
+ var mapi_1 = require("@unimaze/api-clients/lib/mapi");
30
34
  /**
31
35
  * Component for creating a form for creating an invoice and submitting it to the MAPI transaction services
32
36
  *
33
37
  * @component
34
38
  */
35
39
  var CreateInvoice = function (props) {
36
- // const [submitInvoiceRequest, setSubmitInvoiceRequest] = useState<CreateSubmitInvoiceRequest>();
40
+ // const [submitInvoiceRequest, setSubmitInvoiceRequest] = React.useState<CreateSubmitInvoiceRequest>();
37
41
  var form = antd_1.Form.useForm()[0];
42
+ var _a = react_1.useState([]), files = _a[0], setFiles = _a[1];
38
43
  var formItemLayout = {
39
44
  labelCol: {
40
45
  xs: { span: 24 },
@@ -45,14 +50,53 @@ var CreateInvoice = function (props) {
45
50
  sm: { span: 16 },
46
51
  },
47
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
+ };
48
62
  var handleSetBillingLineMetadata = function (formInstance, billingLineMetadata) {
49
63
  formInstance.setFieldsValue({
50
- "billingLineMetadata": billingLineMetadata,
64
+ "billingLinesMetadata": billingLineMetadata
51
65
  });
52
66
  };
53
67
  var handleSubmit = function (values) {
54
- // props.handleSubmitInvoice(values);
55
- // console.log('Received values of form: ', values);
68
+ var invoiceMetadataInput = utils_1.convertToInvoiceMetadataInput(values, BillingLineUtility_1.billingLinesFieldsMetadata(form), props.customer);
69
+ var createSubmitInvoice = {
70
+ invoiceMetadataInput: invoiceMetadataInput,
71
+ more: files.length > 0,
72
+ messageId: uuid_1.v4(),
73
+ processingMode: mapi_1.TransactionProcessingMode.Device
74
+ };
75
+ utils_1.submitInvoice(createSubmitInvoice, props.mapiBaseUrl, props.apiKey, "submitInvoice", props.language)
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
+ })
97
+ .catch(function (error) {
98
+ antd_1.message.error(error.message);
99
+ });
56
100
  };
57
101
  var setLocale = function (language) {
58
102
  switch (language) {
@@ -65,23 +109,37 @@ var CreateInvoice = function (props) {
65
109
  }
66
110
  };
67
111
  return (react_1.default.createElement(antd_1.ConfigProvider, { locale: setLocale(props.language), componentSize: "small" },
68
- react_1.default.createElement(antd_1.Form, __assign({}, formItemLayout, { onFinish: handleSubmit }),
112
+ react_1.default.createElement(antd_1.Form, __assign({}, formItemLayout, { form: form, onFinish: handleSubmit, initialValues: {
113
+ invoice: {
114
+ currencyCode: "ISK",
115
+ supplier: {
116
+ address: {
117
+ countryCode: "IS"
118
+ }
119
+ },
120
+ customer: {
121
+ address: {
122
+ countryCode: "IS"
123
+ }
124
+ }
125
+ }
126
+ } }),
69
127
  react_1.default.createElement("h1", null, "Invoice"),
70
128
  react_1.default.createElement(antd_1.Row, { gutter: [16, 16] },
71
129
  react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 }, xl: { span: 8 } },
72
- react_1.default.createElement(payer_1.default, null)),
130
+ react_1.default.createElement(components_1.Supplier, null)),
73
131
  react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 }, xl: { span: 8 } },
74
- react_1.default.createElement(delivery_location_1.default, null)),
132
+ react_1.default.createElement(components_1.Customer, null)),
75
133
  react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 }, xl: { span: 8 } },
76
- react_1.default.createElement(issuer_1.default, { issuer: props.issuer })),
134
+ react_1.default.createElement(components_1.BaseInformation, { form: form, documentType: "invoice" })),
77
135
  react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 }, xl: { span: 8 } },
78
- react_1.default.createElement(base_information_1.default, { form: form, documentType: "invoice" })),
136
+ react_1.default.createElement(components_1.DeliveryLocation, null)),
79
137
  react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 24 }, xl: { span: 16 } },
80
- react_1.default.createElement(billing_lines_1.default, { setBillingLineMetadata: handleSetBillingLineMetadata, form: form })),
138
+ react_1.default.createElement(components_1.BillingLines, { setBillingLineMetadata: handleSetBillingLineMetadata, formInstance: form })),
81
139
  react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 8 }, xl: { span: 8 } },
82
- react_1.default.createElement(payment_method_1.default, null)),
140
+ react_1.default.createElement(components_1.PaymentMethod, null)),
83
141
  react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 16 }, xl: { span: 16 } },
84
- react_1.default.createElement(attachments_1.default, null)),
142
+ react_1.default.createElement(components_1.Attachments, { handleAddFile: handleAddFile })),
85
143
  react_1.default.createElement(antd_1.Col, { span: 24 },
86
144
  react_1.default.createElement(antd_1.Form.Item, null,
87
145
  react_1.default.createElement(antd_1.Button, { type: "primary", htmlType: "submit" }, "Submit")))))));
@@ -1 +1 @@
1
- export {};
1
+ import "antd/dist/antd.compact.css";
package/lib/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export * from "./common/enums";
2
2
  export * from "./common/types";
3
- import CreateInvoice from "./create-invoice";
4
- import CreateCreditNote from "./create-credit-note";
5
- export { CreateInvoice, CreateCreditNote };
3
+ export { default as CreateInvoice } from "./create-invoice";
4
+ export { default as CreateCreditNote } from "./create-credit-note";
package/lib/index.js CHANGED
@@ -1,9 +1,12 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
2
+ function __export(m) {
3
+ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
4
+ }
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- var create_invoice_1 = __importDefault(require("./create-invoice"));
6
+ // Enums, Types
7
+ __export(require("./common/enums"));
8
+ // Components
9
+ var create_invoice_1 = require("./create-invoice");
7
10
  exports.CreateInvoice = create_invoice_1.default;
8
- var create_credit_note_1 = __importDefault(require("./create-credit-note"));
11
+ var create_credit_note_1 = require("./create-credit-note");
9
12
  exports.CreateCreditNote = create_credit_note_1.default;
@@ -0,0 +1,21 @@
1
+ import * as React from 'react';
2
+ import '@ant-design/compatible/assets/index.css';
3
+ import { UploadFile } from "antd/lib/upload/interface";
4
+ import { InjectedIntlProps } from "react-intl";
5
+ interface Props extends InjectedIntlProps {
6
+ fieldName: string;
7
+ handleAddFile: (file: UploadFile) => void;
8
+ }
9
+ interface States {
10
+ file: any[];
11
+ }
12
+ declare class Attachment extends React.Component<Props, States> {
13
+ constructor(props: Props);
14
+ handleRemoveFile: () => void;
15
+ normFile: (e: any) => any;
16
+ render(): JSX.Element;
17
+ }
18
+ declare const _default: React.ComponentClass<Pick<Props & React.RefAttributes<Attachment>, "ref" | "handleAddFile" | "fieldName" | "key">, any> & {
19
+ WrappedComponent: React.ComponentType<Props & React.RefAttributes<Attachment> & InjectedIntlProps>;
20
+ };
21
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ import { UploadFile } from "antd/lib/upload/interface";
3
+ import { InjectedIntlProps } from "react-intl";
4
+ interface Props extends InjectedIntlProps {
5
+ handleAddFile: (file: UploadFile) => void;
6
+ }
7
+ declare const AttachmentGroupIntl: React.ComponentClass<Pick<Props, "handleAddFile">, any> & {
8
+ WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
9
+ };
10
+ export default AttachmentGroupIntl;
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ import { InjectedIntlProps } from "react-intl";
3
+ declare const _default: React.ComponentClass<Pick<InjectedIntlProps, never>, any> & {
4
+ WrappedComponent: React.ComponentType<InjectedIntlProps>;
5
+ };
6
+ export default _default;
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import '@ant-design/compatible/assets/index.css';
3
+ import { FormInstance } from "antd/es/form";
4
+ import { InjectedIntlProps } from "react-intl";
5
+ interface Props extends InjectedIntlProps {
6
+ form: FormInstance;
7
+ documentType: "creditNote" | "invoice";
8
+ }
9
+ declare const BaseInformationIntl: React.ComponentClass<Pick<Props, "form" | "documentType">, any> & {
10
+ WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
11
+ };
12
+ export default BaseInformationIntl;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { BillingLineMetadataOverride } from "../../types/BillingLineMetadataOverride";
3
+ import { InjectedIntlProps } from "react-intl";
4
+ interface Props extends InjectedIntlProps {
5
+ billingLinesMetadata: BillingLineMetadataOverride[];
6
+ renderCurrencyColumn: (text: string | number) => string;
7
+ }
8
+ declare const _default: React.ComponentClass<Pick<Props, "billingLinesMetadata" | "renderCurrencyColumn">, any> & {
9
+ WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
10
+ };
11
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { BillingLineMetadataOverride } from "../../types/BillingLineMetadataOverride";
3
+ import { InjectedIntlProps } from "react-intl";
4
+ interface Props extends InjectedIntlProps {
5
+ billingLines: BillingLineMetadataOverride[];
6
+ }
7
+ declare const _default: React.ComponentClass<Pick<Props, "billingLines">, any> & {
8
+ WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
9
+ };
10
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import { BillingLineMetadata } from '@unimaze/api-clients/lib/mapi';
2
+ import { FormInstance } from "antd/es/form";
3
+ import { TaxCategoryTypeEnum } from "@unimaze/api-clients/lib/mapi/api";
4
+ export declare const billingLinesFieldsMetadata: (formInstance: FormInstance) => BillingLineMetadata[];
5
+ export declare const calculateTaxableAmount: (discountValue: string | null | undefined, quantity: number | null, unitPriceAmount: number | null) => number;
6
+ export declare const calculateTaxAmount: (taxableAmount: number, taxPercentage: number) => number;
7
+ export declare const calculateTaxPercentage: (taxCategoryType: TaxCategoryTypeEnum) => number;
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+ import '@ant-design/compatible/assets/index.css';
3
+ import { BillingLineMetadata } from "@unimaze/api-clients/lib/mapi/models";
4
+ import { InjectedIntlProps } from "react-intl";
5
+ import { FormInstance } from "antd/es/form";
6
+ interface Props extends InjectedIntlProps {
7
+ formInstance: FormInstance;
8
+ setBillingLineMetadata: (formInstance: FormInstance, billingLineMetadata: BillingLineMetadata[]) => void;
9
+ }
10
+ declare const BillingLinesIntl: React.ComponentClass<Pick<Props, "formInstance" | "setBillingLineMetadata">, any> & {
11
+ WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
12
+ };
13
+ export default BillingLinesIntl;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { HeightProperty } from "csstype";
3
+ interface Props {
4
+ height?: HeightProperty<number>;
5
+ }
6
+ declare const Content: React.FC<Props>;
7
+ export default Content;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { IconProps } from "@ant-design/compatible/es/icon";
3
+ interface HeaderProps {
4
+ iconProps?: IconProps;
5
+ title?: string;
6
+ action?: React.ReactNode;
7
+ }
8
+ declare const Header: React.FC<HeaderProps>;
9
+ export default Header;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { IconProps } from "@ant-design/compatible/es/icon";
3
+ interface Props {
4
+ iconProps?: IconProps;
5
+ title?: string;
6
+ action?: React.ReactNode;
7
+ noPadding?: boolean;
8
+ }
9
+ declare const ComponentContainer: React.FC<Props>;
10
+ export default ComponentContainer;
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ import { InjectedIntlProps } from "react-intl";
3
+ declare const CustomerIntl: React.ComponentClass<Pick<InjectedIntlProps, never>, any> & {
4
+ WrappedComponent: React.ComponentType<InjectedIntlProps>;
5
+ };
6
+ export default CustomerIntl;
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ import { InjectedIntlProps } from "react-intl";
3
+ declare const DeliveryLocationIntl: React.ComponentClass<Pick<InjectedIntlProps, never>, any> & {
4
+ WrappedComponent: React.ComponentType<InjectedIntlProps>;
5
+ };
6
+ export default DeliveryLocationIntl;
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import { BillingLineMetadataOverride } from "../../types/BillingLineMetadataOverride";
3
+ interface EditableCellProps {
4
+ record: BillingLineMetadataOverride;
5
+ handleSave: (billingLineMetadata: BillingLineMetadataOverride) => void;
6
+ dataIndex: keyof Omit<BillingLineMetadataOverride, 'key'>;
7
+ editable: boolean;
8
+ index: number;
9
+ }
10
+ declare const EditableCell: React.FC<EditableCellProps>;
11
+ export default EditableCell;
@@ -0,0 +1,6 @@
1
+ import * as React from "react";
2
+ import 'antd/dist/antd.css';
3
+ import { FormInstance } from "antd/lib/form";
4
+ export declare const EditableContext: React.Context<FormInstance>;
5
+ declare const EditableRow: ({ index, ...props }: any) => JSX.Element;
6
+ export default EditableRow;
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { AvailableFields, ReceiverRequirements } from "../../types/ReceiverRequirements";
3
+ import { Rule } from "rc-field-form/lib/interface";
4
+ import { InjectedIntlProps } from "react-intl";
5
+ interface StringMap {
6
+ [key: string]: string;
7
+ }
8
+ interface Props extends InjectedIntlProps {
9
+ receiverRequirements: ReceiverRequirements;
10
+ receiverRequirementsKey: AvailableFields;
11
+ defaultLabel: React.ReactNode;
12
+ defaultIsRequired: boolean;
13
+ fieldName: string | string[];
14
+ additionalRules?: Rule[];
15
+ style?: React.CSSProperties;
16
+ initialValue?: StringMap;
17
+ }
18
+ declare const _default: React.ComponentClass<Pick<Props, "style" | "initialValue" | "fieldName" | "receiverRequirements" | "receiverRequirementsKey" | "defaultLabel" | "defaultIsRequired" | "additionalRules">, any> & {
19
+ WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
20
+ };
21
+ export default _default;
@@ -0,0 +1,10 @@
1
+ export { default as Attachments } from "./attachments";
2
+ export { default as BaseInformation } from "./base-information";
3
+ export { default as BillingLines } from "./billing-lines";
4
+ export { default as ComponentContainer } from "./component-container";
5
+ export { default as Customer } from "./customer";
6
+ export { default as DeliveryLocation } from "./delivery-location";
7
+ export { default as EditableCell } from "./editable-cell";
8
+ export { default as EditableRow } from "./editable-row";
9
+ export { default as PaymentMethod } from "./payment-method";
10
+ export { default as Supplier } from "./supplier";
@@ -0,0 +1,10 @@
1
+ import * as React from "react";
2
+ import "moment/locale/is";
3
+ import "moment/locale/sr";
4
+ interface IHotSwappingIntlProviderOwnProps {
5
+ initialLocale: string;
6
+ initialMessages: any;
7
+ languageString?: string;
8
+ }
9
+ declare const HotIntlProvider: React.FC<IHotSwappingIntlProviderOwnProps>;
10
+ export default HotIntlProvider;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { InjectedIntlProps } from "react-intl";
3
+ declare const _default: React.ComponentClass<Pick<InjectedIntlProps, never>, any> & {
4
+ WrappedComponent: React.ComponentType<InjectedIntlProps>;
5
+ };
6
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ import { InjectedIntlProps } from "react-intl";
3
+ declare const SupplierIntl: React.ComponentClass<Pick<InjectedIntlProps, never>, any> & {
4
+ WrappedComponent: React.ComponentType<InjectedIntlProps>;
5
+ };
6
+ export default SupplierIntl;
@@ -0,0 +1,6 @@
1
+ import { BillingLineMetadataOverride } from "../types/BillingLineMetadataOverride";
2
+ import { Rule } from "rc-field-form/lib/interface";
3
+ export declare type ValidationRulesObject = {
4
+ [key in keyof Omit<BillingLineMetadataOverride, 'key'>]: Rule[];
5
+ };
6
+ export declare const validationRules: ValidationRulesObject;
@@ -0,0 +1,81 @@
1
+ interface Values {
2
+ key?: string;
3
+ label?: string;
4
+ values?: Values[];
5
+ }
6
+ interface FieldRequirement extends Values {
7
+ isRequired: boolean;
8
+ }
9
+ declare type ReceiverRequirements = {
10
+ [key in AvailableFields]?: FieldRequirement;
11
+ };
12
+ export declare enum AvailableFields {
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"
79
+ }
80
+ export { ReceiverRequirements, FieldRequirement };
81
+ export declare const receiverRequirementsObject: ReceiverRequirements;
@@ -0,0 +1,14 @@
1
+ import "../style/index.css";
2
+ import React from "react";
3
+ import { ProfileOutput } from "@unimaze/api-clients/lib/wapi2";
4
+ import { CommonProps } from "../common/types/CommonProps";
5
+ interface Props extends CommonProps {
6
+ customer: ProfileOutput;
7
+ }
8
+ /**
9
+ * Component for creating a form for creating an invoice and submitting it to the MAPI transaction services
10
+ *
11
+ * @component
12
+ */
13
+ declare const CreateInvoice: React.FC<Props>;
14
+ export default CreateInvoice;
@@ -0,0 +1,74 @@
1
+ declare const _default: {
2
+ en: {};
3
+ is: {
4
+ "attachment_labels_Reference": string;
5
+ "attachment_labels_Reference_requiredMessage": string;
6
+ "attachment_labels_Description": string;
7
+ "attachment_labels_Description_requiredMessage": string;
8
+ "attachment_labels_File": string;
9
+ "attachment_title": string;
10
+ "baseInformation_title": string;
11
+ "baseInformation_invoiceNo": string;
12
+ "baseInformation_issueDate": string;
13
+ "baseInformation_dueDate": string;
14
+ "baseInformation_orderReference_documentNo": string;
15
+ "baseInformation_notes": string;
16
+ "baseInformation_currencyCode": string;
17
+ "billingCalculations_labels_TaxAmountWithoutVat": string;
18
+ "billingCalculations_labels_TotalVatAmount": string;
19
+ "billingCalculations_labels_TotalAmountWithVat": string;
20
+ "billingTaxSummary_taxOverview": string;
21
+ "billingTaxSummary_taxableAmount": string;
22
+ "billingTaxSummary_taxAmount": string;
23
+ "billingLines_title": string;
24
+ "billingLines_itemNo": string;
25
+ "billingLines_name": string;
26
+ "billingLines_quantity": string;
27
+ "billingLines_unitOfMeasure": string;
28
+ "billingLines_unitPriceAmount": string;
29
+ "billingLines_taxCategoryType": string;
30
+ "billingLines_taxCategoryPercentage": string;
31
+ "billingLines_discount": string;
32
+ "billingLines_lineAmount": string;
33
+ "billingLines_taxAmount": string;
34
+ "billingLines_button_addRow": string;
35
+ "deliveryLocation_title": string;
36
+ "deliveryLocation_partyName": string;
37
+ "deliveryLocation_streetNameAndNumber": string;
38
+ "deliveryLocation_postalZone": string;
39
+ "deliveryLocation_city": string;
40
+ "deliveryLocation_countryCode": string;
41
+ "formItem_required_errorMessage": string;
42
+ "paymentMethod_labels_domesticTransfer_bankNo": string;
43
+ "paymentMethod_labels_domesticTransfer_typeNo": string;
44
+ "paymentMethod_labels_domesticTransfer_accountNo": string;
45
+ "paymentMethod_labels_domesticTransfer_paymentReference": string;
46
+ "paymentMethod_labels_icelandicClaim_bankNo": string;
47
+ "paymentMethod_labels_icelandicClaim_claimNo": string;
48
+ "paymentMethod_labels_methods_undefined": string;
49
+ "paymentMethod_labels_methods_mutuallyAgreed": string;
50
+ "paymentMethod_labels_methods_domesticTransfer": string;
51
+ "paymentMethod_labels_methods_domesticClaim": string;
52
+ "supplier_title": string;
53
+ "supplier_name": string;
54
+ "supplier_identifier": string;
55
+ "supplier_vatNumber": string;
56
+ "supplier_address_streetNameAndNumber": string;
57
+ "supplier_address_zip_postalCode": string;
58
+ "supplier_address_city": string;
59
+ "supplier_address_countryCode": string;
60
+ "supplier_contact_email": string;
61
+ "supplier_contact_name": string;
62
+ "supplier_notValidEmail": string;
63
+ "customer_title": string;
64
+ "customer_name": string;
65
+ "customer_identifier": string;
66
+ "customer_address_streetNameAndNumber": string;
67
+ "customer_address_zip_postalCode": string;
68
+ "customer_address_city": string;
69
+ "customer_address_countryCode": string;
70
+ "customer_contact_email": string;
71
+ "customer_contact_name": string;
72
+ };
73
+ };
74
+ export default _default;
@@ -0,0 +1,21 @@
1
+ import { mapi } from "@unimaze/api-clients";
2
+ import { InvoiceMetadataInput, TransactionProcessingMode } from "@unimaze/api-clients/lib/mapi/api";
3
+ import { AxiosPromise } from "axios";
4
+ import { LanguageProp } from "../common/types/CommonProps";
5
+ interface CreateSubmitInvoice {
6
+ messageId: string;
7
+ more: boolean;
8
+ conversationIdentifier?: string;
9
+ processingMode?: TransactionProcessingMode;
10
+ services?: string[];
11
+ invoiceMetadataInput?: InvoiceMetadataInput;
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>;
20
+ declare const submitInvoice: (createSubmitInvoice: CreateSubmitInvoice, mapiBaseUrl: string, apiKey?: string | undefined, callName?: string | undefined, language?: LanguageProp) => AxiosPromise<mapi.MessageOutput>;
21
+ export { submitInvoice, CreateSubmitInvoice, submitDocument, AttachDocument };
@@ -0,0 +1,8 @@
1
+ import { BillingLineMetadata } from '@unimaze/api-clients/lib/mapi';
2
+ import { FormInstance } from "antd/es/form";
3
+ import { TaxCategoryTypeEnum } from "@unimaze/api-clients/lib/mapi/api";
4
+ export declare const billingLinesFieldsMetadata: (formInstance: FormInstance) => BillingLineMetadata[];
5
+ export declare const calculateTaxableAmount: (discountValue: string | null | undefined, quantity: number | null, unitPriceAmount: number | null) => number;
6
+ export declare const calculateTaxAmount: (taxableAmount: number, taxPercentage: number) => number;
7
+ export declare const calculateTaxPercentage: (taxCategoryType: TaxCategoryTypeEnum) => number;
8
+ export declare const generateTaxCategoryLabel: (taxCategoryType: TaxCategoryTypeEnum) => string;