@develit-services/ledger 0.3.2 → 0.3.3

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.
@@ -1,9 +1,9 @@
1
1
  import { first, develitWorker, uuidv4, useResult, createInternalError, action, service } from '@develit-io/backend-sdk';
2
2
  import { WorkerEntrypoint } from 'cloudflare:workers';
3
3
  import { drizzle } from 'drizzle-orm/d1';
4
- import { s as schema } from '../shared/ledger.BGgIPMu-.mjs';
4
+ import { s as schema } from '../shared/ledger.B-gGCFFu.mjs';
5
5
  import { eq, and, inArray, or, count, gte, lte, sql, asc, desc } from 'drizzle-orm';
6
- import { j as createTransactionInputSchema, w as matchTransactionInputSchema, l as failTransactionInputSchema, h as cancelTransactionInputSchema, r as getTransactionByIdInputSchema, s as getTransactionsByReferenceIdInputSchema, t as getTransactionsInputSchema, i as createAccountInputSchema, x as updateAccountInputSchema, k as deleteAccountInputSchema, p as getAccountInputSchema, q as getAccountsByOwnerInputSchema, v as listAccountsInputSchema, o as getAccountIdentifierInputSchema, u as listAccountIdentifiersInputSchema, m as findAccountByIdentifierInputSchema, n as getAccountBalanceInputSchema, y as updateTransactionConfirmationSentAtInputSchema, z as updateTransactionStatusInputSchema } from '../shared/ledger.BVNtjljl.mjs';
6
+ import { k as createTransactionInputSchema, x as matchTransactionInputSchema, m as failTransactionInputSchema, i as cancelTransactionInputSchema, y as refundTransactionInputSchema, g as REFUNDABLE_TRANSACTION_STATUSES, s as getTransactionByIdInputSchema, t as getTransactionsByReferenceIdInputSchema, u as getTransactionsInputSchema, j as createAccountInputSchema, z as updateAccountInputSchema, l as deleteAccountInputSchema, q as getAccountInputSchema, r as getAccountsByOwnerInputSchema, w as listAccountsInputSchema, p as getAccountIdentifierInputSchema, v as listAccountIdentifiersInputSchema, n as findAccountByIdentifierInputSchema, o as getAccountBalanceInputSchema, D as updateTransactionConfirmationSentAtInputSchema, F as updateTransactionStatusInputSchema } from '../shared/ledger.DWO4eS7Q.mjs';
7
7
  import '@develit-io/general-codes';
8
8
  import 'drizzle-orm/sqlite-core';
9
9
  import 'zod';
@@ -534,6 +534,142 @@ let LedgerServiceBase = class extends develitWorker(
534
534
  }
535
535
  );
536
536
  }
