@voyantjs/finance 0.20.0 → 0.21.1

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/service.d.ts CHANGED
@@ -2,7 +2,7 @@ import type { EventBus } from "@voyantjs/core";
2
2
  import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
3
3
  import type { z } from "zod";
4
4
  import { getFinanceAggregates } from "./service-aggregates.js";
5
- import type { agingReportQuerySchema, applyDefaultBookingPaymentPlanSchema, cancelPaymentSessionSchema, completePaymentSessionSchema, createPaymentSessionFromGuaranteeSchema, createPaymentSessionFromInvoiceSchema, createPaymentSessionFromScheduleSchema, expirePaymentSessionSchema, failPaymentSessionSchema, insertBookingGuaranteeSchema, insertBookingItemCommissionSchema, insertBookingItemTaxLineSchema, insertBookingPaymentScheduleSchema, insertCreditNoteLineItemSchema, insertCreditNoteSchema, insertFinanceNoteSchema, insertInvoiceExternalRefSchema, insertInvoiceLineItemSchema, insertInvoiceNumberSeriesSchema, insertInvoiceRenditionSchema, insertInvoiceSchema, insertInvoiceTemplateSchema, insertPaymentAuthorizationSchema, insertPaymentCaptureSchema, insertPaymentInstrumentSchema, insertPaymentSchema, insertPaymentSessionSchema, insertSupplierPaymentSchema, insertTaxRegimeSchema, invoiceFromBookingSchema, invoiceListQuerySchema, invoiceNumberSeriesListQuerySchema, invoiceTemplateListQuerySchema, markPaymentSessionRequiresRedirectSchema, paymentAuthorizationListQuerySchema, paymentCaptureListQuerySchema, paymentInstrumentListQuerySchema, paymentSessionListQuerySchema, profitabilityQuerySchema, renderInvoiceInputSchema, revenueReportQuerySchema, supplierPaymentListQuerySchema, taxRegimeListQuerySchema, updateBookingGuaranteeSchema, updateBookingItemCommissionSchema, updateBookingItemTaxLineSchema, updateBookingPaymentScheduleSchema, updateCreditNoteSchema, updateInvoiceLineItemSchema, updateInvoiceNumberSeriesSchema, updateInvoiceRenditionSchema, updateInvoiceSchema, updateInvoiceTemplateSchema, updatePaymentAuthorizationSchema, updatePaymentCaptureSchema, updatePaymentInstrumentSchema, updatePaymentSessionSchema, updateSupplierPaymentSchema, updateTaxRegimeSchema } from "./validation.js";
5
+ import type { agingReportQuerySchema, applyDefaultBookingPaymentPlanSchema, cancelPaymentSessionSchema, completePaymentSessionSchema, createPaymentSessionFromGuaranteeSchema, createPaymentSessionFromInvoiceSchema, createPaymentSessionFromScheduleSchema, expirePaymentSessionSchema, failPaymentSessionSchema, insertBookingGuaranteeSchema, insertBookingItemCommissionSchema, insertBookingItemTaxLineSchema, insertBookingPaymentScheduleSchema, insertCreditNoteLineItemSchema, insertCreditNoteSchema, insertFinanceNoteSchema, insertInvoiceExternalRefSchema, insertInvoiceLineItemSchema, insertInvoiceNumberSeriesSchema, insertInvoiceRenditionSchema, insertInvoiceSchema, insertInvoiceTemplateSchema, insertPaymentAuthorizationSchema, insertPaymentCaptureSchema, insertPaymentInstrumentSchema, insertPaymentSchema, insertPaymentSessionSchema, insertSupplierPaymentSchema, insertTaxClassSchema, insertTaxPolicyProfileSchema, insertTaxPolicyRuleSchema, insertTaxRegimeSchema, invoiceFromBookingSchema, invoiceListQuerySchema, invoiceNumberSeriesListQuerySchema, invoiceTemplateListQuerySchema, markPaymentSessionRequiresRedirectSchema, paymentAuthorizationListQuerySchema, paymentCaptureListQuerySchema, paymentInstrumentListQuerySchema, paymentSessionListQuerySchema, profitabilityQuerySchema, renderInvoiceInputSchema, revenueReportQuerySchema, supplierPaymentListQuerySchema, taxClassListQuerySchema, taxPolicyProfileListQuerySchema, taxPolicyRuleListQuerySchema, taxRegimeListQuerySchema, updateBookingGuaranteeSchema, updateBookingItemCommissionSchema, updateBookingItemTaxLineSchema, updateBookingPaymentScheduleSchema, updateCreditNoteSchema, updateInvoiceLineItemSchema, updateInvoiceNumberSeriesSchema, updateInvoiceRenditionSchema, updateInvoiceSchema, updateInvoiceTemplateSchema, updatePaymentAuthorizationSchema, updatePaymentCaptureSchema, updatePaymentInstrumentSchema, updatePaymentSessionSchema, updateSupplierPaymentSchema, updateTaxClassSchema, updateTaxPolicyProfileSchema, updateTaxPolicyRuleSchema, updateTaxRegimeSchema } from "./validation.js";
6
6
  type RevenueReportQuery = z.infer<typeof revenueReportQuerySchema>;
