@unimaze/billing 0.10.2 → 0.10.4

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.
@@ -34,6 +34,7 @@ var uuid_1 = require("uuid");
34
34
  var editable_cell_1 = require("../common/components/editable-cell");
35
35
  var billing_lines_1 = require("../common/components/billing-lines");
36
36
  var react_google_recaptcha_1 = __importDefault(require("react-google-recaptcha"));
37
+ var ApiUtility_1 = require("../utils/ApiUtility");
37
38
  var translationMessages = react_intl_1.defineMessages({
38
39
  createInvoice_addDocumentLineMsg: {
39
40
  id: "createInvoice_addDocumentLineMsg",
@@ -184,7 +185,7 @@ var CreateInvoiceConstructor = function (props) {
184
185
  name: nextFileDescription // nextFile.name,
185
186
  };
186
187
  setSubmitting(true);
187
- utils_1.submitDocument(nextFile, createAttachDocument, props.mapiBaseUrl, chosenCustomerApiKey)
188
+ ApiUtility_1.submitDocumentFetch(nextFile, createAttachDocument, props.mapiBaseUrl, chosenCustomerApiKey)
188
189
  .then(function (submitDocumentResponse) {
189
190
  antd_1.message.success(intl.formatMessage(translationMessages.createInvoice_successfullyUploadedAttachmentMsg, { attachment: nextFileDescription }));
190
191
  setSubmitting(false);
@@ -17,6 +17,7 @@ interface AttachDocument {
17
17
  more: boolean;
18
18
  }
19
19
  declare const submitDocument: (data: any, attachDocument: AttachDocument, mapiBaseUrl: string, apiKey?: string | undefined) => AxiosPromise<mapi.MessageOutput>;
20
+ declare const submitDocumentFetch: (data: any, attachDocument: AttachDocument, mapiBaseUrl: string, apiKey?: string | undefined) => Promise<Response>;
20
21
  declare const submitInvoice: (createSubmitInvoice: CreateSubmitInvoice, mapiBaseUrl: string, apiKey?: string | undefined, callName?: string | undefined, language?: LanguageProp) => AxiosPromise<mapi.MessageOutput>;
21
22
  export declare const getCancelToken: (callName: string) => CancelToken;
22
- export { submitInvoice, CreateSubmitInvoice, submitDocument, AttachDocument };
23
+ export { submitInvoice, CreateSubmitInvoice, submitDocument, AttachDocument, submitDocumentFetch };
@@ -33,13 +33,14 @@ var initialiseMessageApi = function (mapiBaseUrl) {
33
33
  };
34
34
  var submitDocument = function (data, attachDocument, mapiBaseUrl, apiKey) {
35
35
  var messageId = attachDocument.messageId, name = attachDocument.name, contentType = attachDocument.contentType, more = attachDocument.more;
36
+ var headers = __assign({}, (apiKey && { Authorization: "Bearer " + window.btoa(apiKey) }), { "Content-Type": "application/octet-stream", "X-test": "test" });
36
37
  return axios_1.default.post(mapiBaseUrl + "/api/v1/messages/" + messageId + "/documents", data, {
37
38
  params: {
38
39
  name: name,
39
40
  contentType: contentType,
40
41
  more: more
41
42
  },
42
- headers: __assign({}, (apiKey && { Authorization: "Bearer " + window.btoa(apiKey) }), { "Content-Type": "application/octet-stream", "X-test": "test" })
43
+ headers: headers
43
44
  });
44
45
  // const messageApi = initialiseMessageApi(mapiBaseUrl);
45
46
  //
@@ -56,6 +57,17 @@ var submitDocument = function (data, attachDocument, mapiBaseUrl, apiKey) {
56
57
  // )
57
58
  };
58
59
  exports.submitDocument = submitDocument;
60
+ var submitDocumentFetch = function (data, attachDocument, mapiBaseUrl, apiKey) {
61
+ var messageId = attachDocument.messageId, name = attachDocument.name, contentType = attachDocument.contentType, more = attachDocument.more;
62
+ var headers = __assign({}, (apiKey && { Authorization: "Bearer " + window.btoa(apiKey) }), { "Content-Type": "application/octet-stream", "X-test": "test" });
63
+ var responsePromise = fetch(mapiBaseUrl + "/api/v1/messages/" + messageId + "/documents?Name=" + name + "&ContentType=" + contentType + "&More=" + more, {
64
+ method: "POST",
65
+ headers: headers,
66
+ body: data
67
+ });
68
+ return responsePromise;
69
+ };
70
+ exports.submitDocumentFetch = submitDocumentFetch;
59
71
  var submitInvoice = function (createSubmitInvoice, mapiBaseUrl, apiKey, callName, language) {
60
72
  var transactionApi = initialiseTransactionApi(mapiBaseUrl);
61
73
  var messageId = createSubmitInvoice.messageId, more = createSubmitInvoice.more, conversationIdentifier = createSubmitInvoice.conversationIdentifier, processingMode = createSubmitInvoice.processingMode, services = createSubmitInvoice.services, invoiceMetadataInput = createSubmitInvoice.invoiceMetadataInput;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unimaze/billing",
3
- "version": "0.10.2",
3
+ "version": "0.10.4",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -26,7 +26,7 @@
26
26
  "@types/uuid": "latest",
27
27
  "antd": "4.3.3",
28
28
  "awesome-typescript-loader": "^5.2.1",
29
- "axios": "^0.19.2",
29
+ "axios": "0.19.2",
30
30
  "babel-loader": "^8.1.0",
31
31
  "copyfiles": "^2.2.0",
32
32
  "cross-env": "^7.0.2",