@bisondesk/documents-sdk 1.0.364 → 1.0.366

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 (50) hide show
  1. package/lib/apis/document-drafts.d.ts +2 -2
  2. package/lib/apis/document-drafts.d.ts.map +1 -1
  3. package/lib/apis/document-drafts.js +1 -1
  4. package/lib/apis/document-drafts.js.map +1 -1
  5. package/lib/apis/documents.d.ts +8 -2
  6. package/lib/apis/documents.d.ts.map +1 -1
  7. package/lib/apis/documents.js +41 -5
  8. package/lib/apis/documents.js.map +1 -1
  9. package/lib/constants.d.ts +9 -0
  10. package/lib/constants.d.ts.map +1 -1
  11. package/lib/constants.js +9 -0
  12. package/lib/constants.js.map +1 -1
  13. package/lib/schemas.js +1 -1
  14. package/lib/schemas.js.map +1 -1
  15. package/lib/types/bank-accounts.d.ts +23 -0
  16. package/lib/types/bank-accounts.d.ts.map +1 -0
  17. package/lib/types/bank-accounts.js +2 -0
  18. package/lib/types/bank-accounts.js.map +1 -0
  19. package/lib/types/booking.d.ts +4 -0
  20. package/lib/types/booking.d.ts.map +1 -1
  21. package/lib/types/booking.js.map +1 -1
  22. package/lib/types/document-categories.d.ts +3 -1
  23. package/lib/types/document-categories.d.ts.map +1 -1
  24. package/lib/types/document-categories.js.map +1 -1
  25. package/lib/types/documents.d.ts +10 -6
  26. package/lib/types/documents.d.ts.map +1 -1
  27. package/lib/types/documents.js.map +1 -1
  28. package/lib/types/leasing.d.ts +25 -0
  29. package/lib/types/leasing.d.ts.map +1 -0
  30. package/lib/types/leasing.js +9 -0
  31. package/lib/types/leasing.js.map +1 -0
  32. package/lib/types/legacy.d.ts +0 -1
  33. package/lib/types/legacy.d.ts.map +1 -1
  34. package/lib/types/legacy.js.map +1 -1
  35. package/lib/types/search.d.ts +4 -0
  36. package/lib/types/search.d.ts.map +1 -1
  37. package/lib/types/search.js.map +1 -1
  38. package/package.json +1 -1
  39. package/src/apis/document-drafts.ts +3 -3
  40. package/src/apis/documents.ts +61 -6
  41. package/src/constants.ts +14 -0
  42. package/src/schemas.ts +1 -1
  43. package/src/types/bank-accounts.ts +30 -0
  44. package/src/types/booking.ts +5 -0
  45. package/src/types/document-categories.ts +3 -1
  46. package/src/types/documents.ts +13 -8
  47. package/src/types/leasing.ts +26 -0
  48. package/src/types/legacy.ts +0 -1
  49. package/src/types/search.ts +4 -0
  50. package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"leasing.d.ts","sourceRoot":"/","sources":["types/leasing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAExE,MAAM,MAAM,iCAAiC,GAAG;IAC9C,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,IAAI,EAAE,cAAc,CAAC,IAAI,CAAC;IAC1B,OAAO,EAAE,sBAAsB,CAAC,OAAO,GAAG,sBAAsB,CAAC,UAAU,CAAC;IAC5E,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,eAAe,CAAC;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,4BAA4B,iBAAiB,CAAC;AAC3D,eAAO,MAAM,sBAAsB,wBAAwB,CAAC;AAC5D,oBAAY,sBAAsB;IAChC,QAAQ,qBAAqB;IAC7B,OAAO,oBAAoB;IAC3B,IAAI,iBAAiB;CACtB"}
