@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
@@ -114,10 +114,30 @@ function toBatchedPaymentFromPaymentRequest(sp) {
114
114
  };
115
115
  }
116
116
 
117
+ function buildEndToEndId(payment, options = {}) {
118
+ const { separator = "/" } = options;
119
+ const parts = [];
120
+ if (payment.vs) parts.push(`VS${payment.vs}`);
121
+ if (payment.ss) parts.push(`SS${payment.ss}`);
122
+ if (payment.ks) parts.push(`KS${payment.ks}`);
123
+ if (parts.length === 0) {
124
+ return payment.id.replace(/-/g, "");
125
+ }
126
+ return `${separator}${parts.join(separator)}`;
127
+ }
128
+
117
129
  class IBankConnector {
118
130
  supportsPaymentType(paymentType) {
119
131
  return paymentType === "DOMESTIC";
120
132
  }
133
+ /**
134
+ * Builds the endToEndIdentification string for a SEPA payment.
135
+ * Override in subclasses to adjust bank-specific formatting — e.g. Moneta
136
+ * rejects `/` in this field, so `MonetaConnector` uses `-` as separator.
137
+ */
138
+ buildEndToEndId(payment) {
139
+ return buildEndToEndId(payment);
140
+ }
121
141
  // ── Deprecated methods (backward compatibility) ────────────────────
122
142
  /**
123
143
  * @deprecated Use initiateDomesticBatch, initiateSEPABatch, or initiateForeignBatch instead.
@@ -203,17 +223,19 @@ class IBankConnector {
203
223
  }
204
224
  return this.initiateForeignBatchImpl({ batchId, payments });
205
225
  }
206
- }
207
-
208
- function buildEndToEndId(payment) {
209
- const parts = [];
210
- if (payment.vs) parts.push(`VS${payment.vs}`);
211
- if (payment.ss) parts.push(`SS${payment.ss}`);
212
- if (payment.ks) parts.push(`KS${payment.ks}`);
213
- if (parts.length === 0) {
214
- return payment.id.replace(/-/g, "");
226
+ /**
227
+ * Gets current account balance.
228
+ * Optional - not all connectors support this.
229
+ * @param account - Bank account
230
+ * @returns Balance information or throws NOT_IMPLEMENTED
231
+ */
232
+ getAccountBalance({ account }) {
233
+ throw backendSdk.createInternalError(null, {
234
+ message: `Balance not supported for ${this.connectorKey} connector`,
235
+ code: "SYS-B-004",
236
+ status: 501
237
+ });
215
238
  }
216
- return `/${parts.join("/")}`;
217
239
  }
218
240
 
