@develit-services/bank 0.3.50 → 0.3.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const database_schema = require('../shared/bank.BfBw79Y1.cjs');
3
+ const database_schema = require('../shared/bank.DoHc7geB.cjs');
4
4
  require('@develit-io/backend-sdk');
5
5
  require('drizzle-orm/sqlite-core');
6
6
  require('date-fns');
@@ -1,4 +1,4 @@
1
- export { a9 as account, aa as accountCredentials, a5 as batch, a8 as ott, a6 as payment, a7 as paymentRelations } from '../shared/bank.CG0gMBFx.cjs';
1
+ export { a9 as account, aa as accountCredentials, a5 as batch, a8 as ott, a6 as payment, a7 as paymentRelations } from '../shared/bank.DHQNmyQt.cjs';
2
2
  import 'zod';
3
3
  import 'drizzle-zod';
4
4
  import 'drizzle-orm/sqlite-core';
@@ -1,4 +1,4 @@
1
- export { a9 as account, aa as accountCredentials, a5 as batch, a8 as ott, a6 as payment, a7 as paymentRelations } from '../shared/bank.CG0gMBFx.mjs';
1
+ export { a9 as account, aa as accountCredentials, a5 as batch, a8 as ott, a6 as payment, a7 as paymentRelations } from '../shared/bank.DHQNmyQt.mjs';
2
2
  import 'zod';
3
3
  import 'drizzle-zod';
4
4
  import 'drizzle-orm/sqlite-core';
@@ -1,4 +1,4 @@
1
- export { a9 as account, aa as accountCredentials, a5 as batch, a8 as ott, a6 as payment, a7 as paymentRelations } from '../shared/bank.CG0gMBFx.js';
1
+ export { a9 as account, aa as accountCredentials, a5 as batch, a8 as ott, a6 as payment, a7 as paymentRelations } from '../shared/bank.DHQNmyQt.js';
2
2
  import 'zod';
3
3
  import 'drizzle-zod';
4
4
  import 'drizzle-orm/sqlite-core';
@@ -1,4 +1,4 @@
1
- export { t as account, u as accountCredentials, n as batch, r as ott, p as payment, q as paymentRelations } from '../shared/bank.m2X4FSvr.mjs';
1
+ export { t as account, u as accountCredentials, n as batch, r as ott, p as payment, q as paymentRelations } from '../shared/bank.C1bHZDjr.mjs';
2
2
  import '@develit-io/backend-sdk';
3
3
  import 'drizzle-orm/sqlite-core';
4
4
  import 'date-fns';
@@ -3,15 +3,15 @@
3
3
  const backendSdk = require('@develit-io/backend-sdk');
4
4
  const cloudflare_workers = require('cloudflare:workers');
5
5
  const d1 = require('drizzle-orm/d1');
6
- const drizzle = require('../shared/bank.DXj5tpXa.cjs');
6
+ const drizzle = require('../shared/bank.DF_uKc1D.cjs');
7
7
  const zod = require('zod');
8
- const database_schema = require('../shared/bank.BfBw79Y1.cjs');
8
+ const database_schema = require('../shared/bank.DoHc7geB.cjs');
9
9
  const generalCodes = require('@develit-io/general-codes');
10
10
  require('date-fns');
11
11
  const drizzleOrm = require('drizzle-orm');
12
12
  require('jose');
13
13
  require('node:crypto');
14
- const encryption = require('../shared/bank.CwRMB9Ek.cjs');
14
+ const encryption = require('../shared/bank.DH-qLkp5.cjs');
15
15
  require('drizzle-orm/sqlite-core');
16
16
  require('drizzle-orm/relations');
17
17
  require('drizzle-zod');
@@ -578,15 +578,16 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
578
578
  }
