@develit-services/bank 2.0.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +6 -0
  2. package/dist/database/schema.d.cts +1 -1
  3. package/dist/database/schema.d.mts +1 -1
  4. package/dist/database/schema.d.ts +1 -1
  5. package/dist/export/worker.cjs +38 -1
  6. package/dist/export/worker.d.cts +24 -8
  7. package/dist/export/worker.d.mts +24 -8
  8. package/dist/export/worker.d.ts +24 -8
  9. package/dist/export/worker.mjs +38 -1
  10. package/dist/export/workflows.cjs +1 -1
  11. package/dist/export/workflows.mjs +1 -1
  12. package/dist/export/wrangler.cjs +2 -0
  13. package/dist/export/wrangler.d.cts +1 -1
  14. package/dist/export/wrangler.d.mts +1 -1
  15. package/dist/export/wrangler.d.ts +1 -1
  16. package/dist/export/wrangler.mjs +2 -0
  17. package/dist/shared/{bank.BsKwYyaC.mjs → bank.Bo4HtOgs.mjs} +97 -15
  18. package/dist/shared/{bank.BYUn0j0r.d.mts → bank.BpTNVqyL.d.mts} +1 -1
  19. package/dist/shared/{bank.Bl1DnY7_.d.cts → bank.Bu5RkozT.d.cts} +1 -1
  20. package/dist/shared/{bank.NqesB7DM.d.cts → bank.BvQ2SE8p.d.cts} +37 -6
  21. package/dist/shared/{bank.NqesB7DM.d.mts → bank.BvQ2SE8p.d.mts} +37 -6
  22. package/dist/shared/{bank.NqesB7DM.d.ts → bank.BvQ2SE8p.d.ts} +37 -6
  23. package/dist/shared/{bank.CVJosema.d.mts → bank.Bz4DIxJL.d.cts} +1 -0
  24. package/dist/shared/{bank.CVJosema.d.ts → bank.Bz4DIxJL.d.mts} +1 -0
  25. package/dist/shared/{bank.CVJosema.d.cts → bank.Bz4DIxJL.d.ts} +1 -0
  26. package/dist/shared/{bank.CpEGzmAr.cjs → bank.Dk3nEc0x.cjs} +97 -15
  27. package/dist/shared/{bank.Dg_QI-D5.d.ts → bank.FUi1SRkA.d.ts} +1 -1
  28. package/dist/types.cjs +1 -1
  29. package/dist/types.d.cts +17 -5
  30. package/dist/types.d.mts +17 -5
  31. package/dist/types.d.ts +17 -5
  32. package/dist/types.mjs +1 -1
  33. package/package.json +1 -1
@@ -112,10 +112,30 @@ function toBatchedPaymentFromPaymentRequest(sp) {
112
112
  };
113
113
  }
114
114
 
