@voyant-travel/finance 0.119.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (294) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +192 -0
  3. package/dist/action-ledger-drift.d.ts +29 -0
  4. package/dist/action-ledger-drift.d.ts.map +1 -0
  5. package/dist/action-ledger-drift.js +166 -0
  6. package/dist/booking-tax.d.ts +124 -0
  7. package/dist/booking-tax.d.ts.map +1 -0
  8. package/dist/booking-tax.js +264 -0
  9. package/dist/checkout-routes.d.ts +1154 -0
  10. package/dist/checkout-routes.d.ts.map +1 -0
  11. package/dist/checkout-routes.js +116 -0
  12. package/dist/checkout-service-plan.d.ts +137 -0
  13. package/dist/checkout-service-plan.d.ts.map +1 -0
  14. package/dist/checkout-service-plan.js +119 -0
  15. package/dist/checkout-service.d.ts +9 -0
  16. package/dist/checkout-service.d.ts.map +1 -0
  17. package/dist/checkout-service.js +324 -0
  18. package/dist/checkout-validation.d.ts +1682 -0
  19. package/dist/checkout-validation.d.ts.map +1 -0
  20. package/dist/checkout-validation.js +228 -0
  21. package/dist/document-download.d.ts +3 -0
  22. package/dist/document-download.d.ts.map +1 -0
  23. package/dist/document-download.js +1 -0
  24. package/dist/fx-money.d.ts +17 -0
  25. package/dist/fx-money.d.ts.map +1 -0
  26. package/dist/fx-money.js +194 -0
  27. package/dist/index.d.ts +65 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +108 -0
  30. package/dist/invoice-fx.d.ts +134 -0
  31. package/dist/invoice-fx.d.ts.map +1 -0
  32. package/dist/invoice-fx.js +240 -0
  33. package/dist/invoice-number-errors.d.ts +2 -0
  34. package/dist/invoice-number-errors.d.ts.map +1 -0
  35. package/dist/invoice-number-errors.js +58 -0
  36. package/dist/markets-ref.d.ts +149 -0
  37. package/dist/markets-ref.d.ts.map +1 -0
  38. package/dist/markets-ref.js +17 -0
  39. package/dist/payment-link.d.ts +23 -0
  40. package/dist/payment-link.d.ts.map +1 -0
  41. package/dist/payment-link.js +30 -0
  42. package/dist/payment-policy.d.ts +113 -0
  43. package/dist/payment-policy.d.ts.map +1 -0
  44. package/dist/payment-policy.js +193 -0
  45. package/dist/route-runtime.d.ts +22 -0
  46. package/dist/route-runtime.d.ts.map +1 -0
  47. package/dist/route-runtime.js +18 -0
  48. package/dist/routes-action-ledger.d.ts +181 -0
  49. package/dist/routes-action-ledger.d.ts.map +1 -0
  50. package/dist/routes-action-ledger.js +142 -0
  51. package/dist/routes-booking-billing.d.ts +852 -0
  52. package/dist/routes-booking-billing.d.ts.map +1 -0
  53. package/dist/routes-booking-billing.js +223 -0
  54. package/dist/routes-booking-create.d.ts +3 -0
  55. package/dist/routes-booking-create.d.ts.map +1 -0
  56. package/dist/routes-booking-create.js +194 -0
  57. package/dist/routes-booking-reads.d.ts +46 -0
  58. package/dist/routes-booking-reads.d.ts.map +1 -0
  59. package/dist/routes-booking-reads.js +20 -0
  60. package/dist/routes-documents.d.ts +195 -0
  61. package/dist/routes-documents.d.ts.map +1 -0
  62. package/dist/routes-documents.js +93 -0
  63. package/dist/routes-invoice-core.d.ts +794 -0
  64. package/dist/routes-invoice-core.d.ts.map +1 -0
  65. package/dist/routes-invoice-core.js +238 -0
  66. package/dist/routes-invoice-documents.d.ts +401 -0
  67. package/dist/routes-invoice-documents.d.ts.map +1 -0
  68. package/dist/routes-invoice-documents.js +91 -0
  69. package/dist/routes-invoice-issue.d.ts +384 -0
  70. package/dist/routes-invoice-issue.d.ts.map +1 -0
  71. package/dist/routes-invoice-issue.js +208 -0
  72. package/dist/routes-payment-processing.d.ts +1193 -0
  73. package/dist/routes-payment-processing.d.ts.map +1 -0
  74. package/dist/routes-payment-processing.js +238 -0
  75. package/dist/routes-payments.d.ts +309 -0
  76. package/dist/routes-payments.d.ts.map +1 -0
  77. package/dist/routes-payments.js +94 -0
  78. package/dist/routes-public.d.ts +1948 -0
  79. package/dist/routes-public.d.ts.map +1 -0
  80. package/dist/routes-public.js +275 -0
  81. package/dist/routes-reference-data.d.ts +977 -0
  82. package/dist/routes-reference-data.d.ts.map +1 -0
  83. package/dist/routes-reference-data.js +191 -0
  84. package/dist/routes-reports.d.ts +344 -0
  85. package/dist/routes-reports.d.ts.map +1 -0
  86. package/dist/routes-reports.js +93 -0
  87. package/dist/routes-runtime.d.ts +71 -0
  88. package/dist/routes-runtime.d.ts.map +1 -0
  89. package/dist/routes-runtime.js +59 -0
  90. package/dist/routes-settlement.d.ts +67 -0
  91. package/dist/routes-settlement.d.ts.map +1 -0
  92. package/dist/routes-settlement.js +23 -0
  93. package/dist/routes-shared.d.ts +35 -0
  94. package/dist/routes-shared.d.ts.map +1 -0
  95. package/dist/routes-shared.js +10 -0
  96. package/dist/routes-supplier-invoices.d.ts +778 -0
  97. package/dist/routes-supplier-invoices.d.ts.map +1 -0
  98. package/dist/routes-supplier-invoices.js +159 -0
  99. package/dist/routes-vouchers.d.ts +228 -0
  100. package/dist/routes-vouchers.d.ts.map +1 -0
  101. package/dist/routes-vouchers.js +54 -0
  102. package/dist/routes.d.ts +5577 -0
  103. package/dist/routes.d.ts.map +1 -0
  104. package/dist/routes.js +44 -0
  105. package/dist/schema/booking-billing.d.ts +1006 -0
  106. package/dist/schema/booking-billing.d.ts.map +1 -0
  107. package/dist/schema/booking-billing.js +106 -0
  108. package/dist/schema/enums.d.ts +48 -0
  109. package/dist/schema/enums.d.ts.map +1 -0
  110. package/dist/schema/enums.js +237 -0
  111. package/dist/schema/invoice-documents.d.ts +1245 -0
  112. package/dist/schema/invoice-documents.d.ts.map +1 -0
  113. package/dist/schema/invoice-documents.js +140 -0
  114. package/dist/schema/payment-instruments.d.ts +418 -0
  115. package/dist/schema/payment-instruments.d.ts.map +1 -0
  116. package/dist/schema/payment-instruments.js +45 -0
  117. package/dist/schema/payment-processing.d.ts +563 -0
  118. package/dist/schema/payment-processing.d.ts.map +1 -0
  119. package/dist/schema/payment-processing.js +65 -0
  120. package/dist/schema/payment-sessions.d.ts +728 -0
  121. package/dist/schema/payment-sessions.d.ts.map +1 -0
  122. package/dist/schema/payment-sessions.js +79 -0
  123. package/dist/schema/receivables.d.ts +1474 -0
  124. package/dist/schema/receivables.d.ts.map +1 -0
  125. package/dist/schema/receivables.js +179 -0
  126. package/dist/schema/relations.d.ts +82 -0
  127. package/dist/schema/relations.d.ts.map +1 -0
  128. package/dist/schema/relations.js +144 -0
  129. package/dist/schema/supplier-invoices.d.ts +1619 -0
  130. package/dist/schema/supplier-invoices.d.ts.map +1 -0
  131. package/dist/schema/supplier-invoices.js +228 -0
  132. package/dist/schema/tax.d.ts +712 -0
  133. package/dist/schema/tax.d.ts.map +1 -0
  134. package/dist/schema/tax.js +98 -0
  135. package/dist/schema/vouchers.d.ts +444 -0
  136. package/dist/schema/vouchers.d.ts.map +1 -0
  137. package/dist/schema/vouchers.js +64 -0
  138. package/dist/schema.d.ts +12 -0
  139. package/dist/schema.d.ts.map +1 -0
  140. package/dist/schema.js +11 -0
  141. package/dist/service-accountant-shares.d.ts +106 -0
  142. package/dist/service-accountant-shares.d.ts.map +1 -0
  143. package/dist/service-accountant-shares.js +331 -0
  144. package/dist/service-action-ledger-accounting.d.ts +104 -0
  145. package/dist/service-action-ledger-accounting.d.ts.map +1 -0
  146. package/dist/service-action-ledger-accounting.js +386 -0
  147. package/dist/service-action-ledger-booking-payments.d.ts +48 -0
  148. package/dist/service-action-ledger-booking-payments.d.ts.map +1 -0
  149. package/dist/service-action-ledger-booking-payments.js +178 -0
  150. package/dist/service-action-ledger-bookings.d.ts +44 -0
  151. package/dist/service-action-ledger-bookings.d.ts.map +1 -0
  152. package/dist/service-action-ledger-bookings.js +81 -0
  153. package/dist/service-action-ledger-payment-authorizations.d.ts +48 -0
  154. package/dist/service-action-ledger-payment-authorizations.d.ts.map +1 -0
  155. package/dist/service-action-ledger-payment-authorizations.js +209 -0
  156. package/dist/service-action-ledger-payment-sessions.d.ts +83 -0
  157. package/dist/service-action-ledger-payment-sessions.d.ts.map +1 -0
  158. package/dist/service-action-ledger-payment-sessions.js +294 -0
  159. package/dist/service-action-ledger-supplier-invoices.d.ts +27 -0
  160. package/dist/service-action-ledger-supplier-invoices.d.ts.map +1 -0
  161. package/dist/service-action-ledger-supplier-invoices.js +111 -0
  162. package/dist/service-action-ledger-supplier-payments.d.ts +21 -0
  163. package/dist/service-action-ledger-supplier-payments.d.ts.map +1 -0
  164. package/dist/service-action-ledger-supplier-payments.js +97 -0
  165. package/dist/service-action-ledger.d.ts +7 -0
  166. package/dist/service-action-ledger.d.ts.map +1 -0
  167. package/dist/service-action-ledger.js +6 -0
  168. package/dist/service-aggregates.d.ts +96 -0
  169. package/dist/service-aggregates.d.ts.map +1 -0
  170. package/dist/service-aggregates.js +294 -0
  171. package/dist/service-booking-billing.d.ts +2322 -0
  172. package/dist/service-booking-billing.d.ts.map +1 -0
  173. package/dist/service-booking-billing.js +8 -0
  174. package/dist/service-booking-create.d.ts +410 -0
  175. package/dist/service-booking-create.d.ts.map +1 -0
  176. package/dist/service-booking-create.js +1256 -0
  177. package/dist/service-booking-guarantees.d.ts +725 -0
  178. package/dist/service-booking-guarantees.d.ts.map +1 -0
  179. package/dist/service-booking-guarantees.js +153 -0
  180. package/dist/service-booking-item-billing.d.ts +1062 -0
  181. package/dist/service-booking-item-billing.d.ts.map +1 -0
  182. package/dist/service-booking-item-billing.js +77 -0
  183. package/dist/service-booking-payment-schedules.d.ts +557 -0
  184. package/dist/service-booking-payment-schedules.d.ts.map +1 -0
  185. package/dist/service-booking-payment-schedules.js +372 -0
  186. package/dist/service-bookings-dual-create.d.ts +308 -0
  187. package/dist/service-bookings-dual-create.d.ts.map +1 -0
  188. package/dist/service-bookings-dual-create.js +131 -0
  189. package/dist/service-boundary-sql.d.ts +6 -0
  190. package/dist/service-boundary-sql.d.ts.map +1 -0
  191. package/dist/service-boundary-sql.js +15 -0
  192. package/dist/service-cost-categories.d.ts +26 -0
  193. package/dist/service-cost-categories.d.ts.map +1 -0
  194. package/dist/service-cost-categories.js +76 -0
  195. package/dist/service-documents.d.ts +80 -0
  196. package/dist/service-documents.d.ts.map +1 -0
  197. package/dist/service-documents.js +228 -0
  198. package/dist/service-invoice-artifacts.d.ts +246 -0
  199. package/dist/service-invoice-artifacts.d.ts.map +1 -0
  200. package/dist/service-invoice-artifacts.js +277 -0
  201. package/dist/service-invoice-core.d.ts +405 -0
  202. package/dist/service-invoice-core.d.ts.map +1 -0
  203. package/dist/service-invoice-core.js +290 -0
  204. package/dist/service-invoice-credit-notes.d.ts +973 -0
  205. package/dist/service-invoice-credit-notes.d.ts.map +1 -0
  206. package/dist/service-invoice-credit-notes.js +142 -0
  207. package/dist/service-invoice-from-booking.d.ts +41 -0
  208. package/dist/service-invoice-from-booking.d.ts.map +1 -0
  209. package/dist/service-invoice-from-booking.js +267 -0
  210. package/dist/service-invoice-line-items.d.ts +432 -0
  211. package/dist/service-invoice-line-items.d.ts.map +1 -0
  212. package/dist/service-invoice-line-items.js +102 -0
  213. package/dist/service-invoice-numbering.d.ts +227 -0
  214. package/dist/service-invoice-numbering.d.ts.map +1 -0
  215. package/dist/service-invoice-numbering.js +260 -0
  216. package/dist/service-invoice-payments.d.ts +673 -0
  217. package/dist/service-invoice-payments.d.ts.map +1 -0
  218. package/dist/service-invoice-payments.js +398 -0
  219. package/dist/service-invoices.d.ts +2501 -0
  220. package/dist/service-invoices.d.ts.map +1 -0
  221. package/dist/service-invoices.js +12 -0
  222. package/dist/service-issue.d.ts +207 -0
  223. package/dist/service-issue.d.ts.map +1 -0
  224. package/dist/service-issue.js +431 -0
  225. package/dist/service-payment-authorizations.d.ts +164 -0
  226. package/dist/service-payment-authorizations.d.ts.map +1 -0
  227. package/dist/service-payment-authorizations.js +227 -0
  228. package/dist/service-payment-instruments.d.ts +116 -0
  229. package/dist/service-payment-instruments.d.ts.map +1 -0
  230. package/dist/service-payment-instruments.js +99 -0
  231. package/dist/service-payment-processing.d.ts +676 -0
  232. package/dist/service-payment-processing.d.ts.map +1 -0
  233. package/dist/service-payment-processing.js +10 -0
  234. package/dist/service-payment-session-completion.d.ts +48 -0
  235. package/dist/service-payment-session-completion.d.ts.map +1 -0
  236. package/dist/service-payment-session-completion.js +238 -0
  237. package/dist/service-payment-sessions.d.ts +361 -0
  238. package/dist/service-payment-sessions.d.ts.map +1 -0
  239. package/dist/service-payment-sessions.js +280 -0
  240. package/dist/service-profitability.d.ts +114 -0
  241. package/dist/service-profitability.d.ts.map +1 -0
  242. package/dist/service-profitability.js +794 -0
  243. package/dist/service-public.d.ts +553 -0
  244. package/dist/service-public.d.ts.map +1 -0
  245. package/dist/service-public.js +583 -0
  246. package/dist/service-reference-data.d.ts +272 -0
  247. package/dist/service-reference-data.d.ts.map +1 -0
  248. package/dist/service-reference-data.js +280 -0
  249. package/dist/service-rendition-wait.d.ts +38 -0
  250. package/dist/service-rendition-wait.d.ts.map +1 -0
  251. package/dist/service-rendition-wait.js +67 -0
  252. package/dist/service-reports.d.ts +37 -0
  253. package/dist/service-reports.d.ts.map +1 -0
  254. package/dist/service-reports.js +62 -0
  255. package/dist/service-settlement.d.ts +46 -0
  256. package/dist/service-settlement.d.ts.map +1 -0
  257. package/dist/service-settlement.js +185 -0
  258. package/dist/service-shared.d.ts +541 -0
  259. package/dist/service-shared.d.ts.map +1 -0
  260. package/dist/service-shared.js +764 -0
  261. package/dist/service-supplier-invoices.d.ts +871 -0
  262. package/dist/service-supplier-invoices.d.ts.map +1 -0
  263. package/dist/service-supplier-invoices.js +744 -0
  264. package/dist/service-supplier-payments.d.ts +69 -0
  265. package/dist/service-supplier-payments.d.ts.map +1 -0
  266. package/dist/service-supplier-payments.js +136 -0
  267. package/dist/service-vouchers-migration.d.ts +44 -0
  268. package/dist/service-vouchers-migration.d.ts.map +1 -0
  269. package/dist/service-vouchers-migration.js +148 -0
  270. package/dist/service-vouchers.d.ts +157 -0
  271. package/dist/service-vouchers.d.ts.map +1 -0
  272. package/dist/service-vouchers.js +191 -0
  273. package/dist/service.d.ts +6490 -0
  274. package/dist/service.d.ts.map +1 -0
  275. package/dist/service.js +29 -0
  276. package/dist/validation-billing.d.ts +2 -0
  277. package/dist/validation-billing.d.ts.map +1 -0
  278. package/dist/validation-billing.js +1 -0
  279. package/dist/validation-payments.d.ts +2 -0
  280. package/dist/validation-payments.d.ts.map +1 -0
  281. package/dist/validation-payments.js +1 -0
  282. package/dist/validation-public.d.ts +2 -0
  283. package/dist/validation-public.d.ts.map +1 -0
  284. package/dist/validation-public.js +1 -0
  285. package/dist/validation-shared.d.ts +2 -0
  286. package/dist/validation-shared.d.ts.map +1 -0
  287. package/dist/validation-shared.js +1 -0
  288. package/dist/validation-vouchers.d.ts +2 -0
  289. package/dist/validation-vouchers.d.ts.map +1 -0
  290. package/dist/validation-vouchers.js +1 -0
  291. package/dist/validation.d.ts +2 -0
  292. package/dist/validation.d.ts.map +1 -0
  293. package/dist/validation.js +1 -0
  294. package/package.json +121 -0