@@ -0,0 +1,9 @@
1
+ export const LEASING_DOCUMENT_CATEGORY_ID = 'leasing_sale';
2
+ export const LEASING_COST_CENTER_ID = 'leasing_cost_center';
3
+ export var LeasingFinanceLineCode;
4
+ (function (LeasingFinanceLineCode) {
5
+ LeasingFinanceLineCode["Residual"] = "LEASING_RESIDUAL";
6
+ LeasingFinanceLineCode["Deposit"] = "LEASING_DEPOSIT";
7
+ LeasingFinanceLineCode["Rent"] = "LEASING_RENT";
8
+ })(LeasingFinanceLineCode || (LeasingFinanceLineCode = {}));
9
+ //# sourceMappingURL=leasing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"leasing.js","sourceRoot":"/","sources":["types/leasing.ts"],"names":[],"mappings":"AAmBA,MAAM,CAAC,MAAM,4BAA4B,GAAG,cAAc,CAAC;AAC3D,MAAM,CAAC,MAAM,sBAAsB,GAAG,qBAAqB,CAAC;AAC5D,MAAM,CAAN,IAAY,sBAIX;AAJD,WAAY,sBAAsB;IAChC,uDAA6B,CAAA;IAC7B,qDAA2B,CAAA;IAC3B,+CAAqB,CAAA;AACvB,CAAC,EAJW,sBAAsB,KAAtB,sBAAsB,QAIjC","sourcesContent":["import { AttachmentValue } from '@bisondesk/commons-sdk/types';\nimport { FinanceDocType, FinanceDocumentSubtype } from './documents.js';\n\nexport type NewExistingLeasingFinanceDocument = {\n id?: undefined;\n type: FinanceDocType.Sale;\n subtype: FinanceDocumentSubtype.Invoice | FinanceDocumentSubtype.CreditNote;\n issueDate: string;\n contractId: string;\n amountExcl: string;\n paidAt?: string;\n dueDate?: string;\n attachment: AttachmentValue;\n invoiceNumber: string;\n vatPercentage: string;\n period: string;\n description: string;\n};\n\nexport const LEASING_DOCUMENT_CATEGORY_ID = 'leasing_sale';\nexport const LEASING_COST_CENTER_ID = 'leasing_cost_center';\nexport enum LeasingFinanceLineCode {\n Residual = 'LEASING_RESIDUAL',\n Deposit = 'LEASING_DEPOSIT',\n Rent = 'LEASING_RENT',\n}\n"]}
@@ -39,7 +39,6 @@ export type FinanceDocumentV1 = {
39
39
  createdBy: string;
40
40
  issueDate: string;
41
41
  paidAt?: string;
42
- paymentNotes?: string;
43
42
  amount?: string;
44
43
  dueDate?: string;
45
44
  organizationSummary?: {
@@ -1 +1 @@
1
- {"version":3,"file":"legacy.d.ts","sourceRoot":"/","sources":["types/legacy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,MAAM,MAAM,aAAa,GAAG;IAC1B,YAAY,EAAE;QACZ,MAAM,EAAE;YAAE,SAAS,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QAC/C,KAAK,EAAE;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,SAAS,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QAC1D,SAAS,EAAE;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,SAAS,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;KAC/D,CAAC;IACF,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,GAAG,CAAC;IAEd,IAAI,EAAE,cAAc,GAAG,kBAAkB,CAAC;IAC1C,OAAO,EAAE,SAAS,GAAG,aAAa,GAAG,UAAU,GAAG,gBAAgB,CAAC;IACnE,SAAS,EAAE,MAAM,CAAC;IAElB,UAAU,EAAE,eAAe,CAAC;IAC5B,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,mBAAmB,CAAC,EAAE,aAAa,EA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,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC;QAEd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;CACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"legacy.js","sourceRoot":"/","sources":["types/legacy.ts"],"names":[],"mappings":"","sourcesContent":["import { AttachmentValue } from '@bisondesk/commons-sdk/types';\n\nexport type FinanceLineV1 = {\n associations: {\n others: { vehicleId: string; label: string }[];\n sales: { id: string; vehicleId: string; label: string }[];\n purchases: { id: string; vehicleId: string; label: string }[];\n };\n description: string;\n id: string;\n lineCode: string;\n quantity: string;\n unitPriceExclusive: string;\n vatCode: string;\n vatCoefficient: string;\n};\n\nexport type FinanceDocumentV1 = {\n id: string;\n branchId: string;\n version?: 1.0;\n\n type: 'Sale Finance' | 'Purchase Finance';\n subtype: 'Invoice' | 'Credit Note' | 'Proforma' | 'Purchase Order';\n reference: string;\n\n attachment: AttachmentValue;\n lines: FinanceLineV1[];\n accountingOnlyLines?: FinanceLineV1[];\n notes?: string;\n\n createdAt: string;\n createdBy: string;\n issueDate: string;\n paidAt?: string;\n paymentNotes?: string;\n amount?: string;\n dueDate?: string;\n\n organizationSummary?: {\n id: string;\n code: string;\n name: string;\n country: string;\n vatNumber?: string;\n\n addressLine1?: string;\n addressLine2?: string;\n addressLine3?: string;\n postcode?: string;\n city?: string;\n\n email?: string;\n phone?: string;\n fax?: string;\n };\n};\n"]}
1
+ {"version":3,"file":"legacy.js","sourceRoot":"/","sources":["types/legacy.ts"],"names":[],"mappings":"","sourcesContent":["import { AttachmentValue } from '@bisondesk/commons-sdk/types';\n\nexport type FinanceLineV1 = {\n associations: {\n others: { vehicleId: string; label: string }[];\n sales: { id: string; vehicleId: string; label: string }[];\n purchases: { id: string; vehicleId: string; label: string }[];\n };\n description: string;\n id: string;\n lineCode: string;\n quantity: string;\n unitPriceExclusive: string;\n vatCode: string;\n vatCoefficient: string;\n};\n\nexport type FinanceDocumentV1 = {\n id: string;\n branchId: string;\n version?: 1.0;\n\n type: 'Sale Finance' | 'Purchase Finance';\n subtype: 'Invoice' | 'Credit Note' | 'Proforma' | 'Purchase Order';\n reference: string;\n\n attachment: AttachmentValue;\n lines: FinanceLineV1[];\n accountingOnlyLines?: FinanceLineV1[];\n notes?: string;\n\n createdAt: string;\n createdBy: string;\n issueDate: string;\n paidAt?: string;\n amount?: string;\n dueDate?: string;\n\n organizationSummary?: {\n id: string;\n code: string;\n name: string;\n country: string;\n vatNumber?: string;\n\n addressLine1?: string;\n addressLine2?: string;\n addressLine3?: string;\n postcode?: string;\n city?: string;\n\n email?: string;\n phone?: string;\n fax?: string;\n };\n};\n"]}
@@ -36,11 +36,15 @@ export type SearchFinanceDocument = {
36
36
  };
37
37
  export type SearchAdministrativeDocument = {
38
38
  doc: AdministrativeDocument;
39
+ custom: {
40
+ categorySubtype: 'generic' | 'deal';
41
+ };
39
42
  };
40
43
  export type RelatedDocumentsRequest = {
41
44
  businessEntityId: BusinessEntityIds;
42
45
  recordId: string;
43
46
  docTypes?: DocumentType[];
47
+ subtype?: 'generic' | 'deal';
44
48
  } & PaginatedRequest;
45
49
  export type SearchDocumentDraftDefinitions = {
46
50
  document: PublicSearchDefinition;
@@ -1 +1 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"/","sources":["types/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EACL,sBAAsB,EACtB,aAAa,EACb,YAAY,EACZ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AAqB,CAAC,EAAE,CAAC,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC,EAAE,CAAC;KAC7D,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"search.js","sourceRoot":"/","sources":["types/search.ts"],"names":[],"mappings":"AAiCA,MAAM,CAAN,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC/B,8CAAqB,CAAA;IACrB,gDAAuB,CAAA;AACzB,CAAC,EAHW,qBAAqB,KAArB,qBAAqB,QAGhC","sourcesContent":["import { BusinessEntityIds } from '@bisondesk/commons-sdk/constants';\nimport { PaginatedRequest, SearchPermissions } from '@bisondesk/commons-sdk/types';\nimport { Organization } from '@bisondesk/core-sdk/types/crm';\nimport { PublicSearchDefinition } from '@bisondesk/core-sdk/types/definitions';\nimport { FinanceBooking } from './booking.js';\nimport {\n AdministrativeDocument,\n DocumentDraft,\n DocumentType,\n DraftProcessStage,\n FinanceDocument,\n} from './documents.js';\n\nexport type SearchDocumentVehicleRef = {\n id: string;\n stockNumber: string;\n administrativeNumber?: string;\n};\n\nexport type InputSearchFinanceDocument = SearchFinanceDocument & {\n permissions: SearchPermissions;\n};\n\nexport type InputSearchAdministrativeDocument = SearchAdministrativeDocument;\n\nexport type DocsSearchDefinitions = {\n searchFinanceDoc: PublicSearchDefinition;\n};\n\nexport type AdministrativeDocsSearchDefinitions = {\n searchAdministrativeDoc: PublicSearchDefinition;\n};\n\nexport enum FinanceDocumentSource {\n HyperDMS = 'HyperDMS',\n Bisondesk = 'Bisondesk',\n}\n\nexport type SearchFinanceDocument = {\n permissions: SearchPermissions;\n org?: Organization;\n doc: FinanceDocument;\n booking?: FinanceBooking;\n vehicle?: SearchDocumentVehicleRef[];\n custom: {\n isBooked: boolean;\n source: FinanceDocumentSource;\n };\n};\n\nexport type SearchAdministrativeDocument = {\n doc: AdministrativeDocument;\n};\n\nexport type RelatedDocumentsRequest = {\n businessEntityId: BusinessEntityIds;\n recordId: string;\n docTypes?: DocumentType[];\n} & PaginatedRequest;\n\nexport type SearchDocumentDraftDefinitions = {\n document: PublicSearchDefinition;\n};\n\nexport type SearchDocumentDraft = {\n doc: DocumentDraft;\n permissions: SearchPermissions;\n custom: {\n stage: DraftProcessStage;\n rejected?: boolean;\n validators?: string[];\n validationRulesStatus?: ('passed' | 'failed' | 'skipped')[];\n };\n};\n\nexport type CheckDraftDuplicatesRequest = {\n draftId: string;\n reference: string;\n};\n\nexport type ReindexDraftEvent = {\n id: string;\n tenantId: string;\n};\n"]}
1
+ {"version":3,"file":"search.js","sourceRoot":"/","sources":["types/search.ts"],"names":[],"mappings":"AAiCA,MAAM,CAAN,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC/B,8CAAqB,CAAA;IACrB,gDAAuB,CAAA;AACzB,CAAC,EAHW,qBAAqB,KAArB,qBAAqB,QAGhC","sourcesContent":["import { BusinessEntityIds } from '@bisondesk/commons-sdk/constants';\nimport { PaginatedRequest, SearchPermissions } from '@bisondesk/commons-sdk/types';\nimport { Organization } from '@bisondesk/core-sdk/types/crm';\nimport { PublicSearchDefinition } from '@bisondesk/core-sdk/types/definitions';\nimport { FinanceBooking } from './booking.js';\nimport {\n AdministrativeDocument,\n DocumentDraft,\n DocumentType,\n DraftProcessStage,\n FinanceDocument,\n} from './documents.js';\n\nexport type SearchDocumentVehicleRef = {\n id: string;\n stockNumber: string;\n administrativeNumber?: string;\n};\n\nexport type InputSearchFinanceDocument = SearchFinanceDocument & {\n permissions: SearchPermissions;\n};\n\nexport type InputSearchAdministrativeDocument = SearchAdministrativeDocument;\n\nexport type DocsSearchDefinitions = {\n searchFinanceDoc: PublicSearchDefinition;\n};\n\nexport type AdministrativeDocsSearchDefinitions = {\n searchAdministrativeDoc: PublicSearchDefinition;\n};\n\nexport enum FinanceDocumentSource {\n HyperDMS = 'HyperDMS',\n Bisondesk = 'Bisondesk',\n}\n\nexport type SearchFinanceDocument = {\n permissions: SearchPermissions;\n org?: Organization;\n doc: FinanceDocument;\n booking?: FinanceBooking;\n vehicle?: SearchDocumentVehicleRef[];\n custom: {\n isBooked: boolean;\n source: FinanceDocumentSource;\n };\n};\n\nexport type SearchAdministrativeDocument = {\n doc: AdministrativeDocument;\n custom: {\n categorySubtype: 'generic' | 'deal';\n };\n};\n\nexport type RelatedDocumentsRequest = {\n businessEntityId: BusinessEntityIds;\n recordId: string;\n docTypes?: DocumentType[];\n subtype?: 'generic' | 'deal';\n} & PaginatedRequest;\n\nexport type SearchDocumentDraftDefinitions = {\n document: PublicSearchDefinition;\n};\n\nexport type SearchDocumentDraft = {\n doc: DocumentDraft;\n permissions: SearchPermissions;\n custom: {\n stage: DraftProcessStage;\n rejected?: boolean;\n validators?: string[];\n validationRulesStatus?: ('passed' | 'failed' | 'skipped')[];\n };\n};\n\nexport type CheckDraftDuplicatesRequest = {\n draftId: string;\n reference: string;\n};\n\nexport type ReindexDraftEvent = {\n id: string;\n tenantId: string;\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bisondesk/documents-sdk",
3
- "version": "1.0.364",
3
+ "version": "1.0.366",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -4,15 +4,15 @@ import { getAdminAuth } from '@bisondesk/commons-sdk/fetch';
4
4
  import fetch, { Response } from 'node-fetch';
5
5
  import {
6
6
  CostCenter,
7
- FinanceDocumentCategory,
7
+ DocumentCategory,
8
8
  FinanceDocumentLineCategory,
9
9
  } from '../types/document-categories.js';
10
10
 
11
- export const getFinanceDocumentCategory = async (
11
+ export const getDocumentCategory = async <T extends DocumentCategory>(
12
12
  tenantId: string,
13
13
  branchId: string,
14
14
  docCategoryId: string
15
- ): Promise<FinanceDocumentCategory | undefined> => {
15
+ ): Promise<T | undefined> => {
16
16
  const auth = await getAdminAuth();
17
17
  const response: Response = await fetch(
18
18
  `${process.env.DOCUMENT_DRAFTS_API_ORIGIN}/api/documents/settings/${branchId}/document-categories/${docCategoryId}`,
@@ -1,6 +1,6 @@
1
- import { TENANT_ID_ADMIN_HEADER } from '@bisondesk/commons-sdk/constants';
1
+ import { SERVICE_ID_ADMIN_HEADER, TENANT_ID_ADMIN_HEADER } from '@bisondesk/commons-sdk/constants';
2
2
  import { XError } from '@bisondesk/commons-sdk/errors';
3
- import { getAdminAuth } from '@bisondesk/commons-sdk/fetch';
3
+ import { cleanHeaders, getAdminAuth } from '@bisondesk/commons-sdk/fetch';
4
4
  import { DataRecord, ReferenceData } from '@bisondesk/core-sdk/types/utils';
5
5
  import fetch, { Response } from 'node-fetch';
6
6
  import { FinanceBooking, FinanceBookingPaymentUpdate } from '../types/booking.js';
@@ -34,6 +34,27 @@ export const getFinanceDocument = async (
34
34
  });
35
35
  };
36
36
 
37
+ export const checkDocumentStatus = async (
38
+ tenantId: string,
39
+ documentId: string
40
+ ): Promise<{ status: number }> => {
41
+ const auth = await getAdminAuth();
42
+ const response: Response = await fetch(
43
+ `${process.env.CORE_API_ORIGIN}/api/documents/finance/${documentId}`,
44
+ {
45
+ method: 'HEAD',
46
+ headers: {
47
+ Authorization: auth,
48
+ [TENANT_ID_ADMIN_HEADER]: tenantId,
49
+ },
50
+ }
51
+ );
52
+
53
+ return {
54
+ status: response.status,
55
+ };
56
+ };
57
+
37
58
  export const getFinanceBookingByDocId = async (
38
59
  tenantId: string,
39
60
  documentId: string
@@ -94,20 +115,50 @@ export const upsertFinanceDoc = async <T extends FinanceDocument = FinanceDocume
94
115
  });
95
116
  };
96
117
 
118
+ export const getAdminDocument = async (
119
+ tenantId: string,
120
+ documentId: string
121
+ ): Promise<DataRecord<AdministrativeDocument, ReferenceData> | undefined> => {
122
+ const auth = await getAdminAuth();
123
+ const response: Response = await fetch(
124
+ `${process.env.CORE_API_ORIGIN}/api/documents/administrative/${documentId}`,
125
+ {
126
+ headers: {
127
+ Authorization: auth,
128
+ [TENANT_ID_ADMIN_HEADER]: tenantId,
129
+ },
130
+ }
131
+ );
132
+
133
+ if (response.status === 200) {
134
+ return response.json() as any;
135
+ }
136
+
137
+ const body = await response.text();
138
+ throw new XError('documents-sdk.get-admin-doc-fail', {
139
+ tenantId,
140
+ documentId,
141
+ response: body,
142
+ status: response.status,
143
+ });
144
+ };
145
+
97
146
  export const upsertAdminDoc = async (
98
147
  tenantId: string,
99
- doc: AdministrativeDocument
148
+ doc: AdministrativeDocument,
149
+ opts?: { serviceId: string }
100
150
  ): Promise<AdministrativeDocument> => {
101
151
  const auth = await getAdminAuth();
102
152
  const response: Response = await fetch(
103
153
  `${process.env.CORE_API_ORIGIN}/api/documents/administrative`,
104
154
  {
105
155
  method: 'POST',
106
- headers: {
156
+ headers: cleanHeaders({
107
157
  'Content-Type': 'application/json',
108
158
  Authorization: auth,
109
159
  [TENANT_ID_ADMIN_HEADER]: tenantId,
110
- },
160
+ [SERVICE_ID_ADMIN_HEADER]: opts?.serviceId,
161
+ }),
111
162
  body: JSON.stringify(doc),
112
163
  }
113
164
  );
@@ -159,7 +210,7 @@ export const upsertFinanceBooking = async (
159
210
  export const updateFinanceBookingPayment = async (
160
211
  tenantId: string,
161
212
  update: FinanceBookingPaymentUpdate
162
- ): Promise<FinanceBooking> => {
213
+ ): Promise<FinanceBooking | undefined> => {
163
214
  const auth = await getAdminAuth();
164
215
  const response: Response = await fetch(
165
216
  `${process.env.CORE_API_ORIGIN}/api/documents/finance/booking/payment`,
@@ -174,6 +225,10 @@ export const updateFinanceBookingPayment = async (
174
225
  }
175
226
  );
176
227
 
228
+ if (response.status === 204) {
229
+ return;
230
+ }
231
+
177
232
  if (response.status === 200) {
178
233
  return response.json() as any;
179
234
  }
package/src/constants.ts CHANGED
@@ -2,3 +2,17 @@ import { AppRoles } from '@bisondesk/commons-sdk/constants';
2
2
 
3
3
  export const DOCUMENT_PROCESSING_SETTINGS_ID = 'document-processing';
4
4
  export const PRIVATE_DOCUMENT_ROLES = [AppRoles.Admin, AppRoles.Board, AppRoles.SeniorAccountant];
5
+
6
+ export const HEAVY_VEHICLES_LINE_ID = 'heavy_vehicles';
7
+ export const LIGHT_VEHICLES_LINE_ID = 'light_vehicles';
8
+
9
+ export const SALE_USED_VEHICLES_CATEGORY_ID = 'used_vehicles_sale';
10
+ export const SALE_USED_VEHICLES_COST_CENTER_ID = 'USED';
11
+
12
+ export const SALE_USED_HEAVY_VEHICLES_LINE_ID = `${SALE_USED_VEHICLES_CATEGORY_ID}_${HEAVY_VEHICLES_LINE_ID}`;
13
+ export const SALE_USED_LIGHT_VEHICLES_LINE_ID = `${SALE_USED_VEHICLES_CATEGORY_ID}_${LIGHT_VEHICLES_LINE_ID}`;
14
+
15
+ export const SALE_NEW_VEHICLES_CATEGORY_ID = 'new_vehicles_sale';
16
+ export const SALE_NEW_VEHICLES_COST_CENTER_ID = 'NEW';
17
+
18
+ export const SALE_NEW_HEAVY_VEHICLES_LINE_ID = `${SALE_NEW_VEHICLES_CATEGORY_ID}_${HEAVY_VEHICLES_LINE_ID}`;
package/src/schemas.ts CHANGED
@@ -73,7 +73,7 @@ export const newFinanceDocV2Schema = Joi.object({
73
73
  organizationSummary: orgSummarySchema.required(),
74
74
  transferDescription: Joi.string(),
75
75
  invoiceId: Joi.string().uuid(),
76
- notes: Joi.string(),
76
+ notes: Joi.string().empty(''),
77
77
  salesperson: Joi.object({
78
78
  name: Joi.string().required(),
79
79
  username: Joi.string().required(),
@@ -0,0 +1,30 @@
1
+ export type BankAccountData = {
2
+ name: string;
3
+ iban: string;
4
+ swift: string;
5
+ address: string;
6
+ city: string;
7
+ postCode: string;
8
+ country: string;
9
+ };
10
+
11
+ export type BankAccount = BankAccountData & {
12
+ id: string;
13
+ branchId: string;
14
+ default?: boolean;
15
+
16
+ createdAt: string;
17
+ createdBy: string;
18
+
19
+ updatedAt?: string;
20
+ updatedBy?: string;
21
+ };
22
+
23
+ export type NewBankAccount = Omit<
24
+ BankAccount,
25
+ 'id' | 'createdAt' | 'createdBy' | 'updatedAt' | 'updatedBy'
26
+ >;
27
+
28
+ export type BankAccountDefaultUpdate = {
29
+ id: string;
30
+ };
@@ -36,3 +36,8 @@ export type FinanceBookingPaymentUpdate = {
36
36
  paid: boolean;
37
37
  paidAt?: string;
38
38
  };
39
+
40
+ export type FinanceDocumentPaymentData = {
41
+ documentId: string;
42
+ paidAt?: string;
43
+ };
@@ -21,14 +21,16 @@ type BaseDocumentCategory = {
21
21
 
22
22
  export type AdministrativeDocumentCategory = BaseDocumentCategory & {
23
23
  type: DocumentCategoryType.Administrative;
24
+ subtype: 'generic' | 'deal';
24
25
  };
25
26
 
26
27
  export type FinanceDocumentCategory = BaseDocumentCategory & {
27
28
  type: DocumentCategoryType.Finance;
28
- journal?: string;
29
+ journal: string;
29
30
  visibility: DocumentCategoryVisibility;
30
31
  transactionType: TransactionType;
31
32
  validators?: string[];
33
+ bankAccounts?: string[];
32
34
  };
33
35
 
34
36
  export type DocumentCategory = AdministrativeDocumentCategory | FinanceDocumentCategory;
@@ -1,5 +1,6 @@
1
1
  import { BusinessEntityIds } from '@bisondesk/commons-sdk/constants';
2
2
  import { AttachmentValue, PhoneNumberValue } from '@bisondesk/commons-sdk/types';
3
+ import { BankAccountData } from './bank-accounts.js';
3
4
  import { DocumentCategoryVisibility } from './document-categories.js';
4
5
  import { FinanceDocumentV1 } from './legacy.js';
5
6
 
@@ -85,7 +86,6 @@ export type FinanceDocumentV2 = BaseDocument & {
85
86
  transferDescription?: string; // we ask clients to put this as description of the transfer
86
87
  invoiceId?: string; // mandatory in credit notes but forbidden in invoices
87
88
  issueDate: string;
88
- paymentNotes?: string;
89
89
  lines: FinanceDocumentLine[];
90
90
  accountingLines?: FinanceDocumentLine[];
91
91
  notes?: string;
@@ -108,7 +108,7 @@ export type FinanceDocumentV2 = BaseDocument & {
108
108
  vatAmount: string;
109
109
  };
110
110
 
111
- paidAt?: string;
111
+ paidAt?: string; // ONLY for when accounting integration is not used. Otherwise ALWAYS look at the Finance Booking paidAt
112
112
 
113
113
  reportingPeriod?: string;
114
114
  reportingYear?: string;
@@ -253,22 +253,27 @@ export type NewFinanceDocumentLine = Omit<FinanceDocumentLine, 'id'>;
253
253
 
254
254
  export type FinanceDocumentGenerateRequest = Omit<
255
255
  FinanceDocumentV2,
256
- 'id' | 'attachment' | 'createdAt' | 'createdBy' | 'version' | 'reference' | 'lines' | 'subtype'
256
+ 'id' | 'attachment' | 'createdAt' | 'createdBy' | 'version' | 'reference' | 'lines'
257
257
  > & {
258
- subtype: FinanceDocumentSubtype;
259
258
  lines: NewFinanceDocumentLine[];
259
+ bankAccounts: BankAccountData[];
260
260
  };
261
261
 
262
- // TODO
263
262
  export type DocumentGenerateRequestEvent = {
264
263
  tenantId: string;
264
+ userId: string;
265
265
  docId: string;
266
266
  request: FinanceDocumentGenerateRequest;
267
267
  };
268
268
 
269
269
  export type FinanceDocumentSettings<M = {}> = {
270
270
  provider: string;
271
- meta: M;
271
+ meta: {
272
+ [key in FinanceDocumentSubtype]: {
273
+ prefix: string;
274
+ templateId: string;
275
+ };
276
+ };
272
277
  };
273
278
 
274
279
  export type FinanceDocumentBisondeskSettings = {
@@ -283,8 +288,8 @@ export type FinanceDocumentBisondeskSettings = {
283
288
  };
284
289
 
285
290
  export type FinanceDocumentPayment = { documentId: string } & (
286
- | { paid: true; paidAt: string; comment?: string }
287
- | { paid: false; paidAt?: undefined; comment?: undefined }
291
+ | { paid: true; paidAt: string }
292
+ | { paid: false; paidAt?: undefined }
288
293
  );
289
294
 
290
295
  export enum FinanceDocumentSubtype {
@@ -0,0 +1,26 @@
1
+ import { AttachmentValue } from '@bisondesk/commons-sdk/types';
2
+ import { FinanceDocType, FinanceDocumentSubtype } from './documents.js';
3
+
4
+ export type NewExistingLeasingFinanceDocument = {
5
+ id?: undefined;
6
+ type: FinanceDocType.Sale;
7
+ subtype: FinanceDocumentSubtype.Invoice | FinanceDocumentSubtype.CreditNote;
8
+ issueDate: string;
9
+ contractId: string;
10
+ amountExcl: string;
11
+ paidAt?: string;
12
+ dueDate?: string;
13
+ attachment: AttachmentValue;
14
+ invoiceNumber: string;
15
+ vatPercentage: string;
16
+ period: string;
17
+ description: string;
18
+ };
19
+
20
+ export const LEASING_DOCUMENT_CATEGORY_ID = 'leasing_sale';
21
+ export const LEASING_COST_CENTER_ID = 'leasing_cost_center';
22
+ export enum LeasingFinanceLineCode {
23
+ Residual = 'LEASING_RESIDUAL',
24
+ Deposit = 'LEASING_DEPOSIT',
25
+ Rent = 'LEASING_RENT',
26
+ }
@@ -33,7 +33,6 @@ export type FinanceDocumentV1 = {
33
33
  createdBy: string;
34
34
  issueDate: string;
35
35
  paidAt?: string;
36
- paymentNotes?: string;
37
36
  amount?: string;
38
37
  dueDate?: string;
39
38
 
@@ -50,12 +50,16 @@ export type SearchFinanceDocument = {
50
50
 
51
51
  export type SearchAdministrativeDocument = {
52
52
  doc: AdministrativeDocument;
53
+ custom: {
54
+ categorySubtype: 'generic' | 'deal';
55
+ };
53
56
  };
54
57
 
55
58
  export type RelatedDocumentsRequest = {
56
59
  businessEntityId: BusinessEntityIds;
57
60
  recordId: string;
58
61
  docTypes?: DocumentType[];
62
+ subtype?: 'generic' | 'deal';
59
63
  } & PaginatedRequest;
60
64
 
61
65
  export type SearchDocumentDraftDefinitions = {