579
579
  async _resolveSingleBatch(batch, connector) {
580
580
  const previousStatus = batch.status;
581
- const currentStatus = await connector.getBatchStatus({
581
+ const { status: currentStatus, apiResponse } = await connector.getBatchStatus({
582
582
  batchId: batch.id
583
583
  });
584
584
  let statusChanged = false;
585
- if (previousStatus !== currentStatus) {
585
+ if (previousStatus !== currentStatus || !batch.statusResponse) {
586
586
  await encryption.upsertBatchCommand(this.db, {
587
587
  batch: {
588
588
  ...batch,
589
- status: currentStatus
589
+ status: currentStatus,
590
+ statusResponse: apiResponse
590
591
  }
591
592
  }).command.execute();
592
593
  statusChanged = true;
@@ -1,4 +1,4 @@
1
- import { A as AccountSelectType, P as PaymentSelectType, B as BatchSelectType, L as LastSyncMetadata, C as ConfigEnvironmentBank, t as tables, a as ConnectorKey, I as IBankConnector, b as PaymentInsertType, c as BatchMetadata } from '../shared/bank.CG0gMBFx.cjs';
1
+ import { A as AccountSelectType, P as PaymentSelectType, B as BatchSelectType, L as LastSyncMetadata, C as ConfigEnvironmentBank, t as tables, a as ConnectorKey, I as IBankConnector, b as PaymentInsertType, c as BatchMetadata } from '../shared/bank.DHQNmyQt.cjs';
2
2
  import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
3
3
  import { WorkflowInstanceStatus, IRPCResponse } from '@develit-io/backend-sdk';
4
4
  import { DrizzleD1Database } from 'drizzle-orm/d1';
@@ -2515,10 +2515,11 @@ declare class BankServiceBase extends BankServiceBase_base {
2515
2515
  createdAt: Date | null;
2516
2516
  updatedAt: Date | null;
2517
2517
  deletedAt: Date | null;
2518
- accountId: string | null;
2519
2518
  batchPaymentInitiatedAt: Date | null;
2520
2519
  authorizationUrls: string[] | null;
2520
+ accountId: string | null;
2521
2521
  statusReason: string | null;
2522
+ statusResponse: object | null;
2522
2523
  payments: PaymentInsertType[];
2523
2524
  metadata: BatchMetadata | null;
2524
2525
  paymentsChecksum: string | null;
@@ -1,4 +1,4 @@
1
- import { A as AccountSelectType, P as PaymentSelectType, B as BatchSelectType, L as LastSyncMetadata, C as ConfigEnvironmentBank, t as tables, a as ConnectorKey, I as IBankConnector, b as PaymentInsertType, c as BatchMetadata } from '../shared/bank.CG0gMBFx.mjs';
1
+ import { A as AccountSelectType, P as PaymentSelectType, B as BatchSelectType, L as LastSyncMetadata, C as ConfigEnvironmentBank, t as tables, a as ConnectorKey, I as IBankConnector, b as PaymentInsertType, c as BatchMetadata } from '../shared/bank.DHQNmyQt.mjs';
2
2
  import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
3
3
  import { WorkflowInstanceStatus, IRPCResponse } from '@develit-io/backend-sdk';
4
4
  import { DrizzleD1Database } from 'drizzle-orm/d1';
@@ -2515,10 +2515,11 @@ declare class BankServiceBase extends BankServiceBase_base {
2515
2515
  createdAt: Date | null;
2516
2516
  updatedAt: Date | null;
2517
2517
  deletedAt: Date | null;
2518
- accountId: string | null;
2519
2518
  batchPaymentInitiatedAt: Date | null;
2520
2519
  authorizationUrls: string[] | null;
2520
+ accountId: string | null;
2521
2521
  statusReason: string | null;
2522
+ statusResponse: object | null;
2522
2523
  payments: PaymentInsertType[];
2523
2524
  metadata: BatchMetadata | null;
2524
2525
  paymentsChecksum: string | null;
@@ -1,4 +1,4 @@
1
- import { A as AccountSelectType, P as PaymentSelectType, B as BatchSelectType, L as LastSyncMetadata, C as ConfigEnvironmentBank, t as tables, a as ConnectorKey, I as IBankConnector, b as PaymentInsertType, c as BatchMetadata } from '../shared/bank.CG0gMBFx.js';
1
+ import { A as AccountSelectType, P as PaymentSelectType, B as BatchSelectType, L as LastSyncMetadata, C as ConfigEnvironmentBank, t as tables, a as ConnectorKey, I as IBankConnector, b as PaymentInsertType, c as BatchMetadata } from '../shared/bank.DHQNmyQt.js';
2
2
  import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
3
3
  import { WorkflowInstanceStatus, IRPCResponse } from '@develit-io/backend-sdk';
4
4
  import { DrizzleD1Database } from 'drizzle-orm/d1';
@@ -2515,10 +2515,11 @@ declare class BankServiceBase extends BankServiceBase_base {
2515
2515
  createdAt: Date | null;
2516
2516
  updatedAt: Date | null;
2517
2517
  deletedAt: Date | null;
2518
- accountId: string | null;
2519
2518
  batchPaymentInitiatedAt: Date | null;
2520
2519
  authorizationUrls: string[] | null;
2520
+ accountId: string | null;
2521
2521
  statusReason: string | null;
2522
+ statusResponse: object | null;
2522
2523
  payments: PaymentInsertType[];
2523
2524
  metadata: BatchMetadata | null;
2524
2525
  paymentsChecksum: string | null;
@@ -1,15 +1,15 @@
1
1
  import { uuidv4, first, bankAccountMetadataSchema, workflowInstanceStatusSchema, develitWorker, createInternalError, action, service } from '@develit-io/backend-sdk';
2
2
  import { WorkerEntrypoint } from 'cloudflare:workers';
3
3
  import { drizzle } from 'drizzle-orm/d1';
4
- import { t as tables } from '../shared/bank.D7JSg_d9.mjs';
4
+ import { t as tables } from '../shared/bank.BiHEgOL8.mjs';
5
5
  import { z } from 'zod';
6
- import { I as INSTRUCTION_PRIORITIES, C as CHARGE_BEARERS, P as PAYMENT_TYPES, d as CONNECTOR_KEYS, B as BATCH_STATUSES, a as PAYMENT_STATUSES, b as PAYMENT_DIRECTIONS, f as accountInsertSchema } from '../shared/bank.m2X4FSvr.mjs';
6
+ import { I as INSTRUCTION_PRIORITIES, C as CHARGE_BEARERS, P as PAYMENT_TYPES, d as CONNECTOR_KEYS, B as BATCH_STATUSES, a as PAYMENT_STATUSES, b as PAYMENT_DIRECTIONS, f as accountInsertSchema } from '../shared/bank.C1bHZDjr.mjs';
7
7
  import { CURRENCY_CODES } from '@develit-io/general-codes';
8
8
  import 'date-fns';
9
9
  import { eq, sql, inArray, and, asc, desc, gte, lte } from 'drizzle-orm';
10
10
  import 'jose';
11
11
  import 'node:crypto';
12
- import { f as encrypt, i as importAesKey, a as getCredentialsByAccountId, b as initiateConnector, u as upsertBatchCommand, d as getBatchByIdQuery, c as createPaymentCommand, g as getAccountByIdQuery } from '../shared/bank.DYJuicD-.mjs';
12
+ import { f as encrypt, i as importAesKey, a as getCredentialsByAccountId, b as initiateConnector, u as upsertBatchCommand, d as getBatchByIdQuery, c as createPaymentCommand, g as getAccountByIdQuery } from '../shared/bank.BpLl-Z93.mjs';
13
13
  import 'drizzle-orm/sqlite-core';
14
14
  import 'drizzle-orm/relations';
15
15
  import 'drizzle-zod';
@@ -576,15 +576,16 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
576
576
  }
577
577
  async _resolveSingleBatch(batch, connector) {
578
578
  const previousStatus = batch.status;
579
- const currentStatus = await connector.getBatchStatus({
579
+ const { status: currentStatus, apiResponse } = await connector.getBatchStatus({
580
580
  batchId: batch.id
581
581
  });
582
582
  let statusChanged = false;
583
- if (previousStatus !== currentStatus) {
583
+ if (previousStatus !== currentStatus || !batch.statusResponse) {
584
584
  await upsertBatchCommand(this.db, {
585
585
  batch: {
586
586
  ...batch,
587
- status: currentStatus
587
+ status: currentStatus,
588
+ statusResponse: apiResponse
588
589
  }
589
590
  }).command.execute();
590
591
  statusChanged = true;
@@ -3,12 +3,12 @@
3
3
  const cloudflare_workers = require('cloudflare:workers');
4
4
  const cloudflare_workflows = require('cloudflare:workflows');
5
5
  const d1 = require('drizzle-orm/d1');
6
- const drizzle = require('../shared/bank.DXj5tpXa.cjs');
6
+ const drizzle = require('../shared/bank.DF_uKc1D.cjs');
7
7
  const backendSdk = require('@develit-io/backend-sdk');
8
- const encryption = require('../shared/bank.CwRMB9Ek.cjs');
8
+ const encryption = require('../shared/bank.DH-qLkp5.cjs');
9
9
  const drizzleOrm = require('drizzle-orm');
10
10
  require('date-fns');
11
- require('../shared/bank.BfBw79Y1.cjs');
11
+ require('../shared/bank.DoHc7geB.cjs');
12
12
  require('drizzle-orm/sqlite-core');
13
13
  require('drizzle-orm/relations');
14
14
  require('@develit-io/general-codes');
@@ -1,12 +1,12 @@
1
1
  import { WorkflowEntrypoint } from 'cloudflare:workers';
2
2
  import { NonRetryableError } from 'cloudflare:workflows';
3
3
  import { drizzle } from 'drizzle-orm/d1';
4
- import { t as tables } from '../shared/bank.D7JSg_d9.mjs';
4
+ import { t as tables } from '../shared/bank.BiHEgOL8.mjs';
5
5
  import { asNonEmpty, first } from '@develit-io/backend-sdk';
6
- import { g as getAccountByIdQuery, i as importAesKey, a as getCredentialsByAccountId, b as initiateConnector, c as createPaymentCommand, d as getBatchByIdQuery, e as checksum, u as upsertBatchCommand } from '../shared/bank.DYJuicD-.mjs';
6
+ import { g as getAccountByIdQuery, i as importAesKey, a as getCredentialsByAccountId, b as initiateConnector, c as createPaymentCommand, d as getBatchByIdQuery, e as checksum, u as upsertBatchCommand } from '../shared/bank.BpLl-Z93.mjs';
7
7
  import { eq } from 'drizzle-orm';
8
8
  import 'date-fns';
9
- import '../shared/bank.m2X4FSvr.mjs';
9
+ import '../shared/bank.C1bHZDjr.mjs';
10
10
  import 'drizzle-orm/sqlite-core';
11
11
  import 'drizzle-orm/relations';
12
12
  import '@develit-io/general-codes';
@@ -1,6 +1,6 @@
1
1
  import { uuidv4, useResult, createInternalError } from '@develit-io/backend-sdk';
2
2
  import { format, parseISO } from 'date-fns';
3
- import { s as schema } from './bank.m2X4FSvr.mjs';
3
+ import { s as schema } from './bank.C1bHZDjr.mjs';
4
4
  import { and, eq } from 'drizzle-orm';
5
5
  import { importPKCS8, SignJWT } from 'jose';
6
6
  import '@develit-io/general-codes';
@@ -172,7 +172,7 @@ const mapFinbricksTransactionStatus = (status) => {
172
172
  }
173
173
  };
174
174
  const mapFinbricksBatchStatus = (status) => {
175
- return status === "REJECTED" ? "FAILED" : status === "AUTHORIZED" ? "PROCESSING" : "READY_TO_SIGN";
175
+ return status === "REJECTED" ? "SIGNATURE_FAILED" : status === "AUTHORIZED" ? "SIGNED" : void 0;
176
176
  };
177
177
 
178
178
  const mapFinbricksAccountInsert = ({
@@ -686,7 +686,10 @@ class FinbricksConnector extends IBankConnector {
686
686
  }
687
687
  return mapFinbricksTransactionStatus(response.resultCode);
688
688
  }
689
- async getBatchStatus({ batchId }) {
689
+ async getBatchStatus({
690
+ batchId,
691
+ currentStatus
692
+ }) {
690
693
  const [response, error] = await useResult(
691
694
  this.finbricks.request({
692
695
  method: "POST",
@@ -702,7 +705,14 @@ class FinbricksConnector extends IBankConnector {
702
705
  message: "Finbricks: failed to fetch batch status"
703
706
  });
704
707
  }
705
- return mapFinbricksBatchStatus(response.batchResultCode);
708
+ const allAuthorized = response.payments.every(
709
+ (p) => p.resultCode === "AUTHORIZED" || p.resultCode === "BOOKED" || p.resultCode === "SETTLED" || p.resultCode === "COMPLETED"
710
+ );
711
+ const status = allAuthorized ? "SIGNED" : mapFinbricksBatchStatus(response.batchResultCode) ?? currentStatus;
712
+ return {
713
+ status,
714
+ apiResponse: response
715
+ };
706
716
  }
707
717
  }
708
718
 
@@ -1,10 +1,10 @@
1
- import { t as tables, F as FinbricksConnector, M as MockConnector, a as MockCobsConnector, E as ErsteConnector } from './bank.D7JSg_d9.mjs';
1
+ import { t as tables, F as FinbricksConnector, M as MockConnector, a as MockCobsConnector, E as ErsteConnector } from './bank.BiHEgOL8.mjs';
2
2
  import { uuidv4 } from '@develit-io/backend-sdk';
3
3
  import { eq } from 'drizzle-orm';
4
4
  import 'date-fns';
5
5
  import 'jose';
6
6
  import '@develit-io/general-codes';
7
- import './bank.m2X4FSvr.mjs';
7
+ import './bank.C1bHZDjr.mjs';
8
8
  import { createHash } from 'node:crypto';
9
9
 
10
10
  const createPaymentCommand = (db, { payment }) => {
@@ -114,6 +114,7 @@ const batch = sqliteTable("batch", {
114
114
  accountId: text("account_id").references(() => account.id),
115
115
  status: text("status", { enum: BATCH_STATUSES }).$type(),
116
116
  statusReason: text("status_reason"),
117
+ statusResponse: text("status_response", { mode: "json" }).$type(),
117
118
  payments: text("payments", { mode: "json" }).$type().notNull(),
118
119
  metadata: text("metadata", { mode: "json" }).$type(),
119
120
  paymentsChecksum: text("payments_checksum")
@@ -2,7 +2,7 @@
2
2
 
3
3
  const backendSdk = require('@develit-io/backend-sdk');
4
4
  const dateFns = require('date-fns');
5
- const database_schema = require('./bank.BfBw79Y1.cjs');
5
+ const database_schema = require('./bank.DoHc7geB.cjs');
6
6
  const drizzleOrm = require('drizzle-orm');
7
7
  const jose = require('jose');
8
8
  require('@develit-io/general-codes');
@@ -174,7 +174,7 @@ const mapFinbricksTransactionStatus = (status) => {
174
174
  }
175
175
  };
176
176
  const mapFinbricksBatchStatus = (status) => {
177
- return status === "REJECTED" ? "FAILED" : status === "AUTHORIZED" ? "PROCESSING" : "READY_TO_SIGN";
177
+ return status === "REJECTED" ? "SIGNATURE_FAILED" : status === "AUTHORIZED" ? "SIGNED" : void 0;
178
178
  };
179
179
 
180
180
  const mapFinbricksAccountInsert = ({
@@ -688,7 +688,10 @@ class FinbricksConnector extends IBankConnector {
688
688
  }
689
689
  return mapFinbricksTransactionStatus(response.resultCode);
690
690
  }
691
- async getBatchStatus({ batchId }) {
691
+ async getBatchStatus({
692
+ batchId,
693
+ currentStatus
694
+ }) {
692
695
  const [response, error] = await backendSdk.useResult(
693
696
  this.finbricks.request({
694
697
  method: "POST",
@@ -704,7 +707,14 @@ class FinbricksConnector extends IBankConnector {
704
707
  message: "Finbricks: failed to fetch batch status"
705
708
  });
706
709
  }
707
- return mapFinbricksBatchStatus(response.batchResultCode);
710
+ const allAuthorized = response.payments.every(
711
+ (p) => p.resultCode === "AUTHORIZED" || p.resultCode === "BOOKED" || p.resultCode === "SETTLED" || p.resultCode === "COMPLETED"
712
+ );
713
+ const status = allAuthorized ? "SIGNED" : mapFinbricksBatchStatus(response.batchResultCode) ?? currentStatus;
714
+ return {
715
+ status,
716
+ apiResponse: response
717
+ };
708
718
  }
709
719
  }
710
720
 
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- const drizzle = require('./bank.DXj5tpXa.cjs');
3
+ const drizzle = require('./bank.DF_uKc1D.cjs');
4
4
  const backendSdk = require('@develit-io/backend-sdk');
5
5
  const drizzleOrm = require('drizzle-orm');
6
6
  require('date-fns');
7
7
  require('jose');
8
8
  require('@develit-io/general-codes');
9
- require('./bank.BfBw79Y1.cjs');
9
+ require('./bank.DoHc7geB.cjs');
10
10
  const node_crypto = require('node:crypto');
11
11
 
12
12
  const createPaymentCommand = (db, { payment }) => {
@@ -105,6 +105,25 @@ declare const batch: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
105
105
  }, {}, {
106
106
  length: number | undefined;
107
107
  }>;
108
+ statusResponse: drizzle_orm_sqlite_core.SQLiteColumn<{
109
+ name: "status_response";
110
+ tableName: "batch";
111
+ dataType: "json";
112
+ columnType: "SQLiteTextJson";
113
+ data: object;
114
+ driverParam: string;
115
+ notNull: false;
116
+ hasDefault: false;
117
+ isPrimaryKey: false;
118
+ isAutoincrement: false;
119
+ hasRuntimeDefault: false;
120
+ enumValues: undefined;
121
+ baseColumn: never;
122
+ identity: undefined;
123
+ generated: undefined;
124
+ }, {}, {
125
+ $type: object;
126
+ }>;
108
127
  payments: drizzle_orm_sqlite_core.SQLiteColumn<{
109
128
  name: "payments";
110
129
  tableName: "batch";
@@ -1694,7 +1713,10 @@ declare abstract class IBankConnector {
1694
1713
  }): Promise<PaymentStatus>;
1695
1714
  abstract getBatchStatus({ batchId, }: {
1696
1715
  batchId: string;
1697
- }): Promise<BatchStatus>;
1716
+ }): Promise<{
1717
+ status: BatchStatus;
1718
+ apiResponse: object;
1719
+ }>;
1698
1720
  }
1699
1721
 
1700
1722
  interface PaymentSelectType extends InferSelectModel<typeof tables.payment> {
@@ -105,6 +105,25 @@ declare const batch: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
105
105
  }, {}, {
106
106
  length: number | undefined;
107
107
  }>;
108
+ statusResponse: drizzle_orm_sqlite_core.SQLiteColumn<{
109
+ name: "status_response";
110
+ tableName: "batch";
111
+ dataType: "json";
112
+ columnType: "SQLiteTextJson";
113
+ data: object;
114
+ driverParam: string;
115
+ notNull: false;
116
+ hasDefault: false;
117
+ isPrimaryKey: false;
118
+ isAutoincrement: false;
119
+ hasRuntimeDefault: false;
120
+ enumValues: undefined;
121
+ baseColumn: never;
122
+ identity: undefined;
123
+ generated: undefined;
124
+ }, {}, {
125
+ $type: object;
126
+ }>;
108
127
  payments: drizzle_orm_sqlite_core.SQLiteColumn<{
109
128
  name: "payments";
110
129
  tableName: "batch";
@@ -1694,7 +1713,10 @@ declare abstract class IBankConnector {
1694
1713
  }): Promise<PaymentStatus>;
1695
1714
  abstract getBatchStatus({ batchId, }: {
1696
1715
  batchId: string;
1697
- }): Promise<BatchStatus>;
1716
+ }): Promise<{
1717
+ status: BatchStatus;
1718
+ apiResponse: object;
1719
+ }>;
1698
1720
  }
1699
1721
 
1700
1722
  interface PaymentSelectType extends InferSelectModel<typeof tables.payment> {
@@ -105,6 +105,25 @@ declare const batch: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
105
105
  }, {}, {
106
106
  length: number | undefined;
107
107
  }>;
108
+ statusResponse: drizzle_orm_sqlite_core.SQLiteColumn<{
109
+ name: "status_response";
110
+ tableName: "batch";
111
+ dataType: "json";
112
+ columnType: "SQLiteTextJson";
113
+ data: object;
114
+ driverParam: string;
115
+ notNull: false;
116
+ hasDefault: false;
117
+ isPrimaryKey: false;
118
+ isAutoincrement: false;
119
+ hasRuntimeDefault: false;
120
+ enumValues: undefined;
121
+ baseColumn: never;
122
+ identity: undefined;
123
+ generated: undefined;
124
+ }, {}, {
125
+ $type: object;
126
+ }>;
108
127
  payments: drizzle_orm_sqlite_core.SQLiteColumn<{
109
128
  name: "payments";
110
129
  tableName: "batch";
@@ -1694,7 +1713,10 @@ declare abstract class IBankConnector {
1694
1713
  }): Promise<PaymentStatus>;
1695
1714
  abstract getBatchStatus({ batchId, }: {
1696
1715
  batchId: string;
1697
- }): Promise<BatchStatus>;
1716
+ }): Promise<{
1717
+ status: BatchStatus;
1718
+ apiResponse: object;
1719
+ }>;
1698
1720
  }
1699
1721
 
1700
1722
  interface PaymentSelectType extends InferSelectModel<typeof tables.payment> {
@@ -116,6 +116,7 @@ const batch = sqliteCore.sqliteTable("batch", {
116
116
  accountId: sqliteCore.text("account_id").references(() => account.id),
117
117
  status: sqliteCore.text("status", { enum: BATCH_STATUSES }).$type(),
118
118
  statusReason: sqliteCore.text("status_reason"),
119
+ statusResponse: sqliteCore.text("status_response", { mode: "json" }).$type(),
119
120
  payments: sqliteCore.text("payments", { mode: "json" }).$type().notNull(),
120
121
  metadata: sqliteCore.text("metadata", { mode: "json" }).$type(),
121
122
  paymentsChecksum: sqliteCore.text("payments_checksum")
package/dist/types.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const drizzle = require('./shared/bank.DXj5tpXa.cjs');
4
- const database_schema = require('./shared/bank.BfBw79Y1.cjs');
3
+ const drizzle = require('./shared/bank.DF_uKc1D.cjs');
4
+ const database_schema = require('./shared/bank.DoHc7geB.cjs');
5
5
  const generalCodes = require('@develit-io/general-codes');
6
6
  require('@develit-io/backend-sdk');
7
7
  require('date-fns');
package/dist/types.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { I as IBankConnector, d as IncomingPaymentMessage, e as InitiatedPayment, a as ConnectorKey, f as ConnectedAccount, g as AccountCredentialsInsertType, h as AccountInsertType, i as PaymentPreparedInsertType, j as InitiatedBatch, c as BatchMetadata, A as AccountSelectType, k as ParsedBankPayment, l as PaymentStatus, m as BatchStatus, n as CurrencyCode, o as BankCode, p as CountryCode, q as AuthInput, t as tables, r as Currency, P as PaymentSelectType } from './shared/bank.CG0gMBFx.cjs';
2
- export { K as ACCOUNT_STATUSES, a3 as AccountCredentialsPatchType, a4 as AccountCredentialsSelectType, a2 as AccountCredentialsUpdateType, _ as AccountPatchType, M as AccountStatus, Z as AccountUpdateType, w as BATCH_STATUES, w as BATCH_STATUSES, Q as BankAccountWithLastSync, v as BatchInsertType, B as BatchSelectType, z as CHARGE_BEARERS, R as CONNECTOR_KEYS, N as COUNTRY_CODES, S as CREDENTIALS_TYPES, D as ChargeBearer, C as ConfigEnvironmentBank, T as CredentialsType, E as INSTRUCTION_PRIORITIES, F as InstructionPriority, L as LastSyncMetadata, O as OutgoingPaymentMessage, H as PAYMENT_DIRECTIONS, G as PAYMENT_STATUSES, x as PAYMENT_TYPES, J as PaymentDirection, s as PaymentFailedInsertType, u as PaymentInitializedInsertType, b as PaymentInsertType, y as PaymentType, U as TOKEN_TYPES, V as TokenType, $ as accountCredentialsInsertSchema, a1 as accountCredentialsSelectSchema, a0 as accountCredentialsUpdateSchema, W as accountInsertSchema, Y as accountSelectSchema, X as accountUpdateSchema } from './shared/bank.CG0gMBFx.cjs';
1
+ import { I as IBankConnector, d as IncomingPaymentMessage, e as InitiatedPayment, a as ConnectorKey, f as ConnectedAccount, g as AccountCredentialsInsertType, h as AccountInsertType, i as PaymentPreparedInsertType, j as InitiatedBatch, c as BatchMetadata, A as AccountSelectType, k as ParsedBankPayment, l as PaymentStatus, m as BatchStatus, n as CurrencyCode, o as BankCode, p as CountryCode, q as AuthInput, t as tables, r as Currency, P as PaymentSelectType } from './shared/bank.DHQNmyQt.cjs';
2
+ export { K as ACCOUNT_STATUSES, a3 as AccountCredentialsPatchType, a4 as AccountCredentialsSelectType, a2 as AccountCredentialsUpdateType, _ as AccountPatchType, M as AccountStatus, Z as AccountUpdateType, w as BATCH_STATUES, w as BATCH_STATUSES, Q as BankAccountWithLastSync, v as BatchInsertType, B as BatchSelectType, z as CHARGE_BEARERS, R as CONNECTOR_KEYS, N as COUNTRY_CODES, S as CREDENTIALS_TYPES, D as ChargeBearer, C as ConfigEnvironmentBank, T as CredentialsType, E as INSTRUCTION_PRIORITIES, F as InstructionPriority, L as LastSyncMetadata, O as OutgoingPaymentMessage, H as PAYMENT_DIRECTIONS, G as PAYMENT_STATUSES, x as PAYMENT_TYPES, J as PaymentDirection, s as PaymentFailedInsertType, u as PaymentInitializedInsertType, b as PaymentInsertType, y as PaymentType, U as TOKEN_TYPES, V as TokenType, $ as accountCredentialsInsertSchema, a1 as accountCredentialsSelectSchema, a0 as accountCredentialsUpdateSchema, W as accountInsertSchema, Y as accountSelectSchema, X as accountUpdateSchema } from './shared/bank.DHQNmyQt.cjs';
3
3
  import { Environment, BaseEvent } from '@develit-io/backend-sdk';
4
4
  import { DrizzleD1Database } from 'drizzle-orm/d1';
5
5
  export { b as BankServiceEnv, a as BankServiceEnvironmentConfig, B as BankServiceWranglerConfig } from './shared/bank.Dh_H_5rC.cjs';
@@ -69,7 +69,10 @@ declare class ErsteConnector extends IBankConnector {
69
69
  }): Promise<PaymentStatus>;
70
70
  getBatchStatus(_: {
71
71
  batchId: string;
72
- }): Promise<BatchStatus>;
72
+ }): Promise<{
73
+ status: BatchStatus;
74
+ apiResponse: object;
75
+ }>;
73
76
  }
74
77
 
75
78
  type FinbricksProvider = 'KB' | 'ERSTE' | 'CSOB' | 'MOCK_COBS' | 'CREDITAS' | 'FIO' | 'MONETA';
@@ -98,7 +101,7 @@ type FinbricksGetBatchStatusResponse = {
98
101
  merchantTransactionId: string;
99
102
  resultCode: FinbricksTransactionStatus;
100
103
  finalbankStatus: boolean;
101
- };
104
+ }[];
102
105
  batchRecoveryUrl: string;
103
106
  };
104
107
  type FinbricksPaymentBody = {
@@ -494,9 +497,13 @@ declare abstract class FinbricksConnector extends IBankConnector {
494
497
  getPaymentStatus({ paymentId, }: {
495
498
  paymentId: string;
496
499
  }): Promise<PaymentStatus>;
497
- getBatchStatus({ batchId }: {
500
+ getBatchStatus({ batchId, currentStatus, }: {
498
501
  batchId: string;
499
- }): Promise<BatchStatus>;
502
+ currentStatus: BatchStatus;
503
+ }): Promise<{
504
+ status: BatchStatus;
505
+ apiResponse: object;
506
+ }>;
500
507
  }
501
508
 
502
509
  declare class MockConnector extends IBankConnector {
@@ -530,7 +537,10 @@ declare class MockConnector extends IBankConnector {
530
537
  }): Promise<PaymentStatus>;
531
538
  getBatchStatus(_: {
532
539
  batchId: string;
533
- }): Promise<BatchStatus>;
540
+ }): Promise<{
541
+ status: BatchStatus;
542
+ apiResponse: object;
543
+ }>;
534
544
  }
535
545
 
536
546
  declare class MockCobsConnector extends FinbricksConnector {
package/dist/types.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { I as IBankConnector, d as IncomingPaymentMessage, e as InitiatedPayment, a as ConnectorKey, f as ConnectedAccount, g as AccountCredentialsInsertType, h as AccountInsertType, i as PaymentPreparedInsertType, j as InitiatedBatch, c as BatchMetadata, A as AccountSelectType, k as ParsedBankPayment, l as PaymentStatus, m as BatchStatus, n as CurrencyCode, o as BankCode, p as CountryCode, q as AuthInput, t as tables, r as Currency, P as PaymentSelectType } from './shared/bank.CG0gMBFx.mjs';
2
- export { K as ACCOUNT_STATUSES, a3 as AccountCredentialsPatchType, a4 as AccountCredentialsSelectType, a2 as AccountCredentialsUpdateType, _ as AccountPatchType, M as AccountStatus, Z as AccountUpdateType, w as BATCH_STATUES, w as BATCH_STATUSES, Q as BankAccountWithLastSync, v as BatchInsertType, B as BatchSelectType, z as CHARGE_BEARERS, R as CONNECTOR_KEYS, N as COUNTRY_CODES, S as CREDENTIALS_TYPES, D as ChargeBearer, C as ConfigEnvironmentBank, T as CredentialsType, E as INSTRUCTION_PRIORITIES, F as InstructionPriority, L as LastSyncMetadata, O as OutgoingPaymentMessage, H as PAYMENT_DIRECTIONS, G as PAYMENT_STATUSES, x as PAYMENT_TYPES, J as PaymentDirection, s as PaymentFailedInsertType, u as PaymentInitializedInsertType, b as PaymentInsertType, y as PaymentType, U as TOKEN_TYPES, V as TokenType, $ as accountCredentialsInsertSchema, a1 as accountCredentialsSelectSchema, a0 as accountCredentialsUpdateSchema, W as accountInsertSchema, Y as accountSelectSchema, X as accountUpdateSchema } from './shared/bank.CG0gMBFx.mjs';
1
+ import { I as IBankConnector, d as IncomingPaymentMessage, e as InitiatedPayment, a as ConnectorKey, f as ConnectedAccount, g as AccountCredentialsInsertType, h as AccountInsertType, i as PaymentPreparedInsertType, j as InitiatedBatch, c as BatchMetadata, A as AccountSelectType, k as ParsedBankPayment, l as PaymentStatus, m as BatchStatus, n as CurrencyCode, o as BankCode, p as CountryCode, q as AuthInput, t as tables, r as Currency, P as PaymentSelectType } from './shared/bank.DHQNmyQt.mjs';
2
+ export { K as ACCOUNT_STATUSES, a3 as AccountCredentialsPatchType, a4 as AccountCredentialsSelectType, a2 as AccountCredentialsUpdateType, _ as AccountPatchType, M as AccountStatus, Z as AccountUpdateType, w as BATCH_STATUES, w as BATCH_STATUSES, Q as BankAccountWithLastSync, v as BatchInsertType, B as BatchSelectType, z as CHARGE_BEARERS, R as CONNECTOR_KEYS, N as COUNTRY_CODES, S as CREDENTIALS_TYPES, D as ChargeBearer, C as ConfigEnvironmentBank, T as CredentialsType, E as INSTRUCTION_PRIORITIES, F as InstructionPriority, L as LastSyncMetadata, O as OutgoingPaymentMessage, H as PAYMENT_DIRECTIONS, G as PAYMENT_STATUSES, x as PAYMENT_TYPES, J as PaymentDirection, s as PaymentFailedInsertType, u as PaymentInitializedInsertType, b as PaymentInsertType, y as PaymentType, U as TOKEN_TYPES, V as TokenType, $ as accountCredentialsInsertSchema, a1 as accountCredentialsSelectSchema, a0 as accountCredentialsUpdateSchema, W as accountInsertSchema, Y as accountSelectSchema, X as accountUpdateSchema } from './shared/bank.DHQNmyQt.mjs';
3
3
  import { Environment, BaseEvent } from '@develit-io/backend-sdk';
4
4
  import { DrizzleD1Database } from 'drizzle-orm/d1';
5
5
  export { b as BankServiceEnv, a as BankServiceEnvironmentConfig, B as BankServiceWranglerConfig } from './shared/bank.Dh_H_5rC.mjs';
@@ -69,7 +69,10 @@ declare class ErsteConnector extends IBankConnector {
69
69
  }): Promise<PaymentStatus>;
70
70
  getBatchStatus(_: {
71
71
  batchId: string;
72
- }): Promise<BatchStatus>;
72
+ }): Promise<{
73
+ status: BatchStatus;
74
+ apiResponse: object;
75
+ }>;
73
76
  }
