@develit-services/bank 2.0.0 → 2.1.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.
package/README.md CHANGED
@@ -396,4 +396,10 @@ Format: `{CATEGORY}-B-{NUMBER}`
396
396
  | `VALID-B-011` | 422 | Batch: debtor IBAN/currency mismatch |
397
397
  | `VALID-B-012` | 422 | Batch: payment type mismatch |
398
398
  | `VALID-B-013` | 422 | Batch: size limit exceeded |
399
+ | `VALID-B-014` | 404 | Account not found (balance) |
400
+ | `VALID-B-016` | 400 | Account configuration incomplete |
399
401
  | `SYS-B-001` | 501 | Not implemented |
402
+ | `SYS-B-002` | 400 | Account has no bankRefId |
403
+ | `SYS-B-003` | 503 | Balance data unavailable |
404
+ | `SYS-B-004` | 501 | Balance not supported by connector |
405
+ | `SYS-B-005` | 500 | Backoffice API request failed |
@@ -1,4 +1,4 @@
1
- export { az as account, aA as accountCredentials, aB as batch, aC as ott, aD as payment, aE as paymentRelations, aF as paymentRequest, aG as paymentRequestRelations } from '../shared/bank.NqesB7DM.cjs';
1
+ export { az as account, aA as accountCredentials, aB as batch, aC as ott, aD as payment, aE as paymentRelations, aF as paymentRequest, aG as paymentRequestRelations } from '../shared/bank.seypMpK4.cjs';
2
2
  import 'drizzle-orm/sqlite-core';
3
3
  import 'drizzle-orm';
4
4
  import '@develit-io/backend-sdk';
@@ -1,4 +1,4 @@
1
- export { az as account, aA as accountCredentials, aB as batch, aC as ott, aD as payment, aE as paymentRelations, aF as paymentRequest, aG as paymentRequestRelations } from '../shared/bank.NqesB7DM.mjs';
1
+ export { az as account, aA as accountCredentials, aB as batch, aC as ott, aD as payment, aE as paymentRelations, aF as paymentRequest, aG as paymentRequestRelations } from '../shared/bank.seypMpK4.mjs';
2
2
  import 'drizzle-orm/sqlite-core';
3
3
  import 'drizzle-orm';
4
4
  import '@develit-io/backend-sdk';
@@ -1,4 +1,4 @@
1
- export { az as account, aA as accountCredentials, aB as batch, aC as ott, aD as payment, aE as paymentRelations, aF as paymentRequest, aG as paymentRequestRelations } from '../shared/bank.NqesB7DM.js';
1
+ export { az as account, aA as accountCredentials, aB as batch, aC as ott, aD as payment, aE as paymentRelations, aF as paymentRequest, aG as paymentRequestRelations } from '../shared/bank.seypMpK4.js';
2
2
  import 'drizzle-orm/sqlite-core';
3
3
  import 'drizzle-orm';
4
4
  import '@develit-io/backend-sdk';
@@ -5,7 +5,7 @@ const database_schema = require('../shared/bank.CIWYI18z.cjs');
5
5
  const drizzleOrm = require('drizzle-orm');
6
6
  const cloudflare_workers = require('cloudflare:workers');
7
7
  const d1 = require('drizzle-orm/d1');
8
- const mock_connector = require('../shared/bank.CpEGzmAr.cjs');
8
+ const mock_connector = require('../shared/bank.CSwUy2gs.cjs');
9
9
  require('jose');
10
10
  const zod = require('zod');
11
11
  const generalCodes = require('@develit-io/general-codes');
@@ -576,6 +576,10 @@ const getPaymentRequestsInputSchema = zod.z.object({
576
576
  // filterDirection: removed — payment_request is always OUTGOING
577
577
  });
578
578
 
579
+ const getAccountBalanceInputSchema = zod.z.object({
580
+ accountId: zod.z.string().uuid()
581
+ });
582
+
579
583
  var __defProp = Object.defineProperty;
580
584
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
581
585
  var __decorateClass = (decorators, target, key, kind) => {
@@ -1564,6 +1568,36 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
1564
1568
  }
1565
1569
  );
1566
1570
  }