7
7
  type AgingReportQuery = z.infer<typeof agingReportQuerySchema>;
8
8
  type ProfitabilityQuery = z.infer<typeof profitabilityQuerySchema>;
@@ -31,7 +31,7 @@ type CreateSupplierPaymentInput = z.infer<typeof insertSupplierPaymentSchema>;
31
31
  type UpdateSupplierPaymentInput = z.infer<typeof updateSupplierPaymentSchema>;
32
32
  type InvoiceListQuery = z.infer<typeof invoiceListQuerySchema>;
33
33
  type CreateInvoiceInput = z.infer<typeof insertInvoiceSchema>;
34
- type CreateInvoiceFromBookingInput = z.infer<typeof invoiceFromBookingSchema>;
34
+ export type CreateInvoiceFromBookingInput = z.infer<typeof invoiceFromBookingSchema>;
35
35
  type UpdateInvoiceInput = z.infer<typeof updateInvoiceSchema>;
36
36
  type CreateInvoiceLineItemInput = z.infer<typeof insertInvoiceLineItemSchema>;
37
37
  type UpdateInvoiceLineItemInput = z.infer<typeof updateInvoiceLineItemSchema>;
@@ -51,6 +51,15 @@ type UpdateInvoiceRenditionInput = z.infer<typeof updateInvoiceRenditionSchema>;
51
51
  type TaxRegimeListQuery = z.infer<typeof taxRegimeListQuerySchema>;
52
52
  type CreateTaxRegimeInput = z.infer<typeof insertTaxRegimeSchema>;
53
53
  type UpdateTaxRegimeInput = z.infer<typeof updateTaxRegimeSchema>;
54
+ type TaxClassListQuery = z.infer<typeof taxClassListQuerySchema>;
55
+ type CreateTaxClassInput = z.infer<typeof insertTaxClassSchema>;
56
+ type UpdateTaxClassInput = z.infer<typeof updateTaxClassSchema>;
57
+ type TaxPolicyProfileListQuery = z.infer<typeof taxPolicyProfileListQuerySchema>;
58
+ type CreateTaxPolicyProfileInput = z.infer<typeof insertTaxPolicyProfileSchema>;
59
+ type UpdateTaxPolicyProfileInput = z.infer<typeof updateTaxPolicyProfileSchema>;
60
+ type TaxPolicyRuleListQuery = z.infer<typeof taxPolicyRuleListQuerySchema>;
61
+ type CreateTaxPolicyRuleInput = z.infer<typeof insertTaxPolicyRuleSchema>;
62
+ type UpdateTaxPolicyRuleInput = z.infer<typeof updateTaxPolicyRuleSchema>;
54
63
  type CreateInvoiceExternalRefInput = z.infer<typeof insertInvoiceExternalRefSchema>;
55
64
  type RenderInvoiceInput = z.infer<typeof renderInvoiceInputSchema>;
56
65
  type MarkPaymentSessionRequiresRedirectInput = z.infer<typeof markPaymentSessionRequiresRedirectSchema>;