219
241
  async function signFinbricksJws({
@@ -474,7 +496,7 @@ const mapFinbricksTransactionToPayment = (tx, account) => {
474
496
  const isIncoming = tx.creditDebitIndicator === "CRDT";
475
497
  const related = tx.entryDetails?.transactionDetails?.relatedParties;
476
498
  const endToEndId = tx.entryDetails.transactionDetails?.references?.endToEndIdentification;
477
- const symbolsRegex = /^\/VS\d+/;
499
+ const symbolsRegex = /^[-/]?VS\d+/;
478
500
  const base = {
479
501
  id: backendSdk.uuidv4(),
480
502
  correlationId: backendSdk.uuidv4(),
@@ -870,7 +892,7 @@ class FinbricksConnector extends IBankConnector {
870
892
  },
871
893
  paymentIdentification: {
872
894
  merchantTransactionId: bankRefId,
873
- endToEndIdentification: buildEndToEndId(payment)
895
+ endToEndIdentification: this.buildEndToEndId(payment)
874
896
  },
875
897
  amount: payment.amount,
876
898
  debtor: {
@@ -1114,6 +1136,13 @@ class MonetaConnector extends FinbricksConnector {
1114
1136
  supportsBatch(paymentType) {
1115
1137
  return paymentType === "DOMESTIC";
1116
1138
  }
1139
+ /**
1140
+ * MONETA rejects `/` in endToEndIdentification — use `-` as separator.
1141
+ * Confirmed by Finbricks support (2026-04-23).
1142
+ */
1143
+ buildEndToEndId(payment) {
1144
+ return buildEndToEndId(payment, { separator: "-" });
1145
+ }
1117
1146
  }
1118
1147
 
1119
1148
  const isDeposit = (payment, creditorIban) => {
@@ -1322,7 +1351,7 @@ class DbuConnector extends IBankConnector {
1322
1351
  this.sessionId = backendSdk.uuidv4();
1323
1352
  this.allowedPostEndpoints = [
1324
1353
  "/required-transactions",
1325
- "/required-transactions/instant-payments",
1354
+ "/required-transactions/payments/instant",
1326
1355
  "/import/data"
1327
1356
  ];
1328
1357
  }
@@ -1581,7 +1610,7 @@ class DbuConnector extends IBankConnector {
1581
1610
  applicationCode: this.applicationCode
1582
1611
  };
1583
1612
  const response = await this.makeRequest(
1584
- "/required-transactions/instant-payments",
1613
+ "/required-transactions/payments/instant",
1585
1614
  payment.correlationId,
1586
1615
  {
1587
1616
  method: "POST",
@@ -1741,6 +1770,59 @@ class DbuConnector extends IBankConnector {
1741
1770
  );
1742
1771
  return this.mapDbuStatusToPaymentRequestStatus(response.status);
1743
1772
  }
1773
+ async getAccountBalance({
1774
+ account
1775
+ }) {
1776
+ if (!account.bankRefId) {
1777
+ throw backendSdk.createInternalError(null, {
1778
+ message: "Account configuration incomplete",
1779
+ code: "SYS-B-002",
1780
+ status: 400
1781
+ });
1782
+ }
1783
+ const requestId = backendSdk.uuidv4();
1784
+ let response;
1785
+ try {
1786
+ response = await this.makeRequest(
1787
+ `/accounts/${account.bankRefId}/balance`,
1788
+ requestId,
1789
+ {
1790
+ method: "GET",
1791
+ query: {
1792
+ balanceType: "AVAILABLE"
1793
+ }
1794
+ }
1795
+ );
1796
+ } catch (error) {
1797
+ throw backendSdk.createInternalError(error, {
1798
+ message: `Failed to fetch account balance from Backoffice API for ${account.iban}`,
1799
+ code: "SYS-B-005",
1800
+ status: 500
1801
+ });
1802
+ }
1803
+ const balanceRecord = response.balances?.balance?.find(
1804
+ (b) => b.balanceType === "AVAILABLE"
1805
+ );
1806
+ if (!balanceRecord) {
1807
+ throw backendSdk.createInternalError(null, {
1808
+ message: "Available balance not found",
1809
+ code: "SYS-B-003",
1810
+ status: 503
1811
+ });
1812
+ }
1813
+ return {
1814
+ balances: [
1815
+ {
1816
+ amount: {
1817
+ value: balanceRecord.accountBalance,
1818
+ currency: balanceRecord.currencyCode
1819
+ },
1820
+ balanceType: balanceRecord.balanceType,
1821
+ balanceDate: /* @__PURE__ */ new Date()
1822
+ }
1823
+ ]
1824
+ };
1825
+ }
1744
1826
  parseAuthorizationCallback(callbackUrl) {
1745
1827
  const url = new URL(callbackUrl);
1746
1828
  const params = url.searchParams;
@@ -1874,7 +1956,7 @@ class ErsteConnector extends IBankConnector {
1874
1956
  }
1875
1957
  const paymentBody = {
1876
1958
  paymentIdentification: {
1877
- endToEndIdentification: buildEndToEndId(payment),
1959
+ endToEndIdentification: this.buildEndToEndId(payment),
1878
1960
  instructionIdentification: payment.id
1879
1961
  },
1880
1962
  paymentTypeInformation: { instructionPriority: "NORM" },
@@ -1,4 +1,4 @@
1
- import { d as CurrencyCode, O as BankCode, $ as CountryCode, P as PaymentRequestSelectType } from './bank.NqesB7DM.js';
1
+ import { d as CurrencyCode, O as BankCode, $ as CountryCode, P as PaymentRequestSelectType } from './bank.BvQ2SE8p.js';
2
2
  import { z } from 'zod';
3
3
 
4
4
  type ReferenceType = `${'VS' | 'SS' | 'KS'}:${number}`;
package/dist/types.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const mock_connector = require('./shared/bank.CpEGzmAr.cjs');
3
+ const mock_connector = require('./shared/bank.Dk3nEc0x.cjs');
4
4
  const database_schema = require('./shared/bank.CIWYI18z.cjs');
5
5
  const batchLifecycle = require('./shared/bank.NF8bZBy0.cjs');
6
6
  const generalCodes = require('@develit-io/general-codes');
package/dist/types.d.cts CHANGED
@@ -1,8 +1,8 @@
1
- import { I as IBankConnector, b as ConnectorKey, f as ConnectedAccount, c as PaymentType, g as CredentialsResolver, h as AccountCredentialsInsertType, i as AccountInsertType, j as BatchedPayment, k as InitiatedBatch, l as IncomingPayment, m as InitiatedPayment, A as AccountSelectType, n as ParsedBankPayment, o as PaymentRequestStatus, p as AuthorizationCallbackResult, q as BatchMetadata, r as Currency, a as PaymentSelectType, P as PaymentRequestSelectType, s as AccountAssignedPayment, u as PreparedPayment, v as CompletedPayment, w as PaymentRequestInsertType } from './shared/bank.NqesB7DM.cjs';
2
- export { x as ACCOUNT_STATUSES, y as AccountCredentialsPatchType, z as AccountCredentialsSelectType, D as AccountCredentialsUpdateType, E as AccountPatchType, F as AccountStatus, G as AccountUpdateType, J as AuthorizedBatch, K as BATCH_MODES, M as BATCH_STATUES, M as BATCH_STATUSES, N as BankAccountWithLastSync, O as BankCode, Q as BatchInsertType, R as BatchLifecycle, S as BatchMode, T as BatchPayment, B as BatchSelectType, U as BatchStatus, V as CHARGE_BEARERS, W as CONNECTOR_KEYS, X as COUNTRY_CODES, Y as CREDENTIALS_TYPES, Z as ChargeBearer, _ as CompletedBatch, C as ConfigEnvironmentBank, $ as CountryCode, a0 as CredentialsType, d as CurrencyCode, a1 as INSTRUCTION_PRIORITIES, a2 as InstructionPriority, L as LastSyncMetadata, a3 as PAYMENT_DIRECTIONS, a4 as PAYMENT_REQUEST_STATUSES, a5 as PAYMENT_STATUSES, a6 as PAYMENT_TYPES, a7 as PaymentDirection, a8 as PaymentFailedInsertType, a9 as PaymentInsertType, aa as PaymentLifecycle, ab as PaymentPreparedInsertType, ac as PaymentStatus, ad as ProcessingBatch, ae as ReadyToSignBatch, af as ResolvedCredentials, ag as TOKEN_TYPES, ah as TokenType, ai as accountCredentialsInsertSchema, aj as accountCredentialsSelectSchema, ak as accountCredentialsUpdateSchema, al as accountInsertSchema, am as accountSelectSchema, an as accountUpdateSchema, ao as hasPaymentAccountAssigned, ap as isBatchAuthorized, aq as isBatchCompleted, ar as isBatchFailed, as as isBatchInitiated, at as isBatchProcessing, au as isBatchReadyToSign, av as isPaymentCompleted, aw as isPendingStatus, ax as isProcessedStatus, ay as isTerminalStatus } from './shared/bank.NqesB7DM.cjs';
3
- import { d as FinbricksAccount, R as ReferenceType, S as SendPaymentInput } from './shared/bank.Bl1DnY7_.cjs';
4
- export { e as FinbricksAccountTransactionsResponse, f as FinbricksAccountsListResponse, g as FinbricksAuthTokenResponse, h as FinbricksBatchResponse, i as FinbricksConnectAccountResponse, j as FinbricksPaymentResponse, k as FinbricksSupportedBank, F as FinbricksSupportedBanksResponse, b as SendPaymentSyncInput } from './shared/bank.Bl1DnY7_.cjs';
5
- export { a as BankServiceEnv, b as BankServiceEnvironmentConfig, B as BankServiceWranglerConfig } from './shared/bank.CVJosema.cjs';
1
+ import { I as IBankConnector, b as ConnectorKey, f as ConnectedAccount, c as PaymentType, g as CredentialsResolver, h as AccountCredentialsInsertType, i as AccountInsertType, j as BatchedPayment, k as InitiatedBatch, l as IncomingPayment, m as InitiatedPayment, A as AccountSelectType, n as ParsedBankPayment, o as PaymentRequestStatus, p as AuthorizationCallbackResult, q as BatchMetadata, r as Currency, a as PaymentSelectType, P as PaymentRequestSelectType, s as AccountAssignedPayment, u as PreparedPayment, v as CompletedPayment, w as PaymentRequestInsertType } from './shared/bank.BvQ2SE8p.cjs';
2
+ export { x as ACCOUNT_STATUSES, y as AccountCredentialsPatchType, z as AccountCredentialsSelectType, D as AccountCredentialsUpdateType, E as AccountPatchType, F as AccountStatus, G as AccountUpdateType, J as AuthorizedBatch, K as BATCH_MODES, M as BATCH_STATUES, M as BATCH_STATUSES, N as BankAccountWithLastSync, O as BankCode, Q as BatchInsertType, R as BatchLifecycle, S as BatchMode, T as BatchPayment, B as BatchSelectType, U as BatchStatus, V as CHARGE_BEARERS, W as CONNECTOR_KEYS, X as COUNTRY_CODES, Y as CREDENTIALS_TYPES, Z as ChargeBearer, _ as CompletedBatch, C as ConfigEnvironmentBank, $ as CountryCode, a0 as CredentialsType, d as CurrencyCode, a1 as INSTRUCTION_PRIORITIES, a2 as InstructionPriority, L as LastSyncMetadata, a3 as PAYMENT_DIRECTIONS, a4 as PAYMENT_REQUEST_STATUSES, a5 as PAYMENT_STATUSES, a6 as PAYMENT_TYPES, a7 as PaymentDirection, a8 as PaymentFailedInsertType, a9 as PaymentInsertType, aa as PaymentLifecycle, ab as PaymentPreparedInsertType, ac as PaymentStatus, ad as ProcessingBatch, ae as ReadyToSignBatch, af as ResolvedCredentials, ag as TOKEN_TYPES, ah as TokenType, ai as accountCredentialsInsertSchema, aj as accountCredentialsSelectSchema, ak as accountCredentialsUpdateSchema, al as accountInsertSchema, am as accountSelectSchema, an as accountUpdateSchema, ao as hasPaymentAccountAssigned, ap as isBatchAuthorized, aq as isBatchCompleted, ar as isBatchFailed, as as isBatchInitiated, at as isBatchProcessing, au as isBatchReadyToSign, av as isPaymentCompleted, aw as isPendingStatus, ax as isProcessedStatus, ay as isTerminalStatus } from './shared/bank.BvQ2SE8p.cjs';
3
+ import { d as FinbricksAccount, R as ReferenceType, S as SendPaymentInput } from './shared/bank.Bu5RkozT.cjs';
4
+ export { e as FinbricksAccountTransactionsResponse, f as FinbricksAccountsListResponse, g as FinbricksAuthTokenResponse, h as FinbricksBatchResponse, i as FinbricksConnectAccountResponse, j as FinbricksPaymentResponse, k as FinbricksSupportedBank, F as FinbricksSupportedBanksResponse, b as SendPaymentSyncInput } from './shared/bank.Bu5RkozT.cjs';
5
+ export { a as BankServiceEnv, b as BankServiceEnvironmentConfig, B as BankServiceWranglerConfig } from './shared/bank.Bz4DIxJL.cjs';
6
6
  import { BaseEvent } from '@develit-io/backend-sdk';
7
7
  import * as drizzle_zod from 'drizzle-zod';
8
8
  import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
@@ -368,6 +368,18 @@ declare class DbuConnector extends IBankConnector {
368
368
  getPaymentStatus({ paymentId, }: {
369
369
  paymentId: string;
370
370
  }): Promise<PaymentRequestStatus>;
371
+ getAccountBalance({ account, }: {
372
+ account: AccountSelectType;
373
+ }): Promise<{
374
+ balances: Array<{
375
+ amount: {
376
+ value: number;
377
+ currency: string;
378
+ };
379
+ balanceType: 'AVAILABLE' | 'VALUTA' | 'GPE_AVAILABLE' | 'MULTI_AVAILABLE';
380
+ balanceDate: Date;
381
+ }>;
382
+ }>;
371
383
  parseAuthorizationCallback(callbackUrl: string): AuthorizationCallbackResult;
372
384
  }
373
385
 
package/dist/types.d.mts CHANGED
@@ -1,8 +1,8 @@
1
- import { I as IBankConnector, b as ConnectorKey, f as ConnectedAccount, c as PaymentType, g as CredentialsResolver, h as AccountCredentialsInsertType, i as AccountInsertType, j as BatchedPayment, k as InitiatedBatch, l as IncomingPayment, m as InitiatedPayment, A as AccountSelectType, n as ParsedBankPayment, o as PaymentRequestStatus, p as AuthorizationCallbackResult, q as BatchMetadata, r as Currency, a as PaymentSelectType, P as PaymentRequestSelectType, s as AccountAssignedPayment, u as PreparedPayment, v as CompletedPayment, w as PaymentRequestInsertType } from './shared/bank.NqesB7DM.mjs';
2
- export { x as ACCOUNT_STATUSES, y as AccountCredentialsPatchType, z as AccountCredentialsSelectType, D as AccountCredentialsUpdateType, E as AccountPatchType, F as AccountStatus, G as AccountUpdateType, J as AuthorizedBatch, K as BATCH_MODES, M as BATCH_STATUES, M as BATCH_STATUSES, N as BankAccountWithLastSync, O as BankCode, Q as BatchInsertType, R as BatchLifecycle, S as BatchMode, T as BatchPayment, B as BatchSelectType, U as BatchStatus, V as CHARGE_BEARERS, W as CONNECTOR_KEYS, X as COUNTRY_CODES, Y as CREDENTIALS_TYPES, Z as ChargeBearer, _ as CompletedBatch, C as ConfigEnvironmentBank, $ as CountryCode, a0 as CredentialsType, d as CurrencyCode, a1 as INSTRUCTION_PRIORITIES, a2 as InstructionPriority, L as LastSyncMetadata, a3 as PAYMENT_DIRECTIONS, a4 as PAYMENT_REQUEST_STATUSES, a5 as PAYMENT_STATUSES, a6 as PAYMENT_TYPES, a7 as PaymentDirection, a8 as PaymentFailedInsertType, a9 as PaymentInsertType, aa as PaymentLifecycle, ab as PaymentPreparedInsertType, ac as PaymentStatus, ad as ProcessingBatch, ae as ReadyToSignBatch, af as ResolvedCredentials, ag as TOKEN_TYPES, ah as TokenType, ai as accountCredentialsInsertSchema, aj as accountCredentialsSelectSchema, ak as accountCredentialsUpdateSchema, al as accountInsertSchema, am as accountSelectSchema, an as accountUpdateSchema, ao as hasPaymentAccountAssigned, ap as isBatchAuthorized, aq as isBatchCompleted, ar as isBatchFailed, as as isBatchInitiated, at as isBatchProcessing, au as isBatchReadyToSign, av as isPaymentCompleted, aw as isPendingStatus, ax as isProcessedStatus, ay as isTerminalStatus } from './shared/bank.NqesB7DM.mjs';
3
- import { d as FinbricksAccount, R as ReferenceType, S as SendPaymentInput } from './shared/bank.BYUn0j0r.mjs';
4
- export { e as FinbricksAccountTransactionsResponse, f as FinbricksAccountsListResponse, g as FinbricksAuthTokenResponse, h as FinbricksBatchResponse, i as FinbricksConnectAccountResponse, j as FinbricksPaymentResponse, k as FinbricksSupportedBank, F as FinbricksSupportedBanksResponse, b as SendPaymentSyncInput } from './shared/bank.BYUn0j0r.mjs';
5
- export { a as BankServiceEnv, b as BankServiceEnvironmentConfig, B as BankServiceWranglerConfig } from './shared/bank.CVJosema.mjs';
1
+ import { I as IBankConnector, b as ConnectorKey, f as ConnectedAccount, c as PaymentType, g as CredentialsResolver, h as AccountCredentialsInsertType, i as AccountInsertType, j as BatchedPayment, k as InitiatedBatch, l as IncomingPayment, m as InitiatedPayment, A as AccountSelectType, n as ParsedBankPayment, o as PaymentRequestStatus, p as AuthorizationCallbackResult, q as BatchMetadata, r as Currency, a as PaymentSelectType, P as PaymentRequestSelectType, s as AccountAssignedPayment, u as PreparedPayment, v as CompletedPayment, w as PaymentRequestInsertType } from './shared/bank.BvQ2SE8p.mjs';
2
+ export { x as ACCOUNT_STATUSES, y as AccountCredentialsPatchType, z as AccountCredentialsSelectType, D as AccountCredentialsUpdateType, E as AccountPatchType, F as AccountStatus, G as AccountUpdateType, J as AuthorizedBatch, K as BATCH_MODES, M as BATCH_STATUES, M as BATCH_STATUSES, N as BankAccountWithLastSync, O as BankCode, Q as BatchInsertType, R as BatchLifecycle, S as BatchMode, T as BatchPayment, B as BatchSelectType, U as BatchStatus, V as CHARGE_BEARERS, W as CONNECTOR_KEYS, X as COUNTRY_CODES, Y as CREDENTIALS_TYPES, Z as ChargeBearer, _ as CompletedBatch, C as ConfigEnvironmentBank, $ as CountryCode, a0 as CredentialsType, d as CurrencyCode, a1 as INSTRUCTION_PRIORITIES, a2 as InstructionPriority, L as LastSyncMetadata, a3 as PAYMENT_DIRECTIONS, a4 as PAYMENT_REQUEST_STATUSES, a5 as PAYMENT_STATUSES, a6 as PAYMENT_TYPES, a7 as PaymentDirection, a8 as PaymentFailedInsertType, a9 as PaymentInsertType, aa as PaymentLifecycle, ab as PaymentPreparedInsertType, ac as PaymentStatus, ad as ProcessingBatch, ae as ReadyToSignBatch, af as ResolvedCredentials, ag as TOKEN_TYPES, ah as TokenType, ai as accountCredentialsInsertSchema, aj as accountCredentialsSelectSchema, ak as accountCredentialsUpdateSchema, al as accountInsertSchema, am as accountSelectSchema, an as accountUpdateSchema, ao as hasPaymentAccountAssigned, ap as isBatchAuthorized, aq as isBatchCompleted, ar as isBatchFailed, as as isBatchInitiated, at as isBatchProcessing, au as isBatchReadyToSign, av as isPaymentCompleted, aw as isPendingStatus, ax as isProcessedStatus, ay as isTerminalStatus } from './shared/bank.BvQ2SE8p.mjs';
3
+ import { d as FinbricksAccount, R as ReferenceType, S as SendPaymentInput } from './shared/bank.BpTNVqyL.mjs';
4
+ export { e as FinbricksAccountTransactionsResponse, f as FinbricksAccountsListResponse, g as FinbricksAuthTokenResponse, h as FinbricksBatchResponse, i as FinbricksConnectAccountResponse, j as FinbricksPaymentResponse, k as FinbricksSupportedBank, F as FinbricksSupportedBanksResponse, b as SendPaymentSyncInput } from './shared/bank.BpTNVqyL.mjs';
5
+ export { a as BankServiceEnv, b as BankServiceEnvironmentConfig, B as BankServiceWranglerConfig } from './shared/bank.Bz4DIxJL.mjs';
6
6
  import { BaseEvent } from '@develit-io/backend-sdk';
7
7
  import * as drizzle_zod from 'drizzle-zod';
8
8
  import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
@@ -368,6 +368,18 @@ declare class DbuConnector extends IBankConnector {
368
368
  getPaymentStatus({ paymentId, }: {
369
369
  paymentId: string;
370
370
  }): Promise<PaymentRequestStatus>;
371
+ getAccountBalance({ account, }: {
372
+ account: AccountSelectType;
373
+ }): Promise<{
374
+ balances: Array<{
375
+ amount: {
376
+ value: number;
377
+ currency: string;
378
+ };
379
+ balanceType: 'AVAILABLE' | 'VALUTA' | 'GPE_AVAILABLE' | 'MULTI_AVAILABLE';
380
+ balanceDate: Date;
381
+ }>;
382
+ }>;
371
383
  parseAuthorizationCallback(callbackUrl: string): AuthorizationCallbackResult;
372
384
  }
373
385
 
package/dist/types.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { I as IBankConnector, b as ConnectorKey, f as ConnectedAccount, c as PaymentType, g as CredentialsResolver, h as AccountCredentialsInsertType, i as AccountInsertType, j as BatchedPayment, k as InitiatedBatch, l as IncomingPayment, m as InitiatedPayment, A as AccountSelectType, n as ParsedBankPayment, o as PaymentRequestStatus, p as AuthorizationCallbackResult, q as BatchMetadata, r as Currency, a as PaymentSelectType, P as PaymentRequestSelectType, s as AccountAssignedPayment, u as PreparedPayment, v as CompletedPayment, w as PaymentRequestInsertType } from './shared/bank.NqesB7DM.js';
2
- export { x as ACCOUNT_STATUSES, y as AccountCredentialsPatchType, z as AccountCredentialsSelectType, D as AccountCredentialsUpdateType, E as AccountPatchType, F as AccountStatus, G as AccountUpdateType, J as AuthorizedBatch, K as BATCH_MODES, M as BATCH_STATUES, M as BATCH_STATUSES, N as BankAccountWithLastSync, O as BankCode, Q as BatchInsertType, R as BatchLifecycle, S as BatchMode, T as BatchPayment, B as BatchSelectType, U as BatchStatus, V as CHARGE_BEARERS, W as CONNECTOR_KEYS, X as COUNTRY_CODES, Y as CREDENTIALS_TYPES, Z as ChargeBearer, _ as CompletedBatch, C as ConfigEnvironmentBank, $ as CountryCode, a0 as CredentialsType, d as CurrencyCode, a1 as INSTRUCTION_PRIORITIES, a2 as InstructionPriority, L as LastSyncMetadata, a3 as PAYMENT_DIRECTIONS, a4 as PAYMENT_REQUEST_STATUSES, a5 as PAYMENT_STATUSES, a6 as PAYMENT_TYPES, a7 as PaymentDirection, a8 as PaymentFailedInsertType, a9 as PaymentInsertType, aa as PaymentLifecycle, ab as PaymentPreparedInsertType, ac as PaymentStatus, ad as ProcessingBatch, ae as ReadyToSignBatch, af as ResolvedCredentials, ag as TOKEN_TYPES, ah as TokenType, ai as accountCredentialsInsertSchema, aj as accountCredentialsSelectSchema, ak as accountCredentialsUpdateSchema, al as accountInsertSchema, am as accountSelectSchema, an as accountUpdateSchema, ao as hasPaymentAccountAssigned, ap as isBatchAuthorized, aq as isBatchCompleted, ar as isBatchFailed, as as isBatchInitiated, at as isBatchProcessing, au as isBatchReadyToSign, av as isPaymentCompleted, aw as isPendingStatus, ax as isProcessedStatus, ay as isTerminalStatus } from './shared/bank.NqesB7DM.js';
3
- import { d as FinbricksAccount, R as ReferenceType, S as SendPaymentInput } from './shared/bank.Dg_QI-D5.js';
4
- export { e as FinbricksAccountTransactionsResponse, f as FinbricksAccountsListResponse, g as FinbricksAuthTokenResponse, h as FinbricksBatchResponse, i as FinbricksConnectAccountResponse, j as FinbricksPaymentResponse, k as FinbricksSupportedBank, F as FinbricksSupportedBanksResponse, b as SendPaymentSyncInput } from './shared/bank.Dg_QI-D5.js';
5
- export { a as BankServiceEnv, b as BankServiceEnvironmentConfig, B as BankServiceWranglerConfig } from './shared/bank.CVJosema.js';
1
+ import { I as IBankConnector, b as ConnectorKey, f as ConnectedAccount, c as PaymentType, g as CredentialsResolver, h as AccountCredentialsInsertType, i as AccountInsertType, j as BatchedPayment, k as InitiatedBatch, l as IncomingPayment, m as InitiatedPayment, A as AccountSelectType, n as ParsedBankPayment, o as PaymentRequestStatus, p as AuthorizationCallbackResult, q as BatchMetadata, r as Currency, a as PaymentSelectType, P as PaymentRequestSelectType, s as AccountAssignedPayment, u as PreparedPayment, v as CompletedPayment, w as PaymentRequestInsertType } from './shared/bank.BvQ2SE8p.js';
2
+ export { x as ACCOUNT_STATUSES, y as AccountCredentialsPatchType, z as AccountCredentialsSelectType, D as AccountCredentialsUpdateType, E as AccountPatchType, F as AccountStatus, G as AccountUpdateType, J as AuthorizedBatch, K as BATCH_MODES, M as BATCH_STATUES, M as BATCH_STATUSES, N as BankAccountWithLastSync, O as BankCode, Q as BatchInsertType, R as BatchLifecycle, S as BatchMode, T as BatchPayment, B as BatchSelectType, U as BatchStatus, V as CHARGE_BEARERS, W as CONNECTOR_KEYS, X as COUNTRY_CODES, Y as CREDENTIALS_TYPES, Z as ChargeBearer, _ as CompletedBatch, C as ConfigEnvironmentBank, $ as CountryCode, a0 as CredentialsType, d as CurrencyCode, a1 as INSTRUCTION_PRIORITIES, a2 as InstructionPriority, L as LastSyncMetadata, a3 as PAYMENT_DIRECTIONS, a4 as PAYMENT_REQUEST_STATUSES, a5 as PAYMENT_STATUSES, a6 as PAYMENT_TYPES, a7 as PaymentDirection, a8 as PaymentFailedInsertType, a9 as PaymentInsertType, aa as PaymentLifecycle, ab as PaymentPreparedInsertType, ac as PaymentStatus, ad as ProcessingBatch, ae as ReadyToSignBatch, af as ResolvedCredentials, ag as TOKEN_TYPES, ah as TokenType, ai as accountCredentialsInsertSchema, aj as accountCredentialsSelectSchema, ak as accountCredentialsUpdateSchema, al as accountInsertSchema, am as accountSelectSchema, an as accountUpdateSchema, ao as hasPaymentAccountAssigned, ap as isBatchAuthorized, aq as isBatchCompleted, ar as isBatchFailed, as as isBatchInitiated, at as isBatchProcessing, au as isBatchReadyToSign, av as isPaymentCompleted, aw as isPendingStatus, ax as isProcessedStatus, ay as isTerminalStatus } from './shared/bank.BvQ2SE8p.js';
3
+ import { d as FinbricksAccount, R as ReferenceType, S as SendPaymentInput } from './shared/bank.FUi1SRkA.js';
4
+ export { e as FinbricksAccountTransactionsResponse, f as FinbricksAccountsListResponse, g as FinbricksAuthTokenResponse, h as FinbricksBatchResponse, i as FinbricksConnectAccountResponse, j as FinbricksPaymentResponse, k as FinbricksSupportedBank, F as FinbricksSupportedBanksResponse, b as SendPaymentSyncInput } from './shared/bank.FUi1SRkA.js';
5
+ export { a as BankServiceEnv, b as BankServiceEnvironmentConfig, B as BankServiceWranglerConfig } from './shared/bank.Bz4DIxJL.js';
6
6
  import { BaseEvent } from '@develit-io/backend-sdk';
7
7
  import * as drizzle_zod from 'drizzle-zod';
8
8
  import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
@@ -368,6 +368,18 @@ declare class DbuConnector extends IBankConnector {
368
368
  getPaymentStatus({ paymentId, }: {
369
369
  paymentId: string;
370
370
  }): Promise<PaymentRequestStatus>;
371
+ getAccountBalance({ account, }: {
372
+ account: AccountSelectType;
373
+ }): Promise<{
374
+ balances: Array<{
375
+ amount: {
376
+ value: number;
377
+ currency: string;
378
+ };
379
+ balanceType: 'AVAILABLE' | 'VALUTA' | 'GPE_AVAILABLE' | 'MULTI_AVAILABLE';
380
+ balanceDate: Date;
381
+ }>;
382
+ }>;
371
383
  parseAuthorizationCallback(callbackUrl: string): AuthorizationCallbackResult;
372
384
  }
373
385
 
package/dist/types.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { C as CsobConnector, D as DbuConnector, E as ErsteConnector, F as FINBRICKS_ENDPOINTS, a as FinbricksClient, b as FinbricksConnector, I as IBankConnector, K as KBConnector, M as MockCobsConnector, c as MockConnector, d as assignAccount, s as signFinbricksJws, t as toBatchedPayment, e as toBatchedPaymentFromPaymentRequest, f as toCompletedPayment, g as toIncomingPayment, h as toPaymentRequestInsert, i as toPreparedPayment, u as useFinbricksFetch } from './shared/bank.BsKwYyaC.mjs';
1
+ export { C as CsobConnector, D as DbuConnector, E as ErsteConnector, F as FINBRICKS_ENDPOINTS, a as FinbricksClient, b as FinbricksConnector, I as IBankConnector, K as KBConnector, M as MockCobsConnector, c as MockConnector, d as assignAccount, s as signFinbricksJws, t as toBatchedPayment, e as toBatchedPaymentFromPaymentRequest, f as toCompletedPayment, g as toIncomingPayment, h as toPaymentRequestInsert, i as toPreparedPayment, u as useFinbricksFetch } from './shared/bank.Bo4HtOgs.mjs';
2
2
  export { A as ACCOUNT_STATUSES, B as BATCH_MODES, a as BATCH_STATUES, a as BATCH_STATUSES, C as CHARGE_BEARERS, b as CONNECTOR_KEYS, c as COUNTRY_CODES, d as CREDENTIALS_TYPES, I as INSTRUCTION_PRIORITIES, P as PAYMENT_DIRECTIONS, e as PAYMENT_REQUEST_STATUSES, f as PAYMENT_STATUSES, g as PAYMENT_TYPES, T as TOKEN_TYPES, h as accountCredentialsInsertSchema, i as accountCredentialsSelectSchema, j as accountCredentialsUpdateSchema, k as accountInsertSchema, l as accountSelectSchema, m as accountUpdateSchema, n as hasPaymentAccountAssigned, o as isPaymentCompleted, p as isPendingStatus, q as isProcessedStatus, r as isTerminalStatus, s as ottInsertSchema, t as ottSelectSchema, u as ottUpdateSchema } from './shared/bank.C7MA33AX.mjs';
3
3
  export { i as isBatchAuthorized, a as isBatchCompleted, b as isBatchFailed, c as isBatchInitiated, d as isBatchProcessing, e as isBatchReadyToSign } from './shared/bank.XqSw509X.mjs';
4
4
  export { BANK_CODES, CURRENCY_CODES } from '@develit-io/general-codes';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@develit-services/bank",
3
- "version": "2.0.0",
3
+ "version": "2.2.0",
4
4
  "author": "Develit.io s.r.o.",
5
5
  "type": "module",
6
6
  "exports": {