1571
+ async getAccountBalance(input) {
1572
+ return this.handleAction(
1573
+ { data: input, schema: getAccountBalanceInputSchema },
1574
+ { successMessage: "Account balance retrieved successfully" },
1575
+ async (data) => {
1576
+ const account = await credentialsResolver.getAccountByIdQuery(this.db, {
1577
+ accountId: data.accountId
1578
+ });
1579
+ if (!account) {
1580
+ throw backendSdk.createInternalError(null, {
1581
+ message: "Account not found",
1582
+ code: "VALID-B-014",
1583
+ status: 404
1584
+ });
1585
+ }
1586
+ if (!account.bankRefId) {
1587
+ throw backendSdk.createInternalError(null, {
1588
+ message: "Account configuration incomplete",
1589
+ code: "VALID-B-016",
1590
+ status: 400
1591
+ });
1592
+ }
1593
+ const connector = await this._initiateBankConnector({
1594
+ connectorKey: account.connectorKey,
1595
+ skipAccounts: false
1596
+ });
1597
+ return await connector.getAccountBalance({ account });
1598
+ }
1599
+ );
1600
+ }
1567
1601
  async updateAccount(input) {
1568
1602
  return this.handleAction(
1569
1603
  {
@@ -1767,6 +1801,9 @@ __decorateClass([
1767
1801
  __decorateClass([
1768
1802
  backendSdk.action("get-bank-accounts")
1769
1803
  ], BankServiceBase.prototype, "getBankAccounts", 1);
1804
+ __decorateClass([
1805
+ backendSdk.action("get-account-balance")
1806
+ ], BankServiceBase.prototype, "getAccountBalance", 1);
1770
1807
  __decorateClass([
1771
1808
  backendSdk.action("update-account")
1772
1809
  ], BankServiceBase.prototype, "updateAccount", 1);
@@ -1,5 +1,5 @@
1
- import { B as BatchSelectType, P as PaymentRequestSelectType, A as AccountSelectType, a as PaymentSelectType, L as LastSyncMetadata, C as ConfigEnvironmentBank, t as tables, b as ConnectorKey, I as IBankConnector, c as PaymentType, d as CurrencyCode, H as HandleAuthorizationCallbackInput, e as HandleAuthorizationCallbackOutput } from '../shared/bank.NqesB7DM.cjs';
2
- import { S as SendPaymentInput, a as SendPaymentOutput, b as SendPaymentSyncInput, c as SendPaymentSyncOutput, F as FinbricksSupportedBanksResponse } from '../shared/bank.Bl1DnY7_.cjs';
1
+ import { B as BatchSelectType, P as PaymentRequestSelectType, A as AccountSelectType, a as PaymentSelectType, L as LastSyncMetadata, C as ConfigEnvironmentBank, t as tables, b as ConnectorKey, I as IBankConnector, c as PaymentType, d as CurrencyCode, H as HandleAuthorizationCallbackInput, e as HandleAuthorizationCallbackOutput } from '../shared/bank.seypMpK4.cjs';
2
+ import { S as SendPaymentInput, a as SendPaymentOutput, b as SendPaymentSyncInput, c as SendPaymentSyncOutput, F as FinbricksSupportedBanksResponse } from '../shared/bank.Cp1MNkxw.cjs';
3
3
  import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
4
4
  import { WorkflowInstanceStatus, IRPCResponse } from '@develit-io/backend-sdk';
5
5
  import { WorkerEntrypoint } from 'cloudflare:workers';
@@ -4072,6 +4072,21 @@ type GetPaymentRequestOutput = {
4072
4072
  paymentRequest: PaymentRequestSelectType;
4073
4073
  };
4074
4074
 
4075
+ declare const getAccountBalanceInputSchema: z.ZodObject<{
4076
+ accountId: z.ZodString;
4077
+ }, z.core.$strip>;
4078
+ type GetAccountBalanceInput = z.input<typeof getAccountBalanceInputSchema>;
4079
+ type GetAccountBalanceOutput = {
4080
+ balances: Array<{
4081
+ amount: {
4082
+ value: number;
4083
+ currency: string;
4084
+ };
4085
+ balanceType: 'AVAILABLE' | 'VALUTA' | 'GPE_AVAILABLE' | 'MULTI_AVAILABLE';
4086
+ balanceDate: Date;
4087
+ }>;
4088
+ };
4089
+
4075
4090
  declare const BankServiceBase_base: (abstract new (ctx: ExecutionContext, env: BankEnv) => WorkerEntrypoint<BankEnv, {}>) & (abstract new (...args: any[]) => _develit_io_backend_sdk.DevelitWorkerMethods);
4076
4091
  declare class BankServiceBase extends BankServiceBase_base {
4077
4092
  readonly db: DrizzleD1Database<typeof tables>;
@@ -4228,6 +4243,7 @@ declare class BankServiceBase extends BankServiceBase_base {
4228
4243
  */
4229
4244
  sendBatch(input: SendBatchInput): Promise<IRPCResponse<SendBatchOutput>>;
4230
4245
  getBankAccounts(input: GetBankAccountsInput): Promise<IRPCResponse<GetBankAccountsOutput>>;
4246
+ getAccountBalance(input: GetAccountBalanceInput): Promise<IRPCResponse<GetAccountBalanceOutput>>;
4231
4247
  updateAccount(input: UpdateAccountInput): Promise<IRPCResponse<UpdateAccountOutput>>;
4232
4248
  disconnectAccount(input: DisconnectAccountInput): Promise<IRPCResponse<DisconnectAccountOutput>>;
4233
4249
  getBatches(input: GetBatchesInput): Promise<IRPCResponse<GetBatchesOutput>>;
@@ -1,5 +1,5 @@
1
- import { B as BatchSelectType, P as PaymentRequestSelectType, A as AccountSelectType, a as PaymentSelectType, L as LastSyncMetadata, C as ConfigEnvironmentBank, t as tables, b as ConnectorKey, I as IBankConnector, c as PaymentType, d as CurrencyCode, H as HandleAuthorizationCallbackInput, e as HandleAuthorizationCallbackOutput } from '../shared/bank.NqesB7DM.mjs';
2
- import { S as SendPaymentInput, a as SendPaymentOutput, b as SendPaymentSyncInput, c as SendPaymentSyncOutput, F as FinbricksSupportedBanksResponse } from '../shared/bank.BYUn0j0r.mjs';
1
+ import { B as BatchSelectType, P as PaymentRequestSelectType, A as AccountSelectType, a as PaymentSelectType, L as LastSyncMetadata, C as ConfigEnvironmentBank, t as tables, b as ConnectorKey, I as IBankConnector, c as PaymentType, d as CurrencyCode, H as HandleAuthorizationCallbackInput, e as HandleAuthorizationCallbackOutput } from '../shared/bank.seypMpK4.mjs';
2
+ import { S as SendPaymentInput, a as SendPaymentOutput, b as SendPaymentSyncInput, c as SendPaymentSyncOutput, F as FinbricksSupportedBanksResponse } from '../shared/bank.BW-Ts5Zr.mjs';
3
3
  import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
4
4
  import { WorkflowInstanceStatus, IRPCResponse } from '@develit-io/backend-sdk';
5
5
  import { WorkerEntrypoint } from 'cloudflare:workers';
@@ -4072,6 +4072,21 @@ type GetPaymentRequestOutput = {
4072
4072
  paymentRequest: PaymentRequestSelectType;
4073
4073
  };
4074
4074
 
4075
+ declare const getAccountBalanceInputSchema: z.ZodObject<{
4076
+ accountId: z.ZodString;
4077
+ }, z.core.$strip>;
4078
+ type GetAccountBalanceInput = z.input<typeof getAccountBalanceInputSchema>;
4079
+ type GetAccountBalanceOutput = {
4080
+ balances: Array<{
4081
+ amount: {
4082
+ value: number;
4083
+ currency: string;
4084
+ };
4085
+ balanceType: 'AVAILABLE' | 'VALUTA' | 'GPE_AVAILABLE' | 'MULTI_AVAILABLE';
4086
+ balanceDate: Date;
4087
+ }>;
4088
+ };
4089
+
4075
4090
  declare const BankServiceBase_base: (abstract new (ctx: ExecutionContext, env: BankEnv) => WorkerEntrypoint<BankEnv, {}>) & (abstract new (...args: any[]) => _develit_io_backend_sdk.DevelitWorkerMethods);
4076
4091
  declare class BankServiceBase extends BankServiceBase_base {
4077
4092
  readonly db: DrizzleD1Database<typeof tables>;
@@ -4228,6 +4243,7 @@ declare class BankServiceBase extends BankServiceBase_base {
4228
4243
  */
4229
4244
  sendBatch(input: SendBatchInput): Promise<IRPCResponse<SendBatchOutput>>;
4230
4245
  getBankAccounts(input: GetBankAccountsInput): Promise<IRPCResponse<GetBankAccountsOutput>>;
4246
+ getAccountBalance(input: GetAccountBalanceInput): Promise<IRPCResponse<GetAccountBalanceOutput>>;
4231
4247
  updateAccount(input: UpdateAccountInput): Promise<IRPCResponse<UpdateAccountOutput>>;
4232
4248
  disconnectAccount(input: DisconnectAccountInput): Promise<IRPCResponse<DisconnectAccountOutput>>;
4233
4249
  getBatches(input: GetBatchesInput): Promise<IRPCResponse<GetBatchesOutput>>;
@@ -1,5 +1,5 @@
1
- import { B as BatchSelectType, P as PaymentRequestSelectType, A as AccountSelectType, a as PaymentSelectType, L as LastSyncMetadata, C as ConfigEnvironmentBank, t as tables, b as ConnectorKey, I as IBankConnector, c as PaymentType, d as CurrencyCode, H as HandleAuthorizationCallbackInput, e as HandleAuthorizationCallbackOutput } from '../shared/bank.NqesB7DM.js';
2
- import { S as SendPaymentInput, a as SendPaymentOutput, b as SendPaymentSyncInput, c as SendPaymentSyncOutput, F as FinbricksSupportedBanksResponse } from '../shared/bank.Dg_QI-D5.js';
1
+ import { B as BatchSelectType, P as PaymentRequestSelectType, A as AccountSelectType, a as PaymentSelectType, L as LastSyncMetadata, C as ConfigEnvironmentBank, t as tables, b as ConnectorKey, I as IBankConnector, c as PaymentType, d as CurrencyCode, H as HandleAuthorizationCallbackInput, e as HandleAuthorizationCallbackOutput } from '../shared/bank.seypMpK4.js';
2
+ import { S as SendPaymentInput, a as SendPaymentOutput, b as SendPaymentSyncInput, c as SendPaymentSyncOutput, F as FinbricksSupportedBanksResponse } from '../shared/bank.Cwj4uNY5.js';
3
3
  import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
4
4
  import { WorkflowInstanceStatus, IRPCResponse } from '@develit-io/backend-sdk';
5
5
  import { WorkerEntrypoint } from 'cloudflare:workers';
@@ -4072,6 +4072,21 @@ type GetPaymentRequestOutput = {
4072
4072
  paymentRequest: PaymentRequestSelectType;
4073
4073
  };
4074
4074
 
4075
+ declare const getAccountBalanceInputSchema: z.ZodObject<{
4076
+ accountId: z.ZodString;
4077
+ }, z.core.$strip>;
4078
+ type GetAccountBalanceInput = z.input<typeof getAccountBalanceInputSchema>;
4079
+ type GetAccountBalanceOutput = {
4080
+ balances: Array<{
4081
+ amount: {
4082
+ value: number;
4083
+ currency: string;
4084
+ };
4085
+ balanceType: 'AVAILABLE' | 'VALUTA' | 'GPE_AVAILABLE' | 'MULTI_AVAILABLE';
4086
+ balanceDate: Date;
4087
+ }>;
4088
+ };
4089
+
4075
4090
  declare const BankServiceBase_base: (abstract new (ctx: ExecutionContext, env: BankEnv) => WorkerEntrypoint<BankEnv, {}>) & (abstract new (...args: any[]) => _develit_io_backend_sdk.DevelitWorkerMethods);
4076
4091
  declare class BankServiceBase extends BankServiceBase_base {
4077
4092
  readonly db: DrizzleD1Database<typeof tables>;
@@ -4228,6 +4243,7 @@ declare class BankServiceBase extends BankServiceBase_base {
4228
4243
  */
4229
4244
  sendBatch(input: SendBatchInput): Promise<IRPCResponse<SendBatchOutput>>;
4230
4245
  getBankAccounts(input: GetBankAccountsInput): Promise<IRPCResponse<GetBankAccountsOutput>>;
4246
+ getAccountBalance(input: GetAccountBalanceInput): Promise<IRPCResponse<GetAccountBalanceOutput>>;
4231
4247
  updateAccount(input: UpdateAccountInput): Promise<IRPCResponse<UpdateAccountOutput>>;
4232
4248
  disconnectAccount(input: DisconnectAccountInput): Promise<IRPCResponse<DisconnectAccountOutput>>;
4233
4249
  getBatches(input: GetBatchesInput): Promise<IRPCResponse<GetBatchesOutput>>;
@@ -3,7 +3,7 @@ import { v as tables, I as INSTRUCTION_PRIORITIES, C as CHARGE_BEARERS, g as PAY
3
3
  import { eq, sql, and, like, asc, desc, inArray, gte, lte, isNull, count } from 'drizzle-orm';
4
4
  import { WorkerEntrypoint } from 'cloudflare:workers';
5
5
  import { drizzle } from 'drizzle-orm/d1';
6
- import { j as initiateConnector, g as toIncomingPayment, d as assignAccount, t as toBatchedPayment, h as toPaymentRequestInsert, a as FinbricksClient, F as FINBRICKS_ENDPOINTS } from '../shared/bank.BsKwYyaC.mjs';
6
+ import { j as initiateConnector, g as toIncomingPayment, d as assignAccount, t as toBatchedPayment, h as toPaymentRequestInsert, a as FinbricksClient, F as FINBRICKS_ENDPOINTS } from '../shared/bank.BohzZXQu.mjs';
7
7
  import 'jose';
8
8
  import { z } from 'zod';
9
9
  import { CURRENCY_CODES } from '@develit-io/general-codes';
@@ -574,6 +574,10 @@ const getPaymentRequestsInputSchema = z.object({
574
574
  // filterDirection: removed — payment_request is always OUTGOING
575
575
  });
576
576
 
577
+ const getAccountBalanceInputSchema = z.object({
578
+ accountId: z.string().uuid()
579
+ });
580
+
577
581
  var __defProp = Object.defineProperty;
578
582
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
579
583
  var __decorateClass = (decorators, target, key, kind) => {
@@ -1562,6 +1566,36 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
1562
1566
  }
1563
1567
  );
1564
1568
  }
1569
+ async getAccountBalance(input) {
1570
+ return this.handleAction(
1571
+ { data: input, schema: getAccountBalanceInputSchema },
1572
+ { successMessage: "Account balance retrieved successfully" },
1573
+ async (data) => {
1574
+ const account = await getAccountByIdQuery(this.db, {
1575
+ accountId: data.accountId
1576
+ });
1577
+ if (!account) {
1578
+ throw createInternalError(null, {
1579
+ message: "Account not found",
1580
+ code: "VALID-B-014",
1581
+ status: 404
1582
+ });
1583
+ }
1584
+ if (!account.bankRefId) {
1585
+ throw createInternalError(null, {
1586
+ message: "Account configuration incomplete",
1587
+ code: "VALID-B-016",
1588
+ status: 400
1589
+ });
1590
+ }
1591
+ const connector = await this._initiateBankConnector({
1592
+ connectorKey: account.connectorKey,
1593
+ skipAccounts: false
1594
+ });
1595
+ return await connector.getAccountBalance({ account });
1596
+ }
1597
+ );
1598
+ }
1565
1599
  async updateAccount(input) {
1566
1600
  return this.handleAction(
1567
1601
  {
@@ -1765,6 +1799,9 @@ __decorateClass([
1765
1799
  __decorateClass([
1766
1800
  action("get-bank-accounts")
1767
1801
  ], BankServiceBase.prototype, "getBankAccounts", 1);
1802
+ __decorateClass([
1803
+ action("get-account-balance")
1804
+ ], BankServiceBase.prototype, "getAccountBalance", 1);
1768
1805
  __decorateClass([
1769
1806
  action("update-account")
1770
1807
  ], BankServiceBase.prototype, "updateAccount", 1);
@@ -3,7 +3,7 @@
3
3
  const backendSdk = require('@develit-io/backend-sdk');
4
4
  const database_schema = require('../shared/bank.CIWYI18z.cjs');
5
5
  const batchLifecycle = require('../shared/bank.NF8bZBy0.cjs');
6
- const mock_connector = require('../shared/bank.CpEGzmAr.cjs');
6
+ const mock_connector = require('../shared/bank.CSwUy2gs.cjs');
7
7
  const drizzleOrm = require('drizzle-orm');
8
8
  const credentialsResolver = require('../shared/bank.B0EWZbAs.cjs');
9
9
  const cloudflare_workers = require('cloudflare:workers');
@@ -1,7 +1,7 @@
1
1
  import { first, uuidv4, asNonEmpty } from '@develit-io/backend-sdk';
2
2
  import { v as tables, o as isPaymentCompleted } from '../shared/bank.C7MA33AX.mjs';
3
3
  import { i as isBatchAuthorized, b as isBatchFailed, d as isBatchProcessing } from '../shared/bank.XqSw509X.mjs';
4
- import { e as toBatchedPaymentFromPaymentRequest, i as toPreparedPayment, j as initiateConnector } from '../shared/bank.BsKwYyaC.mjs';
4
+ import { e as toBatchedPaymentFromPaymentRequest, i as toPreparedPayment, j as initiateConnector } from '../shared/bank.BohzZXQu.mjs';
5
5
  import { eq, and, inArray } from 'drizzle-orm';
6
6
  import { g as getBatchByIdQuery, a as getPaymentRequestsByBatchIdQuery, c as checksum, u as upsertBatchCommand, b as getAccountByIdQuery, d as createCredentialsResolver, e as updatePaymentRequestStatusCommand, f as createPaymentCommand } from '../shared/bank.UBWdag5k.mjs';
7
7
  import { WorkflowEntrypoint } from 'cloudflare:workers';
@@ -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.seypMpK4.mjs';
2
2
  import { z } from 'zod';
3
3
 
4
4
  type ReferenceType = `${'VS' | 'SS' | 'KS'}:${number}`;
@@ -201,6 +201,19 @@ class IBankConnector {
201
201
  }
202
202
  return this.initiateForeignBatchImpl({ batchId, payments });
203
203
  }
204
+ /**
205
+ * Gets current account balance.
206
+ * Optional - not all connectors support this.
207
+ * @param account - Bank account
208
+ * @returns Balance information or throws NOT_IMPLEMENTED
209
+ */
210
+ getAccountBalance({ account }) {
211
+ throw createInternalError(null, {
212
+ message: `Balance not supported for ${this.connectorKey} connector`,
213
+ code: "SYS-B-004",
214
+ status: 501
215
+ });
216
+ }
204
217
  }
205
218
 
206
219
  function buildEndToEndId(payment) {
@@ -1320,7 +1333,7 @@ class DbuConnector extends IBankConnector {
1320
1333
  this.sessionId = uuidv4();
1321
1334
  this.allowedPostEndpoints = [
1322
1335
  "/required-transactions",
1323
- "/required-transactions/instant-payments",
1336
+ "/required-transactions/payments/instant",
1324
1337
  "/import/data"
1325
1338
  ];
1326
1339
  }
@@ -1579,7 +1592,7 @@ class DbuConnector extends IBankConnector {
1579
1592
  applicationCode: this.applicationCode
1580
1593
  };
1581
1594
  const response = await this.makeRequest(
1582
- "/required-transactions/instant-payments",
1595
+ "/required-transactions/payments/instant",
1583
1596
  payment.correlationId,
1584
1597
  {
1585
1598
  method: "POST",
@@ -1739,6 +1752,59 @@ class DbuConnector extends IBankConnector {
1739
1752
  );
1740
1753
  return this.mapDbuStatusToPaymentRequestStatus(response.status);
1741
1754
  }
1755
+ async getAccountBalance({
1756
+ account
1757
+ }) {
1758
+ if (!account.bankRefId) {
1759
+ throw createInternalError(null, {
1760
+ message: "Account configuration incomplete",
1761
+ code: "SYS-B-002",
1762
+ status: 400
1763
+ });
1764
+ }
1765
+ const requestId = uuidv4();
1766
+ let response;
1767
+ try {
1768
+ response = await this.makeRequest(
1769
+ `/accounts/${account.bankRefId}/balance`,
1770
+ requestId,
1771
+ {
1772
+ method: "GET",
1773
+ query: {
1774
+ balanceType: "AVAILABLE"
1775
+ }
1776
+ }
1777
+ );
1778
+ } catch (error) {
1779
+ throw createInternalError(error, {
1780
+ message: `Failed to fetch account balance from Backoffice API for ${account.iban}`,
1781
+ code: "SYS-B-005",
1782
+ status: 500
1783
+ });
1784
+ }
1785
+ const balanceRecord = response.balances?.balance?.find(
1786
+ (b) => b.balanceType === "AVAILABLE"
1787
+ );
1788
+ if (!balanceRecord) {
1789
+ throw createInternalError(null, {
1790
+ message: "Available balance not found",
1791
+ code: "SYS-B-003",
1792
+ status: 503
1793
+ });
1794
+ }
1795
+ return {
1796
+ balances: [
1797
+ {
1798
+ amount: {
1799
+ value: balanceRecord.accountBalance,
1800
+ currency: balanceRecord.currencyCode
1801
+ },
1802
+ balanceType: balanceRecord.balanceType,
1803
+ balanceDate: /* @__PURE__ */ new Date()
1804
+ }
1805
+ ]
1806
+ };
1807
+ }
1742
1808
  parseAuthorizationCallback(callbackUrl) {
1743
1809
  const url = new URL(callbackUrl);
1744
1810
  const params = url.searchParams;
@@ -203,6 +203,19 @@ class IBankConnector {
203
203
  }
204
204
  return this.initiateForeignBatchImpl({ batchId, payments });
205
205
  }
206
+ /**
207
+ * Gets current account balance.
208
+ * Optional - not all connectors support this.
209
+ * @param account - Bank account
210
+ * @returns Balance information or throws NOT_IMPLEMENTED
211
+ */
212
+ getAccountBalance({ account }) {
213
+ throw backendSdk.createInternalError(null, {
214
+ message: `Balance not supported for ${this.connectorKey} connector`,
215
+ code: "SYS-B-004",
216
+ status: 501
217
+ });
218
+ }
206
219
  }
207
220
 
208
221
  function buildEndToEndId(payment) {
@@ -1322,7 +1335,7 @@ class DbuConnector extends IBankConnector {
1322
1335
  this.sessionId = backendSdk.uuidv4();
1323
1336
  this.allowedPostEndpoints = [
1324
1337
  "/required-transactions",
1325
- "/required-transactions/instant-payments",
1338
+ "/required-transactions/payments/instant",
1326
1339
  "/import/data"
1327
1340
  ];
1328
1341
  }
@@ -1581,7 +1594,7 @@ class DbuConnector extends IBankConnector {
1581
1594
  applicationCode: this.applicationCode
1582
1595
  };
1583
1596
  const response = await this.makeRequest(
1584
- "/required-transactions/instant-payments",
1597
+ "/required-transactions/payments/instant",
1585
1598
  payment.correlationId,
1586
1599
  {
1587
1600
  method: "POST",
@@ -1741,6 +1754,59 @@ class DbuConnector extends IBankConnector {
1741
1754
  );
1742
1755
  return this.mapDbuStatusToPaymentRequestStatus(response.status);
1743
1756
  }
1757
+ async getAccountBalance({
1758
+ account
1759
+ }) {
1760
+ if (!account.bankRefId) {
1761
+ throw backendSdk.createInternalError(null, {
1762
+ message: "Account configuration incomplete",
1763
+ code: "SYS-B-002",
1764
+ status: 400
1765
+ });
1766
+ }
1767
+ const requestId = backendSdk.uuidv4();
1768
+ let response;
1769
+ try {
1770
+ response = await this.makeRequest(
1771
+ `/accounts/${account.bankRefId}/balance`,
1772
+ requestId,
1773
+ {
1774
+ method: "GET",
1775
+ query: {
1776
+ balanceType: "AVAILABLE"
1777
+ }
1778
+ }
1779
+ );
1780
+ } catch (error) {
1781
+ throw backendSdk.createInternalError(error, {
1782
+ message: `Failed to fetch account balance from Backoffice API for ${account.iban}`,
1783
+ code: "SYS-B-005",
1784
+ status: 500
1785
+ });
1786
+ }
1787
+ const balanceRecord = response.balances?.balance?.find(
1788
+ (b) => b.balanceType === "AVAILABLE"
1789
+ );
1790
+ if (!balanceRecord) {
1791
+ throw backendSdk.createInternalError(null, {
1792
+ message: "Available balance not found",
1793
+ code: "SYS-B-003",
1794
+ status: 503
1795
+ });
1796
+ }
1797
+ return {
1798
+ balances: [
1799
+ {
1800
+ amount: {
1801
+ value: balanceRecord.accountBalance,
1802
+ currency: balanceRecord.currencyCode
1803
+ },
1804
+ balanceType: balanceRecord.balanceType,
1805
+ balanceDate: /* @__PURE__ */ new Date()
1806
+ }
1807
+ ]
1808
+ };
1809
+ }
1744
1810
  parseAuthorizationCallback(callbackUrl) {
1745
1811
  const url = new URL(callbackUrl);
1746
1812
  const params = url.searchParams;
@@ -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.seypMpK4.cjs';
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.js';
1
+ import { d as CurrencyCode, O as BankCode, $ as CountryCode, P as PaymentRequestSelectType } from './bank.seypMpK4.js';
2
2
  import { z } from 'zod';
3
3
 
4
4
  type ReferenceType = `${'VS' | 'SS' | 'KS'}:${number}`;
@@ -271,6 +271,24 @@ declare abstract class IBankConnector {
271
271
  * @returns Parsed result — either success (with paymentRequestId or batchId) or error
272
272
  */
273
273
  abstract parseAuthorizationCallback(callbackUrl: string): AuthorizationCallbackResult;
274
+ /**
275
+ * Gets current account balance.
276
+ * Optional - not all connectors support this.
277
+ * @param account - Bank account
278
+ * @returns Balance information or throws NOT_IMPLEMENTED
279
+ */
280
+ getAccountBalance({ account }: {
281
+ account: AccountSelectType;
282
+ }): Promise<{
283
+ balances: Array<{
284
+ amount: {
285
+ value: number;
286
+ currency: string;
287
+ };
288
+ balanceType: 'AVAILABLE' | 'VALUTA' | 'GPE_AVAILABLE' | 'MULTI_AVAILABLE';
289
+ balanceDate: Date;
290
+ }>;
291
+ }>;
274
292
  }
275
293
 
276
294
  declare const accountCredentialsInsertSchema: drizzle_zod.BuildSchema<"insert", {
@@ -271,6 +271,24 @@ declare abstract class IBankConnector {
271
271
  * @returns Parsed result — either success (with paymentRequestId or batchId) or error
272
272
  */
273
273
  abstract parseAuthorizationCallback(callbackUrl: string): AuthorizationCallbackResult;
274
+ /**
275
+ * Gets current account balance.
276
+ * Optional - not all connectors support this.
277
+ * @param account - Bank account
278
+ * @returns Balance information or throws NOT_IMPLEMENTED
279
+ */
280
+ getAccountBalance({ account }: {
281
+ account: AccountSelectType;
282
+ }): Promise<{
283
+ balances: Array<{
284
+ amount: {
285
+ value: number;
286
+ currency: string;
287
+ };
288
+ balanceType: 'AVAILABLE' | 'VALUTA' | 'GPE_AVAILABLE' | 'MULTI_AVAILABLE';
289
+ balanceDate: Date;
290
+ }>;
291
+ }>;
274
292
  }
275
293
 
276
294
  declare const accountCredentialsInsertSchema: drizzle_zod.BuildSchema<"insert", {
@@ -271,6 +271,24 @@ declare abstract class IBankConnector {
271
271
  * @returns Parsed result — either success (with paymentRequestId or batchId) or error
272
272
  */
273
273
  abstract parseAuthorizationCallback(callbackUrl: string): AuthorizationCallbackResult;
274
+ /**
275
+ * Gets current account balance.
276
+ * Optional - not all connectors support this.
277
+ * @param account - Bank account
278
+ * @returns Balance information or throws NOT_IMPLEMENTED
279
+ */
280
+ getAccountBalance({ account }: {
281
+ account: AccountSelectType;
282
+ }): Promise<{
283
+ balances: Array<{
284
+ amount: {
285
+ value: number;
286
+ currency: string;
287
+ };
288
+ balanceType: 'AVAILABLE' | 'VALUTA' | 'GPE_AVAILABLE' | 'MULTI_AVAILABLE';
289
+ balanceDate: Date;
290
+ }>;
291
+ }>;
274
292
  }
275
293
 
276
294
  declare const accountCredentialsInsertSchema: drizzle_zod.BuildSchema<"insert", {
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.CSwUy2gs.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,7 +1,7 @@
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';
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.seypMpK4.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.seypMpK4.cjs';
3
+ import { d as FinbricksAccount, R as ReferenceType, S as SendPaymentInput } from './shared/bank.Cp1MNkxw.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.Cp1MNkxw.cjs';
5
5
  export { a as BankServiceEnv, b as BankServiceEnvironmentConfig, B as BankServiceWranglerConfig } from './shared/bank.CVJosema.cjs';
6
6
  import { BaseEvent } from '@develit-io/backend-sdk';
7
7
  import * as drizzle_zod from 'drizzle-zod';
@@ -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,7 +1,7 @@
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';
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.seypMpK4.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.seypMpK4.mjs';
3
+ import { d as FinbricksAccount, R as ReferenceType, S as SendPaymentInput } from './shared/bank.BW-Ts5Zr.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.BW-Ts5Zr.mjs';
5
5
  export { a as BankServiceEnv, b as BankServiceEnvironmentConfig, B as BankServiceWranglerConfig } from './shared/bank.CVJosema.mjs';
6
6
  import { BaseEvent } from '@develit-io/backend-sdk';
7
7
  import * as drizzle_zod from 'drizzle-zod';
@@ -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,7 +1,7 @@
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';
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.seypMpK4.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.seypMpK4.js';
3
+ import { d as FinbricksAccount, R as ReferenceType, S as SendPaymentInput } from './shared/bank.Cwj4uNY5.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.Cwj4uNY5.js';
5
5
  export { a as BankServiceEnv, b as BankServiceEnvironmentConfig, B as BankServiceWranglerConfig } from './shared/bank.CVJosema.js';
6
6
  import { BaseEvent } from '@develit-io/backend-sdk';
7
7
  import * as drizzle_zod from 'drizzle-zod';
@@ -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.BohzZXQu.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.1.0",
4
4
  "author": "Develit.io s.r.o.",
5
5
  "type": "module",
6
6
  "exports": {