@@ -382,7 +391,7 @@ export declare const financeService: {
382
391
  paymentAuthorizationId: string | null;
383
392
  paymentCaptureId: string | null;
384
393
  paymentId: string | null;
385
- status: "pending" | "expired" | "cancelled" | "failed" | "paid" | "requires_redirect" | "processing" | "authorized";
394
+ status: "pending" | "failed" | "expired" | "cancelled" | "paid" | "requires_redirect" | "processing" | "authorized";
386
395
  provider: string | null;
387
396
  providerSessionId: string | null;
388
397
  providerPaymentId: string | null;
@@ -430,7 +439,7 @@ export declare const financeService: {
430
439
  paymentAuthorizationId: string | null;
431
440
  paymentCaptureId: string | null;
432
441
  paymentId: string | null;
433
- status: "pending" | "expired" | "cancelled" | "failed" | "paid" | "requires_redirect" | "processing" | "authorized";
442
+ status: "pending" | "failed" | "expired" | "cancelled" | "paid" | "requires_redirect" | "processing" | "authorized";
434
443
  provider: string | null;
435
444
  providerSessionId: string | null;
436
445
  providerPaymentId: string | null;
@@ -467,7 +476,7 @@ export declare const financeService: {
467
476
  createdAt: Date;
468
477
  updatedAt: Date;
469
478
  expiresAt: Date | null;
470
- status: "pending" | "expired" | "cancelled" | "failed" | "paid" | "requires_redirect" | "processing" | "authorized";
479
+ status: "pending" | "failed" | "expired" | "cancelled" | "paid" | "requires_redirect" | "processing" | "authorized";
471
480
  currency: string;
472
481
  notes: string | null;
473
482
  idempotencyKey: string | null;
@@ -518,7 +527,7 @@ export declare const financeService: {
518
527
  paymentAuthorizationId: string | null;
519
528
  paymentCaptureId: string | null;
520
529
  paymentId: string | null;
521
- status: "pending" | "expired" | "cancelled" | "failed" | "paid" | "requires_redirect" | "processing" | "authorized";
530
+ status: "pending" | "failed" | "expired" | "cancelled" | "paid" | "requires_redirect" | "processing" | "authorized";
522
531
  provider: string | null;
523
532
  providerSessionId: string | null;
524
533
  providerPaymentId: string | null;
@@ -562,7 +571,7 @@ export declare const financeService: {
562
571
  paymentAuthorizationId: string | null;
563
572
  paymentCaptureId: string | null;
564
573
  paymentId: string | null;
565
- status: "pending" | "expired" | "cancelled" | "failed" | "paid" | "requires_redirect" | "processing" | "authorized";
574
+ status: "pending" | "failed" | "expired" | "cancelled" | "paid" | "requires_redirect" | "processing" | "authorized";
566
575
  provider: string | null;
567
576
  providerSessionId: string | null;
568
577
  providerPaymentId: string | null;
@@ -606,7 +615,7 @@ export declare const financeService: {
606
615
  paymentAuthorizationId: string | null;
607
616
  paymentCaptureId: string | null;
608
617
  paymentId: string | null;
609
- status: "pending" | "expired" | "cancelled" | "failed" | "paid" | "requires_redirect" | "processing" | "authorized";
618
+ status: "pending" | "failed" | "expired" | "cancelled" | "paid" | "requires_redirect" | "processing" | "authorized";
610
619
  provider: string | null;
611
620
  providerSessionId: string | null;
612
621
  providerPaymentId: string | null;
@@ -650,7 +659,7 @@ export declare const financeService: {
650
659
  paymentAuthorizationId: string | null;
651
660
  paymentCaptureId: string | null;
652
661
  paymentId: string | null;
653
- status: "pending" | "expired" | "cancelled" | "failed" | "paid" | "requires_redirect" | "processing" | "authorized";
662
+ status: "pending" | "failed" | "expired" | "cancelled" | "paid" | "requires_redirect" | "processing" | "authorized";
654
663
  provider: string | null;
655
664
  providerSessionId: string | null;
656
665
  providerPaymentId: string | null;
@@ -694,7 +703,7 @@ export declare const financeService: {
694
703
  paymentAuthorizationId: string | null;
695
704
  paymentCaptureId: string | null;
696
705
  paymentId: string | null;
697
- status: "pending" | "expired" | "cancelled" | "failed" | "paid" | "requires_redirect" | "processing" | "authorized";
706
+ status: "pending" | "failed" | "expired" | "cancelled" | "paid" | "requires_redirect" | "processing" | "authorized";
698
707
  provider: string | null;
699
708
  providerSessionId: string | null;
700
709
  providerPaymentId: string | null;
@@ -738,7 +747,7 @@ export declare const financeService: {
738
747
  paymentAuthorizationId: string | null;
739
748
  paymentCaptureId: string | null;
740
749
  paymentId: string | null;
741
- status: "pending" | "expired" | "cancelled" | "failed" | "paid" | "requires_redirect" | "processing" | "authorized";
750
+ status: "pending" | "failed" | "expired" | "cancelled" | "paid" | "requires_redirect" | "processing" | "authorized";
742
751
  provider: string | null;
743
752
  providerSessionId: string | null;
744
753
  providerPaymentId: string | null;
@@ -777,7 +786,7 @@ export declare const financeService: {
777
786
  invoiceId: string | null;
778
787
  bookingGuaranteeId: string | null;
779
788
  paymentInstrumentId: string | null;
780
- status: "pending" | "expired" | "failed" | "authorized" | "partially_captured" | "captured" | "voided";
789
+ status: "pending" | "failed" | "expired" | "authorized" | "partially_captured" | "captured" | "voided";
781
790
  captureMode: "manual" | "automatic";
782
791
  currency: string;
783
792
  amountCents: number;
@@ -802,7 +811,7 @@ export declare const financeService: {
802
811
  invoiceId: string | null;
803
812
  bookingGuaranteeId: string | null;
804
813
  paymentInstrumentId: string | null;
805
- status: "pending" | "expired" | "failed" | "authorized" | "partially_captured" | "captured" | "voided";
814
+ status: "pending" | "failed" | "expired" | "authorized" | "partially_captured" | "captured" | "voided";
806
815
  captureMode: "manual" | "automatic";
807
816
  currency: string;
808
817
  amountCents: number;
@@ -821,7 +830,7 @@ export declare const financeService: {
821
830
  createdAt: Date;
822
831
  updatedAt: Date;
823
832
  expiresAt: Date | null;
824
- status: "pending" | "expired" | "failed" | "authorized" | "partially_captured" | "captured" | "voided";
833
+ status: "pending" | "failed" | "expired" | "authorized" | "partially_captured" | "captured" | "voided";
825
834
  currency: string;
826
835
  notes: string | null;
827
836
  provider: string | null;
@@ -844,7 +853,7 @@ export declare const financeService: {
844
853
  invoiceId: string | null;
845
854
  bookingGuaranteeId: string | null;
846
855
  paymentInstrumentId: string | null;
847
- status: "pending" | "expired" | "failed" | "authorized" | "partially_captured" | "captured" | "voided";
856
+ status: "pending" | "failed" | "expired" | "authorized" | "partially_captured" | "captured" | "voided";
848
857
  captureMode: "manual" | "automatic";
849
858
  currency: string;
850
859
  amountCents: number;
@@ -866,7 +875,7 @@ export declare const financeService: {
866
875
  id: string;
867
876
  paymentAuthorizationId: string | null;
868
877
  invoiceId: string | null;
869
- status: "pending" | "completed" | "failed" | "refunded" | "voided";
878
+ status: "pending" | "failed" | "completed" | "refunded" | "voided";
870
879
  currency: string;
871
880
  amountCents: number;
872
881
  provider: string | null;
@@ -885,7 +894,7 @@ export declare const financeService: {
885
894
  id: string;
886
895
  paymentAuthorizationId: string | null;
887
896
  invoiceId: string | null;
888
- status: "pending" | "completed" | "failed" | "refunded" | "voided";
897
+ status: "pending" | "failed" | "completed" | "refunded" | "voided";
889
898
  currency: string;
890
899
  amountCents: number;
891
900
  provider: string | null;
@@ -900,7 +909,7 @@ export declare const financeService: {
900
909
  id: string;
901
910
  createdAt: Date;
902
911
  updatedAt: Date;
903
- status: "pending" | "completed" | "failed" | "refunded" | "voided";
912
+ status: "pending" | "failed" | "completed" | "refunded" | "voided";
904
913
  currency: string;
905
914
  notes: string | null;
906
915
  provider: string | null;
@@ -915,7 +924,7 @@ export declare const financeService: {
915
924
  id: string;
916
925
  paymentAuthorizationId: string | null;
917
926
  invoiceId: string | null;
918
- status: "pending" | "completed" | "failed" | "refunded" | "voided";
927
+ status: "pending" | "failed" | "completed" | "refunded" | "voided";
919
928
  currency: string;
920
929
  amountCents: number;
921
930
  provider: string | null;
@@ -1331,6 +1340,40 @@ export declare const financeService: {
1331
1340
  dueDate: string;
1332
1341
  scheduleType: "other" | "deposit" | "installment" | "balance" | "hold";
1333
1342
  } | null>;
1343
+ /**
1344
+ * Persist a payment schedule that was already computed elsewhere
1345
+ * (typically by `computePaymentSchedule()` from the policy primitive).
1346
+ *
1347
+ * Idempotency: when `replace: true` (the default), any existing
1348
+ * pending/due schedule rows on the booking are cleared first so a
1349
+ * re-fire of the same hook doesn't pile up duplicate rows. Set
1350
+ * `replace: false` to insert alongside existing rows (e.g. when
1351
+ * inserting a manually-added one-off installment).
1352
+ *
1353
+ * Skips silently when the booking row doesn't exist (returns
1354
+ * `null`) or when there are no entries to persist.
1355
+ */
1356
+ applyComputedPaymentSchedule(db: PostgresJsDatabase, bookingId: string, entries: Array<{
1357
+ scheduleType: "deposit" | "balance" | "installment" | "hold" | "other" | "full";
1358
+ amountCents: number;
1359
+ currency: string;
1360
+ dueDate: string;
1361
+ notes?: string | null;
1362
+ }>, options?: {
1363
+ replace?: boolean;
1364
+ }): Promise<{
1365
+ id: string;
1366
+ createdAt: Date;
1367
+ updatedAt: Date;
1368
+ status: "pending" | "expired" | "cancelled" | "paid" | "due" | "waived";
1369
+ currency: string;
1370
+ notes: string | null;
1371
+ bookingId: string;
1372
+ bookingItemId: string | null;
1373
+ amountCents: number;
1374
+ dueDate: string;
1375
+ scheduleType: "other" | "deposit" | "installment" | "balance" | "hold";
1376
+ }[] | null>;
1334
1377
  applyDefaultBookingPaymentPlan(db: PostgresJsDatabase, bookingId: string, data: ApplyDefaultBookingPaymentPlanInput): Promise<{
1335
1378
  id: string;
1336
1379
  createdAt: Date;
@@ -1366,7 +1409,7 @@ export declare const financeService: {
1366
1409
  createdAt: Date;
1367
1410
  updatedAt: Date;
1368
1411
  expiresAt: Date | null;
1369
- status: "pending" | "expired" | "cancelled" | "failed" | "paid" | "requires_redirect" | "processing" | "authorized";
1412
+ status: "pending" | "failed" | "expired" | "cancelled" | "paid" | "requires_redirect" | "processing" | "authorized";
1370
1413
  currency: string;
1371
1414
  notes: string | null;
1372
1415
  idempotencyKey: string | null;
@@ -1410,7 +1453,7 @@ export declare const financeService: {
1410
1453
  createdAt: Date;
1411
1454
  updatedAt: Date;
1412
1455
  expiresAt: Date | null;
1413
- status: "pending" | "expired" | "cancelled" | "failed" | "paid" | "requires_redirect" | "processing" | "authorized";
1456
+ status: "pending" | "failed" | "expired" | "cancelled" | "paid" | "requires_redirect" | "processing" | "authorized";
1414
1457
  currency: string;
1415
1458
  notes: string | null;
1416
1459
  idempotencyKey: string | null;
@@ -1539,7 +1582,7 @@ export declare const financeService: {
1539
1582
  tableName: "booking_guarantees";
1540
1583
  dataType: "string";
1541
1584
  columnType: "PgEnumColumn";
1542
- data: "pending" | "active" | "expired" | "cancelled" | "released" | "failed";
1585
+ data: "pending" | "active" | "failed" | "expired" | "cancelled" | "released";
1543
1586
  driverParam: string;
1544
1587
  notNull: true;
1545
1588
  hasDefault: true;
@@ -1761,7 +1804,7 @@ export declare const financeService: {
1761
1804
  bookingPaymentScheduleId: string | null;
1762
1805
  bookingItemId: string | null;
1763
1806
  guaranteeType: "other" | "voucher" | "bank_transfer" | "credit_card" | "deposit" | "preauth" | "card_on_file" | "agency_letter";
1764
- status: "pending" | "active" | "expired" | "cancelled" | "released" | "failed";
1807
+ status: "pending" | "active" | "failed" | "expired" | "cancelled" | "released";
1765
1808
  paymentInstrumentId: string | null;
1766
1809
  paymentAuthorizationId: string | null;
1767
1810
  currency: string | null;
@@ -1865,7 +1908,7 @@ export declare const financeService: {
1865
1908
  tableName: "booking_guarantees";
1866
1909
  dataType: "string";
1867
1910
  columnType: "PgEnumColumn";
1868
- data: "pending" | "active" | "expired" | "cancelled" | "released" | "failed";
1911
+ data: "pending" | "active" | "failed" | "expired" | "cancelled" | "released";
1869
1912
  driverParam: string;
1870
1913
  notNull: true;
1871
1914
  hasDefault: true;
@@ -2087,7 +2130,7 @@ export declare const financeService: {
2087
2130
  createdAt: Date;
2088
2131
  updatedAt: Date;
2089
2132
  expiresAt: Date | null;
2090
- status: "pending" | "active" | "expired" | "cancelled" | "released" | "failed";
2133
+ status: "pending" | "active" | "failed" | "expired" | "cancelled" | "released";
2091
2134
  currency: string | null;
2092
2135
  notes: string | null;
2093
2136
  provider: string | null;
@@ -2108,7 +2151,7 @@ export declare const financeService: {
2108
2151
  createdAt: Date;
2109
2152
  updatedAt: Date;
2110
2153
  expiresAt: Date | null;
2111
- status: "pending" | "expired" | "cancelled" | "failed" | "paid" | "requires_redirect" | "processing" | "authorized";
2154
+ status: "pending" | "failed" | "expired" | "cancelled" | "paid" | "requires_redirect" | "processing" | "authorized";
2112
2155
  currency: string;
2113
2156
  notes: string | null;
2114
2157
  idempotencyKey: string | null;
@@ -2152,7 +2195,7 @@ export declare const financeService: {
2152
2195
  bookingPaymentScheduleId: string | null;
2153
2196
  bookingItemId: string | null;
2154
2197
  guaranteeType: "other" | "voucher" | "bank_transfer" | "credit_card" | "deposit" | "preauth" | "card_on_file" | "agency_letter";
2155
- status: "pending" | "active" | "expired" | "cancelled" | "released" | "failed";
2198
+ status: "pending" | "active" | "failed" | "expired" | "cancelled" | "released";
2156
2199
  paymentInstrumentId: string | null;
2157
2200
  paymentAuthorizationId: string | null;
2158
2201
  currency: string | null;
@@ -3199,6 +3242,7 @@ export declare const financeService: {
3199
3242
  status: "pending" | "void" | "paid" | "accrued" | "payable";
3200
3243
  currency: string | null;
3201
3244
  notes: string | null;
3245
+ paidAt: string | null;
3202
3246
  bookingItemId: string;
3203
3247
  amountCents: number | null;
3204
3248
  channelId: string | null;
@@ -3206,7 +3250,6 @@ export declare const financeService: {
3206
3250
  recipientType: "internal" | "supplier" | "other" | "affiliate" | "channel" | "agency" | "agent";
3207
3251
  commissionModel: "fixed" | "percentage" | "markup" | "net";
3208
3252
  payableAt: string | null;
3209
- paidAt: string | null;
3210
3253
  } | null>;
3211
3254
  updateBookingItemCommission(db: PostgresJsDatabase, commissionId: string, data: UpdateBookingItemCommissionInput): Promise<{
3212
3255
  id: string;
@@ -3273,7 +3316,7 @@ export declare const financeService: {
3273
3316
  fxRateSetId: string | null;
3274
3317
  paymentMethod: "other" | "voucher" | "wallet" | "bank_transfer" | "credit_card" | "debit_card" | "cash" | "cheque" | "direct_bill";
3275
3318
  paymentInstrumentId: string | null;
3276
- status: "pending" | "completed" | "failed" | "refunded";
3319
+ status: "pending" | "failed" | "completed" | "refunded";
3277
3320
  referenceNumber: string | null;
3278
3321
  paymentDate: string;
3279
3322
  notes: string | null;
@@ -3288,7 +3331,7 @@ export declare const financeService: {
3288
3331
  id: string;
3289
3332
  createdAt: Date;
3290
3333
  updatedAt: Date;
3291
- status: "pending" | "completed" | "failed" | "refunded";
3334
+ status: "pending" | "failed" | "completed" | "refunded";
3292
3335
  currency: string;
3293
3336
  notes: string | null;
3294
3337
  bookingId: string;
@@ -3315,7 +3358,7 @@ export declare const financeService: {
3315
3358
  fxRateSetId: string | null;
3316
3359
  paymentMethod: "other" | "voucher" | "wallet" | "bank_transfer" | "credit_card" | "debit_card" | "cash" | "cheque" | "direct_bill";
3317
3360
  paymentInstrumentId: string | null;
3318
- status: "pending" | "completed" | "failed" | "refunded";
3361
+ status: "pending" | "failed" | "completed" | "refunded";
3319
3362
  referenceNumber: string | null;
3320
3363
  paymentDate: string;
3321
3364
  notes: string | null;
@@ -3327,6 +3370,7 @@ export declare const financeService: {
3327
3370
  id: string;
3328
3371
  invoiceNumber: string;
3329
3372
  invoiceType: "invoice" | "proforma" | "credit_note";
3373
+ convertedFromInvoiceId: string | null;
3330
3374
  seriesId: string | null;
3331
3375
  sequence: number | null;
3332
3376
  templateId: string | null;
@@ -3376,6 +3420,7 @@ export declare const financeService: {
3376
3420
  fxRateSetId: string | null;
3377
3421
  invoiceNumber: string;
3378
3422
  invoiceType: "invoice" | "proforma" | "credit_note";
3423
+ convertedFromInvoiceId: string | null;
3379
3424
  seriesId: string | null;
3380
3425
  sequence: number | null;
3381
3426
  templateId: string | null;
@@ -3410,6 +3455,7 @@ export declare const financeService: {
3410
3455
  fxRateSetId: string | null;
3411
3456
  invoiceNumber: string;
3412
3457
  invoiceType: "invoice" | "proforma" | "credit_note";
3458
+ convertedFromInvoiceId: string | null;
3413
3459
  seriesId: string | null;
3414
3460
  sequence: number | null;
3415
3461
  templateId: string | null;
@@ -3433,6 +3479,7 @@ export declare const financeService: {
3433
3479
  id: string;
3434
3480
  invoiceNumber: string;
3435
3481
  invoiceType: "invoice" | "proforma" | "credit_note";
3482
+ convertedFromInvoiceId: string | null;
3436
3483
  seriesId: string | null;
3437
3484
  sequence: number | null;
3438
3485
  templateId: string | null;
@@ -3467,6 +3514,7 @@ export declare const financeService: {
3467
3514
  id: string;
3468
3515
  invoiceNumber: string;
3469
3516
  invoiceType: "invoice" | "proforma" | "credit_note";
3517
+ convertedFromInvoiceId: string | null;
3470
3518
  seriesId: string | null;
3471
3519
  sequence: number | null;
3472
3520
  templateId: string | null;
@@ -4078,7 +4126,7 @@ export declare const financeService: {
4078
4126
  tableName: "payments";
4079
4127
  dataType: "string";
4080
4128
  columnType: "PgEnumColumn";
4081
- data: "pending" | "completed" | "failed" | "refunded";
4129
+ data: "pending" | "failed" | "completed" | "refunded";
4082
4130
  driverParam: string;
4083
4131
  notNull: true;
4084
4132
  hasDefault: true;
@@ -4187,7 +4235,7 @@ export declare const financeService: {
4187
4235
  paymentInstrumentId: string | null;
4188
4236
  paymentAuthorizationId: string | null;
4189
4237
  paymentCaptureId: string | null;
4190
- status: "pending" | "completed" | "failed" | "refunded";
4238
+ status: "pending" | "failed" | "completed" | "refunded";
4191
4239
  referenceNumber: string | null;
4192
4240
  paymentDate: string;
4193
4241
  notes: string | null;
@@ -4386,7 +4434,7 @@ export declare const financeService: {
4386
4434
  tableName: "payments";
4387
4435
  dataType: "string";
4388
4436
  columnType: "PgEnumColumn";
4389
- data: "pending" | "completed" | "failed" | "refunded";
4437
+ data: "pending" | "failed" | "completed" | "refunded";
4390
4438
  driverParam: string;
4391
4439
  notNull: true;
4392
4440
  hasDefault: true;
@@ -4488,7 +4536,7 @@ export declare const financeService: {
4488
4536
  id: string;
4489
4537
  createdAt: Date;
4490
4538
  updatedAt: Date;
4491
- status: "pending" | "completed" | "failed" | "refunded";
4539
+ status: "pending" | "failed" | "completed" | "refunded";
4492
4540
  currency: string;
4493
4541
  notes: string | null;
4494
4542
  baseCurrency: string | null;
@@ -5669,13 +5717,13 @@ export declare const financeService: {
5669
5717
  updatedAt: Date;
5670
5718
  status: "pending" | "failed" | "ready" | "stale";
5671
5719
  format: "json" | "pdf" | "html" | "xml";
5720
+ errorMessage: string | null;
5672
5721
  templateId: string | null;
5673
5722
  language: string | null;
5674
5723
  invoiceId: string;
5675
5724
  storageKey: string | null;
5676
5725
  fileSize: number | null;
5677
5726
  checksum: string | null;
5678
- errorMessage: string | null;
5679
5727
  generatedAt: Date | null;
5680
5728
  } | null>;
5681
5729
  updateInvoiceRendition(db: PostgresJsDatabase, id: string, data: UpdateInvoiceRenditionInput): Promise<{
@@ -5715,13 +5763,13 @@ export declare const financeService: {
5715
5763
  updatedAt: Date;
5716
5764
  status: "pending" | "failed" | "ready" | "stale";
5717
5765
  format: "json" | "pdf" | "html" | "xml";
5766
+ errorMessage: string | null;
5718
5767
  templateId: string | null;
5719
5768
  language: string | null;
5720
5769
  invoiceId: string;
5721
5770
  storageKey: string | null;
5722
5771
  fileSize: number | null;
5723
5772
  checksum: string | null;
5724
- errorMessage: string | null;
5725
5773
  generatedAt: Date | null;
5726
5774
  } | null;
5727
5775
  }>;
@@ -5785,6 +5833,178 @@ export declare const financeService: {
5785
5833
  deleteTaxRegime(db: PostgresJsDatabase, id: string): Promise<{
5786
5834
  id: string;
5787
5835
  } | null>;
5836
+ listTaxClasses(db: PostgresJsDatabase, query: TaxClassListQuery): Promise<{
5837
+ data: {
5838
+ id: string;
5839
+ code: string;
5840
+ label: string;
5841
+ description: string | null;
5842
+ defaultRegimeId: string | null;
5843
+ lines: {
5844
+ regime_id: string;
5845
+ applies_to: "base" | "addon" | "accommodation" | "all";
5846
+ }[] | null;
5847
+ active: boolean;
5848
+ createdAt: Date;
5849
+ updatedAt: Date;
5850
+ }[];
5851
+ total: number;
5852
+ limit: number;
5853
+ offset: number;
5854
+ }>;
5855
+ getTaxClassById(db: PostgresJsDatabase, id: string): Promise<{
5856
+ id: string;
5857
+ code: string;
5858
+ label: string;
5859
+ description: string | null;
5860
+ defaultRegimeId: string | null;
5861
+ lines: {
5862
+ regime_id: string;
5863
+ applies_to: "base" | "addon" | "accommodation" | "all";
5864
+ }[] | null;
5865
+ active: boolean;
5866
+ createdAt: Date;
5867
+ updatedAt: Date;
5868
+ } | null>;
5869
+ createTaxClass(db: PostgresJsDatabase, data: CreateTaxClassInput): Promise<{
5870
+ id: string;
5871
+ createdAt: Date;
5872
+ updatedAt: Date;
5873
+ description: string | null;
5874
+ code: string;
5875
+ active: boolean;
5876
+ label: string;
5877
+ defaultRegimeId: string | null;
5878
+ lines: {
5879
+ regime_id: string;
5880
+ applies_to: "base" | "addon" | "accommodation" | "all";
5881
+ }[] | null;
5882
+ } | null>;
5883
+ updateTaxClass(db: PostgresJsDatabase, id: string, data: UpdateTaxClassInput): Promise<{
5884
+ id: string;
5885
+ code: string;
5886
+ label: string;
5887
+ description: string | null;
5888
+ defaultRegimeId: string | null;
5889
+ lines: {
5890
+ regime_id: string;
5891
+ applies_to: "base" | "addon" | "accommodation" | "all";
5892
+ }[] | null;
5893
+ active: boolean;
5894
+ createdAt: Date;
5895
+ updatedAt: Date;
5896
+ } | null>;
5897
+ deleteTaxClass(db: PostgresJsDatabase, id: string): Promise<{
5898
+ id: string;
5899
+ } | null>;
5900
+ listTaxPolicyProfiles(db: PostgresJsDatabase, query: TaxPolicyProfileListQuery): Promise<{
5901
+ data: {
5902
+ id: string;
5903
+ code: string;
5904
+ name: string;
5905
+ jurisdiction: string | null;
5906
+ description: string | null;
5907
+ active: boolean;
5908
+ createdAt: Date;
5909
+ updatedAt: Date;
5910
+ }[];
5911
+ total: number;
5912
+ limit: number;
5913
+ offset: number;
5914
+ }>;
5915
+ getTaxPolicyProfileById(db: PostgresJsDatabase, id: string): Promise<{
5916
+ id: string;
5917
+ code: string;
5918
+ name: string;
5919
+ jurisdiction: string | null;
5920
+ description: string | null;
5921
+ active: boolean;
5922
+ createdAt: Date;
5923
+ updatedAt: Date;
5924
+ } | null>;
5925
+ createTaxPolicyProfile(db: PostgresJsDatabase, data: CreateTaxPolicyProfileInput): Promise<{
5926
+ id: string;
5927
+ name: string;
5928
+ createdAt: Date;
5929
+ updatedAt: Date;
5930
+ description: string | null;
5931
+ code: string;
5932
+ active: boolean;
5933
+ jurisdiction: string | null;
5934
+ } | null>;
5935
+ updateTaxPolicyProfile(db: PostgresJsDatabase, id: string, data: UpdateTaxPolicyProfileInput): Promise<{
5936
+ id: string;
5937
+ code: string;
5938
+ name: string;
5939
+ jurisdiction: string | null;
5940
+ description: string | null;
5941
+ active: boolean;
5942
+ createdAt: Date;
5943
+ updatedAt: Date;
5944
+ } | null>;
5945
+ deleteTaxPolicyProfile(db: PostgresJsDatabase, id: string): Promise<{
5946
+ id: string;
5947
+ } | null>;
5948
+ listTaxPolicyRules(db: PostgresJsDatabase, query: TaxPolicyRuleListQuery): Promise<{
5949
+ data: {
5950
+ id: string;
5951
+ profileId: string;
5952
+ side: "sell" | "buy";
5953
+ priority: number;
5954
+ name: string;
5955
+ appliesTo: "all" | "accommodation" | "base" | "addon";
5956
+ condition: Record<string, unknown> | null;
5957
+ taxRegimeId: string;
5958
+ active: boolean;
5959
+ createdAt: Date;
5960
+ updatedAt: Date;
5961
+ }[];
5962
+ total: number;
5963
+ limit: number;
5964
+ offset: number;
5965
+ }>;
5966
+ getTaxPolicyRuleById(db: PostgresJsDatabase, id: string): Promise<{
5967
+ id: string;
5968
+ profileId: string;
5969
+ side: "sell" | "buy";
5970
+ priority: number;
5971
+ name: string;
5972
+ appliesTo: "all" | "accommodation" | "base" | "addon";
5973
+ condition: Record<string, unknown> | null;
5974
+ taxRegimeId: string;
5975
+ active: boolean;
5976
+ createdAt: Date;
5977
+ updatedAt: Date;
5978
+ } | null>;
5979
+ createTaxPolicyRule(db: PostgresJsDatabase, data: CreateTaxPolicyRuleInput): Promise<{
5980
+ id: string;
5981
+ name: string;
5982
+ createdAt: Date;
5983
+ updatedAt: Date;
5984
+ active: boolean;
5985
+ taxRegimeId: string;
5986
+ profileId: string;
5987
+ side: "sell" | "buy";
5988
+ priority: number;
5989
+ appliesTo: "all" | "accommodation" | "base" | "addon";
5990
+ condition: Record<string, unknown> | null;
5991
+ } | null>;
5992
+ updateTaxPolicyRule(db: PostgresJsDatabase, id: string, data: UpdateTaxPolicyRuleInput): Promise<{
5993
+ id: string;
5994
+ profileId: string;
5995
+ side: "sell" | "buy";
5996
+ priority: number;
5997
+ name: string;
5998
+ appliesTo: "all" | "accommodation" | "base" | "addon";
5999
+ condition: Record<string, unknown> | null;
6000
+ taxRegimeId: string;
6001
+ active: boolean;
6002
+ createdAt: Date;
6003
+ updatedAt: Date;
6004
+ } | null>;
6005
+ deleteTaxPolicyRule(db: PostgresJsDatabase, id: string): Promise<{
6006
+ id: string;
6007
+ } | null>;
5788
6008
  listInvoiceExternalRefs(db: PostgresJsDatabase, invoiceId: string): Promise<{
5789
6009
  id: string;
5790
6010
  invoiceId: string;