@bisondesk/core-sdk 1.0.299 → 1.0.300
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/cjs/apis/leasing.js +1 -16
- package/lib/cjs/apis/leasing.js.map +1 -1
- package/lib/cjs/types/documents.js +2 -3
- package/lib/cjs/types/documents.js.map +1 -1
- package/lib/esm/apis/leasing.js +0 -14
- package/lib/esm/apis/leasing.js.map +1 -1
- package/lib/esm/types/documents.js +2 -3
- package/lib/esm/types/documents.js.map +1 -1
- package/lib/tsconfig.cjs.tsbuildinfo +1 -1
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/types/apis/leasing.d.ts +0 -6
- package/lib/types/apis/leasing.d.ts.map +1 -1
- package/lib/types/types/documents.d.ts +33 -3
- package/lib/types/types/documents.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/apis/leasing.ts +0 -32
- package/src/types/documents.ts +29 -4
package/src/apis/leasing.ts
CHANGED
|
@@ -202,38 +202,6 @@ export const upsertLeasingContract = async (
|
|
|
202
202
|
throw new XError(response.statusText, { tenantId, contract, body });
|
|
203
203
|
};
|
|
204
204
|
|
|
205
|
-
export const computeFinanceDocLeasingAmounts = async (
|
|
206
|
-
tenantId: string,
|
|
207
|
-
contractId: string,
|
|
208
|
-
documentId: string
|
|
209
|
-
): Promise<
|
|
210
|
-
| {
|
|
211
|
-
totalAmountExcl: string;
|
|
212
|
-
totalCapital: string;
|
|
213
|
-
totalInterest: string;
|
|
214
|
-
totalOthers: string;
|
|
215
|
-
}
|
|
216
|
-
| undefined
|
|
217
|
-
> => {
|
|
218
|
-
const auth = await getAdminAuth();
|
|
219
|
-
const response: Response = await fetch(
|
|
220
|
-
`${process.env.CORE_API_ORIGIN}/api/leasing/doc/${documentId}/amounts`,
|
|
221
|
-
{
|
|
222
|
-
headers: {
|
|
223
|
-
Authorization: auth,
|
|
224
|
-
[TENANT_ID_ADMIN_HEADER]: tenantId,
|
|
225
|
-
},
|
|
226
|
-
}
|
|
227
|
-
);
|
|
228
|
-
|
|
229
|
-
if (response.status === 200) {
|
|
230
|
-
return response.json();
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
const body = await response.text();
|
|
234
|
-
throw new XError(response.statusText, { tenantId, contractId, body });
|
|
235
|
-
};
|
|
236
|
-
|
|
237
205
|
export const getLeasingAmortizations = async (
|
|
238
206
|
tenantId: string,
|
|
239
207
|
contractId: string
|
package/src/types/documents.ts
CHANGED
|
@@ -3,9 +3,8 @@ import { Organization } from './crm';
|
|
|
3
3
|
import { PublicSearchDefinition } from './definitions';
|
|
4
4
|
|
|
5
5
|
export enum FinanceDocumentActions {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
DELETE_FINANCE_DOCUMENT = 'delete_existing_invoice',
|
|
6
|
+
PAY_FINANCE_DOCUMENT = 'pay_finance_document',
|
|
7
|
+
DELETE_FINANCE_DOCUMENT = 'delete_finance_document',
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
export type FinanceLine = {
|
|
@@ -23,6 +22,22 @@ export type FinanceLine = {
|
|
|
23
22
|
vatCoefficient: string;
|
|
24
23
|
};
|
|
25
24
|
|
|
25
|
+
export type NewExistingLeasingFinanceDocument = {
|
|
26
|
+
id?: undefined;
|
|
27
|
+
type: 'Sale Finance';
|
|
28
|
+
subtype: 'Invoice' | 'Credit Note';
|
|
29
|
+
issueDate: string;
|
|
30
|
+
contractId: string;
|
|
31
|
+
amount: string;
|
|
32
|
+
paidAt?: string;
|
|
33
|
+
dueDate?: string;
|
|
34
|
+
attachment: AttachmentValue;
|
|
35
|
+
invoiceNumber: string;
|
|
36
|
+
vatPercentage: string;
|
|
37
|
+
period: string;
|
|
38
|
+
description: string;
|
|
39
|
+
};
|
|
40
|
+
|
|
26
41
|
export type FinanceDocument = {
|
|
27
42
|
id: string;
|
|
28
43
|
branchId: string;
|
|
@@ -38,6 +53,10 @@ export type FinanceDocument = {
|
|
|
38
53
|
createdAt: string;
|
|
39
54
|
createdBy: string;
|
|
40
55
|
issueDate: string;
|
|
56
|
+
paidAt?: string;
|
|
57
|
+
paymentNotes?: string;
|
|
58
|
+
amount?: string;
|
|
59
|
+
dueDate?: string;
|
|
41
60
|
|
|
42
61
|
organizationSummary?: {
|
|
43
62
|
id: string;
|
|
@@ -61,6 +80,7 @@ export type FinanceDocument = {
|
|
|
61
80
|
export type FinanceDocumentEvent = {
|
|
62
81
|
id: string;
|
|
63
82
|
actionAt: string;
|
|
83
|
+
action: 'upsert' | 'delete';
|
|
64
84
|
userId: string;
|
|
65
85
|
tenantId: string;
|
|
66
86
|
type: 'Sale Finance' | 'Purchase Finance';
|
|
@@ -78,7 +98,7 @@ export type FinanceBookingEvent = {
|
|
|
78
98
|
|
|
79
99
|
export type FinanceBooking = {
|
|
80
100
|
branchId: string; // same tenantId can have different companies
|
|
81
|
-
bookingNumber: string; // same booking number can and will exist across different "branches"
|
|
101
|
+
bookingNumber: string; // same booking number can and will exist across different "branches", unique => BranchId / Journal / Booking Number
|
|
82
102
|
documentId: string;
|
|
83
103
|
|
|
84
104
|
booked: true;
|
|
@@ -114,3 +134,8 @@ export type InputSearchFinanceDocument = SearchFinanceDocument & {
|
|
|
114
134
|
export type DocsSearchDefinitions = {
|
|
115
135
|
searchFinanceDoc: PublicSearchDefinition;
|
|
116
136
|
};
|
|
137
|
+
|
|
138
|
+
export type FinanceDocumentPayment = { documentId: string } & (
|
|
139
|
+
| { paid: true; paidAt: string; comment?: string }
|
|
140
|
+
| { paid: false; paidAt?: undefined; comment?: undefined }
|
|
141
|
+
);
|