115
+ function buildEndToEndId(payment, options = {}) {
116
+ const { separator = "/" } = options;
117
+ const parts = [];
118
+ if (payment.vs) parts.push(`VS${payment.vs}`);
119
+ if (payment.ss) parts.push(`SS${payment.ss}`);
120
+ if (payment.ks) parts.push(`KS${payment.ks}`);
121
+ if (parts.length === 0) {
122
+ return payment.id.replace(/-/g, "");
123
+ }
124
+ return `${separator}${parts.join(separator)}`;
125
+ }
126
+
115
127
  class IBankConnector {
116
128
  supportsPaymentType(paymentType) {
117
129
  return paymentType === "DOMESTIC";
118
130
  }
131
+ /**
132
+ * Builds the endToEndIdentification string for a SEPA payment.
133
+ * Override in subclasses to adjust bank-specific formatting — e.g. Moneta
134
+ * rejects `/` in this field, so `MonetaConnector` uses `-` as separator.
135
+ */
136
+ buildEndToEndId(payment) {
137
+ return buildEndToEndId(payment);
138
+ }
119
139
  // ── Deprecated methods (backward compatibility) ────────────────────
120
140
  /**
121
141
  * @deprecated Use initiateDomesticBatch, initiateSEPABatch, or initiateForeignBatch instead.
@@ -201,17 +221,19 @@ class IBankConnector {
201
221
  }
202
222
  return this.initiateForeignBatchImpl({ batchId, payments });
203
223
  }
204
- }
205
-
206
- function buildEndToEndId(payment) {
207
- const parts = [];
208
- if (payment.vs) parts.push(`VS${payment.vs}`);
209
- if (payment.ss) parts.push(`SS${payment.ss}`);
210
- if (payment.ks) parts.push(`KS${payment.ks}`);
211
- if (parts.length === 0) {
212
- return payment.id.replace(/-/g, "");
224
+ /**
225
+ * Gets current account balance.
226
+ * Optional - not all connectors support this.
227
+ * @param account - Bank account
228
+ * @returns Balance information or throws NOT_IMPLEMENTED
229
+ */
230
+ getAccountBalance({ account }) {
231
+ throw createInternalError(null, {
232
+ message: `Balance not supported for ${this.connectorKey} connector`,
233
+ code: "SYS-B-004",
234
+ status: 501
235
+ });
213
236
  }
214
- return `/${parts.join("/")}`;
215
237
  }
216
238
 