@@ -0,0 +1,149 @@
1
+ /**
2
+ * Local reference to `markets.exchange_rates`. Finance stores plain-text
3
+ * `fx_rate_set_id` links and reads this table opportunistically to normalize
4
+ * cross-currency payment/document amounts without taking a hard markets dep.
5
+ */
6
+ export declare const exchangeRatesRef: import("drizzle-orm/pg-core").PgTableWithColumns<{
7
+ name: "exchange_rates";
8
+ schema: undefined;
9
+ columns: {
10
+ id: import("drizzle-orm/pg-core").PgColumn<{
11
+ name: string;
12
+ tableName: "exchange_rates";
13
+ dataType: "string";
14
+ columnType: "PgText";
15
+ data: string;
16
+ driverParam: string;
17
+ notNull: true;
18
+ hasDefault: true;
19
+ isPrimaryKey: true;
20
+ isAutoincrement: false;
21
+ hasRuntimeDefault: true;
22
+ enumValues: [string, ...string[]];
23
+ baseColumn: never;
24
+ identity: undefined;
25
+ generated: undefined;
26
+ }, {}, {}>;
27
+ fxRateSetId: import("drizzle-orm/pg-core").PgColumn<{
28
+ name: string;
29
+ tableName: "exchange_rates";
30
+ dataType: "string";
31
+ columnType: "PgText";
32
+ data: string;
33
+ driverParam: string;
34
+ notNull: true;
35
+ hasDefault: false;
36
+ isPrimaryKey: false;
37
+ isAutoincrement: false;
38
+ hasRuntimeDefault: false;
39
+ enumValues: [string, ...string[]];
40
+ baseColumn: never;
41
+ identity: undefined;
42
+ generated: undefined;
43
+ }, {}, {}>;
44
+ baseCurrency: import("drizzle-orm/pg-core").PgColumn<{
45
+ name: "base_currency";
46
+ tableName: "exchange_rates";
47
+ dataType: "string";
48
+ columnType: "PgText";
49
+ data: string;
50
+ driverParam: string;
51
+ notNull: true;
52
+ hasDefault: false;
53
+ isPrimaryKey: false;
54
+ isAutoincrement: false;
55
+ hasRuntimeDefault: false;
56
+ enumValues: [string, ...string[]];
57
+ baseColumn: never;
58
+ identity: undefined;
59
+ generated: undefined;
60
+ }, {}, {}>;
61
+ quoteCurrency: import("drizzle-orm/pg-core").PgColumn<{
62
+ name: "quote_currency";
63
+ tableName: "exchange_rates";
64
+ dataType: "string";
65
+ columnType: "PgText";
66
+ data: string;
67
+ driverParam: string;
68
+ notNull: true;
69
+ hasDefault: false;
70
+ isPrimaryKey: false;
71
+ isAutoincrement: false;
72
+ hasRuntimeDefault: false;
73
+ enumValues: [string, ...string[]];
74
+ baseColumn: never;
75
+ identity: undefined;
76
+ generated: undefined;
77
+ }, {}, {}>;
78
+ rateDecimal: import("drizzle-orm/pg-core").PgColumn<{
79
+ name: "rate_decimal";
80
+ tableName: "exchange_rates";
81
+ dataType: "string";
82
+ columnType: "PgNumeric";
83
+ data: string;
84
+ driverParam: string;
85
+ notNull: true;
86
+ hasDefault: false;
87
+ isPrimaryKey: false;
88
+ isAutoincrement: false;
89
+ hasRuntimeDefault: false;
90
+ enumValues: undefined;
91
+ baseColumn: never;
92
+ identity: undefined;
93
+ generated: undefined;
94
+ }, {}, {}>;
95
+ inverseRateDecimal: import("drizzle-orm/pg-core").PgColumn<{
96
+ name: "inverse_rate_decimal";
97
+ tableName: "exchange_rates";
98
+ dataType: "string";
99
+ columnType: "PgNumeric";
100
+ data: string;
101
+ driverParam: string;
102
+ notNull: false;
103
+ hasDefault: false;
104
+ isPrimaryKey: false;
105
+ isAutoincrement: false;
106
+ hasRuntimeDefault: false;
107
+ enumValues: undefined;
108
+ baseColumn: never;
109
+ identity: undefined;
110
+ generated: undefined;
111
+ }, {}, {}>;
112
+ observedAt: import("drizzle-orm/pg-core").PgColumn<{
113
+ name: "observed_at";
114
+ tableName: "exchange_rates";
115
+ dataType: "date";
116
+ columnType: "PgTimestamp";
117
+ data: Date;
118
+ driverParam: string;
119
+ notNull: false;
120
+ hasDefault: false;
121
+ isPrimaryKey: false;
122
+ isAutoincrement: false;
123
+ hasRuntimeDefault: false;
124
+ enumValues: undefined;
125
+ baseColumn: never;
126
+ identity: undefined;
127
+ generated: undefined;
128
+ }, {}, {}>;
129
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
130
+ name: "created_at";
131
+ tableName: "exchange_rates";
132
+ dataType: "date";
133
+ columnType: "PgTimestamp";
134
+ data: Date;
135
+ driverParam: string;
136
+ notNull: true;
137
+ hasDefault: false;
138
+ isPrimaryKey: false;
139
+ isAutoincrement: false;
140
+ hasRuntimeDefault: false;
141
+ enumValues: undefined;
142
+ baseColumn: never;
143
+ identity: undefined;
144
+ generated: undefined;
145
+ }, {}, {}>;
146
+ };
147
+ dialect: "pg";
148
+ }>;
149
+ //# sourceMappingURL=markets-ref.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markets-ref.d.ts","sourceRoot":"","sources":["../src/markets-ref.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAS3B,CAAA"}
@@ -0,0 +1,17 @@
1
+ import { typeId, typeIdRef } from "@voyant-travel/db/lib/typeid-column";
2
+ import { numeric, pgTable, text, timestamp } from "drizzle-orm/pg-core";
3
+ /**
4
+ * Local reference to `markets.exchange_rates`. Finance stores plain-text
5
+ * `fx_rate_set_id` links and reads this table opportunistically to normalize
6
+ * cross-currency payment/document amounts without taking a hard markets dep.
7
+ */
8
+ export const exchangeRatesRef = pgTable("exchange_rates", {
9
+ id: typeId("exchange_rates").primaryKey(),
10
+ fxRateSetId: typeIdRef("fx_rate_set_id").notNull(),
11
+ baseCurrency: text("base_currency").notNull(),
12
+ quoteCurrency: text("quote_currency").notNull(),
13
+ rateDecimal: numeric("rate_decimal", { precision: 18, scale: 8 }).notNull(),
14
+ inverseRateDecimal: numeric("inverse_rate_decimal", { precision: 18, scale: 8 }),
15
+ observedAt: timestamp("observed_at", { withTimezone: true }),
16
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
17
+ });
@@ -0,0 +1,23 @@
1
+ export interface BuildPaymentLinkUrlOptions {
2
+ /**
3
+ * Customer-facing site base URL. When omitted in a browser, the current
4
+ * origin is used; outside a browser, the helper returns a root-relative URL.
5
+ */
6
+ baseUrl?: string | null;
7
+ /**
8
+ * Full customer-facing payment-session URL template. Supports `{sessionId}`.
9
+ * When supplied, it takes precedence over `baseUrl`.
10
+ */
11
+ invoicePayUrlTemplate?: string | null;
12
+ }
13
+ export declare function buildPaymentLinkUrl(paymentSessionId: string, options?: BuildPaymentLinkUrlOptions): string;
14
+ export interface BookingCheckoutUrlSettings {
15
+ bookingCheckoutUrlTemplate?: string | null;
16
+ }
17
+ export interface BuildBookingCheckoutUrlOptions {
18
+ bookingId?: string | null;
19
+ bookingCode?: string | null;
20
+ settings?: BookingCheckoutUrlSettings | null;
21
+ }
22
+ export declare function buildBookingCheckoutUrl(options: BuildBookingCheckoutUrlOptions): string | null;
23
+ //# sourceMappingURL=payment-link.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payment-link.d.ts","sourceRoot":"","sources":["../src/payment-link.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACtC;AAED,wBAAgB,mBAAmB,CACjC,gBAAgB,EAAE,MAAM,EACxB,OAAO,GAAE,0BAA+B,GACvC,MAAM,CAQR;AAED,MAAM,WAAW,0BAA0B;IACzC,0BAA0B,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC3C;AAED,MAAM,WAAW,8BAA8B;IAC7C,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,QAAQ,CAAC,EAAE,0BAA0B,GAAG,IAAI,CAAA;CAC7C;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,8BAA8B,GAAG,MAAM,GAAG,IAAI,CAU9F"}
@@ -0,0 +1,30 @@
1
+ export function buildPaymentLinkUrl(paymentSessionId, options = {}) {
2
+ const template = normalizePaymentLinkBaseUrl(options.invoicePayUrlTemplate);
3
+ if (template)
4
+ return template.replaceAll("{sessionId}", encodeURIComponent(paymentSessionId));
5
+ const path = `/pay/${encodeURIComponent(paymentSessionId)}`;
6
+ const baseUrl = normalizePaymentLinkBaseUrl(options.baseUrl ?? getBrowserOrigin());
7
+ return baseUrl ? `${baseUrl}${path}` : path;
8
+ }
9
+ export function buildBookingCheckoutUrl(options) {
10
+ const template = options.settings?.bookingCheckoutUrlTemplate?.trim();
11
+ if (!template)
12
+ return null;
13
+ if (template.includes("{bookingCode}") && !options.bookingCode)
14
+ return null;
15
+ if (template.includes("{bookingId}") && !options.bookingId)
16
+ return null;
17
+ return template
18
+ .replaceAll("{bookingCode}", encodeURIComponent(options.bookingCode ?? ""))
19
+ .replaceAll("{bookingId}", encodeURIComponent(options.bookingId ?? ""));
20
+ }
21
+ function normalizePaymentLinkBaseUrl(baseUrl) {
22
+ const trimmed = baseUrl?.trim();
23
+ if (!trimmed)
24
+ return null;
25
+ return trimmed.replace(/\/+$/, "");
26
+ }
27
+ function getBrowserOrigin() {
28
+ const location = globalThis.location;
29
+ return typeof location?.origin === "string" && location.origin.length > 0 ? location.origin : null;
30
+ }
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Customer-facing payment policy primitive.
3
+ *
4
+ * Decides how to split a booking total into a payment schedule: full
5
+ * payment up-front, or a deposit now + balance due before departure.
6
+ * Pure function — no DB, no IO. Two policies in (the operator default
7
+ * + any per-supplier / per-category / per-listing override) plus the
8
+ * booking total + departure date, schedule rows out.
9
+ *
10
+ * Behaviour:
11
+ *
12
+ * 1. If `policy.deposit.kind === "none"` → one row, full total, due
13
+ * immediately. Skips the rest of the rules.
14
+ * 2. If departure is too close (`< minDaysBeforeDepartureForDeposit`
15
+ * from today) → also full payment now. The agency doesn't have
16
+ * time to chase a balance.
17
+ * 3. Otherwise → two rows:
18
+ * - deposit row, due today, amount = percent × total OR fixed
19
+ * cents (capped at total).
20
+ * - balance row, amount = total − deposit, due
21
+ * `balanceDueDaysBeforeDeparture` before departure, but never
22
+ * sooner than `balanceDueMinDaysFromNow` days from now.
23
+ *
24
+ * Cascade resolution lives in {@link resolveEffectivePaymentPolicy}:
25
+ * the most-specific layer that defines a policy wins (booking >
26
+ * listing > category > supplier > operator default), no field-level
27
+ * merging — so the audit trail is "this whole policy applied".
28
+ */
29
+ export type DepositKind = "none" | "percent" | "fixed_cents";
30
+ export interface DepositRule {
31
+ kind: DepositKind;
32
+ /** Required when `kind === "percent"`. 0–100 inclusive. */
33
+ percent?: number;
34
+ /** Required when `kind === "fixed_cents"`. Capped at total. */
35
+ amountCents?: number;
36
+ }
37
+ export interface PaymentPolicy {
38
+ deposit: DepositRule;
39
+ /** Below this many days before departure, deposits are rejected and
40
+ * the booking is invoiced for the full amount up-front. */
41
+ minDaysBeforeDepartureForDeposit: number;
42
+ /** When the balance is due (days BEFORE departure). */
43
+ balanceDueDaysBeforeDeparture: number;
44
+ /** Floor on the balance due date so it's never sooner than this
45
+ * many days from "now". Protects the customer from a tight squeeze
46
+ * when departure is barely outside the deposit window. */
47
+ balanceDueMinDaysFromNow: number;
48
+ }
49
+ /** Default policy: 100% up-front, no deposit. Safe fallback for
50
+ * agencies that haven't configured anything yet. */
51
+ export declare const noDepositPolicy: PaymentPolicy;
52
+ export type PaymentScheduleEntryType = "deposit" | "balance" | "full";
53
+ export interface ComputedScheduleEntry {
54
+ scheduleType: PaymentScheduleEntryType;
55
+ amountCents: number;
56
+ currency: string;
57
+ /** ISO `YYYY-MM-DD`. */
58
+ dueDate: string;
59
+ }
60
+ export interface ComputeScheduleInput {
61
+ totalCents: number;
62
+ currency: string;
63
+ /** ISO `YYYY-MM-DD` (or full ISO string — we only look at the date). */
64
+ departureDate: string | null | undefined;
65
+ /** Defaults to `new Date()`. Injectable for deterministic tests. */
66
+ today?: Date;
67
+ }
68
+ /**
69
+ * Compute the customer-facing payment schedule for a booking.
70
+ *
71
+ * Always returns at least one row. When the policy resolves to no
72
+ * deposit (or the gate denies one), the single row is a `full`
73
+ * scheduled for today.
74
+ */
75
+ export declare function computePaymentSchedule(input: ComputeScheduleInput, policy: PaymentPolicy): ComputedScheduleEntry[];
76
+ /** True when this policy is empty / "inherit from parent". */
77
+ export declare function isPaymentPolicyEmpty(policy: PaymentPolicy | null | undefined): boolean;
78
+ export type PaymentPolicySource = "booking" | "listing" | "category" | "supplier" | "operator_default";
79
+ export interface PaymentPolicyCascadeLayers {
80
+ bookingPolicy?: PaymentPolicy | null;
81
+ listingPolicy?: PaymentPolicy | null;
82
+ categoryPolicy?: PaymentPolicy | null;
83
+ supplierPolicy?: PaymentPolicy | null;
84
+ operatorDefault: PaymentPolicy;
85
+ }
86
+ export interface ResolvedPaymentPolicy {
87
+ policy: PaymentPolicy;
88
+ source: PaymentPolicySource;
89
+ }
90
+ /**
91
+ * Most-specific-wins cascade. Returns both the policy and which
92
+ * layer it came from so contracts and ops UIs can show the trace.
93
+ *
94
+ * A layer is "set" when it's not null/undefined AND not effectively
95
+ * empty (deposit kind === "none" with no other meaningful fields).
96
+ * That way operators who declare an explicit "no deposit" policy on
97
+ * a supplier override their parent's "50% deposit" — they pass an
98
+ * explicit `deposit: { kind: "none" }` AND set non-zero day fields
99
+ * to mark the layer as intentional.
100
+ *
101
+ * For v1 we rely on null/undefined to mean "inherit". The settings
102
+ * API stores `null` for "use parent". An explicit "none" policy
103
+ * needs to be modeled with a different deposit kind later if it
104
+ * proves useful.
105
+ */
106
+ export declare function resolveEffectivePaymentPolicy(layers: PaymentPolicyCascadeLayers): ResolvedPaymentPolicy;
107
+ /**
108
+ * Predicate the storefront UI uses to decide whether to surface the
109
+ * "deposit + balance" copy or just "pay full now". Returns true when
110
+ * the policy + departure date resolve to a single full-payment row.
111
+ */
112
+ export declare function policyShouldRequireFullPayment(policy: PaymentPolicy, departureDate: string | null | undefined, today?: Date): boolean;
113
+ //# sourceMappingURL=payment-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payment-policy.d.ts","sourceRoot":"","sources":["../src/payment-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,SAAS,GAAG,aAAa,CAAA;AAE5D,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,WAAW,CAAA;IACjB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,+DAA+D;IAC/D,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,WAAW,CAAA;IACpB;gEAC4D;IAC5D,gCAAgC,EAAE,MAAM,CAAA;IACxC,uDAAuD;IACvD,6BAA6B,EAAE,MAAM,CAAA;IACrC;;+DAE2D;IAC3D,wBAAwB,EAAE,MAAM,CAAA;CACjC;AAED;qDACqD;AACrD,eAAO,MAAM,eAAe,EAAE,aAK7B,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,CAAA;AAErE,MAAM,WAAW,qBAAqB;IACpC,YAAY,EAAE,wBAAwB,CAAA;IACtC,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,wBAAwB;IACxB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,wEAAwE;IACxE,aAAa,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IACxC,oEAAoE;IACpE,KAAK,CAAC,EAAE,IAAI,CAAA;CACb;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,oBAAoB,EAC3B,MAAM,EAAE,aAAa,GACpB,qBAAqB,EAAE,CA8DzB;AAaD,8DAA8D;AAC9D,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAgBtF;AAED,MAAM,MAAM,mBAAmB,GAC3B,SAAS,GACT,SAAS,GACT,UAAU,GACV,UAAU,GACV,kBAAkB,CAAA;AAEtB,MAAM,WAAW,0BAA0B;IACzC,aAAa,CAAC,EAAE,aAAa,GAAG,IAAI,CAAA;IACpC,aAAa,CAAC,EAAE,aAAa,GAAG,IAAI,CAAA;IACpC,cAAc,CAAC,EAAE,aAAa,GAAG,IAAI,CAAA;IACrC,cAAc,CAAC,EAAE,aAAa,GAAG,IAAI,CAAA;IACrC,eAAe,EAAE,aAAa,CAAA;CAC/B;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,aAAa,CAAA;IACrB,MAAM,EAAE,mBAAmB,CAAA;CAC5B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,0BAA0B,GACjC,qBAAqB,CAMvB;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,aAAa,EACrB,aAAa,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACxC,KAAK,GAAE,IAAiB,GACvB,OAAO,CAKT"}
@@ -0,0 +1,193 @@
1
+ /**
2
+ * Customer-facing payment policy primitive.
3
+ *
4
+ * Decides how to split a booking total into a payment schedule: full
5
+ * payment up-front, or a deposit now + balance due before departure.
6
+ * Pure function — no DB, no IO. Two policies in (the operator default
7
+ * + any per-supplier / per-category / per-listing override) plus the
8
+ * booking total + departure date, schedule rows out.
9
+ *
10
+ * Behaviour:
11
+ *
12
+ * 1. If `policy.deposit.kind === "none"` → one row, full total, due
13
+ * immediately. Skips the rest of the rules.
14
+ * 2. If departure is too close (`< minDaysBeforeDepartureForDeposit`
15
+ * from today) → also full payment now. The agency doesn't have
16
+ * time to chase a balance.
17
+ * 3. Otherwise → two rows:
18
+ * - deposit row, due today, amount = percent × total OR fixed
19
+ * cents (capped at total).
20
+ * - balance row, amount = total − deposit, due
21
+ * `balanceDueDaysBeforeDeparture` before departure, but never
22
+ * sooner than `balanceDueMinDaysFromNow` days from now.
23
+ *
24
+ * Cascade resolution lives in {@link resolveEffectivePaymentPolicy}:
25
+ * the most-specific layer that defines a policy wins (booking >
26
+ * listing > category > supplier > operator default), no field-level
27
+ * merging — so the audit trail is "this whole policy applied".
28
+ */
29
+ /** Default policy: 100% up-front, no deposit. Safe fallback for
30
+ * agencies that haven't configured anything yet. */
31
+ export const noDepositPolicy = {
32
+ deposit: { kind: "none" },
33
+ minDaysBeforeDepartureForDeposit: 0,
34
+ balanceDueDaysBeforeDeparture: 0,
35
+ balanceDueMinDaysFromNow: 0,
36
+ };
37
+ /**
38
+ * Compute the customer-facing payment schedule for a booking.
39
+ *
40
+ * Always returns at least one row. When the policy resolves to no
41
+ * deposit (or the gate denies one), the single row is a `full`
42
+ * scheduled for today.
43
+ */
44
+ export function computePaymentSchedule(input, policy) {
45
+ const total = Math.max(0, Math.round(input.totalCents));
46
+ const today = input.today ?? new Date();
47
+ const todayIso = isoDate(today);
48
+ if (total === 0) {
49
+ return [{ scheduleType: "full", amountCents: 0, currency: input.currency, dueDate: todayIso }];
50
+ }
51
+ if (policy.deposit.kind === "none") {
52
+ return [
53
+ { scheduleType: "full", amountCents: total, currency: input.currency, dueDate: todayIso },
54
+ ];
55
+ }
56
+ const departure = parseIsoDate(input.departureDate);
57
+ if (!departure) {
58
+ // Without a departure date we can't anchor the balance, so fall
59
+ // back to full upfront — the operator can still split manually
60
+ // via a booking-level override later.
61
+ return [
62
+ { scheduleType: "full", amountCents: total, currency: input.currency, dueDate: todayIso },
63
+ ];
64
+ }
65
+ const daysUntilDeparture = wholeDaysBetween(today, departure);
66
+ if (daysUntilDeparture < policy.minDaysBeforeDepartureForDeposit) {
67
+ return [
68
+ { scheduleType: "full", amountCents: total, currency: input.currency, dueDate: todayIso },
69
+ ];
70
+ }
71
+ const depositCents = clampCents(computeDepositCents(total, policy.deposit), 0, total);
72
+ const balanceCents = total - depositCents;
73
+ if (depositCents <= 0 || balanceCents <= 0) {
74
+ // Edge: a policy that resolves to 0% deposit or 100% deposit
75
+ // collapses to a single row rather than emitting a zero-cent
76
+ // partner.
77
+ return [
78
+ { scheduleType: "full", amountCents: total, currency: input.currency, dueDate: todayIso },
79
+ ];
80
+ }
81
+ const rawBalanceDue = addDays(departure, -policy.balanceDueDaysBeforeDeparture);
82
+ const earliestBalanceDue = addDays(today, policy.balanceDueMinDaysFromNow);
83
+ const balanceDue = rawBalanceDue.getTime() > earliestBalanceDue.getTime() ? rawBalanceDue : earliestBalanceDue;
84
+ return [
85
+ {
86
+ scheduleType: "deposit",
87
+ amountCents: depositCents,
88
+ currency: input.currency,
89
+ dueDate: todayIso,
90
+ },
91
+ {
92
+ scheduleType: "balance",
93
+ amountCents: balanceCents,
94
+ currency: input.currency,
95
+ dueDate: isoDate(balanceDue),
96
+ },
97
+ ];
98
+ }
99
+ function computeDepositCents(total, rule) {
100
+ if (rule.kind === "percent") {
101
+ const pct = clampNumber(rule.percent ?? 0, 0, 100);
102
+ return Math.round((total * pct) / 100);
103
+ }
104
+ if (rule.kind === "fixed_cents") {
105
+ return Math.max(0, Math.round(rule.amountCents ?? 0));
106
+ }
107
+ return 0;
108
+ }
109
+ /** True when this policy is empty / "inherit from parent". */
110
+ export function isPaymentPolicyEmpty(policy) {
111
+ if (!policy)
112
+ return true;
113
+ if (policy.deposit.kind === "none")
114
+ return true;
115
+ if (policy.deposit.kind === "percent" &&
116
+ (policy.deposit.percent === undefined || policy.deposit.percent === 0)) {
117
+ return true;
118
+ }
119
+ if (policy.deposit.kind === "fixed_cents" &&
120
+ (policy.deposit.amountCents === undefined || policy.deposit.amountCents === 0)) {
121
+ return true;
122
+ }
123
+ return false;
124
+ }
125
+ /**
126
+ * Most-specific-wins cascade. Returns both the policy and which
127
+ * layer it came from so contracts and ops UIs can show the trace.
128
+ *
129
+ * A layer is "set" when it's not null/undefined AND not effectively
130
+ * empty (deposit kind === "none" with no other meaningful fields).
131
+ * That way operators who declare an explicit "no deposit" policy on
132
+ * a supplier override their parent's "50% deposit" — they pass an
133
+ * explicit `deposit: { kind: "none" }` AND set non-zero day fields
134
+ * to mark the layer as intentional.
135
+ *
136
+ * For v1 we rely on null/undefined to mean "inherit". The settings
137
+ * API stores `null` for "use parent". An explicit "none" policy
138
+ * needs to be modeled with a different deposit kind later if it
139
+ * proves useful.
140
+ */
141
+ export function resolveEffectivePaymentPolicy(layers) {
142
+ if (layers.bookingPolicy)
143
+ return { policy: layers.bookingPolicy, source: "booking" };
144
+ if (layers.listingPolicy)
145
+ return { policy: layers.listingPolicy, source: "listing" };
146
+ if (layers.categoryPolicy)
147
+ return { policy: layers.categoryPolicy, source: "category" };
148
+ if (layers.supplierPolicy)
149
+ return { policy: layers.supplierPolicy, source: "supplier" };
150
+ return { policy: layers.operatorDefault, source: "operator_default" };
151
+ }
152
+ /**
153
+ * Predicate the storefront UI uses to decide whether to surface the
154
+ * "deposit + balance" copy or just "pay full now". Returns true when
155
+ * the policy + departure date resolve to a single full-payment row.
156
+ */
157
+ export function policyShouldRequireFullPayment(policy, departureDate, today = new Date()) {
158
+ if (policy.deposit.kind === "none")
159
+ return true;
160
+ const departure = parseIsoDate(departureDate);
161
+ if (!departure)
162
+ return true;
163
+ return wholeDaysBetween(today, departure) < policy.minDaysBeforeDepartureForDeposit;
164
+ }
165
+ // ─────────────────────────────────────────────────────────────────
166
+ // Helpers
167
+ // ─────────────────────────────────────────────────────────────────
168
+ function parseIsoDate(value) {
169
+ if (!value)
170
+ return null;
171
+ const trimmed = value.length >= 10 ? value.slice(0, 10) : value;
172
+ const parsed = new Date(`${trimmed}T00:00:00Z`);
173
+ return Number.isNaN(parsed.getTime()) ? null : parsed;
174
+ }
175
+ function isoDate(d) {
176
+ return d.toISOString().slice(0, 10);
177
+ }
178
+ function wholeDaysBetween(from, to) {
179
+ const fromMs = Date.UTC(from.getUTCFullYear(), from.getUTCMonth(), from.getUTCDate());
180
+ const toMs = Date.UTC(to.getUTCFullYear(), to.getUTCMonth(), to.getUTCDate());
181
+ return Math.floor((toMs - fromMs) / (24 * 60 * 60 * 1000));
182
+ }
183
+ function addDays(d, days) {
184
+ const next = new Date(d.getTime());
185
+ next.setUTCDate(next.getUTCDate() + days);
186
+ return next;
187
+ }
188
+ function clampCents(value, min, max) {
189
+ return Math.max(min, Math.min(max, Math.round(value)));
190
+ }
191
+ function clampNumber(value, min, max) {
192
+ return Math.max(min, Math.min(max, value));
193
+ }
@@ -0,0 +1,22 @@
1
+ import type { EventBus } from "@voyant-travel/core";
2
+ import type { InvoiceFxOptions } from "./invoice-fx.js";
3
+ import type { FinanceDocumentRouteOptions, InvoiceDocumentGenerator } from "./routes-documents.js";
4
+ import type { FinanceSettlementRouteOptions, InvoiceSettlementPoller } from "./routes-settlement.js";
5
+ import type { InvoiceDueDateResolver, InvoiceLineDescriptionResolver, PaymentScheduleLineDescriptionFormat } from "./service.js";
6
+ export type FinanceRouteRuntime = {
7
+ invoiceDocumentGenerator?: InvoiceDocumentGenerator;
8
+ resolveDocumentDownloadUrl?: FinanceDocumentRouteOptions["resolveDocumentDownloadUrl"];
9
+ invoiceSettlementPollers: Record<string, InvoiceSettlementPoller>;
10
+ eventBus?: EventBus;
11
+ descriptionResolver?: InvoiceLineDescriptionResolver;
12
+ invoiceDueDateResolver?: InvoiceDueDateResolver;
13
+ paymentScheduleLineDescriptionFormat?: PaymentScheduleLineDescriptionFormat;
14
+ } & InvoiceFxOptions;
15
+ export declare const FINANCE_ROUTE_RUNTIME_CONTAINER_KEY = "providers.finance.runtime";
16
+ export interface FinanceRuntimeOptions extends FinanceDocumentRouteOptions, FinanceSettlementRouteOptions, InvoiceFxOptions {
17
+ descriptionResolver?: InvoiceLineDescriptionResolver;
18
+ invoiceDueDateResolver?: InvoiceDueDateResolver;
19
+ paymentScheduleLineDescriptionFormat?: PaymentScheduleLineDescriptionFormat;
20
+ }
21
+ export declare function buildFinanceRouteRuntime(bindings: Record<string, unknown>, options?: FinanceRuntimeOptions): FinanceRouteRuntime;
22
+ //# sourceMappingURL=route-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-runtime.d.ts","sourceRoot":"","sources":["../src/route-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAEnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,KAAK,EAAE,2BAA2B,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAClG,OAAO,KAAK,EAAE,6BAA6B,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAA;AACpG,OAAO,KAAK,EACV,sBAAsB,EACtB,8BAA8B,EAC9B,oCAAoC,EACrC,MAAM,cAAc,CAAA;AAErB,MAAM,MAAM,mBAAmB,GAAG;IAChC,wBAAwB,CAAC,EAAE,wBAAwB,CAAA;IACnD,0BAA0B,CAAC,EAAE,2BAA2B,CAAC,4BAA4B,CAAC,CAAA;IACtF,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAA;IACjE,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,mBAAmB,CAAC,EAAE,8BAA8B,CAAA;IACpD,sBAAsB,CAAC,EAAE,sBAAsB,CAAA;IAC/C,oCAAoC,CAAC,EAAE,oCAAoC,CAAA;CAC5E,GAAG,gBAAgB,CAAA;AAEpB,eAAO,MAAM,mCAAmC,8BAA8B,CAAA;AAE9E,MAAM,WAAW,qBACf,SAAQ,2BAA2B,EACjC,6BAA6B,EAC7B,gBAAgB;IAClB,mBAAmB,CAAC,EAAE,8BAA8B,CAAA;IACpD,sBAAsB,CAAC,EAAE,sBAAsB,CAAA;IAC/C,oCAAoC,CAAC,EAAE,oCAAoC,CAAA;CAC5E;AAED,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,OAAO,GAAE,qBAA0B,GAClC,mBAAmB,CAmBrB"}
@@ -0,0 +1,18 @@
1
+ export const FINANCE_ROUTE_RUNTIME_CONTAINER_KEY = "providers.finance.runtime";
2
+ export function buildFinanceRouteRuntime(bindings, options = {}) {
3
+ return {
4
+ invoiceDocumentGenerator: options.resolveInvoiceDocumentGenerator?.(bindings) ?? options.invoiceDocumentGenerator,
5
+ resolveDocumentDownloadUrl: options.resolveDocumentDownloadUrl,
6
+ invoiceSettlementPollers: options.resolveInvoiceSettlementPollers?.(bindings) ?? options.invoiceSettlementPollers ?? {},
7
+ eventBus: options.resolveEventBus?.(bindings) ?? options.eventBus,
8
+ descriptionResolver: options.descriptionResolver,
9
+ invoiceDueDateResolver: options.invoiceDueDateResolver,
10
+ paymentScheduleLineDescriptionFormat: options.paymentScheduleLineDescriptionFormat,
11
+ invoiceFxSettings: options.invoiceFxSettings,
12
+ resolveInvoiceFxSettings: options.resolveInvoiceFxSettings,
13
+ updateInvoiceFxSettings: options.updateInvoiceFxSettings,
14
+ resolveInvoiceExchangeRate: options.resolveInvoiceExchangeRateResolver?.(bindings) ?? options.resolveInvoiceExchangeRate,
15
+ resolveInvoiceExchangeRateResolver: options.resolveInvoiceExchangeRateResolver,
16
+ onInvoiceFxResolutionError: options.onInvoiceFxResolutionError,
17
+ };
18
+ }