537
+ async refundTransaction(input) {
538
+ return this.handleAction(
539
+ { data: input, schema: refundTransactionInputSchema },
540
+ { successMessage: "Transaction successfully refunded." },
541
+ async (params) => {
542
+ const { transactionId, amount, reason } = params;
543
+ const originalTx = await getTransactionByIdQuery(this.db, transactionId);
544
+ if (!originalTx) {
545
+ throw createInternalError(null, {
546
+ message: "Transaction not found",
547
+ status: 404,
548
+ code: "DB-L-03"
549
+ });
550
+ }
551
+ if (!REFUNDABLE_TRANSACTION_STATUSES.some(
552
+ (status) => status === originalTx.status
553
+ )) {
554
+ throw createInternalError(null, {
555
+ message: `Transaction with status ${originalTx.status} cannot be refunded`,
556
+ status: 400,
557
+ code: "VALID-L-01"
558
+ });
559
+ }
560
+ const refundAmount = amount || originalTx.value || 0;
561
+ if (refundAmount <= 0) {
562
+ throw createInternalError(null, {
563
+ message: "Invalid refund amount",
564
+ status: 400,
565
+ code: "VALID-L-02"
566
+ });
567
+ }
568
+ if (originalTx.value && refundAmount > originalTx.value) {
569
+ throw createInternalError(null, {
570
+ message: "Refund amount exceeds transaction value",
571
+ status: 400,
572
+ code: "VALID-L-03"
573
+ });
574
+ }
575
+ const originalPayment = originalTx.metadata?.payment;
576
+ if (!originalPayment?.debtor || !originalPayment?.creditor) {
577
+ throw createInternalError(null, {
578
+ message: "Transaction missing payment information for refund",
579
+ status: 400,
580
+ code: "VALID-L-04"
581
+ });
582
+ }
583
+ if (!originalTx.currency) {
584
+ throw createInternalError(null, {
585
+ message: "Transaction missing currency information",
586
+ status: 400,
587
+ code: "VALID-L-05"
588
+ });
589
+ }
590
+ const refundTxId = uuidv4();
591
+ const correlationId = uuidv4();
592
+ const timestamp = /* @__PURE__ */ new Date();
593
+ const isPartialRefund = amount !== void 0 && originalTx.value != null && amount < originalTx.value;
594
+ const refundTransaction = {
595
+ id: refundTxId,
596
+ correlationId,
597
+ referenceType: "TRANSACTION",
598
+ referenceId: transactionId,
599
+ type: "REFUND",
600
+ description: `Refund: ${reason}`,
601
+ status: "WAITING_FOR_PAYMENT",
602
+ value: refundAmount,
603
+ currency: originalTx.currency,
604
+ createdAt: timestamp,
605
+ updatedAt: timestamp,
606
+ completedAt: null,
607
+ metadata: {
608
+ tags: ["refund", `refund-${originalTx.type.toLowerCase()}`],
609
+ note: reason,
610
+ payment: {
611
+ amount: refundAmount,
612
+ currency: originalPayment.currency,
613
+ type: originalPayment.type || "DOMESTIC",
614
+ vs: originalPayment.vs,
615
+ ss: originalPayment.ss,
616
+ ks: originalPayment.ks,
617
+ debtor: originalPayment.creditor,
618
+ creditor: originalPayment.debtor
619
+ },
620
+ refund: {
621
+ isPartialRefund
622
+ }
623
+ }
624
+ };
625
+ const insertRefundCommand = this.db.insert(tables.transaction).values(refundTransaction).returning();
626
+ const { command: updateOriginalCommand } = updateTransactionStatusCommand(this.db, {
627
+ transactionId,
628
+ status: "RETURNING",
629
+ statusReason: `Refund in progress via transaction ${refundTxId}`
630
+ });
631
+ const [refundResult, originalResult] = await this.db.batch([
632
+ insertRefundCommand,
633
+ updateOriginalCommand
634
+ ]);
635
+ const createdRefundTx = first(refundResult);
636
+ const updatedOriginalTx = first(originalResult);
637
+ if (!createdRefundTx || !updatedOriginalTx) {
638
+ throw createInternalError(null, {
639
+ message: "Failed to process refund transaction",
640
+ status: 500,
641
+ code: "DB-L-02"
642
+ });
643
+ }
644
+ await Promise.all([
645
+ this.pushToQueue(this.env.QUEUE_BUS_QUEUE, {
646
+ eventType: "LEDGER_TRANSACTION",
647
+ eventSignal: "created",
648
+ ledgerTransaction: createdRefundTx,
649
+ metadata: {
650
+ correlationId: uuidv4(),
651
+ entityId: createdRefundTx.id,
652
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
653
+ }
654
+ }),
655
+ this.pushToQueue(this.env.QUEUE_BUS_QUEUE, {
656
+ eventType: "LEDGER_TRANSACTION",
657
+ eventSignal: "refunding",
658
+ ledgerTransaction: updatedOriginalTx,
659
+ metadata: {
660
+ correlationId: uuidv4(),
661
+ entityId: updatedOriginalTx.id,
662
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
663
+ }
664
+ })
665
+ ]);
666
+ return {
667
+ refundTransaction: createdRefundTx,
668
+ originalTransaction: updatedOriginalTx
669
+ };
670
+ }
671
+ );
672
+ }
537
673
  async getTransactionById(input) {
538
674
  return this.handleAction(
539
675
  { data: input, schema: getTransactionByIdInputSchema },
@@ -860,6 +996,9 @@ __decorateClass([
860
996
  __decorateClass([
861
997
  action("cancel-transaction")
862
998
  ], LedgerServiceBase.prototype, "cancelTransaction", 1);
999
+ __decorateClass([
1000
+ action("refund-transaction")
1001
+ ], LedgerServiceBase.prototype, "refundTransaction", 1);
863
1002
  __decorateClass([
864
1003
  action("get-transaction-by-id")
865
1004
  ], LedgerServiceBase.prototype, "getTransactionById", 1);
@@ -1,7 +1,7 @@
1
1
  import { base } from '@develit-io/backend-sdk';
2
2
  import { relations } from 'drizzle-orm';
3
3
  import { sqliteTable, integer, text, real } from 'drizzle-orm/sqlite-core';
4
- import { T as TRANSACTION_STATUSES, g as TRANSACTION_TYPES, R as REFERENCE_TYPES } from './ledger.BVNtjljl.mjs';
4
+ import { T as TRANSACTION_STATUSES, h as TRANSACTION_TYPES, R as REFERENCE_TYPES } from './ledger.DWO4eS7Q.mjs';
5
5
  import '@develit-io/general-codes';
6
6
 
7
7
  const account = sqliteTable("account", {
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { D as schema } from './ledger.CLVyCzRb.cjs';
2
+ import { F as schema } from './ledger.aRF1eJOD.js';
3
3
  import { InferSelectModel, ExtractTablesWithRelations, DBQueryConfig, BuildQueryResult, InferInsertModel } from 'drizzle-orm';
4
4
 
5
5
  interface TSchema extends ExtractTablesWithRelations<typeof tables> {
@@ -424,10 +424,11 @@ declare const createTransactionInputSchema: z.ZodObject<{
424
424
  CLIENT_FUND_OUT: "CLIENT_FUND_OUT";
425
425
  PROVIDER_FUND_IN: "PROVIDER_FUND_IN";
426
426
  PROVIDER_FUND_OUT: "PROVIDER_FUND_OUT";
427
+ COLLATERAL_FUND_IN: "COLLATERAL_FUND_IN";
428
+ COLLATERAL_FUND_OUT: "COLLATERAL_FUND_OUT";
427
429
  UNMATCHED: "UNMATCHED";
428
430
  ADJUSTMENT: "ADJUSTMENT";
429
431
  TRANSFER: "TRANSFER";
430
- COLLATERAL: "COLLATERAL";
431
432
  REFUND: "REFUND";
432
433
  }>;
433
434
  description: z.ZodOptional<z.ZodString>;
@@ -1176,9 +1177,6 @@ declare const createTransactionInputSchema: z.ZodObject<{
1176
1177
  status: z.ZodEnum<{
1177
1178
  FAILED: "FAILED";
1178
1179
  WAITING_FOR_PAYMENT: "WAITING_FOR_PAYMENT";
1179
- WAITING_FOR_COLLATERAL: "WAITING_FOR_COLLATERAL";
1180
- COLLATERAL_PAID: "COLLATERAL_PAID";
1181
- PAUSED: "PAUSED";
1182
1180
  WAITING_FOR_MANUAL_PROCESSING: "WAITING_FOR_MANUAL_PROCESSING";
1183
1181
  MATCHED: "MATCHED";
1184
1182
  RETURNING: "RETURNING";
@@ -1393,10 +1391,11 @@ declare const getTransactionsInputSchema: z.ZodObject<{
1393
1391
  CLIENT_FUND_OUT: "CLIENT_FUND_OUT";
1394
1392
  PROVIDER_FUND_IN: "PROVIDER_FUND_IN";
1395
1393
  PROVIDER_FUND_OUT: "PROVIDER_FUND_OUT";
1394
+ COLLATERAL_FUND_IN: "COLLATERAL_FUND_IN";
1395
+ COLLATERAL_FUND_OUT: "COLLATERAL_FUND_OUT";
1396
1396
  UNMATCHED: "UNMATCHED";
1397
1397
  ADJUSTMENT: "ADJUSTMENT";
1398
1398
  TRANSFER: "TRANSFER";
1399
- COLLATERAL: "COLLATERAL";
1400
1399
  REFUND: "REFUND";
1401
1400
  }>>;
1402
1401
  filterTransactionDescription: z.ZodOptional<z.ZodString>;
@@ -1406,9 +1405,6 @@ declare const getTransactionsInputSchema: z.ZodObject<{
1406
1405
  filterTransactionStatus: z.ZodOptional<z.ZodEnum<{
1407
1406
  FAILED: "FAILED";
1408
1407
  WAITING_FOR_PAYMENT: "WAITING_FOR_PAYMENT";
1409
- WAITING_FOR_COLLATERAL: "WAITING_FOR_COLLATERAL";
1410
- COLLATERAL_PAID: "COLLATERAL_PAID";
1411
- PAUSED: "PAUSED";
1412
1408
  WAITING_FOR_MANUAL_PROCESSING: "WAITING_FOR_MANUAL_PROCESSING";
1413
1409
  MATCHED: "MATCHED";
1414
1410
  RETURNING: "RETURNING";
@@ -1651,14 +1647,23 @@ interface UpdateTransactionConfirmationSentAtInput extends z.input<typeof update
1651
1647
  }
1652
1648
  type UpdateTransactionConfirmationSentAtOutput = void;
1653
1649
 
1650
+ declare const refundTransactionInputSchema: z.ZodObject<{
1651
+ transactionId: z.ZodUUID;
1652
+ amount: z.ZodOptional<z.ZodNumber>;
1653
+ reason: z.ZodString;
1654
+ }, z.core.$strip>;
1655
+ interface RefundTransactionInput extends z.infer<typeof refundTransactionInputSchema> {
1656
+ }
1657
+ interface RefundTransactionOutput {
1658
+ refundTransaction: TransactionSelectType;
1659
+ originalTransaction: TransactionSelectType;
1660
+ }
1661
+
1654
1662
  declare const updateTransactionStatusInputSchema: z.ZodObject<{
1655
1663
  transactionId: z.ZodUUID;
1656
1664
  status: z.ZodEnum<{
1657
1665
  FAILED: "FAILED";
1658
1666
  WAITING_FOR_PAYMENT: "WAITING_FOR_PAYMENT";
1659
- WAITING_FOR_COLLATERAL: "WAITING_FOR_COLLATERAL";
1660
- COLLATERAL_PAID: "COLLATERAL_PAID";
1661
- PAUSED: "PAUSED";
1662
1667
  WAITING_FOR_MANUAL_PROCESSING: "WAITING_FOR_MANUAL_PROCESSING";
1663
1668
  MATCHED: "MATCHED";
1664
1669
  RETURNING: "RETURNING";
@@ -1677,5 +1682,5 @@ interface UpdateTransactionStatusOutput extends TransactionSelectType {
1677
1682
 
1678
1683
  declare const tables: typeof schema;
1679
1684
 
1680
- export { deleteAccountInputSchema as $, cancelTransactionInputSchema as Y, createAccountInputSchema as Z, createTransactionInputSchema as _, failTransactionInputSchema as a0, findAccountByIdentifierInputSchema as a1, getAccountBalanceInputSchema as a2, getAccountIdentifierInputSchema as a3, getAccountInputSchema as a4, getAccountsByOwnerInputSchema as a5, getTransactionByIdInputSchema as a6, getTransactionsByReferenceIdInputSchema as a7, getTransactionsInputSchema as a8, listAccountIdentifiersInputSchema as a9, listAccountsInputSchema as aa, matchTransactionInputSchema as ab, updateAccountInputSchema as ac, updateTransactionConfirmationSentAtInputSchema as ad, updateTransactionStatusInputSchema as ae, tables as t };
1681
- export type { GetAccountBalanceInput as A, GetAccountBalanceOutput as B, CreateTransactionInput as C, DeleteAccountInput as D, UpdateTransactionConfirmationSentAtInput as E, FailTransactionInput as F, GetTransactionByIdInput as G, UpdateTransactionConfirmationSentAtOutput as H, UpdateTransactionStatusInput as I, UpdateTransactionStatusOutput as J, AccountIdentifierInsertType as K, ListAccountsInput as L, MatchTransactionInput as M, AccountIdentifierMappingInsertType as N, AccountIdentifierMappingSelectType as O, AccountIdentifierSelectType as P, AccountInsertType as Q, AccountSelectType as R, AccountWithIdentifiersSelectType as S, TransactionSelectType as T, UpdateAccountInput as U, IncludeRelation as V, InferResultType as W, TransactionInsertType as X, CreateTransactionOutput as a, MatchTransactionOutput as b, FailTransactionOutput as c, CancelTransactionInput as d, CancelTransactionOutput as e, GetTransactionByIdOutput as f, GetTransactionsByIdReferenceInput as g, GetTransactionsByReferenceIdOutput as h, GetTransactionsInput as i, GetTransactionsOutput as j, CreateAccountInput as k, CreateAccountOutput as l, UpdateAccountOutput as m, DeleteAccountOutput as n, GetAccountInput as o, GetAccountOutput as p, GetAccountsByOwnerInput as q, GetAccountsByOwnerOutput as r, ListAccountsOutput as s, GetAccountIdentifierInput as u, GetAccountIdentifierOutput as v, ListAccountIdentifiersInput as w, ListAccountIdentifiersOutput as x, FindAccountByIdentifierInput as y, FindAccountByIdentifierOutput as z };
1685
+ export { createAccountInputSchema as $, cancelTransactionInputSchema as _, createTransactionInputSchema as a0, deleteAccountInputSchema as a1, failTransactionInputSchema as a2, findAccountByIdentifierInputSchema as a3, getAccountBalanceInputSchema as a4, getAccountIdentifierInputSchema as a5, getAccountInputSchema as a6, getAccountsByOwnerInputSchema as a7, getTransactionByIdInputSchema as a8, getTransactionsByReferenceIdInputSchema as a9, getTransactionsInputSchema as aa, listAccountIdentifiersInputSchema as ab, listAccountsInputSchema as ac, matchTransactionInputSchema as ad, refundTransactionInputSchema as ae, updateAccountInputSchema as af, updateTransactionConfirmationSentAtInputSchema as ag, updateTransactionStatusInputSchema as ah, tables as t };
1686
+ export type { FindAccountByIdentifierOutput as A, GetAccountBalanceInput as B, CreateTransactionInput as C, DeleteAccountInput as D, GetAccountBalanceOutput as E, FailTransactionInput as F, GetTransactionByIdInput as G, UpdateTransactionConfirmationSentAtInput as H, UpdateTransactionConfirmationSentAtOutput as I, UpdateTransactionStatusInput as J, UpdateTransactionStatusOutput as K, ListAccountsInput as L, MatchTransactionInput as M, AccountIdentifierInsertType as N, AccountIdentifierMappingInsertType as O, AccountIdentifierMappingSelectType as P, AccountIdentifierSelectType as Q, RefundTransactionInput as R, AccountInsertType as S, TransactionSelectType as T, UpdateAccountInput as U, AccountSelectType as V, AccountWithIdentifiersSelectType as W, IncludeRelation as X, InferResultType as Y, TransactionInsertType as Z, CreateTransactionOutput as a, MatchTransactionOutput as b, FailTransactionOutput as c, CancelTransactionInput as d, CancelTransactionOutput as e, RefundTransactionOutput as f, GetTransactionByIdOutput as g, GetTransactionsByIdReferenceInput as h, GetTransactionsByReferenceIdOutput as i, GetTransactionsInput as j, GetTransactionsOutput as k, CreateAccountInput as l, CreateAccountOutput as m, UpdateAccountOutput as n, DeleteAccountOutput as o, GetAccountInput as p, GetAccountOutput as q, GetAccountsByOwnerInput as r, GetAccountsByOwnerOutput as s, ListAccountsOutput as u, GetAccountIdentifierInput as v, GetAccountIdentifierOutput as w, ListAccountIdentifiersInput as x, ListAccountIdentifiersOutput as y, FindAccountByIdentifierInput as z };
@@ -59,9 +59,7 @@ const ENTRY_STATUSES = [
59
59
  ];
60
60
  const TRANSACTION_STATUSES = [
61
61
  "WAITING_FOR_PAYMENT",
62
- "WAITING_FOR_COLLATERAL",
63
- "COLLATERAL_PAID",
64
- "PAUSED",
62
+ // 'PAUSED',
65
63
  "WAITING_FOR_MANUAL_PROCESSING",
66
64
  "MATCHED",
67
65
  "RETURNING",
@@ -69,21 +67,22 @@ const TRANSACTION_STATUSES = [
69
67
  "FAILED",
70
68
  "CANCELLED",
71
69
  "SETTLED"
70
+ // not used for now, but maybe in future when we have settlement process implemented
72
71
  ];
73
72
  const TRANSACTION_TYPES = [
74
73
  "CLIENT_FUND_IN",
75
74
  "CLIENT_FUND_OUT",
76
75
  "PROVIDER_FUND_IN",
77
76
  "PROVIDER_FUND_OUT",
77
+ "COLLATERAL_FUND_IN",
78
+ "COLLATERAL_FUND_OUT",
78
79
  "EXCHANGE",
79
80
  // maybe in future
80
81
  "UNMATCHED",
81
82
  "ADJUSTMENT",
82
- // manual correction
83
+ // manual correction maybe in future
83
84
  "TRANSFER",
84
85
  // internal transfer between accounts
85
- "COLLATERAL",
86
- // forward collateral payment from client
87
86
  "REFUND"
88
87
  ];
89
88
  const REFERENCE_TYPES = [
@@ -96,6 +95,9 @@ const REFERENCE_TYPES = [
96
95
  ];
97
96
  const PAYMENT_CHARGE_TYPES = ["SHA", "OUR", "BEN"];
98
97
  const PAYMENT_TYPES = ["DOMESTIC", "SEPA", "SWIFT", "UNKNOWN"];
98
+ const REFUNDABLE_TRANSACTION_STATUSES = [
99
+ "WAITING_FOR_MANUAL_PROCESSING"
100
+ ];
99
101
 
100
102
  const ALLOWED_TRANSACTION_FILTERS = {
101
103
  CORRELATION_ID: "filterTransactionCorrelationId",
@@ -311,6 +313,12 @@ const updateTransactionConfirmationSentAtInputSchema = z.object({
311
313
  transactionId: z.uuid()
312
314
  });
313
315
 
316
+ const refundTransactionInputSchema = z.object({
317
+ transactionId: z.uuid(),
318
+ amount: z.number().positive().optional(),
319
+ reason: z.string().min(1)
320
+ });
321
+
314
322
  const updateTransactionStatusInputSchema = z.object({
315
323
  transactionId: z.uuid(),
316
324
  status: z.enum(TRANSACTION_STATUSES),
@@ -319,4 +327,4 @@ const updateTransactionStatusInputSchema = z.object({
319
327
  completedAt: z.date().optional()
320
328
  });
321
329
 
322
- export { ACCOUNT_TYPES as A, BALANCE_STRATEGIES as B, COUNTRY_CODES as C, ENTRY_STATUSES as E, IDENTIFIER_KINDS as I, PAYMENT_CHARGE_TYPES as P, REFERENCE_TYPES as R, TRANSACTION_STATUSES as T, ALLOWED_TRANSACTION_FILTERS as a, ASSET_TYPES as b, BATCH_STATUSES as c, PAYMENT_DIRECTIONS as d, PAYMENT_STATUSES as e, PAYMENT_TYPES as f, TRANSACTION_TYPES as g, cancelTransactionInputSchema as h, createAccountInputSchema as i, createTransactionInputSchema as j, deleteAccountInputSchema as k, failTransactionInputSchema as l, findAccountByIdentifierInputSchema as m, getAccountBalanceInputSchema as n, getAccountIdentifierInputSchema as o, getAccountInputSchema as p, getAccountsByOwnerInputSchema as q, getTransactionByIdInputSchema as r, getTransactionsByReferenceIdInputSchema as s, getTransactionsInputSchema as t, listAccountIdentifiersInputSchema as u, listAccountsInputSchema as v, matchTransactionInputSchema as w, updateAccountInputSchema as x, updateTransactionConfirmationSentAtInputSchema as y, updateTransactionStatusInputSchema as z };
330
+ export { ACCOUNT_TYPES as A, BALANCE_STRATEGIES as B, COUNTRY_CODES as C, updateTransactionConfirmationSentAtInputSchema as D, ENTRY_STATUSES as E, updateTransactionStatusInputSchema as F, IDENTIFIER_KINDS as I, PAYMENT_CHARGE_TYPES as P, REFERENCE_TYPES as R, TRANSACTION_STATUSES as T, ALLOWED_TRANSACTION_FILTERS as a, ASSET_TYPES as b, BATCH_STATUSES as c, PAYMENT_DIRECTIONS as d, PAYMENT_STATUSES as e, PAYMENT_TYPES as f, REFUNDABLE_TRANSACTION_STATUSES as g, TRANSACTION_TYPES as h, cancelTransactionInputSchema as i, createAccountInputSchema as j, createTransactionInputSchema as k, deleteAccountInputSchema as l, failTransactionInputSchema as m, findAccountByIdentifierInputSchema as n, getAccountBalanceInputSchema as o, getAccountIdentifierInputSchema as p, getAccountInputSchema as q, getAccountsByOwnerInputSchema as r, getTransactionByIdInputSchema as s, getTransactionsByReferenceIdInputSchema as t, getTransactionsInputSchema as u, listAccountIdentifiersInputSchema as v, listAccountsInputSchema as w, matchTransactionInputSchema as x, refundTransactionInputSchema as y, updateAccountInputSchema as z };
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { D as schema } from './ledger.CLVyCzRb.mjs';
2
+ import { F as schema } from './ledger.aRF1eJOD.cjs';
3
3
  import { InferSelectModel, ExtractTablesWithRelations, DBQueryConfig, BuildQueryResult, InferInsertModel } from 'drizzle-orm';
4
4
 
5
5
  interface TSchema extends ExtractTablesWithRelations<typeof tables> {
@@ -424,10 +424,11 @@ declare const createTransactionInputSchema: z.ZodObject<{
424
424
  CLIENT_FUND_OUT: "CLIENT_FUND_OUT";
425
425
  PROVIDER_FUND_IN: "PROVIDER_FUND_IN";
426
426
  PROVIDER_FUND_OUT: "PROVIDER_FUND_OUT";
427
+ COLLATERAL_FUND_IN: "COLLATERAL_FUND_IN";
428
+ COLLATERAL_FUND_OUT: "COLLATERAL_FUND_OUT";
427
429
  UNMATCHED: "UNMATCHED";
428
430
  ADJUSTMENT: "ADJUSTMENT";
429
431
  TRANSFER: "TRANSFER";
430
- COLLATERAL: "COLLATERAL";
431
432
  REFUND: "REFUND";
432
433
  }>;
433
434
  description: z.ZodOptional<z.ZodString>;
@@ -1176,9 +1177,6 @@ declare const createTransactionInputSchema: z.ZodObject<{
1176
1177
  status: z.ZodEnum<{
1177
1178
  FAILED: "FAILED";
1178
1179
  WAITING_FOR_PAYMENT: "WAITING_FOR_PAYMENT";
1179
- WAITING_FOR_COLLATERAL: "WAITING_FOR_COLLATERAL";
1180
- COLLATERAL_PAID: "COLLATERAL_PAID";
1181
- PAUSED: "PAUSED";
1182
1180
  WAITING_FOR_MANUAL_PROCESSING: "WAITING_FOR_MANUAL_PROCESSING";
1183
1181
  MATCHED: "MATCHED";
1184
1182
  RETURNING: "RETURNING";
@@ -1393,10 +1391,11 @@ declare const getTransactionsInputSchema: z.ZodObject<{
1393
1391
  CLIENT_FUND_OUT: "CLIENT_FUND_OUT";
1394
1392
  PROVIDER_FUND_IN: "PROVIDER_FUND_IN";
1395
1393
  PROVIDER_FUND_OUT: "PROVIDER_FUND_OUT";
1394
+ COLLATERAL_FUND_IN: "COLLATERAL_FUND_IN";
1395
+ COLLATERAL_FUND_OUT: "COLLATERAL_FUND_OUT";
1396
1396
  UNMATCHED: "UNMATCHED";
1397
1397
  ADJUSTMENT: "ADJUSTMENT";
1398
1398
  TRANSFER: "TRANSFER";
1399
- COLLATERAL: "COLLATERAL";
1400
1399
  REFUND: "REFUND";
1401
1400
  }>>;
1402
1401
  filterTransactionDescription: z.ZodOptional<z.ZodString>;
@@ -1406,9 +1405,6 @@ declare const getTransactionsInputSchema: z.ZodObject<{
1406
1405
  filterTransactionStatus: z.ZodOptional<z.ZodEnum<{
1407
1406
  FAILED: "FAILED";
1408
1407
  WAITING_FOR_PAYMENT: "WAITING_FOR_PAYMENT";
1409
- WAITING_FOR_COLLATERAL: "WAITING_FOR_COLLATERAL";
1410
- COLLATERAL_PAID: "COLLATERAL_PAID";
1411
- PAUSED: "PAUSED";
1412
1408
  WAITING_FOR_MANUAL_PROCESSING: "WAITING_FOR_MANUAL_PROCESSING";
1413
1409
  MATCHED: "MATCHED";
1414
1410
  RETURNING: "RETURNING";
@@ -1651,14 +1647,23 @@ interface UpdateTransactionConfirmationSentAtInput extends z.input<typeof update
1651
1647
  }
1652
1648
  type UpdateTransactionConfirmationSentAtOutput = void;
1653
1649
 
1650
+ declare const refundTransactionInputSchema: z.ZodObject<{
1651
+ transactionId: z.ZodUUID;
1652
+ amount: z.ZodOptional<z.ZodNumber>;
1653
+ reason: z.ZodString;
1654
+ }, z.core.$strip>;
1655
+ interface RefundTransactionInput extends z.infer<typeof refundTransactionInputSchema> {
1656
+ }
1657
+ interface RefundTransactionOutput {
1658
+ refundTransaction: TransactionSelectType;
1659
+ originalTransaction: TransactionSelectType;
1660
+ }
1661
+
1654
1662
  declare const updateTransactionStatusInputSchema: z.ZodObject<{
1655
1663
  transactionId: z.ZodUUID;
1656
1664
  status: z.ZodEnum<{
1657
1665
  FAILED: "FAILED";
1658
1666
  WAITING_FOR_PAYMENT: "WAITING_FOR_PAYMENT";
1659
- WAITING_FOR_COLLATERAL: "WAITING_FOR_COLLATERAL";
1660
- COLLATERAL_PAID: "COLLATERAL_PAID";
1661
- PAUSED: "PAUSED";
1662
1667
  WAITING_FOR_MANUAL_PROCESSING: "WAITING_FOR_MANUAL_PROCESSING";
1663
1668
  MATCHED: "MATCHED";
1664
1669
  RETURNING: "RETURNING";
@@ -1677,5 +1682,5 @@ interface UpdateTransactionStatusOutput extends TransactionSelectType {
1677
1682
 
1678
1683
  declare const tables: typeof schema;
1679
1684
 
1680
- export { deleteAccountInputSchema as $, cancelTransactionInputSchema as Y, createAccountInputSchema as Z, createTransactionInputSchema as _, failTransactionInputSchema as a0, findAccountByIdentifierInputSchema as a1, getAccountBalanceInputSchema as a2, getAccountIdentifierInputSchema as a3, getAccountInputSchema as a4, getAccountsByOwnerInputSchema as a5, getTransactionByIdInputSchema as a6, getTransactionsByReferenceIdInputSchema as a7, getTransactionsInputSchema as a8, listAccountIdentifiersInputSchema as a9, listAccountsInputSchema as aa, matchTransactionInputSchema as ab, updateAccountInputSchema as ac, updateTransactionConfirmationSentAtInputSchema as ad, updateTransactionStatusInputSchema as ae, tables as t };
1681
- export type { GetAccountBalanceInput as A, GetAccountBalanceOutput as B, CreateTransactionInput as C, DeleteAccountInput as D, UpdateTransactionConfirmationSentAtInput as E, FailTransactionInput as F, GetTransactionByIdInput as G, UpdateTransactionConfirmationSentAtOutput as H, UpdateTransactionStatusInput as I, UpdateTransactionStatusOutput as J, AccountIdentifierInsertType as K, ListAccountsInput as L, MatchTransactionInput as M, AccountIdentifierMappingInsertType as N, AccountIdentifierMappingSelectType as O, AccountIdentifierSelectType as P, AccountInsertType as Q, AccountSelectType as R, AccountWithIdentifiersSelectType as S, TransactionSelectType as T, UpdateAccountInput as U, IncludeRelation as V, InferResultType as W, TransactionInsertType as X, CreateTransactionOutput as a, MatchTransactionOutput as b, FailTransactionOutput as c, CancelTransactionInput as d, CancelTransactionOutput as e, GetTransactionByIdOutput as f, GetTransactionsByIdReferenceInput as g, GetTransactionsByReferenceIdOutput as h, GetTransactionsInput as i, GetTransactionsOutput as j, CreateAccountInput as k, CreateAccountOutput as l, UpdateAccountOutput as m, DeleteAccountOutput as n, GetAccountInput as o, GetAccountOutput as p, GetAccountsByOwnerInput as q, GetAccountsByOwnerOutput as r, ListAccountsOutput as s, GetAccountIdentifierInput as u, GetAccountIdentifierOutput as v, ListAccountIdentifiersInput as w, ListAccountIdentifiersOutput as x, FindAccountByIdentifierInput as y, FindAccountByIdentifierOutput as z };
1685
+ export { createAccountInputSchema as $, cancelTransactionInputSchema as _, createTransactionInputSchema as a0, deleteAccountInputSchema as a1, failTransactionInputSchema as a2, findAccountByIdentifierInputSchema as a3, getAccountBalanceInputSchema as a4, getAccountIdentifierInputSchema as a5, getAccountInputSchema as a6, getAccountsByOwnerInputSchema as a7, getTransactionByIdInputSchema as a8, getTransactionsByReferenceIdInputSchema as a9, getTransactionsInputSchema as aa, listAccountIdentifiersInputSchema as ab, listAccountsInputSchema as ac, matchTransactionInputSchema as ad, refundTransactionInputSchema as ae, updateAccountInputSchema as af, updateTransactionConfirmationSentAtInputSchema as ag, updateTransactionStatusInputSchema as ah, tables as t };
1686
+ export type { FindAccountByIdentifierOutput as A, GetAccountBalanceInput as B, CreateTransactionInput as C, DeleteAccountInput as D, GetAccountBalanceOutput as E, FailTransactionInput as F, GetTransactionByIdInput as G, UpdateTransactionConfirmationSentAtInput as H, UpdateTransactionConfirmationSentAtOutput as I, UpdateTransactionStatusInput as J, UpdateTransactionStatusOutput as K, ListAccountsInput as L, MatchTransactionInput as M, AccountIdentifierInsertType as N, AccountIdentifierMappingInsertType as O, AccountIdentifierMappingSelectType as P, AccountIdentifierSelectType as Q, RefundTransactionInput as R, AccountInsertType as S, TransactionSelectType as T, UpdateAccountInput as U, AccountSelectType as V, AccountWithIdentifiersSelectType as W, IncludeRelation as X, InferResultType as Y, TransactionInsertType as Z, CreateTransactionOutput as a, MatchTransactionOutput as b, FailTransactionOutput as c, CancelTransactionInput as d, CancelTransactionOutput as e, RefundTransactionOutput as f, GetTransactionByIdOutput as g, GetTransactionsByIdReferenceInput as h, GetTransactionsByReferenceIdOutput as i, GetTransactionsInput as j, GetTransactionsOutput as k, CreateAccountInput as l, CreateAccountOutput as m, UpdateAccountOutput as n, DeleteAccountOutput as o, GetAccountInput as p, GetAccountOutput as q, GetAccountsByOwnerInput as r, GetAccountsByOwnerOutput as s, ListAccountsOutput as u, GetAccountIdentifierInput as v, GetAccountIdentifierOutput as w, ListAccountIdentifiersInput as x, ListAccountIdentifiersOutput as y, FindAccountByIdentifierInput as z };
@@ -61,9 +61,7 @@ const ENTRY_STATUSES = [
61
61
  ];
62
62
  const TRANSACTION_STATUSES = [
63
63
  "WAITING_FOR_PAYMENT",
64
- "WAITING_FOR_COLLATERAL",
65
- "COLLATERAL_PAID",
66
- "PAUSED",
64
+ // 'PAUSED',
67
65
  "WAITING_FOR_MANUAL_PROCESSING",
68
66
  "MATCHED",
69
67
  "RETURNING",
@@ -71,21 +69,22 @@ const TRANSACTION_STATUSES = [
71
69
  "FAILED",
72
70
  "CANCELLED",
73
71
  "SETTLED"
72
+ // not used for now, but maybe in future when we have settlement process implemented
74
73
  ];
75
74
  const TRANSACTION_TYPES = [
76
75
  "CLIENT_FUND_IN",
77
76
  "CLIENT_FUND_OUT",
78
77
  "PROVIDER_FUND_IN",
79
78
  "PROVIDER_FUND_OUT",
79
+ "COLLATERAL_FUND_IN",
80
+ "COLLATERAL_FUND_OUT",
80
81
  "EXCHANGE",
81
82
  // maybe in future
82
83
  "UNMATCHED",
83
84
  "ADJUSTMENT",
84
- // manual correction
85
+ // manual correction maybe in future
85
86
  "TRANSFER",
86
87
  // internal transfer between accounts
87
- "COLLATERAL",
88
- // forward collateral payment from client
89
88
  "REFUND"
90
89
  ];
91
90
  const REFERENCE_TYPES = [
@@ -98,6 +97,9 @@ const REFERENCE_TYPES = [
98
97
  ];
99
98
  const PAYMENT_CHARGE_TYPES = ["SHA", "OUR", "BEN"];
100
99
  const PAYMENT_TYPES = ["DOMESTIC", "SEPA", "SWIFT", "UNKNOWN"];
100
+ const REFUNDABLE_TRANSACTION_STATUSES = [
101
+ "WAITING_FOR_MANUAL_PROCESSING"
102
+ ];
101
103
 
102
104
  const ALLOWED_TRANSACTION_FILTERS = {
103
105
  CORRELATION_ID: "filterTransactionCorrelationId",
@@ -313,6 +315,12 @@ const updateTransactionConfirmationSentAtInputSchema = zod.z.object({
313
315
  transactionId: zod.z.uuid()
314
316
  });
315
317
 
318
+ const refundTransactionInputSchema = zod.z.object({
319
+ transactionId: zod.z.uuid(),
320
+ amount: zod.z.number().positive().optional(),
321
+ reason: zod.z.string().min(1)
322
+ });
323
+
316
324
  const updateTransactionStatusInputSchema = zod.z.object({
317
325
  transactionId: zod.z.uuid(),
318
326
  status: zod.z.enum(TRANSACTION_STATUSES),
@@ -334,6 +342,7 @@ exports.PAYMENT_DIRECTIONS = PAYMENT_DIRECTIONS;
334
342
  exports.PAYMENT_STATUSES = PAYMENT_STATUSES;
335
343
  exports.PAYMENT_TYPES = PAYMENT_TYPES;
336
344
  exports.REFERENCE_TYPES = REFERENCE_TYPES;
345
+ exports.REFUNDABLE_TRANSACTION_STATUSES = REFUNDABLE_TRANSACTION_STATUSES;
337
346
  exports.TRANSACTION_STATUSES = TRANSACTION_STATUSES;
338
347
  exports.TRANSACTION_TYPES = TRANSACTION_TYPES;
339
348
  exports.cancelTransactionInputSchema = cancelTransactionInputSchema;
@@ -352,6 +361,7 @@ exports.getTransactionsInputSchema = getTransactionsInputSchema;
352
361
  exports.listAccountIdentifiersInputSchema = listAccountIdentifiersInputSchema;
353
362
  exports.listAccountsInputSchema = listAccountsInputSchema;
354
363
  exports.matchTransactionInputSchema = matchTransactionInputSchema;
364
+ exports.refundTransactionInputSchema = refundTransactionInputSchema;
355
365
  exports.updateAccountInputSchema = updateAccountInputSchema;
356
366
  exports.updateTransactionConfirmationSentAtInputSchema = updateTransactionConfirmationSentAtInputSchema;
357
367
  exports.updateTransactionStatusInputSchema = updateTransactionStatusInputSchema;
@@ -3,7 +3,7 @@
3
3
  const backendSdk = require('@develit-io/backend-sdk');
4
4
  const drizzleOrm = require('drizzle-orm');
5
5
  const sqliteCore = require('drizzle-orm/sqlite-core');
6
- const updateTransactionStatus = require('./ledger.Dfi_K5W2.cjs');
6
+ const updateTransactionStatus = require('./ledger.QNHpaH-m.cjs');
7
7
  require('@develit-io/general-codes');
8
8
 
9
9
  const account = sqliteCore.sqliteTable("account", {
@@ -464,9 +464,9 @@ declare const IDENTIFIER_KINDS: readonly ["IBAN", "LOCAL_CZ", "SWIFT", "CRYPTO_A
464
464
  type IdentifierKind = (typeof IDENTIFIER_KINDS)[number];
465
465
  declare const ENTRY_STATUSES: readonly ["PENDING", "REALIZED", "FAILED", "CANCELED"];
466
466
  type EntryStatus = (typeof ENTRY_STATUSES)[number];
467
- declare const TRANSACTION_STATUSES: readonly ["WAITING_FOR_PAYMENT", "WAITING_FOR_COLLATERAL", "COLLATERAL_PAID", "PAUSED", "WAITING_FOR_MANUAL_PROCESSING", "MATCHED", "RETURNING", "RETURNED", "FAILED", "CANCELLED", "SETTLED"];
467
+ declare const TRANSACTION_STATUSES: readonly ["WAITING_FOR_PAYMENT", "WAITING_FOR_MANUAL_PROCESSING", "MATCHED", "RETURNING", "RETURNED", "FAILED", "CANCELLED", "SETTLED"];
468
468
  type TransactionStatus = (typeof TRANSACTION_STATUSES)[number];
469
- declare const TRANSACTION_TYPES: readonly ["CLIENT_FUND_IN", "CLIENT_FUND_OUT", "PROVIDER_FUND_IN", "PROVIDER_FUND_OUT", "EXCHANGE", "UNMATCHED", "ADJUSTMENT", "TRANSFER", "COLLATERAL", "REFUND"];
469
+ declare const TRANSACTION_TYPES: readonly ["CLIENT_FUND_IN", "CLIENT_FUND_OUT", "PROVIDER_FUND_IN", "PROVIDER_FUND_OUT", "COLLATERAL_FUND_IN", "COLLATERAL_FUND_OUT", "EXCHANGE", "UNMATCHED", "ADJUSTMENT", "TRANSFER", "REFUND"];
470
470
  type TransactionType = (typeof TRANSACTION_TYPES)[number];
471
471
  declare const REFERENCE_TYPES: readonly ["PAYMENT", "EXCHANGE", "ORDER", "INTERNAL-TRANSFER", "FORWARD", "TRANSACTION"];
472
472
  type ReferenceType = (typeof REFERENCE_TYPES)[number];
@@ -474,6 +474,7 @@ declare const PAYMENT_CHARGE_TYPES: readonly ["SHA", "OUR", "BEN"];
474
474
  type PaymentChargeType = (typeof PAYMENT_CHARGE_TYPES)[number];
475
475
  declare const PAYMENT_TYPES: readonly ["DOMESTIC", "SEPA", "SWIFT", "UNKNOWN"];
476
476
  type PaymentType = (typeof PAYMENT_TYPES)[number];
477
+ declare const REFUNDABLE_TRANSACTION_STATUSES: readonly ["WAITING_FOR_MANUAL_PROCESSING"];
477
478
 
478
479
  type CryptoNetworkCode = (typeof CRYPTO_NETWORK_CODES)[number];
479
480
  declare const PAYMENT_STATUSES: readonly ["PREPARED", "INITIALIZED", "FAILED", "PENDING", "COMPLETED", "CREATED"];
@@ -525,6 +526,12 @@ interface TransactionMetadata {
525
526
  * Additional notes or comments about the transaction
526
527
  */
527
528
  note?: string;
529
+ /**
530
+ * Refund information when transaction type is REFUND
531
+ */
532
+ refund?: {
533
+ isPartialRefund: boolean;
534
+ };
528
535
  }
529
536
  interface EntryMetadata {
530
537
  context?: {
@@ -706,7 +713,7 @@ declare const entry: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
706
713
  tableName: "entry";
707
714
  dataType: "string";
708
715
  columnType: "SQLiteText";
709
- data: "FAILED" | "PENDING" | "REALIZED" | "CANCELED";
716
+ data: "PENDING" | "REALIZED" | "FAILED" | "CANCELED";
710
717
  driverParam: string;
711
718
  notNull: true;
712
719
  hasDefault: false;
@@ -719,7 +726,7 @@ declare const entry: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
719
726
  generated: undefined;
720
727
  }, {}, {
721
728
  length: number | undefined;
722
- $type: "FAILED" | "PENDING" | "REALIZED" | "CANCELED";
729
+ $type: "PENDING" | "REALIZED" | "FAILED" | "CANCELED";
723
730
  }>;
724
731
  isBalanced: drizzle_orm_sqlite_core.SQLiteColumn<{
725
732
  name: "is_balanced";
@@ -852,20 +859,20 @@ declare const transaction: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
852
859
  tableName: "transaction";
853
860
  dataType: "string";
854
861
  columnType: "SQLiteText";
855
- data: "EXCHANGE" | "CLIENT_FUND_IN" | "CLIENT_FUND_OUT" | "PROVIDER_FUND_IN" | "PROVIDER_FUND_OUT" | "UNMATCHED" | "ADJUSTMENT" | "TRANSFER" | "COLLATERAL" | "REFUND";
862
+ data: "EXCHANGE" | "CLIENT_FUND_IN" | "CLIENT_FUND_OUT" | "PROVIDER_FUND_IN" | "PROVIDER_FUND_OUT" | "COLLATERAL_FUND_IN" | "COLLATERAL_FUND_OUT" | "UNMATCHED" | "ADJUSTMENT" | "TRANSFER" | "REFUND";
856
863
  driverParam: string;
857
864
  notNull: true;
858
865
  hasDefault: false;
859
866
  isPrimaryKey: false;
860
867
  isAutoincrement: false;
861
868
  hasRuntimeDefault: false;
862
- enumValues: ["CLIENT_FUND_IN", "CLIENT_FUND_OUT", "PROVIDER_FUND_IN", "PROVIDER_FUND_OUT", "EXCHANGE", "UNMATCHED", "ADJUSTMENT", "TRANSFER", "COLLATERAL", "REFUND"];
869
+ enumValues: ["CLIENT_FUND_IN", "CLIENT_FUND_OUT", "PROVIDER_FUND_IN", "PROVIDER_FUND_OUT", "COLLATERAL_FUND_IN", "COLLATERAL_FUND_OUT", "EXCHANGE", "UNMATCHED", "ADJUSTMENT", "TRANSFER", "REFUND"];
863
870
  baseColumn: never;
864
871
  identity: undefined;
865
872
  generated: undefined;
866
873
  }, {}, {
867
874
  length: number | undefined;
868
- $type: "EXCHANGE" | "CLIENT_FUND_IN" | "CLIENT_FUND_OUT" | "PROVIDER_FUND_IN" | "PROVIDER_FUND_OUT" | "UNMATCHED" | "ADJUSTMENT" | "TRANSFER" | "COLLATERAL" | "REFUND";
875
+ $type: "EXCHANGE" | "CLIENT_FUND_IN" | "CLIENT_FUND_OUT" | "PROVIDER_FUND_IN" | "PROVIDER_FUND_OUT" | "COLLATERAL_FUND_IN" | "COLLATERAL_FUND_OUT" | "UNMATCHED" | "ADJUSTMENT" | "TRANSFER" | "REFUND";
869
876
  }>;
870
877
  description: drizzle_orm_sqlite_core.SQLiteColumn<{
871
878
  name: "description";
@@ -925,20 +932,20 @@ declare const transaction: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
925
932
  tableName: "transaction";
926
933
  dataType: "string";
927
934
  columnType: "SQLiteText";
928
- data: "FAILED" | "WAITING_FOR_PAYMENT" | "WAITING_FOR_COLLATERAL" | "COLLATERAL_PAID" | "PAUSED" | "WAITING_FOR_MANUAL_PROCESSING" | "MATCHED" | "RETURNING" | "RETURNED" | "CANCELLED" | "SETTLED";
935
+ data: "FAILED" | "WAITING_FOR_PAYMENT" | "WAITING_FOR_MANUAL_PROCESSING" | "MATCHED" | "RETURNING" | "RETURNED" | "CANCELLED" | "SETTLED";
929
936
  driverParam: string;
930
937
  notNull: true;
931
938
  hasDefault: false;
932
939
  isPrimaryKey: false;
933
940
  isAutoincrement: false;
934
941
  hasRuntimeDefault: false;
935
- enumValues: ["WAITING_FOR_PAYMENT", "WAITING_FOR_COLLATERAL", "COLLATERAL_PAID", "PAUSED", "WAITING_FOR_MANUAL_PROCESSING", "MATCHED", "RETURNING", "RETURNED", "FAILED", "CANCELLED", "SETTLED"];
942
+ enumValues: ["WAITING_FOR_PAYMENT", "WAITING_FOR_MANUAL_PROCESSING", "MATCHED", "RETURNING", "RETURNED", "FAILED", "CANCELLED", "SETTLED"];
936
943
  baseColumn: never;
937
944
  identity: undefined;
938
945
  generated: undefined;
939
946
  }, {}, {
940
947
  length: number | undefined;
941
- $type: "FAILED" | "WAITING_FOR_PAYMENT" | "WAITING_FOR_COLLATERAL" | "COLLATERAL_PAID" | "PAUSED" | "WAITING_FOR_MANUAL_PROCESSING" | "MATCHED" | "RETURNING" | "RETURNED" | "CANCELLED" | "SETTLED";
948
+ $type: "FAILED" | "WAITING_FOR_PAYMENT" | "WAITING_FOR_MANUAL_PROCESSING" | "MATCHED" | "RETURNING" | "RETURNED" | "CANCELLED" | "SETTLED";
942
949
  }>;
943
950
  statusReason: drizzle_orm_sqlite_core.SQLiteColumn<{
944
951
  name: "status_reason";
@@ -1066,5 +1073,5 @@ declare namespace schema {
1066
1073
  };
1067
1074
  }
1068
1075
 
1069
- export { ACCOUNT_TYPES as A, BALANCE_STRATEGIES as B, COUNTRY_CODES as C, schema as D, ENTRY_STATUSES as E, account as F, accountIdentifier as G, accountIdentifierMapping as H, IDENTIFIER_KINDS as I, accountIdentifierMappingRelations as J, accountIdentifierRelations as K, accountRelations as L, entry as M, transaction as N, PAYMENT_CHARGE_TYPES as P, REFERENCE_TYPES as R, TRANSACTION_STATUSES as T, ASSET_TYPES as a, BATCH_STATUSES as d, PAYMENT_DIRECTIONS as o, PAYMENT_STATUSES as p, PAYMENT_TYPES as q, TRANSACTION_TYPES as w };
1070
- export type { AccountType as b, AssetType as c, BalanceStrategy as e, BankCode as f, BatchStatus as g, CountryCode as h, CryptoNetworkCode as i, Currency as j, CurrencyCode as k, EntryMetadata as l, EntryStatus as m, IdentifierKind as n, PaymentChargeType as r, PaymentDirection as s, PaymentStatus as t, PaymentType as u, ReferenceType as v, TransactionMetadata as x, TransactionStatus as y, TransactionType as z };
1076
+ export { ACCOUNT_TYPES as A, BALANCE_STRATEGIES as B, COUNTRY_CODES as C, ENTRY_STATUSES as E, schema as F, account as G, accountIdentifier as H, IDENTIFIER_KINDS as I, accountIdentifierMapping as J, accountIdentifierMappingRelations as K, accountIdentifierRelations as L, accountRelations as M, entry as N, transaction as O, PAYMENT_CHARGE_TYPES as P, REFERENCE_TYPES as R, TRANSACTION_STATUSES as T, ASSET_TYPES as a, BATCH_STATUSES as d, PAYMENT_DIRECTIONS as o, PAYMENT_STATUSES as p, PAYMENT_TYPES as q, REFUNDABLE_TRANSACTION_STATUSES as v, TRANSACTION_TYPES as x };
1077
+ export type { TransactionType as D, AccountType as b, AssetType as c, BalanceStrategy as e, BankCode as f, BatchStatus as g, CountryCode as h, CryptoNetworkCode as i, Currency as j, CurrencyCode as k, EntryMetadata as l, EntryStatus as m, IdentifierKind as n, PaymentChargeType as r, PaymentDirection as s, PaymentStatus as t, PaymentType as u, ReferenceType as w, TransactionMetadata as y, TransactionStatus as z };