217
239
  async function signFinbricksJws({
@@ -472,7 +494,7 @@ const mapFinbricksTransactionToPayment = (tx, account) => {
472
494
  const isIncoming = tx.creditDebitIndicator === "CRDT";
473
495
  const related = tx.entryDetails?.transactionDetails?.relatedParties;
474
496
  const endToEndId = tx.entryDetails.transactionDetails?.references?.endToEndIdentification;
475
- const symbolsRegex = /^\/VS\d+/;
497
+ const symbolsRegex = /^[-/]?VS\d+/;
476
498
  const base = {
477
499
  id: uuidv4(),
478
500
  correlationId: uuidv4(),
@@ -868,7 +890,7 @@ class FinbricksConnector extends IBankConnector {
868
890
  },
869
891
  paymentIdentification: {
870
892
  merchantTransactionId: bankRefId,
871
- endToEndIdentification: buildEndToEndId(payment)
893
+ endToEndIdentification: this.buildEndToEndId(payment)
872
894
  },
873
895
  amount: payment.amount,
874
896
  debtor: {
@@ -1112,6 +1134,13 @@ class MonetaConnector extends FinbricksConnector {
1112
1134
  supportsBatch(paymentType) {
1113
1135
  return paymentType === "DOMESTIC";
1114
1136
  }
1137
+ /**
1138
+ * MONETA rejects `/` in endToEndIdentification — use `-` as separator.
1139
+ * Confirmed by Finbricks support (2026-04-23).
1140
+ */
1141
+ buildEndToEndId(payment) {
1142
+ return buildEndToEndId(payment, { separator: "-" });
1143
+ }
1115
1144
  }
1116
1145
 
1117
1146
  const isDeposit = (payment, creditorIban) => {
@@ -1320,7 +1349,7 @@ class DbuConnector extends IBankConnector {
1320
1349
  this.sessionId = uuidv4();
1321
1350
  this.allowedPostEndpoints = [
1322
1351
  "/required-transactions",
1323
- "/required-transactions/instant-payments",
1352
+ "/required-transactions/payments/instant",
1324
1353
  "/import/data"
1325
1354
  ];
1326
1355
  }
@@ -1579,7 +1608,7 @@ class DbuConnector extends IBankConnector {
1579
1608
  applicationCode: this.applicationCode
1580
1609
  };
1581
1610
  const response = await this.makeRequest(
1582
- "/required-transactions/instant-payments",
1611
+ "/required-transactions/payments/instant",
1583
1612
  payment.correlationId,
1584
1613
  {
1585
1614
  method: "POST",
@@ -1739,6 +1768,59 @@ class DbuConnector extends IBankConnector {
1739
1768
  );
1740
1769
  return this.mapDbuStatusToPaymentRequestStatus(response.status);
1741
1770
  }
1771
+ async getAccountBalance({
1772
+ account
1773
+ }) {
1774
+ if (!account.bankRefId) {
1775
+ throw createInternalError(null, {
1776
+ message: "Account configuration incomplete",
1777
+ code: "SYS-B-002",
1778
+ status: 400
1779
+ });
1780
+ }
1781
+ const requestId = uuidv4();
1782
+ let response;
1783
+ try {
1784
+ response = await this.makeRequest(
1785
+ `/accounts/${account.bankRefId}/balance`,
1786
+ requestId,
1787
+ {
1788
+ method: "GET",
1789
+ query: {
1790
+ balanceType: "AVAILABLE"
1791
+ }
1792
+ }
1793
+ );
1794
+ } catch (error) {
1795
+ throw createInternalError(error, {
1796
+ message: `Failed to fetch account balance from Backoffice API for ${account.iban}`,
1797
+ code: "SYS-B-005",
1798
+ status: 500
1799
+ });
1800
+ }
1801
+ const balanceRecord = response.balances?.balance?.find(
1802
+ (b) => b.balanceType === "AVAILABLE"
1803
+ );
1804
+ if (!balanceRecord) {
1805
+ throw createInternalError(null, {
1806
+ message: "Available balance not found",
1807
+ code: "SYS-B-003",
1808
+ status: 503
1809
+ });
1810
+ }
1811
+ return {
1812
+ balances: [
1813
+ {
1814
+ amount: {
1815
+ value: balanceRecord.accountBalance,
1816
+ currency: balanceRecord.currencyCode
1817
+ },
1818
+ balanceType: balanceRecord.balanceType,
1819
+ balanceDate: /* @__PURE__ */ new Date()
1820
+ }
1821
+ ]
1822
+ };
1823
+ }
1742
1824
  parseAuthorizationCallback(callbackUrl) {
1743
1825
  const url = new URL(callbackUrl);
1744
1826
  const params = url.searchParams;
@@ -1872,7 +1954,7 @@ class ErsteConnector extends IBankConnector {
1872
1954
  }
1873
1955
  const paymentBody = {
1874
1956
  paymentIdentification: {
1875
- endToEndIdentification: buildEndToEndId(payment),
1957
+ endToEndIdentification: this.buildEndToEndId(payment),
1876
1958
  instructionIdentification: payment.id
1877
1959
  },
1878
1960
  paymentTypeInformation: { instructionPriority: "NORM" },
@@ -1,4 +1,4 @@
1
- import { d as CurrencyCode, O as BankCode, $ as CountryCode, P as PaymentRequestSelectType } from './bank.NqesB7DM.mjs';
1
+ import { d as CurrencyCode, O as BankCode, $ as CountryCode, P as PaymentRequestSelectType } from './bank.BvQ2SE8p.mjs';
2
2
  import { z } from 'zod';
3
3
 
4
4
  type ReferenceType = `${'VS' | 'SS' | 'KS'}:${number}`;
@@ -1,4 +1,4 @@
1
- import { d as CurrencyCode, O as BankCode, $ as CountryCode, P as PaymentRequestSelectType } from './bank.NqesB7DM.cjs';
1
+ import { d as CurrencyCode, O as BankCode, $ as CountryCode, P as PaymentRequestSelectType } from './bank.BvQ2SE8p.cjs';
2
2
  import { z } from 'zod';
3
3
 
4
4
  type ReferenceType = `${'VS' | 'SS' | 'KS'}:${number}`;
@@ -89,6 +89,13 @@ type HandleAuthorizationCallbackOutput = {
89
89
  error: string | null;
90
90
  };
91
91
 
92
+ type EndToEndIdPayment = {
93
+ id: string;
94
+ vs?: string | null;
95
+ ss?: string | null;
96
+ ks?: string | null;
97
+ };
98
+
92
99
  type WithStatus<T extends {
93
100
  status: PaymentStatus;
94
101
  }, S extends PaymentStatus> = Omit<T, 'status'> & {
@@ -134,6 +141,12 @@ declare abstract class IBankConnector {
134
141
  */
135
142
  abstract supportsBatch(paymentType: PaymentType): boolean;
136
143
  supportsPaymentType(paymentType: PaymentType): boolean;
144
+ /**
145
+ * Builds the endToEndIdentification string for a SEPA payment.
146
+ * Override in subclasses to adjust bank-specific formatting — e.g. Moneta
147
+ * rejects `/` in this field, so `MonetaConnector` uses `-` as separator.
148
+ */
149
+ protected buildEndToEndId(payment: EndToEndIdPayment): string;
137
150
  /**
138
151
  * Generates authorization URI for connecting a new bank account.
139
152
  * @param ott - One-time token used to identify the authorization flow
@@ -271,6 +284,24 @@ declare abstract class IBankConnector {
271
284
  * @returns Parsed result — either success (with paymentRequestId or batchId) or error
272
285
  */
273
286
  abstract parseAuthorizationCallback(callbackUrl: string): AuthorizationCallbackResult;
287
+ /**
288
+ * Gets current account balance.
289
+ * Optional - not all connectors support this.
290
+ * @param account - Bank account
291
+ * @returns Balance information or throws NOT_IMPLEMENTED
292
+ */
293
+ getAccountBalance({ account }: {
294
+ account: AccountSelectType;
295
+ }): Promise<{
296
+ balances: Array<{
297
+ amount: {
298
+ value: number;
299
+ currency: string;
300
+ };
301
+ balanceType: 'AVAILABLE' | 'VALUTA' | 'GPE_AVAILABLE' | 'MULTI_AVAILABLE';
302
+ balanceDate: Date;
303
+ }>;
304
+ }>;
274
305
  }
275
306
 
276
307
  declare const accountCredentialsInsertSchema: drizzle_zod.BuildSchema<"insert", {
@@ -3317,7 +3348,7 @@ declare const batch: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
3317
3348
  tableName: "batch";
3318
3349
  dataType: "string";
3319
3350
  columnType: "SQLiteText";
3320
- data: "AUTHORIZED" | "COMPLETED" | "PROCESSING" | "READY_TO_SIGN" | "FAILED";
3351
+ data: "AUTHORIZED" | "PROCESSING" | "READY_TO_SIGN" | "COMPLETED" | "FAILED";
3321
3352
  driverParam: string;
3322
3353
  notNull: false;
3323
3354
  hasDefault: false;
@@ -3330,7 +3361,7 @@ declare const batch: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
3330
3361
  generated: undefined;
3331
3362
  }, {}, {
3332
3363
  length: number | undefined;
3333
- $type: "AUTHORIZED" | "COMPLETED" | "PROCESSING" | "READY_TO_SIGN" | "FAILED";
3364
+ $type: "AUTHORIZED" | "PROCESSING" | "READY_TO_SIGN" | "COMPLETED" | "FAILED";
3334
3365
  }>;
3335
3366
  statusReason: drizzle_orm_sqlite_core.SQLiteColumn<{
3336
3367
  name: "status_reason";
@@ -3761,7 +3792,7 @@ declare const payment: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
3761
3792
  tableName: "payment";
3762
3793
  dataType: "string";
3763
3794
  columnType: "SQLiteText";
3764
- data: "BOOKED" | "REJECTED" | "PENDING" | "PROCESSING" | "CANCELLED" | "SCHEDULED" | "HOLD" | "INFO";
3795
+ data: "PROCESSING" | "BOOKED" | "REJECTED" | "PENDING" | "CANCELLED" | "SCHEDULED" | "HOLD" | "INFO";
3765
3796
  driverParam: string;
3766
3797
  notNull: true;
3767
3798
  hasDefault: false;
@@ -3774,7 +3805,7 @@ declare const payment: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
3774
3805
  generated: undefined;
3775
3806
  }, {}, {
3776
3807
  length: number | undefined;
3777
- $type: "BOOKED" | "REJECTED" | "PENDING" | "PROCESSING" | "CANCELLED" | "SCHEDULED" | "HOLD" | "INFO";
3808
+ $type: "PROCESSING" | "BOOKED" | "REJECTED" | "PENDING" | "CANCELLED" | "SCHEDULED" | "HOLD" | "INFO";
3778
3809
  }>;
3779
3810
  statusReason: drizzle_orm_sqlite_core.SQLiteColumn<{
3780
3811
  name: "status_reason";
@@ -4355,7 +4386,7 @@ declare const paymentRequest: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
4355
4386
  tableName: "payment_request";
4356
4387
  dataType: "string";
4357
4388
  columnType: "SQLiteText";
4358
- data: "AUTHORIZED" | "OPENED" | "COMPLETED" | "BOOKED" | "SETTLED" | "REJECTED" | "CLOSED";
4389
+ data: "AUTHORIZED" | "COMPLETED" | "OPENED" | "BOOKED" | "SETTLED" | "REJECTED" | "CLOSED";
4359
4390
  driverParam: string;
4360
4391
  notNull: true;
4361
4392
  hasDefault: false;
@@ -4368,7 +4399,7 @@ declare const paymentRequest: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
4368
4399
  generated: undefined;
4369
4400
  }, {}, {
4370
4401
  length: number | undefined;
4371
- $type: "AUTHORIZED" | "OPENED" | "COMPLETED" | "BOOKED" | "SETTLED" | "REJECTED" | "CLOSED";
4402
+ $type: "AUTHORIZED" | "COMPLETED" | "OPENED" | "BOOKED" | "SETTLED" | "REJECTED" | "CLOSED";
4372
4403
  }>;
4373
4404
  statusReason: drizzle_orm_sqlite_core.SQLiteColumn<{
4374
4405
  name: "status_reason";
@@ -89,6 +89,13 @@ type HandleAuthorizationCallbackOutput = {
89
89
  error: string | null;
90
90
  };
91
91
 
92
+ type EndToEndIdPayment = {
93
+ id: string;
94
+ vs?: string | null;
95
+ ss?: string | null;
96
+ ks?: string | null;
97
+ };
98
+
92
99
  type WithStatus<T extends {
93
100
  status: PaymentStatus;
94
101
  }, S extends PaymentStatus> = Omit<T, 'status'> & {
@@ -134,6 +141,12 @@ declare abstract class IBankConnector {
134
141
  */
135
142
  abstract supportsBatch(paymentType: PaymentType): boolean;
136
143
  supportsPaymentType(paymentType: PaymentType): boolean;
144
+ /**
145
+ * Builds the endToEndIdentification string for a SEPA payment.
146
+ * Override in subclasses to adjust bank-specific formatting — e.g. Moneta
147
+ * rejects `/` in this field, so `MonetaConnector` uses `-` as separator.
148
+ */
149
+ protected buildEndToEndId(payment: EndToEndIdPayment): string;
137
150
  /**
138
151
  * Generates authorization URI for connecting a new bank account.
139
152
  * @param ott - One-time token used to identify the authorization flow
@@ -271,6 +284,24 @@ declare abstract class IBankConnector {
271
284
  * @returns Parsed result — either success (with paymentRequestId or batchId) or error
272
285
  */
273
286
  abstract parseAuthorizationCallback(callbackUrl: string): AuthorizationCallbackResult;
287
+ /**
288
+ * Gets current account balance.
289
+ * Optional - not all connectors support this.
290
+ * @param account - Bank account
291
+ * @returns Balance information or throws NOT_IMPLEMENTED
292
+ */
293
+ getAccountBalance({ account }: {
294
+ account: AccountSelectType;
295
+ }): Promise<{
296
+ balances: Array<{
297
+ amount: {
298
+ value: number;
299
+ currency: string;
300
+ };
301
+ balanceType: 'AVAILABLE' | 'VALUTA' | 'GPE_AVAILABLE' | 'MULTI_AVAILABLE';
302
+ balanceDate: Date;
303
+ }>;
304
+ }>;
274
305
  }
275
306
 
276
307
  declare const accountCredentialsInsertSchema: drizzle_zod.BuildSchema<"insert", {
@@ -3317,7 +3348,7 @@ declare const batch: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
3317
3348
  tableName: "batch";
3318
3349
  dataType: "string";
3319
3350
  columnType: "SQLiteText";
3320
- data: "AUTHORIZED" | "COMPLETED" | "PROCESSING" | "READY_TO_SIGN" | "FAILED";
3351
+ data: "AUTHORIZED" | "PROCESSING" | "READY_TO_SIGN" | "COMPLETED" | "FAILED";
3321
3352
  driverParam: string;
3322
3353
  notNull: false;
3323
3354
  hasDefault: false;
@@ -3330,7 +3361,7 @@ declare const batch: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
3330
3361
  generated: undefined;
3331
3362
  }, {}, {
3332
3363
  length: number | undefined;
3333
- $type: "AUTHORIZED" | "COMPLETED" | "PROCESSING" | "READY_TO_SIGN" | "FAILED";
3364
+ $type: "AUTHORIZED" | "PROCESSING" | "READY_TO_SIGN" | "COMPLETED" | "FAILED";
3334
3365
  }>;
3335
3366
  statusReason: drizzle_orm_sqlite_core.SQLiteColumn<{
3336
3367
  name: "status_reason";
@@ -3761,7 +3792,7 @@ declare const payment: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
3761
3792
  tableName: "payment";
3762
3793
  dataType: "string";
3763
3794
  columnType: "SQLiteText";
3764
- data: "BOOKED" | "REJECTED" | "PENDING" | "PROCESSING" | "CANCELLED" | "SCHEDULED" | "HOLD" | "INFO";
3795
+ data: "PROCESSING" | "BOOKED" | "REJECTED" | "PENDING" | "CANCELLED" | "SCHEDULED" | "HOLD" | "INFO";
3765
3796
  driverParam: string;
3766
3797
  notNull: true;
3767
3798
  hasDefault: false;
@@ -3774,7 +3805,7 @@ declare const payment: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
3774
3805
  generated: undefined;
3775
3806
  }, {}, {
3776
3807
  length: number | undefined;
3777
- $type: "BOOKED" | "REJECTED" | "PENDING" | "PROCESSING" | "CANCELLED" | "SCHEDULED" | "HOLD" | "INFO";
3808
+ $type: "PROCESSING" | "BOOKED" | "REJECTED" | "PENDING" | "CANCELLED" | "SCHEDULED" | "HOLD" | "INFO";
3778
3809
  }>;
3779
3810
  statusReason: drizzle_orm_sqlite_core.SQLiteColumn<{
3780
3811
  name: "status_reason";
@@ -4355,7 +4386,7 @@ declare const paymentRequest: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
4355
4386
  tableName: "payment_request";
4356
4387
  dataType: "string";
4357
4388
  columnType: "SQLiteText";
4358
- data: "AUTHORIZED" | "OPENED" | "COMPLETED" | "BOOKED" | "SETTLED" | "REJECTED" | "CLOSED";
4389
+ data: "AUTHORIZED" | "COMPLETED" | "OPENED" | "BOOKED" | "SETTLED" | "REJECTED" | "CLOSED";
4359
4390
  driverParam: string;
4360
4391
  notNull: true;
4361
4392
  hasDefault: false;
@@ -4368,7 +4399,7 @@ declare const paymentRequest: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
4368
4399
  generated: undefined;
4369
4400
  }, {}, {
4370
4401
  length: number | undefined;
4371
- $type: "AUTHORIZED" | "OPENED" | "COMPLETED" | "BOOKED" | "SETTLED" | "REJECTED" | "CLOSED";
4402
+ $type: "AUTHORIZED" | "COMPLETED" | "OPENED" | "BOOKED" | "SETTLED" | "REJECTED" | "CLOSED";
4372
4403
  }>;
4373
4404
  statusReason: drizzle_orm_sqlite_core.SQLiteColumn<{
4374
4405
  name: "status_reason";
@@ -89,6 +89,13 @@ type HandleAuthorizationCallbackOutput = {
89
89
  error: string | null;
90
90
  };
91
91
 
92
+ type EndToEndIdPayment = {
93
+ id: string;
94
+ vs?: string | null;
95
+ ss?: string | null;
96
+ ks?: string | null;
97
+ };
98
+
92
99
  type WithStatus<T extends {
93
100
  status: PaymentStatus;
94
101
  }, S extends PaymentStatus> = Omit<T, 'status'> & {
@@ -134,6 +141,12 @@ declare abstract class IBankConnector {
134
141
  */
135
142
  abstract supportsBatch(paymentType: PaymentType): boolean;
136
143
  supportsPaymentType(paymentType: PaymentType): boolean;
144
+ /**
145
+ * Builds the endToEndIdentification string for a SEPA payment.
146
+ * Override in subclasses to adjust bank-specific formatting — e.g. Moneta
147
+ * rejects `/` in this field, so `MonetaConnector` uses `-` as separator.
148
+ */
149
+ protected buildEndToEndId(payment: EndToEndIdPayment): string;
137
150
  /**
138
151
  * Generates authorization URI for connecting a new bank account.
139
152
  * @param ott - One-time token used to identify the authorization flow
@@ -271,6 +284,24 @@ declare abstract class IBankConnector {
271
284
  * @returns Parsed result — either success (with paymentRequestId or batchId) or error
272
285
  */
273
286
  abstract parseAuthorizationCallback(callbackUrl: string): AuthorizationCallbackResult;
287
+ /**
288
+ * Gets current account balance.
289
+ * Optional - not all connectors support this.
290
+ * @param account - Bank account
291
+ * @returns Balance information or throws NOT_IMPLEMENTED
292
+ */
293
+ getAccountBalance({ account }: {
294
+ account: AccountSelectType;
295
+ }): Promise<{
296
+ balances: Array<{
297
+ amount: {
298
+ value: number;
299
+ currency: string;
300
+ };
301
+ balanceType: 'AVAILABLE' | 'VALUTA' | 'GPE_AVAILABLE' | 'MULTI_AVAILABLE';
302
+ balanceDate: Date;
303
+ }>;
304
+ }>;
274
305
  }
275
306
 
276
307
  declare const accountCredentialsInsertSchema: drizzle_zod.BuildSchema<"insert", {
@@ -3317,7 +3348,7 @@ declare const batch: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
3317
3348
  tableName: "batch";
3318
3349
  dataType: "string";
3319
3350
  columnType: "SQLiteText";
3320
- data: "AUTHORIZED" | "COMPLETED" | "PROCESSING" | "READY_TO_SIGN" | "FAILED";
3351
+ data: "AUTHORIZED" | "PROCESSING" | "READY_TO_SIGN" | "COMPLETED" | "FAILED";
3321
3352
  driverParam: string;
3322
3353
  notNull: false;
3323
3354
  hasDefault: false;
@@ -3330,7 +3361,7 @@ declare const batch: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
3330
3361
  generated: undefined;
3331
3362
  }, {}, {
3332
3363
  length: number | undefined;
3333
- $type: "AUTHORIZED" | "COMPLETED" | "PROCESSING" | "READY_TO_SIGN" | "FAILED";
3364
+ $type: "AUTHORIZED" | "PROCESSING" | "READY_TO_SIGN" | "COMPLETED" | "FAILED";
3334
3365
  }>;
3335
3366
  statusReason: drizzle_orm_sqlite_core.SQLiteColumn<{
3336
3367
  name: "status_reason";
@@ -3761,7 +3792,7 @@ declare const payment: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
3761
3792
  tableName: "payment";
3762
3793
  dataType: "string";
3763
3794
  columnType: "SQLiteText";
3764
- data: "BOOKED" | "REJECTED" | "PENDING" | "PROCESSING" | "CANCELLED" | "SCHEDULED" | "HOLD" | "INFO";
3795
+ data: "PROCESSING" | "BOOKED" | "REJECTED" | "PENDING" | "CANCELLED" | "SCHEDULED" | "HOLD" | "INFO";
3765
3796
  driverParam: string;
3766
3797
  notNull: true;
3767
3798
  hasDefault: false;
@@ -3774,7 +3805,7 @@ declare const payment: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
3774
3805
  generated: undefined;
3775
3806
  }, {}, {
3776
3807
  length: number | undefined;
3777
- $type: "BOOKED" | "REJECTED" | "PENDING" | "PROCESSING" | "CANCELLED" | "SCHEDULED" | "HOLD" | "INFO";
3808
+ $type: "PROCESSING" | "BOOKED" | "REJECTED" | "PENDING" | "CANCELLED" | "SCHEDULED" | "HOLD" | "INFO";
3778
3809
  }>;
3779
3810
  statusReason: drizzle_orm_sqlite_core.SQLiteColumn<{
3780
3811
  name: "status_reason";
@@ -4355,7 +4386,7 @@ declare const paymentRequest: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
4355
4386
  tableName: "payment_request";
4356
4387
  dataType: "string";
4357
4388
  columnType: "SQLiteText";
4358
- data: "AUTHORIZED" | "OPENED" | "COMPLETED" | "BOOKED" | "SETTLED" | "REJECTED" | "CLOSED";
4389
+ data: "AUTHORIZED" | "COMPLETED" | "OPENED" | "BOOKED" | "SETTLED" | "REJECTED" | "CLOSED";
4359
4390
  driverParam: string;
4360
4391
  notNull: true;
4361
4392
  hasDefault: false;
@@ -4368,7 +4399,7 @@ declare const paymentRequest: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
4368
4399
  generated: undefined;
4369
4400
  }, {}, {
4370
4401
  length: number | undefined;
4371
- $type: "AUTHORIZED" | "OPENED" | "COMPLETED" | "BOOKED" | "SETTLED" | "REJECTED" | "CLOSED";
4402
+ $type: "AUTHORIZED" | "COMPLETED" | "OPENED" | "BOOKED" | "SETTLED" | "REJECTED" | "CLOSED";
4372
4403
  }>;
4373
4404
  statusReason: drizzle_orm_sqlite_core.SQLiteColumn<{
4374
4405
  name: "status_reason";
@@ -34,6 +34,7 @@ interface BankServiceEnvironmentConfig {
34
34
  DBUCS_TX_AUTH_URI: string;
35
35
  REDIRECT_URI: string;
36
36
  };
37
+ customVars?: Record<string, string>;
37
38
  }
38
39
  interface BankServiceWranglerConfig {
39
40
  project: string;
@@ -34,6 +34,7 @@ interface BankServiceEnvironmentConfig {
34
34
  DBUCS_TX_AUTH_URI: string;
35
35
  REDIRECT_URI: string;
36
36
  };
37
+ customVars?: Record<string, string>;
37
38
  }
38
39
  interface BankServiceWranglerConfig {
39
40
  project: string;
@@ -34,6 +34,7 @@ interface BankServiceEnvironmentConfig {
34
34
  DBUCS_TX_AUTH_URI: string;
35
35
  REDIRECT_URI: string;
36
36
  };
37
+ customVars?: Record<string, string>;
37
38
  }
38
39
  interface BankServiceWranglerConfig {
39
40
  project: string;