74
77
 
75
78
  type FinbricksProvider = 'KB' | 'ERSTE' | 'CSOB' | 'MOCK_COBS' | 'CREDITAS' | 'FIO' | 'MONETA';
@@ -98,7 +101,7 @@ type FinbricksGetBatchStatusResponse = {
98
101
  merchantTransactionId: string;
99
102
  resultCode: FinbricksTransactionStatus;
100
103
  finalbankStatus: boolean;
101
- };
104
+ }[];
102
105
  batchRecoveryUrl: string;
103
106
  };
104
107
  type FinbricksPaymentBody = {
@@ -494,9 +497,13 @@ declare abstract class FinbricksConnector extends IBankConnector {
494
497
  getPaymentStatus({ paymentId, }: {
495
498
  paymentId: string;
496
499
  }): Promise<PaymentStatus>;
497
- getBatchStatus({ batchId }: {
500
+ getBatchStatus({ batchId, currentStatus, }: {
498
501
  batchId: string;
499
- }): Promise<BatchStatus>;
502
+ currentStatus: BatchStatus;
503
+ }): Promise<{
504
+ status: BatchStatus;
505
+ apiResponse: object;
506
+ }>;
500
507
  }
501
508
 
502
509
  declare class MockConnector extends IBankConnector {
@@ -530,7 +537,10 @@ declare class MockConnector extends IBankConnector {
530
537
  }): Promise<PaymentStatus>;
531
538
  getBatchStatus(_: {
532
539
  batchId: string;
533
- }): Promise<BatchStatus>;
540
+ }): Promise<{
541
+ status: BatchStatus;
542
+ apiResponse: object;
543
+ }>;
534
544
  }
