@scell/sdk 1.0.0 → 1.4.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/README.md +134 -5
- package/dist/index.d.mts +2502 -170
- package/dist/index.d.ts +2502 -170
- package/dist/index.js +1497 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1497 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +79 -1
- package/src/index.ts +17 -1
- package/src/resources/billing.ts +49 -0
- package/src/resources/fiscal.ts +128 -0
- package/src/resources/invoices.ts +217 -0
- package/src/resources/stats.ts +29 -0
- package/src/resources/sub-tenants.ts +41 -0
- package/src/resources/tenant-credit-notes.ts +301 -0
- package/src/resources/tenant-direct-credit-notes.ts +360 -0
- package/src/resources/tenant-direct-invoices.ts +424 -0
- package/src/resources/tenant-incoming-invoices.ts +429 -0
- package/src/tenant-client.ts +105 -0
- package/src/types/billing.ts +73 -0
- package/src/types/fiscal.ts +251 -0
- package/src/types/index.ts +112 -0
- package/src/types/invoices.ts +91 -0
- package/src/types/stats.ts +37 -0
- package/src/types/sub-tenants.ts +57 -0
- package/src/types/tenant-credit-notes.ts +128 -0
- package/src/types/tenant-invoices.ts +390 -0
- package/src/types/tenant-profile.ts +51 -0
- package/src/types/webhooks.ts +30 -1
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fiscal Compliance Types
|
|
3
|
+
*
|
|
4
|
+
* Types for the fiscal compliance API (LF 2026).
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// ── Compliance Dashboard ────────────────────────────────────
|
|
10
|
+
|
|
11
|
+
export interface FiscalComplianceData {
|
|
12
|
+
closing_coverage_percent: number;
|
|
13
|
+
chain_integrity_percent: number;
|
|
14
|
+
open_incidents: FiscalIncident[];
|
|
15
|
+
open_incidents_count: number;
|
|
16
|
+
overall_status: FiscalComplianceStatus;
|
|
17
|
+
last_integrity_check_at: string | null;
|
|
18
|
+
last_closing_at: string | null;
|
|
19
|
+
last_closing_date: string | null;
|
|
20
|
+
total_fiscal_entries: number;
|
|
21
|
+
days_with_activity: number;
|
|
22
|
+
days_closed: number;
|
|
23
|
+
attestation_status: FiscalAttestationStatus;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type FiscalComplianceStatus = 'CONFORME' | 'ALERTE' | 'NON_CONFORME';
|
|
27
|
+
|
|
28
|
+
export interface FiscalIncident {
|
|
29
|
+
type: string;
|
|
30
|
+
severity: 'critical' | 'warning' | 'info';
|
|
31
|
+
message: string;
|
|
32
|
+
since?: string;
|
|
33
|
+
count?: number;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface FiscalAttestationStatus {
|
|
37
|
+
current: boolean;
|
|
38
|
+
software_version: string;
|
|
39
|
+
attestation_version: string | null;
|
|
40
|
+
needs_renewal: boolean;
|
|
41
|
+
reason: string | null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// ── Integrity ───────────────────────────────────────────────
|
|
45
|
+
|
|
46
|
+
export interface FiscalIntegrityReport {
|
|
47
|
+
is_valid: boolean;
|
|
48
|
+
entries_checked: number;
|
|
49
|
+
broken_links: number;
|
|
50
|
+
details?: Record<string, unknown>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface FiscalIntegrityCheck {
|
|
54
|
+
id: string;
|
|
55
|
+
tenant_id: string;
|
|
56
|
+
result: 'passed' | 'failed';
|
|
57
|
+
entries_checked: number;
|
|
58
|
+
broken_links: number;
|
|
59
|
+
details?: Record<string, unknown>;
|
|
60
|
+
created_at: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface FiscalIntegrityOptions {
|
|
64
|
+
date_from?: string;
|
|
65
|
+
date_to?: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface FiscalIntegrityHistoryOptions {
|
|
69
|
+
per_page?: number;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// ── Closings ────────────────────────────────────────────────
|
|
73
|
+
|
|
74
|
+
export interface FiscalClosing {
|
|
75
|
+
id: string;
|
|
76
|
+
tenant_id: string;
|
|
77
|
+
closing_date: string;
|
|
78
|
+
closing_type: string;
|
|
79
|
+
status: string;
|
|
80
|
+
entries_count: number;
|
|
81
|
+
total_debit: number;
|
|
82
|
+
total_credit: number;
|
|
83
|
+
chain_hash?: string;
|
|
84
|
+
environment?: string;
|
|
85
|
+
created_at?: string;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface FiscalClosingsOptions {
|
|
89
|
+
limit?: number;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface FiscalDailyClosingInput {
|
|
93
|
+
date?: string;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// ── FEC Export ───────────────────────────────────────────────
|
|
97
|
+
|
|
98
|
+
export interface FiscalFecExportOptions {
|
|
99
|
+
start_date: string;
|
|
100
|
+
end_date: string;
|
|
101
|
+
format?: 'pipe' | 'tab';
|
|
102
|
+
download?: boolean;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface FiscalFecExportResult {
|
|
106
|
+
period: {
|
|
107
|
+
start_date: string;
|
|
108
|
+
end_date: string;
|
|
109
|
+
};
|
|
110
|
+
format: string;
|
|
111
|
+
file_path: string;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// ── Attestation ─────────────────────────────────────────────
|
|
115
|
+
|
|
116
|
+
export interface FiscalAttestation {
|
|
117
|
+
year: number;
|
|
118
|
+
tenant_name: string;
|
|
119
|
+
software_version: string;
|
|
120
|
+
compliance: Record<string, unknown>;
|
|
121
|
+
generated_at?: string;
|
|
122
|
+
certificate_hash?: string;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// ── Entries (Ledger) ────────────────────────────────────────
|
|
126
|
+
|
|
127
|
+
export interface FiscalEntry {
|
|
128
|
+
id: string;
|
|
129
|
+
tenant_id: string;
|
|
130
|
+
sequence_number: number;
|
|
131
|
+
entry_type: string;
|
|
132
|
+
fiscal_date: string;
|
|
133
|
+
entity_type?: string | null;
|
|
134
|
+
entity_id?: string | null;
|
|
135
|
+
data_snapshot?: Record<string, unknown> | null;
|
|
136
|
+
data_hash?: string;
|
|
137
|
+
previous_hash?: string;
|
|
138
|
+
chain_hash?: string;
|
|
139
|
+
environment?: string;
|
|
140
|
+
legal_status?: string;
|
|
141
|
+
created_at?: string;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export interface FiscalEntriesOptions {
|
|
145
|
+
date_from?: string;
|
|
146
|
+
date_to?: string;
|
|
147
|
+
entry_type?: string;
|
|
148
|
+
environment?: 'production' | 'sandbox';
|
|
149
|
+
per_page?: number;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// ── Kill Switch ─────────────────────────────────────────────
|
|
153
|
+
|
|
154
|
+
export interface FiscalKillSwitchStatus {
|
|
155
|
+
is_active: boolean;
|
|
156
|
+
kill_switch: FiscalKillSwitch | null;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export interface FiscalKillSwitch {
|
|
160
|
+
id: string;
|
|
161
|
+
tenant_id: string;
|
|
162
|
+
is_active: boolean;
|
|
163
|
+
activated_at: string;
|
|
164
|
+
reason: string;
|
|
165
|
+
activated_by: string;
|
|
166
|
+
deactivated_at?: string | null;
|
|
167
|
+
deactivated_by?: string | null;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export interface FiscalKillSwitchActivateInput {
|
|
171
|
+
reason: string;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// ── Anchors ─────────────────────────────────────────────────
|
|
175
|
+
|
|
176
|
+
export interface FiscalAnchor {
|
|
177
|
+
id: string;
|
|
178
|
+
tenant_id: string;
|
|
179
|
+
anchor_type: string;
|
|
180
|
+
source_hash: string;
|
|
181
|
+
anchor_reference?: string | null;
|
|
182
|
+
anchor_provider?: string | null;
|
|
183
|
+
anchored_at?: string | null;
|
|
184
|
+
created_at?: string;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export interface FiscalAnchorsOptions {
|
|
188
|
+
limit?: number;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// ── Rules ───────────────────────────────────────────────────
|
|
192
|
+
|
|
193
|
+
export type FiscalRuleCategory = 'vat' | 'invoicing' | 'credit_note' | 'closing' | 'export';
|
|
194
|
+
|
|
195
|
+
export interface FiscalRule {
|
|
196
|
+
id: string;
|
|
197
|
+
rule_key: string;
|
|
198
|
+
name: string;
|
|
199
|
+
category: FiscalRuleCategory;
|
|
200
|
+
rule_definition: Record<string, unknown>;
|
|
201
|
+
version: number;
|
|
202
|
+
effective_from: string;
|
|
203
|
+
effective_until?: string | null;
|
|
204
|
+
legal_reference?: string | null;
|
|
205
|
+
tenant_id?: string | null;
|
|
206
|
+
description?: string | null;
|
|
207
|
+
is_active: boolean;
|
|
208
|
+
created_at?: string;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export interface FiscalRulesOptions {
|
|
212
|
+
date?: string;
|
|
213
|
+
category?: FiscalRuleCategory;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export interface FiscalCreateRuleInput {
|
|
217
|
+
rule_key: string;
|
|
218
|
+
name: string;
|
|
219
|
+
category: FiscalRuleCategory;
|
|
220
|
+
rule_definition: Record<string, unknown>;
|
|
221
|
+
effective_from: string;
|
|
222
|
+
effective_until?: string;
|
|
223
|
+
legal_reference?: string;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export interface FiscalUpdateRuleInput {
|
|
227
|
+
rule_definition: Record<string, unknown>;
|
|
228
|
+
effective_from?: string;
|
|
229
|
+
effective_until?: string;
|
|
230
|
+
legal_reference?: string;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export interface FiscalExportRulesOptions {
|
|
234
|
+
start_date: string;
|
|
235
|
+
end_date: string;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export interface FiscalReplayRulesInput {
|
|
239
|
+
start_date: string;
|
|
240
|
+
end_date: string;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// ── Forensic Export ─────────────────────────────────────────
|
|
244
|
+
|
|
245
|
+
export type FiscalForensicExportType = 'chronology' | 'graph' | 'report';
|
|
246
|
+
|
|
247
|
+
export interface FiscalForensicExportOptions {
|
|
248
|
+
start_date: string;
|
|
249
|
+
end_date: string;
|
|
250
|
+
type?: FiscalForensicExportType;
|
|
251
|
+
}
|
package/src/types/index.ts
CHANGED
|
@@ -26,20 +26,28 @@ export type {
|
|
|
26
26
|
|
|
27
27
|
// Invoice types
|
|
28
28
|
export type {
|
|
29
|
+
AcceptInvoiceInput,
|
|
29
30
|
AuditTrailEntry,
|
|
30
31
|
AuditTrailResponse,
|
|
31
32
|
ConvertInvoiceInput,
|
|
32
33
|
CreateInvoiceInput,
|
|
34
|
+
DisputeInvoiceInput,
|
|
35
|
+
DisputeType,
|
|
36
|
+
IncomingInvoiceParams,
|
|
33
37
|
Invoice,
|
|
34
38
|
InvoiceDirection,
|
|
35
39
|
InvoiceDownloadResponse,
|
|
36
40
|
InvoiceDownloadType,
|
|
41
|
+
InvoiceFileFormat,
|
|
37
42
|
InvoiceFormat,
|
|
38
43
|
InvoiceLine,
|
|
39
44
|
InvoiceLineInput,
|
|
40
45
|
InvoiceListOptions,
|
|
41
46
|
InvoiceParty,
|
|
42
47
|
InvoiceStatus,
|
|
48
|
+
MarkPaidInput,
|
|
49
|
+
RejectInvoiceInput,
|
|
50
|
+
RejectionCode,
|
|
43
51
|
} from './invoices.js';
|
|
44
52
|
|
|
45
53
|
// Signature types
|
|
@@ -85,6 +93,7 @@ export type {
|
|
|
85
93
|
export type {
|
|
86
94
|
BalanceWebhookData,
|
|
87
95
|
CreateWebhookInput,
|
|
96
|
+
InvoiceIncomingPaidPayload,
|
|
88
97
|
InvoiceWebhookData,
|
|
89
98
|
SignatureWebhookData,
|
|
90
99
|
UpdateWebhookInput,
|
|
@@ -113,3 +122,106 @@ export type {
|
|
|
113
122
|
ResetPasswordInput,
|
|
114
123
|
User,
|
|
115
124
|
} from './auth.js';
|
|
125
|
+
|
|
126
|
+
// Tenant Credit Notes types
|
|
127
|
+
export type {
|
|
128
|
+
CreateTenantCreditNoteInput,
|
|
129
|
+
RemainingCreditable,
|
|
130
|
+
RemainingCreditableLine,
|
|
131
|
+
TenantCreditNote,
|
|
132
|
+
TenantCreditNoteItem,
|
|
133
|
+
TenantCreditNoteItemInput,
|
|
134
|
+
TenantCreditNoteListOptions,
|
|
135
|
+
TenantCreditNoteStatus,
|
|
136
|
+
TenantCreditNoteType,
|
|
137
|
+
UpdateTenantCreditNoteInput,
|
|
138
|
+
} from './tenant-credit-notes.js';
|
|
139
|
+
|
|
140
|
+
// Tenant Invoices types (multi-tenant)
|
|
141
|
+
export type {
|
|
142
|
+
CreateIncomingInvoiceParams,
|
|
143
|
+
CreateTenantDirectCreditNoteParams,
|
|
144
|
+
CreateTenantDirectInvoiceParams,
|
|
145
|
+
TenantCreditNoteFilters,
|
|
146
|
+
TenantInvoice,
|
|
147
|
+
TenantInvoiceBuyer,
|
|
148
|
+
TenantInvoiceDirection,
|
|
149
|
+
TenantInvoiceFilters,
|
|
150
|
+
TenantInvoiceSeller,
|
|
151
|
+
UpdateTenantCreditNoteParams,
|
|
152
|
+
UpdateTenantInvoiceParams,
|
|
153
|
+
} from './tenant-invoices.js';
|
|
154
|
+
|
|
155
|
+
// Fiscal types
|
|
156
|
+
export type {
|
|
157
|
+
FiscalAnchor,
|
|
158
|
+
FiscalAnchorsOptions,
|
|
159
|
+
FiscalAttestation,
|
|
160
|
+
FiscalAttestationStatus,
|
|
161
|
+
FiscalClosing,
|
|
162
|
+
FiscalClosingsOptions,
|
|
163
|
+
FiscalComplianceData,
|
|
164
|
+
FiscalComplianceStatus,
|
|
165
|
+
FiscalCreateRuleInput,
|
|
166
|
+
FiscalDailyClosingInput,
|
|
167
|
+
FiscalEntriesOptions,
|
|
168
|
+
FiscalEntry,
|
|
169
|
+
FiscalExportRulesOptions,
|
|
170
|
+
FiscalFecExportOptions,
|
|
171
|
+
FiscalFecExportResult,
|
|
172
|
+
FiscalForensicExportOptions,
|
|
173
|
+
FiscalForensicExportType,
|
|
174
|
+
FiscalIncident,
|
|
175
|
+
FiscalIntegrityCheck,
|
|
176
|
+
FiscalIntegrityHistoryOptions,
|
|
177
|
+
FiscalIntegrityOptions,
|
|
178
|
+
FiscalIntegrityReport,
|
|
179
|
+
FiscalKillSwitch,
|
|
180
|
+
FiscalKillSwitchActivateInput,
|
|
181
|
+
FiscalKillSwitchStatus,
|
|
182
|
+
FiscalReplayRulesInput,
|
|
183
|
+
FiscalRule,
|
|
184
|
+
FiscalRuleCategory,
|
|
185
|
+
FiscalRulesOptions,
|
|
186
|
+
FiscalUpdateRuleInput,
|
|
187
|
+
} from './fiscal.js';
|
|
188
|
+
|
|
189
|
+
// Billing types
|
|
190
|
+
export type {
|
|
191
|
+
BillingInvoice,
|
|
192
|
+
BillingInvoiceLine,
|
|
193
|
+
BillingInvoiceListOptions,
|
|
194
|
+
BillingTopUpConfirmInput,
|
|
195
|
+
BillingTopUpInput,
|
|
196
|
+
BillingTransaction,
|
|
197
|
+
BillingTransactionListOptions,
|
|
198
|
+
BillingUsage,
|
|
199
|
+
BillingUsageOptions,
|
|
200
|
+
} from './billing.js';
|
|
201
|
+
|
|
202
|
+
// Stats types
|
|
203
|
+
export type {
|
|
204
|
+
StatsMonthly,
|
|
205
|
+
StatsMonthlyOptions,
|
|
206
|
+
StatsOverview,
|
|
207
|
+
StatsOverviewOptions,
|
|
208
|
+
} from './stats.js';
|
|
209
|
+
|
|
210
|
+
// Sub-Tenant types
|
|
211
|
+
export type {
|
|
212
|
+
CreateSubTenantInput,
|
|
213
|
+
SubTenant,
|
|
214
|
+
SubTenantAddress,
|
|
215
|
+
SubTenantListOptions,
|
|
216
|
+
UpdateSubTenantInput,
|
|
217
|
+
} from './sub-tenants.js';
|
|
218
|
+
|
|
219
|
+
// Tenant Profile types
|
|
220
|
+
export type {
|
|
221
|
+
RegenerateKeyResult,
|
|
222
|
+
TenantBalance,
|
|
223
|
+
TenantProfile,
|
|
224
|
+
TenantAddress,
|
|
225
|
+
TenantQuickStats,
|
|
226
|
+
UpdateTenantProfileInput,
|
|
227
|
+
} from './tenant-profile.js';
|
package/src/types/invoices.ts
CHANGED
|
@@ -29,6 +29,9 @@ export type InvoiceStatus =
|
|
|
29
29
|
| 'transmitted'
|
|
30
30
|
| 'accepted'
|
|
31
31
|
| 'rejected'
|
|
32
|
+
| 'paid'
|
|
33
|
+
| 'disputed'
|
|
34
|
+
| 'cancelled'
|
|
32
35
|
| 'error';
|
|
33
36
|
|
|
34
37
|
/**
|
|
@@ -86,6 +89,12 @@ export interface Invoice {
|
|
|
86
89
|
validated_at: DateTimeString | null;
|
|
87
90
|
transmitted_at: DateTimeString | null;
|
|
88
91
|
completed_at: DateTimeString | null;
|
|
92
|
+
/** Date when the invoice was marked as paid (ISO 8601) */
|
|
93
|
+
paid_at: DateTimeString | null;
|
|
94
|
+
/** Payment reference (bank transfer ID, check number, etc.) */
|
|
95
|
+
payment_reference: string | null;
|
|
96
|
+
/** Optional note about the payment */
|
|
97
|
+
payment_note: string | null;
|
|
89
98
|
}
|
|
90
99
|
|
|
91
100
|
/**
|
|
@@ -189,3 +198,85 @@ export interface AuditTrailResponse {
|
|
|
189
198
|
data: AuditTrailEntry[];
|
|
190
199
|
integrity_valid: boolean;
|
|
191
200
|
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Incoming invoice list filter options
|
|
204
|
+
*/
|
|
205
|
+
export interface IncomingInvoiceParams {
|
|
206
|
+
status?: InvoiceStatus | undefined;
|
|
207
|
+
seller_siret?: Siret | undefined;
|
|
208
|
+
from?: DateString | undefined;
|
|
209
|
+
to?: DateString | undefined;
|
|
210
|
+
min_amount?: number | undefined;
|
|
211
|
+
max_amount?: number | undefined;
|
|
212
|
+
page?: number | undefined;
|
|
213
|
+
per_page?: number | undefined;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Rejection reason code for incoming invoices
|
|
218
|
+
*/
|
|
219
|
+
export type RejectionCode =
|
|
220
|
+
| 'incorrect_amount'
|
|
221
|
+
| 'duplicate'
|
|
222
|
+
| 'unknown_order'
|
|
223
|
+
| 'incorrect_vat'
|
|
224
|
+
| 'other';
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Dispute type for incoming invoices
|
|
228
|
+
*/
|
|
229
|
+
export type DisputeType =
|
|
230
|
+
| 'amount_dispute'
|
|
231
|
+
| 'quality_dispute'
|
|
232
|
+
| 'delivery_dispute'
|
|
233
|
+
| 'other';
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Input for accepting an incoming invoice
|
|
237
|
+
*/
|
|
238
|
+
export interface AcceptInvoiceInput {
|
|
239
|
+
/** Expected payment date (YYYY-MM-DD) */
|
|
240
|
+
payment_date?: DateString | undefined;
|
|
241
|
+
/** Optional note about the acceptance */
|
|
242
|
+
note?: string | undefined;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Input for rejecting an incoming invoice
|
|
247
|
+
*/
|
|
248
|
+
export interface RejectInvoiceInput {
|
|
249
|
+
/** Reason for rejection */
|
|
250
|
+
reason: string;
|
|
251
|
+
/** Standardized rejection code */
|
|
252
|
+
reason_code: RejectionCode;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Input for disputing an incoming invoice
|
|
257
|
+
*/
|
|
258
|
+
export interface DisputeInvoiceInput {
|
|
259
|
+
/** Reason for the dispute */
|
|
260
|
+
reason: string;
|
|
261
|
+
/** Type of dispute */
|
|
262
|
+
dispute_type: DisputeType;
|
|
263
|
+
/** Expected correct amount (if amount dispute) */
|
|
264
|
+
expected_amount?: number | undefined;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Input for marking an incoming invoice as paid
|
|
269
|
+
*/
|
|
270
|
+
export interface MarkPaidInput {
|
|
271
|
+
/** Payment reference (bank transfer ID, check number, etc.) */
|
|
272
|
+
payment_reference?: string | undefined;
|
|
273
|
+
/** Payment date (ISO 8601) - defaults to current date/time if not provided */
|
|
274
|
+
paid_at?: DateTimeString | undefined;
|
|
275
|
+
/** Optional note about the payment */
|
|
276
|
+
note?: string | undefined;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Invoice file download format
|
|
281
|
+
*/
|
|
282
|
+
export type InvoiceFileFormat = 'pdf' | 'xml';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stats Types
|
|
3
|
+
*
|
|
4
|
+
* Types for the tenant statistics API.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export interface StatsOverview {
|
|
10
|
+
total_invoices: number;
|
|
11
|
+
total_credit_notes: number;
|
|
12
|
+
total_revenue: number;
|
|
13
|
+
total_expenses: number;
|
|
14
|
+
active_sub_tenants: number;
|
|
15
|
+
currency: string;
|
|
16
|
+
status_breakdown?: Record<string, number> | null;
|
|
17
|
+
period_comparison?: Record<string, unknown> | null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface StatsMonthly {
|
|
21
|
+
month: string;
|
|
22
|
+
invoices_count: number;
|
|
23
|
+
credit_notes_count: number;
|
|
24
|
+
revenue: number;
|
|
25
|
+
expenses: number;
|
|
26
|
+
daily_breakdown?: Record<string, unknown>[] | null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface StatsOverviewOptions {
|
|
30
|
+
period?: string;
|
|
31
|
+
currency?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface StatsMonthlyOptions {
|
|
35
|
+
year?: number;
|
|
36
|
+
month?: number;
|
|
37
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sub-Tenant Types
|
|
3
|
+
*
|
|
4
|
+
* Types for the sub-tenant management API.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export interface SubTenant {
|
|
10
|
+
id: string;
|
|
11
|
+
external_id?: string | null;
|
|
12
|
+
name: string;
|
|
13
|
+
siret?: string | null;
|
|
14
|
+
siren?: string | null;
|
|
15
|
+
email?: string | null;
|
|
16
|
+
phone?: string | null;
|
|
17
|
+
address?: SubTenantAddress | null;
|
|
18
|
+
metadata?: Record<string, unknown> | null;
|
|
19
|
+
created_at?: string;
|
|
20
|
+
updated_at?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface SubTenantAddress {
|
|
24
|
+
line1: string;
|
|
25
|
+
line2?: string;
|
|
26
|
+
postal_code: string;
|
|
27
|
+
city: string;
|
|
28
|
+
country?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface SubTenantListOptions {
|
|
32
|
+
per_page?: number;
|
|
33
|
+
page?: number;
|
|
34
|
+
search?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface CreateSubTenantInput {
|
|
38
|
+
external_id?: string;
|
|
39
|
+
name: string;
|
|
40
|
+
siret?: string;
|
|
41
|
+
siren?: string;
|
|
42
|
+
email?: string;
|
|
43
|
+
phone?: string;
|
|
44
|
+
address?: SubTenantAddress;
|
|
45
|
+
metadata?: Record<string, unknown>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface UpdateSubTenantInput {
|
|
49
|
+
external_id?: string;
|
|
50
|
+
name?: string;
|
|
51
|
+
siret?: string;
|
|
52
|
+
siren?: string;
|
|
53
|
+
email?: string;
|
|
54
|
+
phone?: string;
|
|
55
|
+
address?: SubTenantAddress;
|
|
56
|
+
metadata?: Record<string, unknown>;
|
|
57
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tenant Credit Notes types
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type {
|
|
8
|
+
CurrencyCode,
|
|
9
|
+
DateString,
|
|
10
|
+
DateTimeString,
|
|
11
|
+
PaginationOptions,
|
|
12
|
+
Siret,
|
|
13
|
+
UUID,
|
|
14
|
+
} from './common.js';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Credit note status
|
|
18
|
+
*/
|
|
19
|
+
export type TenantCreditNoteStatus = 'draft' | 'sent' | 'cancelled';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Credit note type
|
|
23
|
+
*/
|
|
24
|
+
export type TenantCreditNoteType = 'partial' | 'total';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Credit note item
|
|
28
|
+
*/
|
|
29
|
+
export interface TenantCreditNoteItem {
|
|
30
|
+
id: UUID;
|
|
31
|
+
invoice_line_id?: UUID | undefined;
|
|
32
|
+
description: string;
|
|
33
|
+
quantity: number;
|
|
34
|
+
unit_price: number;
|
|
35
|
+
tax_rate: number;
|
|
36
|
+
total: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Tenant Credit Note
|
|
41
|
+
*/
|
|
42
|
+
export interface TenantCreditNote {
|
|
43
|
+
id: UUID;
|
|
44
|
+
credit_note_number: string;
|
|
45
|
+
invoice_id: UUID;
|
|
46
|
+
tenant_id: UUID;
|
|
47
|
+
sub_tenant_id: UUID;
|
|
48
|
+
status: TenantCreditNoteStatus;
|
|
49
|
+
type: TenantCreditNoteType;
|
|
50
|
+
reason: string;
|
|
51
|
+
subtotal: number;
|
|
52
|
+
tax_amount: number;
|
|
53
|
+
total: number;
|
|
54
|
+
currency: CurrencyCode;
|
|
55
|
+
buyer_name?: string | undefined;
|
|
56
|
+
buyer_siret?: Siret | undefined;
|
|
57
|
+
seller_name?: string | undefined;
|
|
58
|
+
seller_siret?: Siret | undefined;
|
|
59
|
+
issue_date: DateString;
|
|
60
|
+
created_at: DateTimeString;
|
|
61
|
+
updated_at: DateTimeString;
|
|
62
|
+
items?: TenantCreditNoteItem[] | undefined;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Credit note item input for creation
|
|
67
|
+
*/
|
|
68
|
+
export interface TenantCreditNoteItemInput {
|
|
69
|
+
invoice_line_id: UUID;
|
|
70
|
+
quantity?: number | undefined;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Input for creating a tenant credit note
|
|
75
|
+
*/
|
|
76
|
+
export interface CreateTenantCreditNoteInput {
|
|
77
|
+
invoice_id: UUID;
|
|
78
|
+
reason: string;
|
|
79
|
+
type: TenantCreditNoteType;
|
|
80
|
+
items?: TenantCreditNoteItemInput[] | undefined;
|
|
81
|
+
metadata?: Record<string, unknown> | undefined;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Line item remaining creditable information
|
|
86
|
+
*/
|
|
87
|
+
export interface RemainingCreditableLine {
|
|
88
|
+
invoice_line_id: UUID;
|
|
89
|
+
description: string;
|
|
90
|
+
original_quantity: number;
|
|
91
|
+
credited_quantity: number;
|
|
92
|
+
remaining_quantity: number;
|
|
93
|
+
unit_price: number;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Remaining creditable information for an invoice
|
|
98
|
+
*/
|
|
99
|
+
export interface RemainingCreditable {
|
|
100
|
+
invoice_id: UUID;
|
|
101
|
+
invoice_total: number;
|
|
102
|
+
credited_total: number;
|
|
103
|
+
remaining_total: number;
|
|
104
|
+
lines: RemainingCreditableLine[];
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* List options for tenant credit notes
|
|
109
|
+
*/
|
|
110
|
+
export interface TenantCreditNoteListOptions extends PaginationOptions {
|
|
111
|
+
status?: TenantCreditNoteStatus | undefined;
|
|
112
|
+
date_from?: DateString | undefined;
|
|
113
|
+
date_to?: DateString | undefined;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Input for updating a tenant credit note
|
|
118
|
+
*
|
|
119
|
+
* Only credit notes in 'draft' status can be updated.
|
|
120
|
+
*/
|
|
121
|
+
export interface UpdateTenantCreditNoteInput {
|
|
122
|
+
/** Updated reason for the credit note */
|
|
123
|
+
reason?: string | undefined;
|
|
124
|
+
/** Updated items (for partial credit notes) */
|
|
125
|
+
items?: TenantCreditNoteItemInput[] | undefined;
|
|
126
|
+
/** Updated metadata */
|
|
127
|
+
metadata?: Record<string, unknown> | undefined;
|
|
128
|
+
}
|