@develit-services/bank 0.0.16 → 0.0.18

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 (31) hide show
  1. package/dist/database/schema.cjs +2 -1
  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/database/schema.mjs +1 -1
  6. package/dist/export/worker.cjs +102 -40
  7. package/dist/export/worker.d.cts +27 -12
  8. package/dist/export/worker.d.mts +27 -12
  9. package/dist/export/worker.d.ts +27 -12
  10. package/dist/export/worker.mjs +102 -40
  11. package/dist/export/wrangler.cjs +1 -1
  12. package/dist/export/wrangler.d.cts +2 -1
  13. package/dist/export/wrangler.d.mts +2 -1
  14. package/dist/export/wrangler.d.ts +2 -1
  15. package/dist/export/wrangler.mjs +1 -1
  16. package/dist/shared/{bank.BoVUuQ1D.d.mts → bank.BkLncGmL.d.ts} +18 -10
  17. package/dist/shared/{bank.BT_Yf43j.d.cts → bank.BuNG2S8h.d.cts} +182 -7
  18. package/dist/shared/{bank.BT_Yf43j.d.mts → bank.BuNG2S8h.d.mts} +182 -7
  19. package/dist/shared/{bank.BT_Yf43j.d.ts → bank.BuNG2S8h.d.ts} +182 -7
  20. package/dist/shared/{bank.BeH-ZCJJ.mjs → bank.C9jAvwna.mjs} +24 -1
  21. package/dist/shared/{bank.DZS4d3MJ.mjs → bank.CNpjRxvL.mjs} +103 -59
  22. package/dist/shared/{bank.Ce58djRL.cjs → bank.DQn99N-C.cjs} +103 -59
  23. package/dist/shared/{bank.BwleO_ON.d.cts → bank.DWVLVMDa.d.mts} +18 -10
  24. package/dist/shared/{bank.DlquvmPs.d.ts → bank.DmypH3Au.d.cts} +18 -10
  25. package/dist/shared/{bank.CrAQe4PH.cjs → bank.P9gDUycr.cjs} +26 -0
  26. package/dist/types.cjs +6 -4
  27. package/dist/types.d.cts +47 -15
  28. package/dist/types.d.mts +47 -15
  29. package/dist/types.d.ts +47 -15
  30. package/dist/types.mjs +4 -4
  31. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const database_schema = require('../shared/bank.CrAQe4PH.cjs');
3
+ const database_schema = require('../shared/bank.P9gDUycr.cjs');
4
4
  require('@develit-io/backend-sdk');
5
5
  require('drizzle-orm/sqlite-core');
6
6
  require('drizzle-orm/relations');
@@ -8,5 +8,6 @@ require('drizzle-orm/relations');
8
8
 
9
9
 
10
10
  exports.batch = database_schema.batch;
11
+ exports.ott = database_schema.ott;
11
12
  exports.payment = database_schema.payment;
12
13
  exports.paymentRelations = database_schema.paymentRelations;
@@ -1,4 +1,4 @@
1
- export { c as batch, d as payment, e as paymentRelations } from '../shared/bank.BT_Yf43j.cjs';
1
+ export { c as batch, o as ott, d as payment, e as paymentRelations } from '../shared/bank.BuNG2S8h.cjs';
2
2
  import 'drizzle-orm/sqlite-core';
3
3
  import 'drizzle-orm';
4
4
  import 'zod';
@@ -1,4 +1,4 @@
1
- export { c as batch, d as payment, e as paymentRelations } from '../shared/bank.BT_Yf43j.mjs';
1
+ export { c as batch, o as ott, d as payment, e as paymentRelations } from '../shared/bank.BuNG2S8h.mjs';
2
2
  import 'drizzle-orm/sqlite-core';
3
3
  import 'drizzle-orm';
4
4
  import 'zod';
@@ -1,4 +1,4 @@
1
- export { c as batch, d as payment, e as paymentRelations } from '../shared/bank.BT_Yf43j.js';
1
+ export { c as batch, o as ott, d as payment, e as paymentRelations } from '../shared/bank.BuNG2S8h.js';
2
2
  import 'drizzle-orm/sqlite-core';
3
3
  import 'drizzle-orm';