535
545
 
536
546
  declare class MockCobsConnector extends FinbricksConnector {
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { I as IBankConnector, d as IncomingPaymentMessage, e as InitiatedPayment, a as ConnectorKey, f as ConnectedAccount, g as AccountCredentialsInsertType, h as AccountInsertType, i as PaymentPreparedInsertType, j as InitiatedBatch, c as BatchMetadata, A as AccountSelectType, k as ParsedBankPayment, l as PaymentStatus, m as BatchStatus, n as CurrencyCode, o as BankCode, p as CountryCode, q as AuthInput, t as tables, r as Currency, P as PaymentSelectType } from './shared/bank.CG0gMBFx.js';
2
- export { K as ACCOUNT_STATUSES, a3 as AccountCredentialsPatchType, a4 as AccountCredentialsSelectType, a2 as AccountCredentialsUpdateType, _ as AccountPatchType, M as AccountStatus, Z as AccountUpdateType, w as BATCH_STATUES, w as BATCH_STATUSES, Q as BankAccountWithLastSync, v as BatchInsertType, B as BatchSelectType, z as CHARGE_BEARERS, R as CONNECTOR_KEYS, N as COUNTRY_CODES, S as CREDENTIALS_TYPES, D as ChargeBearer, C as ConfigEnvironmentBank, T as CredentialsType, E as INSTRUCTION_PRIORITIES, F as InstructionPriority, L as LastSyncMetadata, O as OutgoingPaymentMessage, H as PAYMENT_DIRECTIONS, G as PAYMENT_STATUSES, x as PAYMENT_TYPES, J as PaymentDirection, s as PaymentFailedInsertType, u as PaymentInitializedInsertType, b as PaymentInsertType, y as PaymentType, U as TOKEN_TYPES, V as TokenType, $ as accountCredentialsInsertSchema, a1 as accountCredentialsSelectSchema, a0 as accountCredentialsUpdateSchema, W as accountInsertSchema, Y as accountSelectSchema, X as accountUpdateSchema } from './shared/bank.CG0gMBFx.js';
1
+ import { I as IBankConnector, d as IncomingPaymentMessage, e as InitiatedPayment, a as ConnectorKey, f as ConnectedAccount, g as AccountCredentialsInsertType, h as AccountInsertType, i as PaymentPreparedInsertType, j as InitiatedBatch, c as BatchMetadata, A as AccountSelectType, k as ParsedBankPayment, l as PaymentStatus, m as BatchStatus, n as CurrencyCode, o as BankCode, p as CountryCode, q as AuthInput, t as tables, r as Currency, P as PaymentSelectType } from './shared/bank.DHQNmyQt.js';
2
+ export { K as ACCOUNT_STATUSES, a3 as AccountCredentialsPatchType, a4 as AccountCredentialsSelectType, a2 as AccountCredentialsUpdateType, _ as AccountPatchType, M as AccountStatus, Z as AccountUpdateType, w as BATCH_STATUES, w as BATCH_STATUSES, Q as BankAccountWithLastSync, v as BatchInsertType, B as BatchSelectType, z as CHARGE_BEARERS, R as CONNECTOR_KEYS, N as COUNTRY_CODES, S as CREDENTIALS_TYPES, D as ChargeBearer, C as ConfigEnvironmentBank, T as CredentialsType, E as INSTRUCTION_PRIORITIES, F as InstructionPriority, L as LastSyncMetadata, O as OutgoingPaymentMessage, H as PAYMENT_DIRECTIONS, G as PAYMENT_STATUSES, x as PAYMENT_TYPES, J as PaymentDirection, s as PaymentFailedInsertType, u as PaymentInitializedInsertType, b as PaymentInsertType, y as PaymentType, U as TOKEN_TYPES, V as TokenType, $ as accountCredentialsInsertSchema, a1 as accountCredentialsSelectSchema, a0 as accountCredentialsUpdateSchema, W as accountInsertSchema, Y as accountSelectSchema, X as accountUpdateSchema } from './shared/bank.DHQNmyQt.js';
3
3
  import { Environment, BaseEvent } from '@develit-io/backend-sdk';
4
4
  import { DrizzleD1Database } from 'drizzle-orm/d1';
5
5
  export { b as BankServiceEnv, a as BankServiceEnvironmentConfig, B as BankServiceWranglerConfig } from './shared/bank.Dh_H_5rC.js';
@@ -69,7 +69,10 @@ declare class ErsteConnector extends IBankConnector {
69
69
  }): Promise<PaymentStatus>;
