@voyantjs/finance 0.75.6 → 0.76.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/dist/document-download.d.ts +22 -0
- package/dist/document-download.d.ts.map +1 -0
- package/dist/document-download.js +48 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/routes-documents.d.ts +0 -4
- package/dist/routes-documents.d.ts.map +1 -1
- package/dist/routes-documents.js +25 -27
- package/dist/routes-public.d.ts +6 -6
- package/dist/routes-settlement.d.ts +1 -1
- package/dist/routes.d.ts +212 -9
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +92 -50
- package/dist/schema.d.ts +54 -3
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +9 -0
- package/dist/service-issue.d.ts +7 -2
- package/dist/service-issue.d.ts.map +1 -1
- package/dist/service-issue.js +19 -3
- package/dist/service-rendition-wait.d.ts +38 -0
- package/dist/service-rendition-wait.d.ts.map +1 -0
- package/dist/service-rendition-wait.js +67 -0
- package/dist/service.d.ts +129 -7
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +167 -28
- package/dist/validation-billing.d.ts +38 -1
- package/dist/validation-billing.d.ts.map +1 -1
- package/dist/validation-billing.js +21 -1
- package/dist/validation-public.d.ts +3 -0
- package/dist/validation-public.d.ts.map +1 -1
- package/dist/validation-public.js +9 -1
- package/dist/validation-shared.d.ts +3 -1
- package/dist/validation-shared.d.ts.map +1 -1
- package/dist/validation-shared.js +1 -0
- package/package.json +9 -9
package/dist/routes.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare const financeRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
8
8
|
data: {
|
|
9
9
|
total: number;
|
|
10
10
|
countsByStatus: {
|
|
11
|
-
status: "draft" | "sent" | "partially_paid" | "paid" | "overdue" | "void";
|
|
11
|
+
status: "draft" | "pending_external_allocation" | "sent" | "partially_paid" | "paid" | "overdue" | "void";
|
|
12
12
|
count: number;
|
|
13
13
|
}[];
|
|
14
14
|
counts: {
|
|
@@ -59,7 +59,7 @@ export declare const financeRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
59
59
|
id: string;
|
|
60
60
|
invoiceNumber: string | null;
|
|
61
61
|
bookingId: string | null;
|
|
62
|
-
status: "draft" | "sent" | "partially_paid" | "paid" | "overdue" | "void";
|
|
62
|
+
status: "draft" | "pending_external_allocation" | "sent" | "partially_paid" | "paid" | "overdue" | "void";
|
|
63
63
|
currency: string;
|
|
64
64
|
totalCents: number;
|
|
65
65
|
balanceDueCents: number;
|
|
@@ -2357,7 +2357,7 @@ export declare const financeRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
2357
2357
|
bookingId: string;
|
|
2358
2358
|
personId: string | null;
|
|
2359
2359
|
organizationId: string | null;
|
|
2360
|
-
status: "draft" | "sent" | "partially_paid" | "paid" | "overdue" | "void";
|
|
2360
|
+
status: "draft" | "pending_external_allocation" | "sent" | "partially_paid" | "paid" | "overdue" | "void";
|
|
2361
2361
|
currency: string;
|
|
2362
2362
|
baseCurrency: string | null;
|
|
2363
2363
|
fxRateSetId: string | null;
|
|
@@ -2394,7 +2394,7 @@ export declare const financeRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
2394
2394
|
output: {
|
|
2395
2395
|
data: {
|
|
2396
2396
|
id: string;
|
|
2397
|
-
status: "draft" | "sent" | "partially_paid" | "paid" | "overdue" | "void";
|
|
2397
|
+
status: "draft" | "pending_external_allocation" | "sent" | "partially_paid" | "paid" | "overdue" | "void";
|
|
2398
2398
|
organizationId: string | null;
|
|
2399
2399
|
createdAt: string;
|
|
2400
2400
|
currency: string;
|
|
@@ -2441,12 +2441,21 @@ export declare const financeRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
2441
2441
|
};
|
|
2442
2442
|
outputFormat: "json";
|
|
2443
2443
|
status: 404;
|
|
2444
|
+
} | {
|
|
2445
|
+
input: {};
|
|
2446
|
+
output: {
|
|
2447
|
+
error: "invoice_number_series_not_found" | "invoice_number_series_inactive" | "invoice_number_series_scope_mismatch" | "no_active_series_for_scope";
|
|
2448
|
+
scope: "invoice" | "proforma";
|
|
2449
|
+
seriesId: string | null;
|
|
2450
|
+
};
|
|
2451
|
+
outputFormat: "json";
|
|
2452
|
+
status: 409;
|
|
2444
2453
|
} | {
|
|
2445
2454
|
input: {};
|
|
2446
2455
|
output: {
|
|
2447
2456
|
data: {
|
|
2448
2457
|
id: string;
|
|
2449
|
-
status: "draft" | "sent" | "partially_paid" | "paid" | "overdue" | "void";
|
|
2458
|
+
status: "draft" | "pending_external_allocation" | "sent" | "partially_paid" | "paid" | "overdue" | "void";
|
|
2450
2459
|
organizationId: string | null;
|
|
2451
2460
|
createdAt: string;
|
|
2452
2461
|
currency: string;
|
|
@@ -2482,6 +2491,128 @@ export declare const financeRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
2482
2491
|
};
|
|
2483
2492
|
outputFormat: "json";
|
|
2484
2493
|
status: 201;
|
|
2494
|
+
} | {
|
|
2495
|
+
input: {};
|
|
2496
|
+
output: {
|
|
2497
|
+
data: {
|
|
2498
|
+
invoice: {
|
|
2499
|
+
id: string;
|
|
2500
|
+
status: "draft" | "pending_external_allocation" | "sent" | "partially_paid" | "paid" | "overdue" | "void";
|
|
2501
|
+
organizationId: string | null;
|
|
2502
|
+
createdAt: string;
|
|
2503
|
+
currency: string;
|
|
2504
|
+
notes: string | null;
|
|
2505
|
+
updatedAt: string;
|
|
2506
|
+
bookingId: string;
|
|
2507
|
+
personId: string | null;
|
|
2508
|
+
invoiceNumber: string;
|
|
2509
|
+
invoiceType: "invoice" | "proforma" | "credit_note";
|
|
2510
|
+
convertedFromInvoiceId: string | null;
|
|
2511
|
+
seriesId: string | null;
|
|
2512
|
+
sequence: number | null;
|
|
2513
|
+
templateId: string | null;
|
|
2514
|
+
taxRegimeId: string | null;
|
|
2515
|
+
language: string | null;
|
|
2516
|
+
baseCurrency: string | null;
|
|
2517
|
+
fxRateSetId: string | null;
|
|
2518
|
+
subtotalCents: number;
|
|
2519
|
+
baseSubtotalCents: number | null;
|
|
2520
|
+
taxCents: number;
|
|
2521
|
+
baseTaxCents: number | null;
|
|
2522
|
+
totalCents: number;
|
|
2523
|
+
baseTotalCents: number | null;
|
|
2524
|
+
paidCents: number;
|
|
2525
|
+
basePaidCents: number | null;
|
|
2526
|
+
balanceDueCents: number;
|
|
2527
|
+
baseBalanceDueCents: number | null;
|
|
2528
|
+
commissionPercent: number | null;
|
|
2529
|
+
commissionAmountCents: number | null;
|
|
2530
|
+
issueDate: string;
|
|
2531
|
+
dueDate: string;
|
|
2532
|
+
};
|
|
2533
|
+
rendition: {
|
|
2534
|
+
format: "json" | "html" | "pdf" | "xml";
|
|
2535
|
+
id: string;
|
|
2536
|
+
status: "failed" | "pending" | "ready" | "stale";
|
|
2537
|
+
createdAt: string;
|
|
2538
|
+
updatedAt: string;
|
|
2539
|
+
metadata: import("hono/utils/types").JSONValue;
|
|
2540
|
+
templateId: string | null;
|
|
2541
|
+
language: string | null;
|
|
2542
|
+
invoiceId: string;
|
|
2543
|
+
storageKey: string | null;
|
|
2544
|
+
fileSize: number | null;
|
|
2545
|
+
checksum: string | null;
|
|
2546
|
+
errorMessage: string | null;
|
|
2547
|
+
generatedAt: string | null;
|
|
2548
|
+
} | null;
|
|
2549
|
+
};
|
|
2550
|
+
};
|
|
2551
|
+
outputFormat: "json";
|
|
2552
|
+
status: 202;
|
|
2553
|
+
} | {
|
|
2554
|
+
input: {};
|
|
2555
|
+
output: {
|
|
2556
|
+
data: {
|
|
2557
|
+
download: {
|
|
2558
|
+
url: string;
|
|
2559
|
+
expiresAt: string | null;
|
|
2560
|
+
};
|
|
2561
|
+
invoice: {
|
|
2562
|
+
id: string;
|
|
2563
|
+
status: "draft" | "pending_external_allocation" | "sent" | "partially_paid" | "paid" | "overdue" | "void";
|
|
2564
|
+
organizationId: string | null;
|
|
2565
|
+
createdAt: string;
|
|
2566
|
+
currency: string;
|
|
2567
|
+
notes: string | null;
|
|
2568
|
+
updatedAt: string;
|
|
2569
|
+
bookingId: string;
|
|
2570
|
+
personId: string | null;
|
|
2571
|
+
invoiceNumber: string;
|
|
2572
|
+
invoiceType: "invoice" | "proforma" | "credit_note";
|
|
2573
|
+
convertedFromInvoiceId: string | null;
|
|
2574
|
+
seriesId: string | null;
|
|
2575
|
+
sequence: number | null;
|
|
2576
|
+
templateId: string | null;
|
|
2577
|
+
taxRegimeId: string | null;
|
|
2578
|
+
language: string | null;
|
|
2579
|
+
baseCurrency: string | null;
|
|
2580
|
+
fxRateSetId: string | null;
|
|
2581
|
+
subtotalCents: number;
|
|
2582
|
+
baseSubtotalCents: number | null;
|
|
2583
|
+
taxCents: number;
|
|
2584
|
+
baseTaxCents: number | null;
|
|
2585
|
+
totalCents: number;
|
|
2586
|
+
baseTotalCents: number | null;
|
|
2587
|
+
paidCents: number;
|
|
2588
|
+
basePaidCents: number | null;
|
|
2589
|
+
balanceDueCents: number;
|
|
2590
|
+
baseBalanceDueCents: number | null;
|
|
2591
|
+
commissionPercent: number | null;
|
|
2592
|
+
commissionAmountCents: number | null;
|
|
2593
|
+
issueDate: string;
|
|
2594
|
+
dueDate: string;
|
|
2595
|
+
};
|
|
2596
|
+
rendition: {
|
|
2597
|
+
format: "json" | "html" | "pdf" | "xml";
|
|
2598
|
+
id: string;
|
|
2599
|
+
status: "failed" | "pending" | "ready" | "stale";
|
|
2600
|
+
createdAt: string;
|
|
2601
|
+
updatedAt: string;
|
|
2602
|
+
metadata: import("hono/utils/types").JSONValue;
|
|
2603
|
+
templateId: string | null;
|
|
2604
|
+
language: string | null;
|
|
2605
|
+
invoiceId: string;
|
|
2606
|
+
storageKey: string | null;
|
|
2607
|
+
fileSize: number | null;
|
|
2608
|
+
checksum: string | null;
|
|
2609
|
+
errorMessage: string | null;
|
|
2610
|
+
generatedAt: string | null;
|
|
2611
|
+
} | null;
|
|
2612
|
+
};
|
|
2613
|
+
};
|
|
2614
|
+
outputFormat: "json";
|
|
2615
|
+
status: 201;
|
|
2485
2616
|
};
|
|
2486
2617
|
};
|
|
2487
2618
|
} & {
|
|
@@ -2517,7 +2648,7 @@ export declare const financeRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
2517
2648
|
output: {
|
|
2518
2649
|
data: {
|
|
2519
2650
|
id: string;
|
|
2520
|
-
status: "draft" | "sent" | "partially_paid" | "paid" | "overdue" | "void";
|
|
2651
|
+
status: "draft" | "pending_external_allocation" | "sent" | "partially_paid" | "paid" | "overdue" | "void";
|
|
2521
2652
|
organizationId: string | null;
|
|
2522
2653
|
createdAt: string;
|
|
2523
2654
|
currency: string;
|
|
@@ -2588,7 +2719,7 @@ export declare const financeRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
2588
2719
|
bookingId: string;
|
|
2589
2720
|
personId: string | null;
|
|
2590
2721
|
organizationId: string | null;
|
|
2591
|
-
status: "draft" | "sent" | "partially_paid" | "paid" | "overdue" | "void";
|
|
2722
|
+
status: "draft" | "pending_external_allocation" | "sent" | "partially_paid" | "paid" | "overdue" | "void";
|
|
2592
2723
|
currency: string;
|
|
2593
2724
|
baseCurrency: string | null;
|
|
2594
2725
|
fxRateSetId: string | null;
|
|
@@ -2648,7 +2779,7 @@ export declare const financeRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
2648
2779
|
bookingId: string;
|
|
2649
2780
|
personId: string | null;
|
|
2650
2781
|
organizationId: string | null;
|
|
2651
|
-
status: "draft" | "sent" | "partially_paid" | "paid" | "overdue" | "void";
|
|
2782
|
+
status: "draft" | "pending_external_allocation" | "sent" | "partially_paid" | "paid" | "overdue" | "void";
|
|
2652
2783
|
currency: string;
|
|
2653
2784
|
baseCurrency: string | null;
|
|
2654
2785
|
fxRateSetId: string | null;
|
|
@@ -3269,6 +3400,9 @@ export declare const financeRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
3269
3400
|
resetStrategy: "never" | "annual" | "monthly";
|
|
3270
3401
|
resetAt: string | null;
|
|
3271
3402
|
scope: "invoice" | "proforma" | "credit_note";
|
|
3403
|
+
isDefault: boolean;
|
|
3404
|
+
externalProvider: string | null;
|
|
3405
|
+
externalConfigKey: string | null;
|
|
3272
3406
|
active: boolean;
|
|
3273
3407
|
createdAt: string;
|
|
3274
3408
|
updatedAt: string;
|
|
@@ -3300,6 +3434,9 @@ export declare const financeRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
3300
3434
|
currentSequence: number;
|
|
3301
3435
|
resetStrategy: "never" | "annual" | "monthly";
|
|
3302
3436
|
resetAt: string | null;
|
|
3437
|
+
isDefault: boolean;
|
|
3438
|
+
externalProvider: string | null;
|
|
3439
|
+
externalConfigKey: string | null;
|
|
3303
3440
|
} | null;
|
|
3304
3441
|
};
|
|
3305
3442
|
outputFormat: "json";
|
|
@@ -3337,6 +3474,9 @@ export declare const financeRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
3337
3474
|
resetStrategy: "never" | "annual" | "monthly";
|
|
3338
3475
|
resetAt: string | null;
|
|
3339
3476
|
scope: "invoice" | "proforma" | "credit_note";
|
|
3477
|
+
isDefault: boolean;
|
|
3478
|
+
externalProvider: string | null;
|
|
3479
|
+
externalConfigKey: string | null;
|
|
3340
3480
|
active: boolean;
|
|
3341
3481
|
createdAt: string;
|
|
3342
3482
|
updatedAt: string;
|
|
@@ -3377,6 +3517,9 @@ export declare const financeRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
3377
3517
|
resetStrategy: "never" | "annual" | "monthly";
|
|
3378
3518
|
resetAt: string | null;
|
|
3379
3519
|
scope: "invoice" | "proforma" | "credit_note";
|
|
3520
|
+
isDefault: boolean;
|
|
3521
|
+
externalProvider: string | null;
|
|
3522
|
+
externalConfigKey: string | null;
|
|
3380
3523
|
active: boolean;
|
|
3381
3524
|
createdAt: string;
|
|
3382
3525
|
updatedAt: string;
|
|
@@ -3494,11 +3637,11 @@ export declare const financeRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
3494
3637
|
metadata: import("hono/utils/types").JSONValue;
|
|
3495
3638
|
language: string;
|
|
3496
3639
|
jurisdiction: string | null;
|
|
3640
|
+
isDefault: boolean;
|
|
3497
3641
|
slug: string;
|
|
3498
3642
|
bodyFormat: "html" | "markdown" | "lexical_json";
|
|
3499
3643
|
body: string;
|
|
3500
3644
|
cssStyles: string | null;
|
|
3501
|
-
isDefault: boolean;
|
|
3502
3645
|
} | null;
|
|
3503
3646
|
};
|
|
3504
3647
|
outputFormat: "json";
|
|
@@ -4427,6 +4570,66 @@ export declare const financeRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
4427
4570
|
};
|
|
4428
4571
|
outputFormat: "json";
|
|
4429
4572
|
status: 404;
|
|
4573
|
+
} | {
|
|
4574
|
+
input: {
|
|
4575
|
+
param: {
|
|
4576
|
+
id: string;
|
|
4577
|
+
};
|
|
4578
|
+
};
|
|
4579
|
+
output: {
|
|
4580
|
+
data: {
|
|
4581
|
+
rendition: {
|
|
4582
|
+
format: "json" | "html" | "pdf" | "xml";
|
|
4583
|
+
id: string;
|
|
4584
|
+
status: "failed" | "pending" | "ready" | "stale";
|
|
4585
|
+
createdAt: string;
|
|
4586
|
+
updatedAt: string;
|
|
4587
|
+
metadata: import("hono/utils/types").JSONValue;
|
|
4588
|
+
templateId: string | null;
|
|
4589
|
+
language: string | null;
|
|
4590
|
+
invoiceId: string;
|
|
4591
|
+
storageKey: string | null;
|
|
4592
|
+
fileSize: number | null;
|
|
4593
|
+
checksum: string | null;
|
|
4594
|
+
errorMessage: string | null;
|
|
4595
|
+
generatedAt: string | null;
|
|
4596
|
+
};
|
|
4597
|
+
};
|
|
4598
|
+
};
|
|
4599
|
+
outputFormat: "json";
|
|
4600
|
+
status: 202;
|
|
4601
|
+
} | {
|
|
4602
|
+
input: {
|
|
4603
|
+
param: {
|
|
4604
|
+
id: string;
|
|
4605
|
+
};
|
|
4606
|
+
};
|
|
4607
|
+
output: {
|
|
4608
|
+
data: {
|
|
4609
|
+
download: {
|
|
4610
|
+
url: string;
|
|
4611
|
+
expiresAt: string | null;
|
|
4612
|
+
};
|
|
4613
|
+
rendition: {
|
|
4614
|
+
format: "json" | "html" | "pdf" | "xml";
|
|
4615
|
+
id: string;
|
|
4616
|
+
status: "failed" | "pending" | "ready" | "stale";
|
|
4617
|
+
createdAt: string;
|
|
4618
|
+
updatedAt: string;
|
|
4619
|
+
metadata: import("hono/utils/types").JSONValue;
|
|
4620
|
+
templateId: string | null;
|
|
4621
|
+
language: string | null;
|
|
4622
|
+
invoiceId: string;
|
|
4623
|
+
storageKey: string | null;
|
|
4624
|
+
fileSize: number | null;
|
|
4625
|
+
checksum: string | null;
|
|
4626
|
+
errorMessage: string | null;
|
|
4627
|
+
generatedAt: string | null;
|
|
4628
|
+
};
|
|
4629
|
+
};
|
|
4630
|
+
};
|
|
4631
|
+
outputFormat: "json";
|
|
4632
|
+
status: 201;
|
|
4430
4633
|
} | {
|
|
4431
4634
|
input: {
|
|
4432
4635
|
param: {
|
package/dist/routes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAC7D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAA;AAuJ7C,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCAqnDtB,CAAA;AAEJ,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAA;AAChD,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAA"}
|
package/dist/routes.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { parseJsonBody, parseQuery, requireUserId } from "@voyantjs/hono";
|
|
2
2
|
import { Hono } from "hono";
|
|
3
|
+
import { resolveStoredDocumentDownload } from "./document-download.js";
|
|
3
4
|
import { FINANCE_ROUTE_RUNTIME_CONTAINER_KEY } from "./route-runtime.js";
|
|
4
|
-
import { financeService, PaymentValidationError } from "./service.js";
|
|
5
|
+
import { financeService, InvoiceNumberAllocationError, PaymentValidationError } from "./service.js";
|
|
6
|
+
import { waitForInvoiceRendition, waitFormatForMode, } from "./service-rendition-wait.js";
|
|
5
7
|
import { VoucherServiceError } from "./service-vouchers.js";
|
|
6
|
-
import { agingReportQuerySchema, applyDefaultBookingPaymentPlanSchema, cancelPaymentSessionSchema, completePaymentSessionSchema, createPaymentSessionFromGuaranteeSchema, createPaymentSessionFromInvoiceSchema, createPaymentSessionFromScheduleSchema, expirePaymentSessionSchema, failPaymentSessionSchema, financeAggregatesQuerySchema, insertBookingGuaranteeSchema, insertBookingItemCommissionSchema, insertBookingItemTaxLineSchema, insertBookingPaymentScheduleSchema, insertCreditNoteLineItemSchema, insertCreditNoteSchema, insertFinanceNoteSchema, insertInvoiceAttachmentSchema, insertInvoiceExternalRefSchema, insertInvoiceLineItemSchema, insertInvoiceNumberSeriesSchema, insertInvoiceSchema, insertInvoiceTemplateSchema, insertPaymentAuthorizationSchema, insertPaymentCaptureSchema, insertPaymentInstrumentSchema, insertPaymentSchema, insertPaymentSessionSchema, insertSupplierPaymentSchema, insertTaxClassSchema, insertTaxPolicyProfileSchema, insertTaxPolicyRuleSchema, insertTaxRegimeSchema, insertVoucherSchema, invoiceFromBookingSchema, invoiceListQuerySchema, invoiceNumberSeriesListQuerySchema, invoiceTemplateListQuerySchema, markPaymentSessionRequiresRedirectSchema, paymentAuthorizationListQuerySchema, paymentCaptureListQuerySchema, paymentInstrumentListQuerySchema, paymentListQuerySchema, paymentSessionListQuerySchema, profitabilityQuerySchema, redeemVoucherSchema, renderInvoiceInputSchema, revenueReportQuerySchema, supplierPaymentListQuerySchema, taxClassListQuerySchema, taxPolicyProfileListQuerySchema, taxPolicyRuleListQuerySchema, taxRegimeListQuerySchema, updateBookingGuaranteeSchema, updateBookingItemCommissionSchema, updateBookingItemTaxLineSchema, updateBookingPaymentScheduleSchema, updateCreditNoteSchema, updateInvoiceAttachmentSchema, updateInvoiceLineItemSchema, updateInvoiceNumberSeriesSchema, updateInvoiceSchema, updateInvoiceTemplateSchema, updatePaymentAuthorizationSchema, updatePaymentCaptureSchema, updatePaymentInstrumentSchema, updatePaymentSessionSchema, updateSupplierPaymentSchema, updateTaxClassSchema, updateTaxPolicyProfileSchema, updateTaxPolicyRuleSchema, updateTaxRegimeSchema, updateVoucherSchema, voucherListQuerySchema, } from "./validation.js";
|
|
8
|
+
import { agingReportQuerySchema, applyDefaultBookingPaymentPlanSchema, cancelPaymentSessionSchema, completePaymentSessionSchema, createPaymentSessionFromGuaranteeSchema, createPaymentSessionFromInvoiceSchema, createPaymentSessionFromScheduleSchema, expirePaymentSessionSchema, failPaymentSessionSchema, financeAggregatesQuerySchema, insertBookingGuaranteeSchema, insertBookingItemCommissionSchema, insertBookingItemTaxLineSchema, insertBookingPaymentScheduleSchema, insertCreditNoteLineItemSchema, insertCreditNoteSchema, insertFinanceNoteSchema, insertInvoiceAttachmentSchema, insertInvoiceExternalRefSchema, insertInvoiceLineItemSchema, insertInvoiceNumberSeriesSchema, insertInvoiceSchema, insertInvoiceTemplateSchema, insertPaymentAuthorizationSchema, insertPaymentCaptureSchema, insertPaymentInstrumentSchema, insertPaymentSchema, insertPaymentSessionSchema, insertSupplierPaymentSchema, insertTaxClassSchema, insertTaxPolicyProfileSchema, insertTaxPolicyRuleSchema, insertTaxRegimeSchema, insertVoucherSchema, invoiceDocumentWaitQuerySchema, invoiceFromBookingSchema, invoiceListQuerySchema, invoiceNumberSeriesListQuerySchema, invoiceTemplateListQuerySchema, markPaymentSessionRequiresRedirectSchema, paymentAuthorizationListQuerySchema, paymentCaptureListQuerySchema, paymentInstrumentListQuerySchema, paymentListQuerySchema, paymentSessionListQuerySchema, profitabilityQuerySchema, redeemVoucherSchema, renderInvoiceInputSchema, revenueReportQuerySchema, supplierPaymentListQuerySchema, taxClassListQuerySchema, taxPolicyProfileListQuerySchema, taxPolicyRuleListQuerySchema, taxRegimeListQuerySchema, updateBookingGuaranteeSchema, updateBookingItemCommissionSchema, updateBookingItemTaxLineSchema, updateBookingPaymentScheduleSchema, updateCreditNoteSchema, updateInvoiceAttachmentSchema, updateInvoiceLineItemSchema, updateInvoiceNumberSeriesSchema, updateInvoiceSchema, updateInvoiceTemplateSchema, updatePaymentAuthorizationSchema, updatePaymentCaptureSchema, updatePaymentInstrumentSchema, updatePaymentSessionSchema, updateSupplierPaymentSchema, updateTaxClassSchema, updateTaxPolicyProfileSchema, updateTaxPolicyRuleSchema, updateTaxRegimeSchema, updateVoucherSchema, voucherListQuerySchema, } from "./validation.js";
|
|
7
9
|
// ==========================================================================
|
|
8
10
|
// Finance Routes — method-chained for Hono RPC type inference
|
|
9
11
|
// ==========================================================================
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
function maybeUrl(value) {
|
|
17
|
-
return typeof value === "string" && /^https?:\/\//i.test(value) ? value : null;
|
|
12
|
+
const DEFAULT_RENDITION_WAIT_TIMEOUT_MS = 30_000;
|
|
13
|
+
function resolveWaitRequest(body, query) {
|
|
14
|
+
return {
|
|
15
|
+
mode: query.wait ?? body.wait ?? "none",
|
|
16
|
+
timeoutMs: query.waitTimeoutMs ?? body.waitTimeoutMs ?? DEFAULT_RENDITION_WAIT_TIMEOUT_MS,
|
|
17
|
+
};
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
async function buildInlineDownload(c, reference) {
|
|
20
|
+
const runtime = getFinanceRouteRuntime(c);
|
|
21
|
+
return resolveStoredDocumentDownload(reference, {
|
|
22
|
+
bindings: c.env,
|
|
23
|
+
resolveDocumentDownloadUrl: runtime?.resolveDocumentDownloadUrl,
|
|
24
|
+
});
|
|
25
25
|
}
|
|
26
26
|
function getFinanceRouteRuntime(c) {
|
|
27
27
|
try {
|
|
@@ -590,6 +590,7 @@ export const financeRoutes = new Hono()
|
|
|
590
590
|
// POST /invoices/from-booking — Create + issue invoice (or proforma) from booking + booking items
|
|
591
591
|
.post("/invoices/from-booking", async (c) => {
|
|
592
592
|
const input = await parseJsonBody(c, invoiceFromBookingSchema);
|
|
593
|
+
const waitRequest = resolveWaitRequest(input, parseQuery(c, invoiceDocumentWaitQuerySchema));
|
|
593
594
|
const db = c.get("db");
|
|
594
595
|
const [{ bookingItems, bookings }, { eq }, { issueInvoiceFromBooking, issueProformaFromBooking },] = await Promise.all([
|
|
595
596
|
import("@voyantjs/bookings/schema"),
|
|
@@ -614,31 +615,58 @@ export const financeRoutes = new Hono()
|
|
|
614
615
|
}
|
|
615
616
|
})();
|
|
616
617
|
const issuer = input.invoiceType === "proforma" ? issueProformaFromBooking : issueInvoiceFromBooking;
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
618
|
+
let row;
|
|
619
|
+
try {
|
|
620
|
+
row = await issuer(db, input, {
|
|
621
|
+
booking: {
|
|
622
|
+
id: booking.id,
|
|
623
|
+
bookingNumber: booking.bookingNumber,
|
|
624
|
+
personId: booking.personId,
|
|
625
|
+
organizationId: booking.organizationId,
|
|
626
|
+
sellCurrency: booking.sellCurrency,
|
|
627
|
+
baseCurrency: booking.baseCurrency,
|
|
628
|
+
fxRateSetId: null,
|
|
629
|
+
sellAmountCents: booking.sellAmountCents,
|
|
630
|
+
baseSellAmountCents: booking.baseSellAmountCents,
|
|
631
|
+
},
|
|
632
|
+
items: items.map((item) => ({
|
|
633
|
+
id: item.id,
|
|
634
|
+
title: item.title,
|
|
635
|
+
quantity: item.quantity,
|
|
636
|
+
unitSellAmountCents: item.unitSellAmountCents,
|
|
637
|
+
totalSellAmountCents: item.totalSellAmountCents,
|
|
638
|
+
})),
|
|
639
|
+
}, {
|
|
640
|
+
eventBus: runtime?.eventBus,
|
|
641
|
+
actionLedgerContext: getActionLedgerRequestContext(c),
|
|
642
|
+
actionLedgerAuthorizationSource: "finance.invoice.from_booking.route",
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
catch (error) {
|
|
646
|
+
if (error instanceof InvoiceNumberAllocationError) {
|
|
647
|
+
return c.json({ error: error.code, scope: error.scope, seriesId: error.seriesId ?? null }, 409);
|
|
648
|
+
}
|
|
649
|
+
throw error;
|
|
650
|
+
}
|
|
651
|
+
if (!row || waitRequest.mode === "none") {
|
|
652
|
+
return c.json({ data: row }, 201);
|
|
653
|
+
}
|
|
654
|
+
const waitResult = await waitForInvoiceRendition(db, row.id, {
|
|
655
|
+
format: waitFormatForMode(waitRequest.mode),
|
|
656
|
+
timeoutMs: waitRequest.timeoutMs,
|
|
640
657
|
});
|
|
641
|
-
|
|
658
|
+
const payload = {
|
|
659
|
+
invoice: row,
|
|
660
|
+
rendition: waitResult.rendition,
|
|
661
|
+
};
|
|
662
|
+
if (waitResult.status !== "ready") {
|
|
663
|
+
return c.json({ data: payload }, 202);
|
|
664
|
+
}
|
|
665
|
+
const download = await buildInlineDownload(c, waitResult.rendition);
|
|
666
|
+
if (download.status !== "ready") {
|
|
667
|
+
return c.json({ data: payload }, 202);
|
|
668
|
+
}
|
|
669
|
+
return c.json({ data: { ...payload, download: download.download } }, 201);
|
|
642
670
|
})
|
|
643
671
|
// POST /invoices/:id/convert-to-invoice — Convert a proforma into a final invoice
|
|
644
672
|
.post("/invoices/:id/convert-to-invoice", async (c) => {
|
|
@@ -1085,19 +1113,14 @@ export const financeRoutes = new Hono()
|
|
|
1085
1113
|
const attachment = await financeService.getInvoiceAttachmentById(c.get("db"), c.req.param("id"));
|
|
1086
1114
|
if (!attachment)
|
|
1087
1115
|
return c.json({ error: "Attachment not found" }, 404);
|
|
1088
|
-
|
|
1089
|
-
if (
|
|
1090
|
-
|
|
1091
|
-
if (!runtime?.resolveDocumentDownloadUrl) {
|
|
1092
|
-
return c.json({ error: "Document download resolver is not configured" }, 501);
|
|
1093
|
-
}
|
|
1094
|
-
location = await runtime.resolveDocumentDownloadUrl(c.env, attachment.storageKey);
|
|
1116
|
+
const download = await buildInlineDownload(c, attachment);
|
|
1117
|
+
if (download.status === "resolver_not_configured") {
|
|
1118
|
+
return c.json({ error: "Document download resolver is not configured" }, 501);
|
|
1095
1119
|
}
|
|
1096
|
-
|
|
1097
|
-
if (!location) {
|
|
1120
|
+
if (download.status !== "ready") {
|
|
1098
1121
|
return c.json({ error: "Attachment file is not available" }, 404);
|
|
1099
1122
|
}
|
|
1100
|
-
return c.redirect(
|
|
1123
|
+
return c.redirect(download.download.url, 302);
|
|
1101
1124
|
})
|
|
1102
1125
|
.delete("/invoices/:id/attachments/:attachmentId", async (c) => {
|
|
1103
1126
|
const row = await financeService.deleteInvoiceAttachment(c.get("db"), c.req.param("id"), c.req.param("attachmentId"));
|
|
@@ -1107,9 +1130,28 @@ export const financeRoutes = new Hono()
|
|
|
1107
1130
|
})
|
|
1108
1131
|
.post("/invoices/:id/render", async (c) => {
|
|
1109
1132
|
const input = await parseJsonBody(c, renderInvoiceInputSchema);
|
|
1133
|
+
const waitRequest = resolveWaitRequest(input, parseQuery(c, invoiceDocumentWaitQuerySchema));
|
|
1110
1134
|
const result = await financeService.renderInvoice(c.get("db"), c.req.param("id"), input);
|
|
1111
1135
|
if (result.status === "not_found")
|
|
1112
1136
|
return c.json({ error: "Invoice not found" }, 404);
|
|
1137
|
+
if (waitRequest.mode !== "none" && result.rendition) {
|
|
1138
|
+
const waitResult = await waitForInvoiceRendition(c.get("db"), c.req.param("id"), {
|
|
1139
|
+
renditionId: result.rendition.id,
|
|
1140
|
+
format: waitFormatForMode(waitRequest.mode),
|
|
1141
|
+
timeoutMs: waitRequest.timeoutMs,
|
|
1142
|
+
});
|
|
1143
|
+
const payload = {
|
|
1144
|
+
rendition: waitResult.rendition ?? result.rendition,
|
|
1145
|
+
};
|
|
1146
|
+
if (waitResult.status !== "ready") {
|
|
1147
|
+
return c.json({ data: payload }, 202);
|
|
1148
|
+
}
|
|
1149
|
+
const download = await buildInlineDownload(c, waitResult.rendition);
|
|
1150
|
+
if (download.status !== "ready") {
|
|
1151
|
+
return c.json({ data: payload }, 202);
|
|
1152
|
+
}
|
|
1153
|
+
return c.json({ data: { ...payload, download: download.download } }, 201);
|
|
1154
|
+
}
|
|
1113
1155
|
return c.json({ data: result.rendition }, 201);
|
|
1114
1156
|
})
|
|
1115
1157
|
.get("/invoices/:id/external-refs", async (c) => {
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const invoiceStatusEnum: import("drizzle-orm/pg-core").PgEnum<["draft", "sent", "partially_paid", "paid", "overdue", "void"]>;
|
|
1
|
+
export declare const invoiceStatusEnum: import("drizzle-orm/pg-core").PgEnum<["draft", "pending_external_allocation", "sent", "partially_paid", "paid", "overdue", "void"]>;
|
|
2
2
|
export declare const paymentMethodEnum: import("drizzle-orm/pg-core").PgEnum<["bank_transfer", "credit_card", "debit_card", "cash", "cheque", "wallet", "direct_bill", "voucher", "other"]>;
|
|
3
3
|
export declare const paymentStatusEnum: import("drizzle-orm/pg-core").PgEnum<["pending", "completed", "failed", "refunded"]>;
|
|
4
4
|
export declare const paymentSessionStatusEnum: import("drizzle-orm/pg-core").PgEnum<["pending", "requires_redirect", "processing", "authorized", "paid", "failed", "cancelled", "expired"]>;
|
|
@@ -3394,14 +3394,14 @@ export declare const invoices: import("drizzle-orm/pg-core").PgTableWithColumns<
|
|
|
3394
3394
|
tableName: "invoices";
|
|
3395
3395
|
dataType: "string";
|
|
3396
3396
|
columnType: "PgEnumColumn";
|
|
3397
|
-
data: "draft" | "sent" | "partially_paid" | "paid" | "overdue" | "void";
|
|
3397
|
+
data: "draft" | "pending_external_allocation" | "sent" | "partially_paid" | "paid" | "overdue" | "void";
|
|
3398
3398
|
driverParam: string;
|
|
3399
3399
|
notNull: true;
|
|
3400
3400
|
hasDefault: true;
|
|
3401
3401
|
isPrimaryKey: false;
|
|
3402
3402
|
isAutoincrement: false;
|
|
3403
3403
|
hasRuntimeDefault: false;
|
|
3404
|
-
enumValues: ["draft", "sent", "partially_paid", "paid", "overdue", "void"];
|
|
3404
|
+
enumValues: ["draft", "pending_external_allocation", "sent", "partially_paid", "paid", "overdue", "void"];
|
|
3405
3405
|
baseColumn: never;
|
|
3406
3406
|
identity: undefined;
|
|
3407
3407
|
generated: undefined;
|
|
@@ -5169,6 +5169,57 @@ export declare const invoiceNumberSeries: import("drizzle-orm/pg-core").PgTableW
|
|
|
5169
5169
|
identity: undefined;
|
|
5170
5170
|
generated: undefined;
|
|
5171
5171
|
}, {}, {}>;
|
|
5172
|
+
isDefault: import("drizzle-orm/pg-core").PgColumn<{
|
|
5173
|
+
name: "is_default";
|
|
5174
|
+
tableName: "invoice_number_series";
|
|
5175
|
+
dataType: "boolean";
|
|
5176
|
+
columnType: "PgBoolean";
|
|
5177
|
+
data: boolean;
|
|
5178
|
+
driverParam: boolean;
|
|
5179
|
+
notNull: true;
|
|
5180
|
+
hasDefault: true;
|
|
5181
|
+
isPrimaryKey: false;
|
|
5182
|
+
isAutoincrement: false;
|
|
5183
|
+
hasRuntimeDefault: false;
|
|
5184
|
+
enumValues: undefined;
|
|
5185
|
+
baseColumn: never;
|
|
5186
|
+
identity: undefined;
|
|
5187
|
+
generated: undefined;
|
|
5188
|
+
}, {}, {}>;
|
|
5189
|
+
externalProvider: import("drizzle-orm/pg-core").PgColumn<{
|
|
5190
|
+
name: "external_provider";
|
|
5191
|
+
tableName: "invoice_number_series";
|
|
5192
|
+
dataType: "string";
|
|
5193
|
+
columnType: "PgText";
|
|
5194
|
+
data: string;
|
|
5195
|
+
driverParam: string;
|
|
5196
|
+
notNull: false;
|
|
5197
|
+
hasDefault: false;
|
|
5198
|
+
isPrimaryKey: false;
|
|
5199
|
+
isAutoincrement: false;
|
|
5200
|
+
hasRuntimeDefault: false;
|
|
5201
|
+
enumValues: [string, ...string[]];
|
|
5202
|
+
baseColumn: never;
|
|
5203
|
+
identity: undefined;
|
|
5204
|
+
generated: undefined;
|
|
5205
|
+
}, {}, {}>;
|
|
5206
|
+
externalConfigKey: import("drizzle-orm/pg-core").PgColumn<{
|
|
5207
|
+
name: "external_config_key";
|
|
5208
|
+
tableName: "invoice_number_series";
|
|
5209
|
+
dataType: "string";
|
|
5210
|
+
columnType: "PgText";
|
|
5211
|
+
data: string;
|
|
5212
|
+
driverParam: string;
|
|
5213
|
+
notNull: false;
|
|
5214
|
+
hasDefault: false;
|
|
5215
|
+
isPrimaryKey: false;
|
|
5216
|
+
isAutoincrement: false;
|
|
5217
|
+
hasRuntimeDefault: false;
|
|
5218
|
+
enumValues: [string, ...string[]];
|
|
5219
|
+
baseColumn: never;
|
|
5220
|
+
identity: undefined;
|
|
5221
|
+
generated: undefined;
|
|
5222
|
+
}, {}, {}>;
|
|
5172
5223
|
active: import("drizzle-orm/pg-core").PgColumn<{
|
|
5173
5224
|
name: "active";
|
|
5174
5225
|
tableName: "invoice_number_series";
|