4
4
  import 'zod';
@@ -1,4 +1,4 @@
1
- export { b as batch, p as payment, a as paymentRelations } from '../shared/bank.BeH-ZCJJ.mjs';
1
+ export { b as batch, o as ott, p as payment, a as paymentRelations } from '../shared/bank.C9jAvwna.mjs';
2
2
  import '@develit-io/backend-sdk';
3
3
  import 'drizzle-orm/sqlite-core';
4
4
  import 'drizzle-orm/relations';
@@ -3,18 +3,18 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const backendSdk = require('@develit-io/backend-sdk');
6
- const db = require('../shared/bank.Ce58djRL.cjs');
6
+ const db = require('../shared/bank.DQn99N-C.cjs');
7
7
  const cloudflare_workers = require('cloudflare:workers');
8
8
  const d1 = require('drizzle-orm/d1');
9
9
  const zod = require('zod');
10
10
  const generalCodes = require('@develit-io/general-codes');
11
+ const database_schema = require('../shared/bank.P9gDUycr.cjs');
11
12
  require('jose');
12
13
  const drizzleOrm = require('drizzle-orm');
13
14
  const superjson = require('superjson');
14
- require('../shared/bank.CrAQe4PH.cjs');
15
+ require('date-fns');
15
16
  require('drizzle-orm/sqlite-core');
16
17
  require('drizzle-orm/relations');
17
- require('date-fns');
18
18
 
19
19
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
20
20
 
@@ -37,8 +37,13 @@ const sendPaymentInputSchema = zod.z.object({
37
37
  debtorIban: zod.z.string()
38
38
  });
39
39
 