70
70
  getBatchStatus(_: {
71
71
  batchId: string;
72
- }): Promise<BatchStatus>;
72
+ }): Promise<{
73
+ status: BatchStatus;
74
+ apiResponse: object;
75
+ }>;
73
76
  }
74
77
 
75
78
  type FinbricksProvider = 'KB' | 'ERSTE' | 'CSOB' | 'MOCK_COBS' | 'CREDITAS' | 'FIO' | 'MONETA';
@@ -98,7 +101,7 @@ type FinbricksGetBatchStatusResponse = {
98
101
  merchantTransactionId: string;
99
102
  resultCode: FinbricksTransactionStatus;
100
103
  finalbankStatus: boolean;
101
- };
104
+ }[];
102
105
  batchRecoveryUrl: string;
103
106
  };
104
107
  type FinbricksPaymentBody = {
@@ -494,9 +497,13 @@ declare abstract class FinbricksConnector extends IBankConnector {
494
497
  getPaymentStatus({ paymentId, }: {
495
498
  paymentId: string;
496
499
  }): Promise<PaymentStatus>;
497
- getBatchStatus({ batchId }: {
500
+ getBatchStatus({ batchId, currentStatus, }: {
498
501
  batchId: string;
499
- }): Promise<BatchStatus>;
502
+ currentStatus: BatchStatus;
503
+ }): Promise<{
504
+ status: BatchStatus;
505
+ apiResponse: object;
506
+ }>;
500
507
  }
501
508
 
502
509
  declare class MockConnector extends IBankConnector {
@@ -530,7 +537,10 @@ declare class MockConnector extends IBankConnector {
530
537
  }): Promise<PaymentStatus>;
531
538
  getBatchStatus(_: {
532
539
  batchId: string;
533
- }): Promise<BatchStatus>;
540
+ }): Promise<{
541
+ status: BatchStatus;
542
+ apiResponse: object;
543
+ }>;
534
544
  }
