@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,10 @@
1
+ import { financePaymentAuthorizationService } from "./service-payment-authorizations.js";
2
+ import { financePaymentInstrumentService } from "./service-payment-instruments.js";
3
+ import { financePaymentSessionCompletionService } from "./service-payment-session-completion.js";
4
+ import { financePaymentSessionService } from "./service-payment-sessions.js";
5
+ export const financePaymentProcessingService = {
6
+ ...financePaymentInstrumentService,
7
+ ...financePaymentSessionService,
8
+ ...financePaymentSessionCompletionService,
9
+ ...financePaymentAuthorizationService,
10
+ };
@@ -0,0 +1,48 @@
1
+ import type { CompletePaymentSessionInput, FinanceServiceRuntime, PostgresJsDatabase } from "./service-shared.js";
2
+ export declare const financePaymentSessionCompletionService: {
3
+ completePaymentSession(db: PostgresJsDatabase, id: string, data: CompletePaymentSessionInput, runtime?: FinanceServiceRuntime): Promise<{
4
+ id: string;
5
+ targetType: "other" | "booking_payment_schedule" | "invoice" | "booking" | "booking_guarantee" | "flight_order" | "order";
6
+ targetId: string | null;
7
+ bookingId: string | null;
8
+ orderId: string | null;
9
+ invoiceId: string | null;
10
+ bookingPaymentScheduleId: string | null;
11
+ bookingGuaranteeId: string | null;
12
+ paymentInstrumentId: string | null;
13
+ paymentAuthorizationId: string | null;
14
+ paymentCaptureId: string | null;
15
+ paymentId: string | null;
16
+ status: "processing" | "failed" | "pending" | "cancelled" | "paid" | "expired" | "authorized" | "requires_redirect";
17
+ provider: string | null;
18
+ providerSessionId: string | null;
19
+ providerPaymentId: string | null;
20
+ externalReference: string | null;
21
+ idempotencyKey: string | null;
22
+ clientReference: string | null;
23
+ currency: string;
24
+ amountCents: number;
25
+ paymentMethod: "other" | "bank_transfer" | "credit_card" | "voucher" | "debit_card" | "cash" | "cheque" | "wallet" | "direct_bill" | null;
26
+ payerPersonId: string | null;
27
+ payerOrganizationId: string | null;
28
+ payerEmail: string | null;
29
+ payerName: string | null;
30
+ redirectUrl: string | null;
31
+ returnUrl: string | null;
32
+ cancelUrl: string | null;
33
+ callbackUrl: string | null;
34
+ expiresAt: Date | null;
35
+ completedAt: Date | null;
36
+ failedAt: Date | null;
37
+ cancelledAt: Date | null;
38
+ expiredAt: Date | null;
39
+ failureCode: string | null;
40
+ failureMessage: string | null;
41
+ notes: string | null;
42
+ providerPayload: Record<string, unknown> | null;
43
+ metadata: Record<string, unknown> | null;
44
+ createdAt: Date;
45
+ updatedAt: Date;
46
+ } | null>;
47
+ };
48
+ //# sourceMappingURL=service-payment-session-completion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-payment-session-completion.d.ts","sourceRoot":"","sources":["../src/service-payment-session-completion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,2BAA2B,EAC3B,qBAAqB,EAErB,kBAAkB,EACnB,MAAM,qBAAqB,CAAA;AAuB5B,eAAO,MAAM,sCAAsC;+BAE3C,kBAAkB,MAClB,MAAM,QACJ,2BAA2B,YACxB,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAySjC,CAAA"}
@@ -0,0 +1,238 @@
1
+ import { and, appendActionLedgerMutation, assertBookingPaymentScheduleHasPaymentCoverage, bookingGuarantees, bookingPaymentSchedules, buildBookingPaymentSchedulePaidEvent, buildPaymentCompletedEvent, buildPaymentSessionCompletionActionLedgerInput, eq, invoices, ne, PaymentValidationError, paymentAuthorizations, paymentCaptures, paymentSessions, payments, resolveInvoiceForPaymentSession, sql, toTimestamp, } from "./service-shared.js";
2
+ export const financePaymentSessionCompletionService = {
3
+ async completePaymentSession(db, id, data, runtime = {}) {
4
+ const [session] = await db
5
+ .select()
6
+ .from(paymentSessions)
7
+ .where(eq(paymentSessions.id, id))
8
+ .limit(1);
9
+ if (!session) {
10
+ return null;
11
+ }
12
+ const txResult = await db.transaction(async (tx) => {
13
+ let authorizationId = session.paymentAuthorizationId;
14
+ let captureId = session.paymentCaptureId;
15
+ let paymentId = session.paymentId;
16
+ const invoiceForPayment = data.status === "paid" && !paymentId
17
+ ? await resolveInvoiceForPaymentSession(tx, session)
18
+ : null;
19
+ if (data.status === "paid" &&
20
+ session.bookingPaymentScheduleId &&
21
+ !paymentId &&
22
+ !invoiceForPayment) {
23
+ throw new PaymentValidationError("Cannot complete a booking payment schedule session without an outstanding booking invoice", {
24
+ paymentSessionId: session.id,
25
+ bookingPaymentScheduleId: session.bookingPaymentScheduleId,
26
+ });
27
+ }
28
+ // Settlement payload to emit after the tx commits, so subscribers see
29
+ // a consistent post-update view. Stays null when this call doesn't
30
+ // result in a new payment being applied to an invoice.
31
+ let settlementForEmit = null;
32
+ let bookingSchedulePaidForEmit = null;
33
+ if (!authorizationId) {
34
+ const [authorization] = await tx
35
+ .insert(paymentAuthorizations)
36
+ .values({
37
+ bookingId: session.bookingId ?? null,
38
+ orderId: session.orderId ?? null,
39
+ invoiceId: invoiceForPayment?.id ?? session.invoiceId ?? null,
40
+ bookingGuaranteeId: session.bookingGuaranteeId ?? null,
41
+ paymentInstrumentId: data.paymentInstrumentId ?? session.paymentInstrumentId ?? null,
42
+ status: data.status === "paid" ? "captured" : "authorized",
43
+ captureMode: data.captureMode,
44
+ currency: session.currency,
45
+ amountCents: session.amountCents,
46
+ provider: session.provider ?? null,
47
+ externalAuthorizationId: data.externalAuthorizationId ??
48
+ data.providerPaymentId ??
49
+ session.providerPaymentId ??
50
+ null,
51
+ approvalCode: data.approvalCode ?? null,
52
+ authorizedAt: toTimestamp(data.authorizedAt) ?? new Date(),
53
+ expiresAt: toTimestamp(data.expiresAt),
54
+ notes: data.notes ?? session.notes ?? null,
55
+ })
56
+ .returning({ id: paymentAuthorizations.id });
57
+ authorizationId = authorization?.id ?? null;
58
+ }
59
+ else if (data.status === "paid") {
60
+ await tx
61
+ .update(paymentAuthorizations)
62
+ .set({
63
+ status: "captured",
64
+ paymentInstrumentId: data.paymentInstrumentId ?? session.paymentInstrumentId ?? undefined,
65
+ externalAuthorizationId: data.externalAuthorizationId === undefined
66
+ ? undefined
67
+ : (data.externalAuthorizationId ?? null),
68
+ approvalCode: data.approvalCode ?? undefined,
69
+ authorizedAt: data.authorizedAt === undefined ? undefined : toTimestamp(data.authorizedAt),
70
+ expiresAt: data.expiresAt === undefined ? undefined : toTimestamp(data.expiresAt),
71
+ updatedAt: new Date(),
72
+ })
73
+ .where(eq(paymentAuthorizations.id, authorizationId));
74
+ }
75
+ if (data.status === "paid" && !captureId) {
76
+ const [capture] = await tx
77
+ .insert(paymentCaptures)
78
+ .values({
79
+ paymentAuthorizationId: authorizationId,
80
+ invoiceId: invoiceForPayment?.id ?? session.invoiceId ?? null,
81
+ status: "completed",
82
+ currency: session.currency,
83
+ amountCents: session.amountCents,
84
+ provider: session.provider ?? null,
85
+ externalCaptureId: data.externalCaptureId ?? data.providerPaymentId ?? session.providerPaymentId ?? null,
86
+ capturedAt: toTimestamp(data.capturedAt) ?? new Date(),
87
+ settledAt: toTimestamp(data.settledAt),
88
+ notes: data.notes ?? session.notes ?? null,
89
+ })
90
+ .returning({ id: paymentCaptures.id });
91
+ captureId = capture?.id ?? null;
92
+ }
93
+ if (data.status === "paid" && invoiceForPayment && !paymentId) {
94
+ const [payment] = await tx
95
+ .insert(payments)
96
+ .values({
97
+ invoiceId: invoiceForPayment.id,
98
+ amountCents: session.amountCents,
99
+ currency: session.currency,
100
+ paymentMethod: data.paymentMethod ?? session.paymentMethod ?? "other",
101
+ paymentInstrumentId: data.paymentInstrumentId ?? session.paymentInstrumentId ?? null,
102
+ paymentAuthorizationId: authorizationId,
103
+ paymentCaptureId: captureId,
104
+ status: "completed",
105
+ referenceNumber: data.referenceNumber ?? data.externalReference ?? session.externalReference ?? null,
106
+ paymentDate: (data.paymentDate ? new Date(data.paymentDate) : new Date())
107
+ .toISOString()
108
+ .slice(0, 10),
109
+ notes: data.notes ?? session.notes ?? null,
110
+ })
111
+ .returning({ id: payments.id });
112
+ paymentId = payment?.id ?? null;
113
+ const [sumResult] = await tx
114
+ .select({ total: sql `coalesce(sum(amount_cents), 0)::int` })
115
+ .from(payments)
116
+ .where(and(eq(payments.invoiceId, invoiceForPayment.id), eq(payments.status, "completed")));
117
+ const paidCents = sumResult?.total ?? 0;
118
+ const balanceDueCents = Math.max(0, invoiceForPayment.totalCents - paidCents);
119
+ await tx
120
+ .update(invoices)
121
+ .set({
122
+ paidCents,
123
+ balanceDueCents,
124
+ status: paidCents >= invoiceForPayment.totalCents
125
+ ? "paid"
126
+ : paidCents > 0
127
+ ? "partially_paid"
128
+ : invoiceForPayment.status,
129
+ updatedAt: new Date(),
130
+ })
131
+ .where(eq(invoices.id, invoiceForPayment.id));
132
+ if (paymentId) {
133
+ settlementForEmit = {
134
+ invoiceId: invoiceForPayment.id,
135
+ paymentId,
136
+ provider: session.provider ?? "internal",
137
+ newlyAppliedAmountCents: session.amountCents,
138
+ paidCents,
139
+ balanceDueCents,
140
+ };
141
+ }
142
+ }
143
+ if (session.bookingGuaranteeId && authorizationId) {
144
+ await tx
145
+ .update(bookingGuarantees)
146
+ .set({
147
+ paymentAuthorizationId: authorizationId,
148
+ paymentInstrumentId: data.paymentInstrumentId ?? session.paymentInstrumentId ?? undefined,
149
+ status: "active",
150
+ guaranteedAt: toTimestamp(data.authorizedAt) ?? new Date(),
151
+ updatedAt: new Date(),
152
+ })
153
+ .where(eq(bookingGuarantees.id, session.bookingGuaranteeId));
154
+ }
155
+ const [updated] = await tx
156
+ .update(paymentSessions)
157
+ .set({
158
+ status: data.status,
159
+ paymentMethod: data.paymentMethod ?? session.paymentMethod ?? undefined,
160
+ paymentInstrumentId: data.paymentInstrumentId ?? session.paymentInstrumentId ?? undefined,
161
+ paymentAuthorizationId: authorizationId,
162
+ paymentCaptureId: captureId,
163
+ paymentId,
164
+ invoiceId: invoiceForPayment?.id ?? session.invoiceId ?? undefined,
165
+ providerSessionId: data.providerSessionId ?? session.providerSessionId ?? undefined,
166
+ providerPaymentId: data.providerPaymentId ?? session.providerPaymentId ?? undefined,
167
+ externalReference: data.externalReference ?? session.externalReference ?? undefined,
168
+ providerPayload: data.providerPayload ?? undefined,
169
+ metadata: data.metadata ?? undefined,
170
+ notes: data.notes ?? session.notes ?? undefined,
171
+ redirectUrl: data.status === "paid" ? null : session.redirectUrl,
172
+ failureCode: null,
173
+ failureMessage: null,
174
+ expiresAt: data.expiresAt === undefined ? session.expiresAt : toTimestamp(data.expiresAt),
175
+ completedAt: new Date(),
176
+ updatedAt: new Date(),
177
+ })
178
+ .where(eq(paymentSessions.id, id))
179
+ .returning();
180
+ if (updated && runtime.actionLedgerContext) {
181
+ await appendActionLedgerMutation(tx, await buildPaymentSessionCompletionActionLedgerInput(runtime.actionLedgerContext, {
182
+ session: updated,
183
+ status: data.status,
184
+ paymentId,
185
+ }, {
186
+ authorizationSource: runtime.actionLedgerAuthorizationSource,
187
+ }));
188
+ }
189
+ if (data.status === "paid" && session.bookingPaymentScheduleId) {
190
+ const [schedule] = await tx
191
+ .select()
192
+ .from(bookingPaymentSchedules)
193
+ .where(eq(bookingPaymentSchedules.id, session.bookingPaymentScheduleId))
194
+ .limit(1);
195
+ if (schedule) {
196
+ await assertBookingPaymentScheduleHasPaymentCoverage(tx, schedule);
197
+ const [paidSchedule] = await tx
198
+ .update(bookingPaymentSchedules)
199
+ .set({ status: "paid", updatedAt: new Date() })
200
+ .where(and(eq(bookingPaymentSchedules.id, session.bookingPaymentScheduleId), ne(bookingPaymentSchedules.status, "paid")))
201
+ .returning();
202
+ if (paidSchedule && updated) {
203
+ bookingSchedulePaidForEmit = buildBookingPaymentSchedulePaidEvent(paidSchedule, updated, paymentId);
204
+ }
205
+ }
206
+ }
207
+ return {
208
+ updated: updated ?? null,
209
+ settlement: settlementForEmit,
210
+ bookingSchedulePaid: bookingSchedulePaidForEmit,
211
+ };
212
+ });
213
+ if (txResult.settlement) {
214
+ await runtime.eventBus?.emit("invoice.settled", txResult.settlement, {
215
+ category: "domain",
216
+ source: "service",
217
+ });
218
+ }
219
+ if (txResult.bookingSchedulePaid) {
220
+ await runtime.eventBus?.emit("booking_payment_schedule.paid", txResult.bookingSchedulePaid, {
221
+ category: "domain",
222
+ source: "service",
223
+ });
224
+ }
225
+ // Emit a generic `payment.completed` so cross-vertical subscribers
226
+ // can react without having to know the specific provider chain.
227
+ // Some aggregate flows, such as composed trips, intentionally use a
228
+ // generic target instead of booking/order/invoice columns; those still
229
+ // need the completion event keyed by targetType/targetId.
230
+ if (data.status === "paid" && txResult.updated) {
231
+ await runtime.eventBus?.emit("payment.completed", buildPaymentCompletedEvent(txResult.updated), {
232
+ category: "domain",
233
+ source: "service",
234
+ });
235
+ }
236
+ return txResult.updated;
237
+ },
238
+ };
@@ -0,0 +1,361 @@
1
+ import type { CancelPaymentSessionInput, CreatePaymentSessionInput, ExpirePaymentSessionInput, FailPaymentSessionInput, FinanceServiceRuntime, MarkPaymentSessionRequiresRedirectInput, PaymentSessionListQuery, PostgresJsDatabase, UpdatePaymentSessionInput } from "./service-shared.js";
2
+ export declare const financePaymentSessionService: {
3
+ listPaymentSessions(db: PostgresJsDatabase, query: PaymentSessionListQuery): Promise<{
4
+ data: {
5
+ id: string;
6
+ targetType: "other" | "booking_payment_schedule" | "invoice" | "booking" | "booking_guarantee" | "flight_order" | "order";
7
+ targetId: string | null;
8
+ bookingId: string | null;
9
+ orderId: string | null;
10
+ invoiceId: string | null;
11
+ bookingPaymentScheduleId: string | null;
12
+ bookingGuaranteeId: string | null;
13
+ paymentInstrumentId: string | null;
14
+ paymentAuthorizationId: string | null;
15
+ paymentCaptureId: string | null;
16
+ paymentId: string | null;
17
+ status: "processing" | "failed" | "pending" | "cancelled" | "paid" | "expired" | "authorized" | "requires_redirect";
18
+ provider: string | null;
19
+ providerSessionId: string | null;
20
+ providerPaymentId: string | null;
21
+ externalReference: string | null;
22
+ idempotencyKey: string | null;
23
+ clientReference: string | null;
24
+ currency: string;
25
+ amountCents: number;
26
+ paymentMethod: "other" | "bank_transfer" | "credit_card" | "voucher" | "debit_card" | "cash" | "cheque" | "wallet" | "direct_bill" | null;
27
+ payerPersonId: string | null;
28
+ payerOrganizationId: string | null;
29
+ payerEmail: string | null;
30
+ payerName: string | null;
31
+ redirectUrl: string | null;
32
+ returnUrl: string | null;
33
+ cancelUrl: string | null;
34
+ callbackUrl: string | null;
35
+ expiresAt: Date | null;
36
+ completedAt: Date | null;
37
+ failedAt: Date | null;
38
+ cancelledAt: Date | null;
39
+ expiredAt: Date | null;
40
+ failureCode: string | null;
41
+ failureMessage: string | null;
42
+ notes: string | null;
43
+ providerPayload: Record<string, unknown> | null;
44
+ metadata: Record<string, unknown> | null;
45
+ createdAt: Date;
46
+ updatedAt: Date;
47
+ }[];
48
+ total: number;
49
+ limit: number;
50
+ offset: number;
51
+ }>;
52
+ getPaymentSessionById(db: PostgresJsDatabase, id: string): Promise<{
53
+ id: string;
54
+ targetType: "other" | "booking_payment_schedule" | "invoice" | "booking" | "booking_guarantee" | "flight_order" | "order";
55
+ targetId: string | null;
56
+ bookingId: string | null;
57
+ orderId: string | null;
58
+ invoiceId: string | null;
59
+ bookingPaymentScheduleId: string | null;
60
+ bookingGuaranteeId: string | null;
61
+ paymentInstrumentId: string | null;
62
+ paymentAuthorizationId: string | null;
63
+ paymentCaptureId: string | null;
64
+ paymentId: string | null;
65
+ status: "processing" | "failed" | "pending" | "cancelled" | "paid" | "expired" | "authorized" | "requires_redirect";
66
+ provider: string | null;
67
+ providerSessionId: string | null;
68
+ providerPaymentId: string | null;
69
+ externalReference: string | null;
70
+ idempotencyKey: string | null;
71
+ clientReference: string | null;
72
+ currency: string;
73
+ amountCents: number;
74
+ paymentMethod: "other" | "bank_transfer" | "credit_card" | "voucher" | "debit_card" | "cash" | "cheque" | "wallet" | "direct_bill" | null;
75
+ payerPersonId: string | null;
76
+ payerOrganizationId: string | null;
77
+ payerEmail: string | null;
78
+ payerName: string | null;
79
+ redirectUrl: string | null;
80
+ returnUrl: string | null;
81
+ cancelUrl: string | null;
82
+ callbackUrl: string | null;
83
+ expiresAt: Date | null;
84
+ completedAt: Date | null;
85
+ failedAt: Date | null;
86
+ cancelledAt: Date | null;
87
+ expiredAt: Date | null;
88
+ failureCode: string | null;
89
+ failureMessage: string | null;
90
+ notes: string | null;
91
+ providerPayload: Record<string, unknown> | null;
92
+ metadata: Record<string, unknown> | null;
93
+ createdAt: Date;
94
+ updatedAt: Date;
95
+ } | null>;
96
+ createPaymentSession(db: PostgresJsDatabase, data: CreatePaymentSessionInput, runtime?: FinanceServiceRuntime): Promise<{
97
+ currency: string;
98
+ id: string;
99
+ createdAt: Date;
100
+ updatedAt: Date;
101
+ metadata: Record<string, unknown> | null;
102
+ idempotencyKey: string | null;
103
+ status: "processing" | "failed" | "pending" | "cancelled" | "paid" | "expired" | "authorized" | "requires_redirect";
104
+ targetType: "other" | "booking_payment_schedule" | "invoice" | "booking" | "booking_guarantee" | "flight_order" | "order";
105
+ targetId: string | null;
106
+ bookingId: string | null;
107
+ provider: string | null;
108
+ invoiceId: string | null;
109
+ amountCents: number;
110
+ notes: string | null;
111
+ bookingPaymentScheduleId: string | null;
112
+ bookingGuaranteeId: string | null;
113
+ paymentMethod: "other" | "bank_transfer" | "credit_card" | "voucher" | "debit_card" | "cash" | "cheque" | "wallet" | "direct_bill" | null;
114
+ payerPersonId: string | null;
115
+ payerOrganizationId: string | null;
116
+ payerEmail: string | null;
117
+ payerName: string | null;
118
+ externalReference: string | null;
119
+ clientReference: string | null;
120
+ returnUrl: string | null;
121
+ cancelUrl: string | null;
122
+ callbackUrl: string | null;
123
+ expiresAt: Date | null;
124
+ providerPayload: Record<string, unknown> | null;
125
+ orderId: string | null;
126
+ paymentInstrumentId: string | null;
127
+ paymentAuthorizationId: string | null;
128
+ paymentCaptureId: string | null;
129
+ paymentId: string | null;
130
+ providerSessionId: string | null;
131
+ providerPaymentId: string | null;
132
+ redirectUrl: string | null;
133
+ completedAt: Date | null;
134
+ failedAt: Date | null;
135
+ cancelledAt: Date | null;
136
+ expiredAt: Date | null;
137
+ failureCode: string | null;
138
+ failureMessage: string | null;
139
+ } | null>;
140
+ updatePaymentSession(db: PostgresJsDatabase, id: string, data: UpdatePaymentSessionInput, runtime?: FinanceServiceRuntime): Promise<{
141
+ id: string;
142
+ targetType: "other" | "booking_payment_schedule" | "invoice" | "booking" | "booking_guarantee" | "flight_order" | "order";
143
+ targetId: string | null;
144
+ bookingId: string | null;
145
+ orderId: string | null;
146
+ invoiceId: string | null;
147
+ bookingPaymentScheduleId: string | null;
148
+ bookingGuaranteeId: string | null;
149
+ paymentInstrumentId: string | null;
150
+ paymentAuthorizationId: string | null;
151
+ paymentCaptureId: string | null;
152
+ paymentId: string | null;
153
+ status: "processing" | "failed" | "pending" | "cancelled" | "paid" | "expired" | "authorized" | "requires_redirect";
154
+ provider: string | null;
155
+ providerSessionId: string | null;
156
+ providerPaymentId: string | null;
157
+ externalReference: string | null;
158
+ idempotencyKey: string | null;
159
+ clientReference: string | null;
160
+ currency: string;
161
+ amountCents: number;
162
+ paymentMethod: "other" | "bank_transfer" | "credit_card" | "voucher" | "debit_card" | "cash" | "cheque" | "wallet" | "direct_bill" | null;
163
+ payerPersonId: string | null;
164
+ payerOrganizationId: string | null;
165
+ payerEmail: string | null;
166
+ payerName: string | null;
167
+ redirectUrl: string | null;
168
+ returnUrl: string | null;
169
+ cancelUrl: string | null;
170
+ callbackUrl: string | null;
171
+ expiresAt: Date | null;
172
+ completedAt: Date | null;
173
+ failedAt: Date | null;
174
+ cancelledAt: Date | null;
175
+ expiredAt: Date | null;
176
+ failureCode: string | null;
177
+ failureMessage: string | null;
178
+ notes: string | null;
179
+ providerPayload: Record<string, unknown> | null;
180
+ metadata: Record<string, unknown> | null;
181
+ createdAt: Date;
182
+ updatedAt: Date;
183
+ } | null>;
184
+ markPaymentSessionRequiresRedirect(db: PostgresJsDatabase, id: string, data: MarkPaymentSessionRequiresRedirectInput, runtime?: FinanceServiceRuntime): Promise<{
185
+ id: string;
186
+ targetType: "other" | "booking_payment_schedule" | "invoice" | "booking" | "booking_guarantee" | "flight_order" | "order";
187
+ targetId: string | null;
188
+ bookingId: string | null;
189
+ orderId: string | null;
190
+ invoiceId: string | null;
191
+ bookingPaymentScheduleId: string | null;
192
+ bookingGuaranteeId: string | null;
193
+ paymentInstrumentId: string | null;
194
+ paymentAuthorizationId: string | null;
195
+ paymentCaptureId: string | null;
196
+ paymentId: string | null;
197
+ status: "processing" | "failed" | "pending" | "cancelled" | "paid" | "expired" | "authorized" | "requires_redirect";
198
+ provider: string | null;
199
+ providerSessionId: string | null;
200
+ providerPaymentId: string | null;
201
+ externalReference: string | null;
202
+ idempotencyKey: string | null;
203
+ clientReference: string | null;
204
+ currency: string;
205
+ amountCents: number;
206
+ paymentMethod: "other" | "bank_transfer" | "credit_card" | "voucher" | "debit_card" | "cash" | "cheque" | "wallet" | "direct_bill" | null;
207
+ payerPersonId: string | null;
208
+ payerOrganizationId: string | null;
209
+ payerEmail: string | null;
210
+ payerName: string | null;
211
+ redirectUrl: string | null;
212
+ returnUrl: string | null;
213
+ cancelUrl: string | null;
214
+ callbackUrl: string | null;
215
+ expiresAt: Date | null;
216
+ completedAt: Date | null;
217
+ failedAt: Date | null;
218
+ cancelledAt: Date | null;
219
+ expiredAt: Date | null;
220
+ failureCode: string | null;
221
+ failureMessage: string | null;
222
+ notes: string | null;
223
+ providerPayload: Record<string, unknown> | null;
224
+ metadata: Record<string, unknown> | null;
225
+ createdAt: Date;
226
+ updatedAt: Date;
227
+ } | null>;
228
+ failPaymentSession(db: PostgresJsDatabase, id: string, data: FailPaymentSessionInput, runtime?: FinanceServiceRuntime): Promise<{
229
+ id: string;
230
+ targetType: "other" | "booking_payment_schedule" | "invoice" | "booking" | "booking_guarantee" | "flight_order" | "order";
231
+ targetId: string | null;
232
+ bookingId: string | null;
233
+ orderId: string | null;
234
+ invoiceId: string | null;
235
+ bookingPaymentScheduleId: string | null;
236
+ bookingGuaranteeId: string | null;
237
+ paymentInstrumentId: string | null;
238
+ paymentAuthorizationId: string | null;
239
+ paymentCaptureId: string | null;
240
+ paymentId: string | null;
241
+ status: "processing" | "failed" | "pending" | "cancelled" | "paid" | "expired" | "authorized" | "requires_redirect";
242
+ provider: string | null;
243
+ providerSessionId: string | null;
244
+ providerPaymentId: string | null;
245
+ externalReference: string | null;
246
+ idempotencyKey: string | null;
247
+ clientReference: string | null;
248
+ currency: string;
249
+ amountCents: number;
250
+ paymentMethod: "other" | "bank_transfer" | "credit_card" | "voucher" | "debit_card" | "cash" | "cheque" | "wallet" | "direct_bill" | null;
251
+ payerPersonId: string | null;
252
+ payerOrganizationId: string | null;
253
+ payerEmail: string | null;
254
+ payerName: string | null;
255
+ redirectUrl: string | null;
256
+ returnUrl: string | null;
257
+ cancelUrl: string | null;
258
+ callbackUrl: string | null;
259
+ expiresAt: Date | null;
260
+ completedAt: Date | null;
261
+ failedAt: Date | null;
262
+ cancelledAt: Date | null;
263
+ expiredAt: Date | null;
264
+ failureCode: string | null;
265
+ failureMessage: string | null;
266
+ notes: string | null;
267
+ providerPayload: Record<string, unknown> | null;
268
+ metadata: Record<string, unknown> | null;
269
+ createdAt: Date;
270
+ updatedAt: Date;
271
+ } | null>;
272
+ cancelPaymentSession(db: PostgresJsDatabase, id: string, data: CancelPaymentSessionInput, runtime?: FinanceServiceRuntime): Promise<{
273
+ id: string;
274
+ targetType: "other" | "booking_payment_schedule" | "invoice" | "booking" | "booking_guarantee" | "flight_order" | "order";
275
+ targetId: string | null;
276
+ bookingId: string | null;
277
+ orderId: string | null;
278
+ invoiceId: string | null;
279
+ bookingPaymentScheduleId: string | null;
280
+ bookingGuaranteeId: string | null;
281
+ paymentInstrumentId: string | null;
282
+ paymentAuthorizationId: string | null;
283
+ paymentCaptureId: string | null;
284
+ paymentId: string | null;
285
+ status: "processing" | "failed" | "pending" | "cancelled" | "paid" | "expired" | "authorized" | "requires_redirect";
286
+ provider: string | null;
287
+ providerSessionId: string | null;
288
+ providerPaymentId: string | null;
289
+ externalReference: string | null;
290
+ idempotencyKey: string | null;
291
+ clientReference: string | null;
292
+ currency: string;
293
+ amountCents: number;
294
+ paymentMethod: "other" | "bank_transfer" | "credit_card" | "voucher" | "debit_card" | "cash" | "cheque" | "wallet" | "direct_bill" | null;
295
+ payerPersonId: string | null;
296
+ payerOrganizationId: string | null;
297
+ payerEmail: string | null;
298
+ payerName: string | null;
299
+ redirectUrl: string | null;
300
+ returnUrl: string | null;
301
+ cancelUrl: string | null;
302
+ callbackUrl: string | null;
303
+ expiresAt: Date | null;
304
+ completedAt: Date | null;
305
+ failedAt: Date | null;
306
+ cancelledAt: Date | null;
307
+ expiredAt: Date | null;
308
+ failureCode: string | null;
309
+ failureMessage: string | null;
310
+ notes: string | null;
311
+ providerPayload: Record<string, unknown> | null;
312
+ metadata: Record<string, unknown> | null;
313
+ createdAt: Date;
314
+ updatedAt: Date;
315
+ } | null>;
316
+ expirePaymentSession(db: PostgresJsDatabase, id: string, data: ExpirePaymentSessionInput, runtime?: FinanceServiceRuntime): Promise<{
317
+ id: string;
318
+ targetType: "other" | "booking_payment_schedule" | "invoice" | "booking" | "booking_guarantee" | "flight_order" | "order";
319
+ targetId: string | null;
320
+ bookingId: string | null;
321
+ orderId: string | null;
322
+ invoiceId: string | null;
323
+ bookingPaymentScheduleId: string | null;
324
+ bookingGuaranteeId: string | null;
325
+ paymentInstrumentId: string | null;
326
+ paymentAuthorizationId: string | null;
327
+ paymentCaptureId: string | null;
328
+ paymentId: string | null;
329
+ status: "processing" | "failed" | "pending" | "cancelled" | "paid" | "expired" | "authorized" | "requires_redirect";
330
+ provider: string | null;
331
+ providerSessionId: string | null;
332
+ providerPaymentId: string | null;
333
+ externalReference: string | null;
334
+ idempotencyKey: string | null;
335
+ clientReference: string | null;
336
+ currency: string;
337
+ amountCents: number;
338
+ paymentMethod: "other" | "bank_transfer" | "credit_card" | "voucher" | "debit_card" | "cash" | "cheque" | "wallet" | "direct_bill" | null;
339
+ payerPersonId: string | null;
340
+ payerOrganizationId: string | null;
341
+ payerEmail: string | null;
342
+ payerName: string | null;
343
+ redirectUrl: string | null;
344
+ returnUrl: string | null;
345
+ cancelUrl: string | null;
346
+ callbackUrl: string | null;
347
+ expiresAt: Date | null;
348
+ completedAt: Date | null;
349
+ failedAt: Date | null;
350
+ cancelledAt: Date | null;
351
+ expiredAt: Date | null;
352
+ failureCode: string | null;
353
+ failureMessage: string | null;
354
+ notes: string | null;
355
+ providerPayload: Record<string, unknown> | null;
356
+ metadata: Record<string, unknown> | null;
357
+ createdAt: Date;
358
+ updatedAt: Date;
359
+ } | null>;
360
+ };
361
+ //# sourceMappingURL=service-payment-sessions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-payment-sessions.d.ts","sourceRoot":"","sources":["../src/service-payment-sessions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,yBAAyB,EACzB,yBAAyB,EACzB,uBAAuB,EACvB,qBAAqB,EACrB,uCAAuC,EACvC,uBAAuB,EACvB,kBAAkB,EAClB,yBAAyB,EAC1B,MAAM,qBAAqB,CAAA;AAiD5B,eAAO,MAAM,4BAA4B;4BACT,kBAAkB,SAAS,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BA6ChD,kBAAkB,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAMxD,kBAAkB,QAChB,yBAAyB,YACtB,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAiE1B,kBAAkB,MAClB,MAAM,QACJ,yBAAyB,YACtB,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CA8D1B,kBAAkB,MAClB,MAAM,QACJ,uCAAuC,YACpC,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAmD1B,kBAAkB,MAClB,MAAM,QACJ,uBAAuB,YACpB,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAgD1B,kBAAkB,MAClB,MAAM,QACJ,yBAAyB,YACtB,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BA2C1B,kBAAkB,MAClB,MAAM,QACJ,yBAAyB,YACtB,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCjC,CAAA"}