40
- const saveErsteCodeInputSchema = zod.z.object({
41
- code: zod.z.string()
40
+ const getAuthUriInputSchema = zod.z.object({
41
+ accountId: zod.z.string()
42
+ });
43
+
44
+ const authorizeAccountInputSchema = zod.z.object({
45
+ ott: zod.z.string(),
46
+ urlParams: zod.z.string()
42
47
  });
43
48
 
44
49
  const simulateDepositInputSchema = zod.z.object({
@@ -60,7 +65,7 @@ const setLastSyncAtInputSchema = zod.z.object({
60
65
  });
61
66
 
62
67
  const initiateConnectorInputSchema = zod.z.object({
63
- connectorKey: zod.z.string()
68
+ connectorKey: zod.z.enum(database_schema.CONNECTOR_KEYS)
64
69
  });
65
70
 
66
71
  const getBatchesInputSchema = zod.z.object({
@@ -97,6 +102,24 @@ const upsertBatchCommand = (db$1, { batch }) => {
97
102
  };
98
103
  };
99
104
 
105
+ const createOneTimeTokenCommand = (db$1, {
106
+ ott,
107
+ account,
108
+ tokenType
109
+ }) => {
110
+ const id = backendSdk.uuidv4();
111
+ const expiresAt = new Date(Date.now() + 1e3 * 60 * 60) ;
112
+ const command = db$1.insert(db.tables.ott).values({
113
+ id,
114
+ oneTimeToken: ott,
115
+ tokenType,
116
+ accountId: account.id,
117
+ connectorKey: account.connectorKey,
118
+ expiresAt
119
+ }).returning();
120
+ return { id, command };
121
+ };
122
+
100
123
  const getPaymentByRefIdQuery = async (db$1, { refId }) => {
101
124
  const payment = await db$1.select().from(db.tables.payment).where(drizzleOrm.eq(db.tables.payment.refId, refId)).limit(1).get();
102
125
  return payment;
@@ -120,6 +143,10 @@ const getPaymentsByBankRefIdsQuery = async (db$1, { ids }) => {
120
143
  return await db$1.select().from(db.tables.payment).where(drizzleOrm.inArray(db.tables.payment.bankRefId, ids));
121
144
  };
122
145
 
146
+ const getOttQuery = async (db$1, { ott }) => {
147
+ return await db$1.select().from(db.tables.ott).where(drizzleOrm.eq(db.tables.ott.oneTimeToken, ott)).get();
148
+ };
149
+
123
150
  class CreditasConnector extends db.FinbricksConnector {
124
151
  constructor(config) {
125
152
  super("CREDITAS", config);
@@ -148,34 +175,43 @@ const initiateConnector = (bank, env) => {
148
175
  REDIRECT_URI: env.ERSTE_REDIRECT_URI,
149
176
  AUTH_URI: env.ERSTE_AUTH_URI,
150
177
  PAYMENTS_URI: env.ERSTE_PAYMENTS_URI,
151
- ACCOUNTS_URI: env.ERSTE_ACCOUNTS_URI
178
+ ACCOUNTS_URI: env.ERSTE_ACCOUNTS_URI,
179
+ KV: env.BANK_KV
152
180
  });
153
181
  case "CREDITAS":
154
182
  return new CreditasConnector({
155
183
  BASE_URI: env.FINBRICKS_BASE_URI,
156
184
  MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
157
- PRIVATE_KEY_PEM: env.FINBRICKS_PRIVATE_KEY_PEM
185
+ PRIVATE_KEY_PEM: env.FINBRICKS_PRIVATE_KEY_PEM,
186
+ REDIRECT_URI: env.ERSTE_REDIRECT_URI,
187
+ KV: env.BANK_KV
158
188
  });
159
189
  case "MOCK_COBS":
160
190
  return new db.MockCobsConnector({
161
191
  BASE_URI: env.FINBRICKS_BASE_URI,
162
192
  MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
163
- PRIVATE_KEY_PEM: env.FINBRICKS_PRIVATE_KEY_PEM
193
+ PRIVATE_KEY_PEM: env.FINBRICKS_PRIVATE_KEY_PEM,
194
+ REDIRECT_URI: env.ERSTE_REDIRECT_URI,
195
+ KV: env.BANK_KV
164
196
  });
165
197
  case "FIO":
166
198
  return new FioConnector({
167
199
  BASE_URI: env.FINBRICKS_BASE_URI,
168
200
  MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
169
- PRIVATE_KEY_PEM: env.FINBRICKS_PRIVATE_KEY_PEM
201
+ PRIVATE_KEY_PEM: env.FINBRICKS_PRIVATE_KEY_PEM,
202
+ REDIRECT_URI: env.ERSTE_REDIRECT_URI,
203
+ KV: env.BANK_KV
170
204
  });
171
205
  case "MONETA":
172
206
  return new MonetaConnector({
173
207
  BASE_URI: env.FINBRICKS_BASE_URI,
174
208
  MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
175
- PRIVATE_KEY_PEM: env.FINBRICKS_PRIVATE_KEY_PEM
209
+ PRIVATE_KEY_PEM: env.FINBRICKS_PRIVATE_KEY_PEM,
210
+ REDIRECT_URI: env.ERSTE_REDIRECT_URI,
211
+ KV: env.BANK_KV
176
212
  });
177
213
  default:
178
- return new db.MockConnector();
214
+ return new db.MockConnector(env.BANK_KV);
179
215
  }
180
216
  };
181
217
 
@@ -328,18 +364,10 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
328
364
  { data: input, schema: initiateConnectorInputSchema },
329
365
  { successMessage: "Bank connector initiated successfully" },
330
366
  async ({ connectorKey }) => {
331
- this.bankConnector = initiateConnector(
332
- connectorKey,
333
- this.env
334
- );
335
- await this.env.BANK_KV.put(
336
- `${connectorKey}:token`,
337
- "d32a83cf-d352-41f3-96d7-4d2961336ddc"
338
- //hard-coded finbricks clientId (valid til 03/26)
339
- );
340
- const token = await this.env.BANK_KV.get(`${connectorKey}:token`);
367
+ this.bankConnector = initiateConnector(connectorKey, this.env);
368
+ const token = await this.env.BANK_KV.get(`${connectorKey}:auth`);
341
369
  if (!token) throw backendSdk.createInternalError("Provider not authorized");
342
- await this.bankConnector.authenticate({ token });
370
+ await this.bankConnector.authenticate();
343
371
  }
344
372
  );
345
373
  }
@@ -555,27 +583,61 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
555
583
  }
556
584
  );
557
585
  }