535
545
 
536
546
  declare class MockCobsConnector extends FinbricksConnector {
package/dist/types.mjs CHANGED
@@ -1,5 +1,5 @@
1
- export { E as ErsteConnector, c as FINBRICKS_ENDPOINTS, b as FinbricksClient, F as FinbricksConnector, I as IBankConnector, a as MockCobsConnector, M as MockConnector, s as signFinbricksJws, u as useFinbricksFetch } from './shared/bank.D7JSg_d9.mjs';
2
- export { A as ACCOUNT_STATUSES, B as BATCH_STATUES, B as BATCH_STATUSES, C as CHARGE_BEARERS, d as CONNECTOR_KEYS, c as COUNTRY_CODES, e as CREDENTIALS_TYPES, I as INSTRUCTION_PRIORITIES, b as PAYMENT_DIRECTIONS, a as PAYMENT_STATUSES, P as PAYMENT_TYPES, T as TOKEN_TYPES, i as accountCredentialsInsertSchema, k as accountCredentialsSelectSchema, j as accountCredentialsUpdateSchema, f as accountInsertSchema, h as accountSelectSchema, g as accountUpdateSchema, o as ottInsertSchema, m as ottSelectSchema, l as ottUpdateSchema } from './shared/bank.m2X4FSvr.mjs';
1
+ export { E as ErsteConnector, c as FINBRICKS_ENDPOINTS, b as FinbricksClient, F as FinbricksConnector, I as IBankConnector, a as MockCobsConnector, M as MockConnector, s as signFinbricksJws, u as useFinbricksFetch } from './shared/bank.BiHEgOL8.mjs';
2
+ export { A as ACCOUNT_STATUSES, B as BATCH_STATUES, B as BATCH_STATUSES, C as CHARGE_BEARERS, d as CONNECTOR_KEYS, c as COUNTRY_CODES, e as CREDENTIALS_TYPES, I as INSTRUCTION_PRIORITIES, b as PAYMENT_DIRECTIONS, a as PAYMENT_STATUSES, P as PAYMENT_TYPES, T as TOKEN_TYPES, i as accountCredentialsInsertSchema, k as accountCredentialsSelectSchema, j as accountCredentialsUpdateSchema, f as accountInsertSchema, h as accountSelectSchema, g as accountUpdateSchema, o as ottInsertSchema, m as ottSelectSchema, l as ottUpdateSchema } from './shared/bank.C1bHZDjr.mjs';
3
3
  export { BANK_CODES, CURRENCY_CODES } from '@develit-io/general-codes';
4
4
  import '@develit-io/backend-sdk';
5
5
  import 'date-fns';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@develit-services/bank",
3
- "version": "0.3.50",
3
+ "version": "0.3.52",
4
4
  "author": "Develit.io s.r.o.",
5
5
  "type": "module",
6
6
  "exports": {