558
- async getErsteCodeURI() {
586
+ async getAuthUri(input) {
559
587
  return this.handleAction(
560
- null,
561
- { successMessage: "Erste URI code obtained." },
562
- async () => {
563
- this.bankConnector = initiateConnector("ERSTE", this.env);
564
- const uri = this.bankConnector instanceof db.ErsteConnector ? this.bankConnector.adminCodeCreationURI : "nothing";
588
+ { data: input, schema: getAuthUriInputSchema },
589
+ { successMessage: "Auth URI obtained." },
590
+ async ({ accountId }) => {
591
+ const account = this.accounts.find((acc) => acc.id === accountId);
592
+ if (!account)
593
+ throw backendSdk.createInternalError(null, {
594
+ message: "Account not found",
595
+ code: "ACCOUNT_NOT_FOUND",
596
+ status: 404
597
+ });
598
+ this.bankConnector = initiateConnector(account.connectorKey, this.env);
599
+ const ott = backendSdk.uuidv4();
600
+ const { command: oneTimeTokenCommand } = createOneTimeTokenCommand(
601
+ this.db,
602
+ {
603
+ ott,
604
+ account,
605
+ tokenType: "ACCOUNT_AUTHORIZATION"
606
+ }
607
+ );
608
+ await oneTimeTokenCommand.execute();
609
+ const uri = await this.bankConnector.getAuthUri({ accountId, ott });
565
610
  return { uri };
566
611
  }
567
612
  );
568
613
  }
569
- async saveErsteCode(input) {
614
+ async authorizeAccount(input) {
570
615
  return this.handleAction(
571
- { data: input, schema: saveErsteCodeInputSchema },
616
+ { data: input, schema: authorizeAccountInputSchema },
572
617
  { successMessage: "Erste code saved." },
573
- async ({ code }) => {
574
- this.bankConnector = initiateConnector("ERSTE", this.env);
575
- const token = await this.bankConnector.authenticate({
576
- token: code
618
+ async ({ ott, urlParams }) => {
619
+ const ottRow = await getOttQuery(this.db, {
620
+ ott
621
+ });
622
+ if (!ottRow) {
623
+ throw backendSdk.createInternalError(null, {
624
+ message: "One-time token not found",
625
+ code: "NOT_FOUND",
626
+ status: 404
627
+ });
628
+ }
629
+ if (ottRow.expiresAt.getTime() < Date.now()) {
630
+ throw backendSdk.createInternalError(null, {
631
+ message: "One time token has expired",
632
+ code: "INVALID_GRANT",
633
+ status: 400
634
+ });
635
+ }
636
+ this.bankConnector = initiateConnector(ottRow.connectorKey, this.env);
637
+ const authorized = await this.bankConnector.authorizeAccount({
638
+ urlParams
577
639
  });
578
- await this.env.BANK_KV.put("ERSTE:refreshToken", token);
640
+ return { authorized };
579
641
  }
580
642
  );
581
643
  }
@@ -786,11 +848,11 @@ __decorateClass([
786
848
  backendSdk.action("queue-handler")
787
849
  ], BankServiceBase.prototype, "queue", 1);
788
850
  __decorateClass([
789
- backendSdk.action("get-erste-code-uri")
790
- ], BankServiceBase.prototype, "getErsteCodeURI", 1);
851
+ backendSdk.action("get-auth-uri")
852
+ ], BankServiceBase.prototype, "getAuthUri", 1);
791
853
  __decorateClass([
792
- backendSdk.action("save-erste-code")
793
- ], BankServiceBase.prototype, "saveErsteCode", 1);
854
+ backendSdk.action("authorize-account")
855
+ ], BankServiceBase.prototype, "authorizeAccount", 1);
794
856
  __decorateClass([
795
857
  backendSdk.action("save-or-update-payments")
796
858
  ], BankServiceBase.prototype, "saveOrUpdatePayments", 1);
@@ -1,10 +1,10 @@
1
1
  import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
2
2
  import { IRPCResponse } from '@develit-io/backend-sdk';
3
- import { P as PaymentSelectType, B as BatchSelectType, t as tables, a as PaymentInsertType } from '../shared/bank.BT_Yf43j.cjs';
3
+ import { P as PaymentSelectType, B as BatchSelectType, t as tables, a as PaymentInsertType } from '../shared/bank.BuNG2S8h.cjs';
4
4
  import { WorkerEntrypoint } from 'cloudflare:workers';
5
5
  import { DrizzleD1Database } from 'drizzle-orm/d1';
6
6
  import { z } from 'zod';
7
- import { C as ConfigEnvironmentBankAccount, I as IBankConnector, a as ConfigBankAccount, b as ConnectorKey, B as BankAccountWithLastSync } from '../shared/bank.BwleO_ON.cjs';
7
+ import { C as ConfigEnvironmentBankAccount, I as IBankConnector, a as ConfigBankAccount, b as ConnectorKey, B as BankAccountWithLastSync } from '../shared/bank.DmypH3Au.cjs';
8
8
  import 'drizzle-orm/sqlite-core';
9
9
  import 'drizzle-orm';
10
10
  import '@develit-io/general-codes';
@@ -88,16 +88,23 @@ interface SendPaymentInput extends z.infer<typeof sendPaymentInputSchema> {
88
88
  }
89
89
  type SendPaymentOutput = void;
90
90
 
91
- interface GetErsteCodeURIOutput {
91
+ declare const getAuthUriInputSchema: z.ZodObject<{
92
+ accountId: z.ZodString;
93
+ }, z.core.$strip>;
94
+ type GetAuthUriInput = z.infer<typeof getAuthUriInputSchema>;
95
+ type GetAuthUriOutput = {
92
96
  uri: string;
93
- }
97
+ };
94
98
 
95
- declare const saveErsteCodeInputSchema: z.ZodObject<{
96
- code: z.ZodString;
99
+ declare const authorizeAccountInputSchema: z.ZodObject<{
100
+ ott: z.ZodString;
101
+ urlParams: z.ZodString;
97
102
  }, z.core.$strip>;
98
- interface SaveErsteCodeInput extends z.infer<typeof saveErsteCodeInputSchema> {
103
+ interface AuthorizeAccountInput extends z.infer<typeof authorizeAccountInputSchema> {
99
104
  }
100
- type SaveErsteCodeOutput = void;
105
+ type AuthorizeAccountOutput = {
106
+ authorized: boolean;
107
+ };
101
108
 
102
109
  declare const simulateDepositInputSchema: z.ZodObject<{
103
110
  amount: z.ZodNumber;
@@ -179,7 +186,15 @@ interface SetLastSyncAtInput extends z.infer<typeof setLastSyncAtInputSchema> {
179
186
  type SetLastSyncAtOutput = {};
180
187
 
181
188
  declare const initiateConnectorInputSchema: z.ZodObject<{
182
- connectorKey: z.ZodString;
189
+ connectorKey: z.ZodEnum<{
190
+ ERSTE: "ERSTE";
191
+ FINBRICKS: "FINBRICKS";
192
+ MOCK: "MOCK";
193
+ CREDITAS: "CREDITAS";
194
+ MOCK_COBS: "MOCK_COBS";
195
+ FIO: "FIO";
196
+ MONETA: "MONETA";
197
+ }>;
183
198
  }, z.core.$strip>;
184
199
  interface initiateConnectorInput extends z.input<typeof initiateConnectorInputSchema> {
185
200
  }
@@ -211,10 +226,10 @@ declare class BankServiceBase extends BankServiceBase_base {
211
226
  addPaymentsToBatch({ paymentsToBatch, }: {
212
227
  paymentsToBatch: SendPaymentInput[];
213
228
  }): Promise<IRPCResponse<{
229
+ status: "PREPARED" | "FAILED" | "COMPLETED" | "OPEN" | "WAITING_FOR_PROCESSING" | "PROCESSING" | "READY_TO_SIGN" | null;
214
230
  batchPaymentInitiatedAt: Date | null;
215
231
  authorizationUrls: string | string[] | null;
216
232
  accountId: string | null;
217
- status: "OPEN" | "WAITING_FOR_PROCESSING" | "PROCESSING" | "READY_TO_SIGN" | "PREPARED" | "COMPLETED" | "FAILED" | null;
218
233
  payments: PaymentInsertType[];
219
234
  metadata: object | null;
220
235
  id: string;
@@ -227,8 +242,8 @@ declare class BankServiceBase extends BankServiceBase_base {
227
242
  connectorKey: ConnectorKey;
228
243
  }): Promise<IRPCResponse<void>>;
229
244
  queue(b: MessageBatch<SendPaymentInput>): Promise<void>;
230
- getErsteCodeURI(): Promise<IRPCResponse<GetErsteCodeURIOutput>>;
231
- saveErsteCode(input: SaveErsteCodeInput): Promise<IRPCResponse<SaveErsteCodeOutput>>;
245
+ getAuthUri(input: GetAuthUriInput): Promise<IRPCResponse<GetAuthUriOutput>>;
246
+ authorizeAccount(input: AuthorizeAccountInput): Promise<IRPCResponse<AuthorizeAccountOutput>>;
232
247
  saveOrUpdatePayments(accounts: BankAccountWithLastSync[]): Promise<IRPCResponse<void>>;
233
248
  simulateDeposit(input: SimulateDepositInput): Promise<IRPCResponse<SimulateDepositOutput>>;
234
249
  setLastSyncAt(input: SetLastSyncAtInput): Promise<IRPCResponse<SetLastSyncAtOutput>>;
@@ -1,10 +1,10 @@
1
1
  import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
2
2
  import { IRPCResponse } from '@develit-io/backend-sdk';
3
- import { P as PaymentSelectType, B as BatchSelectType, t as tables, a as PaymentInsertType } from '../shared/bank.BT_Yf43j.mjs';
3
+ import { P as PaymentSelectType, B as BatchSelectType, t as tables, a as PaymentInsertType } from '../shared/bank.BuNG2S8h.mjs';
4
4
  import { WorkerEntrypoint } from 'cloudflare:workers';
5
5
  import { DrizzleD1Database } from 'drizzle-orm/d1';
6
6
  import { z } from 'zod';
7
- import { C as ConfigEnvironmentBankAccount, I as IBankConnector, a as ConfigBankAccount, b as ConnectorKey, B as BankAccountWithLastSync } from '../shared/bank.BoVUuQ1D.mjs';
7
+ import { C as ConfigEnvironmentBankAccount, I as IBankConnector, a as ConfigBankAccount, b as ConnectorKey, B as BankAccountWithLastSync } from '../shared/bank.DWVLVMDa.mjs';
8
8
  import 'drizzle-orm/sqlite-core';
9
9
  import 'drizzle-orm';
10
10
  import '@develit-io/general-codes';
@@ -88,16 +88,23 @@ interface SendPaymentInput extends z.infer<typeof sendPaymentInputSchema> {
88
88
  }
89
89
  type SendPaymentOutput = void;
90
90
 
91
- interface GetErsteCodeURIOutput {
91
+ declare const getAuthUriInputSchema: z.ZodObject<{
92
+ accountId: z.ZodString;
93
+ }, z.core.$strip>;
94
+ type GetAuthUriInput = z.infer<typeof getAuthUriInputSchema>;
95
+ type GetAuthUriOutput = {
92
96
  uri: string;
93
- }
97
+ };
94
98
 
95
- declare const saveErsteCodeInputSchema: z.ZodObject<{
96
- code: z.ZodString;
99
+ declare const authorizeAccountInputSchema: z.ZodObject<{
100
+ ott: z.ZodString;
101
+ urlParams: z.ZodString;
97
102
  }, z.core.$strip>;
98
- interface SaveErsteCodeInput extends z.infer<typeof saveErsteCodeInputSchema> {
103
+ interface AuthorizeAccountInput extends z.infer<typeof authorizeAccountInputSchema> {
99
104
  }
100
- type SaveErsteCodeOutput = void;
105
+ type AuthorizeAccountOutput = {
106
+ authorized: boolean;
107
+ };
101
108
 
102
109
  declare const simulateDepositInputSchema: z.ZodObject<{
103
110
  amount: z.ZodNumber;
@@ -179,7 +186,15 @@ interface SetLastSyncAtInput extends z.infer<typeof setLastSyncAtInputSchema> {
179
186
  type SetLastSyncAtOutput = {};
180
187
 
181
188
  declare const initiateConnectorInputSchema: z.ZodObject<{
182
- connectorKey: z.ZodString;
189
+ connectorKey: z.ZodEnum<{
190
+ ERSTE: "ERSTE";
191
+ FINBRICKS: "FINBRICKS";
192
+ MOCK: "MOCK";
193
+ CREDITAS: "CREDITAS";
194
+ MOCK_COBS: "MOCK_COBS";
195
+ FIO: "FIO";
196
+ MONETA: "MONETA";
197
+ }>;
183
198
  }, z.core.$strip>;
184
199
  interface initiateConnectorInput extends z.input<typeof initiateConnectorInputSchema> {
185
200
  }
@@ -211,10 +226,10 @@ declare class BankServiceBase extends BankServiceBase_base {
211
226
  addPaymentsToBatch({ paymentsToBatch, }: {
212
227
  paymentsToBatch: SendPaymentInput[];
213
228
  }): Promise<IRPCResponse<{
229
+ status: "PREPARED" | "FAILED" | "COMPLETED" | "OPEN" | "WAITING_FOR_PROCESSING" | "PROCESSING" | "READY_TO_SIGN" | null;
214
230
  batchPaymentInitiatedAt: Date | null;
215
231
  authorizationUrls: string | string[] | null;
216
232
  accountId: string | null;
217
- status: "OPEN" | "WAITING_FOR_PROCESSING" | "PROCESSING" | "READY_TO_SIGN" | "PREPARED" | "COMPLETED" | "FAILED" | null;
218
233
  payments: PaymentInsertType[];
219
234
  metadata: object | null;
220
235
  id: string;
@@ -227,8 +242,8 @@ declare class BankServiceBase extends BankServiceBase_base {
227
242
  connectorKey: ConnectorKey;
228
243
  }): Promise<IRPCResponse<void>>;
229
244
  queue(b: MessageBatch<SendPaymentInput>): Promise<void>;
230
- getErsteCodeURI(): Promise<IRPCResponse<GetErsteCodeURIOutput>>;
231
- saveErsteCode(input: SaveErsteCodeInput): Promise<IRPCResponse<SaveErsteCodeOutput>>;
245
+ getAuthUri(input: GetAuthUriInput): Promise<IRPCResponse<GetAuthUriOutput>>;
246
+ authorizeAccount(input: AuthorizeAccountInput): Promise<IRPCResponse<AuthorizeAccountOutput>>;
232
247
  saveOrUpdatePayments(accounts: BankAccountWithLastSync[]): Promise<IRPCResponse<void>>;
233
248
  simulateDeposit(input: SimulateDepositInput): Promise<IRPCResponse<SimulateDepositOutput>>;
234
249
  setLastSyncAt(input: SetLastSyncAtInput): Promise<IRPCResponse<SetLastSyncAtOutput>>;
@@ -1,10 +1,10 @@
1
1
  import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
2
2
  import { IRPCResponse } from '@develit-io/backend-sdk';
3
- import { P as PaymentSelectType, B as BatchSelectType, t as tables, a as PaymentInsertType } from '../shared/bank.BT_Yf43j.js';
3
+ import { P as PaymentSelectType, B as BatchSelectType, t as tables, a as PaymentInsertType } from '../shared/bank.BuNG2S8h.js';
4
4
  import { WorkerEntrypoint } from 'cloudflare:workers';
5
5
  import { DrizzleD1Database } from 'drizzle-orm/d1';
6
6
  import { z } from 'zod';
7
- import { C as ConfigEnvironmentBankAccount, I as IBankConnector, a as ConfigBankAccount, b as ConnectorKey, B as BankAccountWithLastSync } from '../shared/bank.DlquvmPs.js';
7
+ import { C as ConfigEnvironmentBankAccount, I as IBankConnector, a as ConfigBankAccount, b as ConnectorKey, B as BankAccountWithLastSync } from '../shared/bank.BkLncGmL.js';
8
8
  import 'drizzle-orm/sqlite-core';
9
9
  import 'drizzle-orm';
10
10
  import '@develit-io/general-codes';
@@ -88,16 +88,23 @@ interface SendPaymentInput extends z.infer<typeof sendPaymentInputSchema> {
88
88
  }
89
89
  type SendPaymentOutput = void;
90
90
 
91
- interface GetErsteCodeURIOutput {
91
+ declare const getAuthUriInputSchema: z.ZodObject<{
92
+ accountId: z.ZodString;
93
+ }, z.core.$strip>;
94
+ type GetAuthUriInput = z.infer<typeof getAuthUriInputSchema>;
95
+ type GetAuthUriOutput = {
92
96
  uri: string;
93
- }
97
+ };
94
98
 
95
- declare const saveErsteCodeInputSchema: z.ZodObject<{
96
- code: z.ZodString;
99
+ declare const authorizeAccountInputSchema: z.ZodObject<{
100
+ ott: z.ZodString;
101
+ urlParams: z.ZodString;
97
102
  }, z.core.$strip>;
98
- interface SaveErsteCodeInput extends z.infer<typeof saveErsteCodeInputSchema> {
103
+ interface AuthorizeAccountInput extends z.infer<typeof authorizeAccountInputSchema> {
99
104
  }
100
- type SaveErsteCodeOutput = void;
105
+ type AuthorizeAccountOutput = {
106
+ authorized: boolean;
107
+ };
101
108
 
102
109
  declare const simulateDepositInputSchema: z.ZodObject<{
103
110
  amount: z.ZodNumber;
@@ -179,7 +186,15 @@ interface SetLastSyncAtInput extends z.infer<typeof setLastSyncAtInputSchema> {
179
186
  type SetLastSyncAtOutput = {};
180
187
 
181
188
  declare const initiateConnectorInputSchema: z.ZodObject<{
182
- connectorKey: z.ZodString;
189
+ connectorKey: z.ZodEnum<{
190
+ ERSTE: "ERSTE";
191
+ FINBRICKS: "FINBRICKS";
192
+ MOCK: "MOCK";
193
+ CREDITAS: "CREDITAS";
194
+ MOCK_COBS: "MOCK_COBS";
195
+ FIO: "FIO";
196
+ MONETA: "MONETA";
197
+ }>;
183
198
  }, z.core.$strip>;
184
199
  interface initiateConnectorInput extends z.input<typeof initiateConnectorInputSchema> {
185
200
  }
@@ -211,10 +226,10 @@ declare class BankServiceBase extends BankServiceBase_base {
211
226
  addPaymentsToBatch({ paymentsToBatch, }: {
212
227
  paymentsToBatch: SendPaymentInput[];
213
228
  }): Promise<IRPCResponse<{
229
+ status: "PREPARED" | "FAILED" | "COMPLETED" | "OPEN" | "WAITING_FOR_PROCESSING" | "PROCESSING" | "READY_TO_SIGN" | null;
214
230
  batchPaymentInitiatedAt: Date | null;
215
231
  authorizationUrls: string | string[] | null;
216
232
  accountId: string | null;
217
- status: "OPEN" | "WAITING_FOR_PROCESSING" | "PROCESSING" | "READY_TO_SIGN" | "PREPARED" | "COMPLETED" | "FAILED" | null;
218
233
  payments: PaymentInsertType[];
219
234
  metadata: object | null;
220
235
  id: string;
@@ -227,8 +242,8 @@ declare class BankServiceBase extends BankServiceBase_base {
227
242
  connectorKey: ConnectorKey;
228
243
  }): Promise<IRPCResponse<void>>;
229
244
  queue(b: MessageBatch<SendPaymentInput>): Promise<void>;
230
- getErsteCodeURI(): Promise<IRPCResponse<GetErsteCodeURIOutput>>;
231
- saveErsteCode(input: SaveErsteCodeInput): Promise<IRPCResponse<SaveErsteCodeOutput>>;
245
+ getAuthUri(input: GetAuthUriInput): Promise<IRPCResponse<GetAuthUriOutput>>;
246
+ authorizeAccount(input: AuthorizeAccountInput): Promise<IRPCResponse<AuthorizeAccountOutput>>;
232
247
  saveOrUpdatePayments(accounts: BankAccountWithLastSync[]): Promise<IRPCResponse<void>>;
233
248
  simulateDeposit(input: SimulateDepositInput): Promise<IRPCResponse<SimulateDepositOutput>>;
234
249
  setLastSyncAt(input: SetLastSyncAtInput): Promise<IRPCResponse<SetLastSyncAtOutput>>;