@develit-services/bank 0.0.13 → 0.0.15

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 (29) hide show
  1. package/dist/database/schema.d.cts +1 -1
  2. package/dist/database/schema.d.mts +1 -1
  3. package/dist/database/schema.d.ts +1 -1
  4. package/dist/export/worker.cjs +42 -24
  5. package/dist/export/worker.d.cts +5 -4
  6. package/dist/export/worker.d.mts +5 -4
  7. package/dist/export/worker.d.ts +5 -4
  8. package/dist/export/worker.mjs +43 -25
  9. package/dist/export/wrangler.d.cts +4 -3
  10. package/dist/export/wrangler.d.mts +4 -3
  11. package/dist/export/wrangler.d.ts +4 -3
  12. package/dist/shared/{bank.BYxCT5rk.d.ts → bank.BlmUZQ6s.d.cts} +20 -8
  13. package/dist/shared/{bank.DxGqqFhD.d.cts → bank.CJFy17-g.d.cts} +3 -1
  14. package/dist/shared/{bank.DxGqqFhD.d.mts → bank.CJFy17-g.d.mts} +3 -1
  15. package/dist/shared/{bank.DxGqqFhD.d.ts → bank.CJFy17-g.d.ts} +3 -1
  16. package/dist/shared/{bank.BU2_AKRG.cjs → bank.Ce58djRL.cjs} +500 -320
  17. package/dist/shared/{bank.TOYdvcg7.mjs → bank.DZS4d3MJ.mjs} +498 -322
  18. package/dist/shared/{bank.CBNQZ5Pd.d.cts → bank.DiMNzl60.d.cts} +8 -6
  19. package/dist/shared/{bank.CBNQZ5Pd.d.mts → bank.DiMNzl60.d.mts} +8 -6
  20. package/dist/shared/{bank.CBNQZ5Pd.d.ts → bank.DiMNzl60.d.ts} +8 -6
  21. package/dist/shared/{bank.BULPVep1.d.cts → bank.j2Z-uViN.d.ts} +20 -8
  22. package/dist/shared/{bank.Dxfp5h5B.d.mts → bank.tyFkXmr8.d.mts} +20 -8
  23. package/dist/{@types.cjs → types.cjs} +8 -3
  24. package/dist/{@types.d.cts → types.d.cts} +142 -22
  25. package/dist/{@types.d.mts → types.d.mts} +142 -22
  26. package/dist/{@types.d.ts → types.d.ts} +142 -22
  27. package/dist/types.mjs +11 -0
  28. package/package.json +4 -4
  29. package/dist/@types.mjs +0 -10
@@ -1,4 +1,4 @@
1
- export { c as batch, d as payment, e as paymentRelations } from '../shared/bank.CBNQZ5Pd.cjs';
1
+ export { c as batch, d as payment, e as paymentRelations } from '../shared/bank.DiMNzl60.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.CBNQZ5Pd.mjs';
1
+ export { c as batch, d as payment, e as paymentRelations } from '../shared/bank.DiMNzl60.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.CBNQZ5Pd.js';
1
+ export { c as batch, d as payment, e as paymentRelations } from '../shared/bank.DiMNzl60.js';
2
2
  import 'drizzle-orm/sqlite-core';
3
3
  import 'drizzle-orm';
4
4
  import 'zod';
@@ -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.BU2_AKRG.cjs');
6
+ const db = require('../shared/bank.Ce58djRL.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
+ require('jose');
11
12
  const drizzleOrm = require('drizzle-orm');
12
13
  const superjson = require('superjson');
13
14
  require('../shared/bank.CrAQe4PH.cjs');
14
15
  require('drizzle-orm/sqlite-core');
15
16
  require('drizzle-orm/relations');
16
17
  require('date-fns');
17
- require('jose');
18
18
 
19
19
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
20
20
 
@@ -45,6 +45,8 @@ const simulateDepositInputSchema = zod.z.object({
45
45
  amount: zod.z.number(),
46
46
  currency: zod.z.enum(generalCodes.CURRENCY_CODES),
47
47
  bankingVs: zod.z.string().max(10),
48
+ bankingSs: zod.z.string().max(10),
49
+ bankingKs: zod.z.string().max(10),
48
50
  message: zod.z.string(),
49
51
  creditorIban: zod.z.string().max(34),
50
52
  creditorHolderName: zod.z.string(),
@@ -130,6 +132,12 @@ class FioConnector extends db.FinbricksConnector {
130
132
  }
131
133
  }
132
134
 
135
+ class MonetaConnector extends db.FinbricksConnector {
136
+ constructor(config) {
137
+ super("MONETA", config);
138
+ }
139
+ }
140
+
133
141
  const initiateConnector = (bank, env) => {
134
142
  switch (bank) {
135
143
  case "ERSTE":
@@ -160,6 +168,12 @@ const initiateConnector = (bank, env) => {
160
168
  MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
161
169
  PRIVATE_KEY_PEM: env.FINBRICKS_PRIVATE_KEY_PEM
162
170
  });
171
+ case "MONETA":
172
+ return new MonetaConnector({
173
+ BASE_URI: env.FINBRICKS_BASE_URI,
174
+ MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
175
+ PRIVATE_KEY_PEM: env.FINBRICKS_PRIVATE_KEY_PEM
176
+ });
163
177
  default:
164
178
  return new db.MockConnector();
165
179
  }
@@ -218,17 +232,16 @@ const seperateSupportedPayments = (mappedPayments, accounts) => {
218
232
  var __defProp = Object.defineProperty;
219
233
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
220
234
  var __decorateClass = (decorators, target, key, kind) => {
221
- var result = __getOwnPropDesc(target, key) ;
235
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
222
236
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
223
237
  if (decorator = decorators[i])
224
- result = (decorator(target, key, result) ) || result;
225
- if (result) __defProp(target, key, result);
238
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
239
+ if (kind && result) __defProp(target, key, result);
226
240
  return result;
227
241
  };
228
- class BankServiceBase extends backendSdk.develitWorker(cloudflare_workers.WorkerEntrypoint) {
242
+ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.WorkerEntrypoint) {
229
243
  constructor(ctx, env, configAccounts) {
230
244
  super(ctx, env);
231
- this.name = "bank-service";
232
245
  this.configAccounts = configAccounts;
233
246
  this.db = d1.drizzle(this.env.BANK_D1, { schema: db.tables });
234
247
  }
@@ -326,9 +339,7 @@ class BankServiceBase extends backendSdk.develitWorker(cloudflare_workers.Worker
326
339
  );
327
340
  const token = await this.env.BANK_KV.get(`${connectorKey}:token`);
328
341
  if (!token) throw backendSdk.createInternalError("Provider not authorized");
329
- await this.bankConnector.authenticate({
330
- token
331
- });
342
+ await this.bankConnector.authenticate({ token });
332
343
  }
333
344
  );
334
345
  }
@@ -657,6 +668,8 @@ class BankServiceBase extends backendSdk.develitWorker(cloudflare_workers.Worker
657
668
  amount,
658
669
  currency,
659
670
  bankingVs,
671
+ bankingSs,
672
+ bankingKs,
660
673
  message,
661
674
  creditorIban,
662
675
  creditorHolderName,
@@ -674,6 +687,8 @@ class BankServiceBase extends backendSdk.develitWorker(cloudflare_workers.Worker
674
687
  initiatedAt: /* @__PURE__ */ new Date(),
675
688
  processedAt: /* @__PURE__ */ new Date(),
676
689
  vs: bankingVs,
690
+ ss: bankingSs,
691
+ ks: bankingKs,
677
692
  message,
678
693
  creditorIban,
679
694
  creditorHolderName,
@@ -754,46 +769,49 @@ class BankServiceBase extends backendSdk.develitWorker(cloudflare_workers.Worker
754
769
  }
755
770
  );
756
771
  }
757
- }
772
+ };
758
773
  __decorateClass([
759
774
  backendSdk.action("synchronize-accounts")
760
- ], BankServiceBase.prototype, "syncAccounts");
775
+ ], BankServiceBase.prototype, "syncAccounts", 1);
761
776
  __decorateClass([
762
777
  backendSdk.action("scheduled")
763
- ], BankServiceBase.prototype, "scheduled");
778
+ ], BankServiceBase.prototype, "scheduled", 1);
764
779
  __decorateClass([
765
780
  backendSdk.action("add-payments-to-batch")
766
- ], BankServiceBase.prototype, "addPaymentsToBatch");
781
+ ], BankServiceBase.prototype, "addPaymentsToBatch", 1);
767
782
  __decorateClass([
768
783
  backendSdk.action("process-batch")
769
- ], BankServiceBase.prototype, "processBatch");
784
+ ], BankServiceBase.prototype, "processBatch", 1);
770
785
  __decorateClass([
771
786
  backendSdk.action("queue-handler")
772
- ], BankServiceBase.prototype, "queue");
787
+ ], BankServiceBase.prototype, "queue", 1);
773
788
  __decorateClass([
774
789
  backendSdk.action("get-erste-code-uri")
775
- ], BankServiceBase.prototype, "getErsteCodeURI");
790
+ ], BankServiceBase.prototype, "getErsteCodeURI", 1);
776
791
  __decorateClass([
777
792
  backendSdk.action("save-erste-code")
778
- ], BankServiceBase.prototype, "saveErsteCode");
793
+ ], BankServiceBase.prototype, "saveErsteCode", 1);
779
794
  __decorateClass([
780
795
  backendSdk.action("save-or-update-payments")
781
- ], BankServiceBase.prototype, "saveOrUpdatePayments");
796
+ ], BankServiceBase.prototype, "saveOrUpdatePayments", 1);
782
797
  __decorateClass([
783
798
  backendSdk.action("simulate-deposit")
784
- ], BankServiceBase.prototype, "simulateDeposit");
799
+ ], BankServiceBase.prototype, "simulateDeposit", 1);
785
800
  __decorateClass([
786
801
  backendSdk.action("set-last-sync-at")
787
- ], BankServiceBase.prototype, "setLastSyncAt");
802
+ ], BankServiceBase.prototype, "setLastSyncAt", 1);
788
803
  __decorateClass([
789
804
  backendSdk.action("send-payment")
790
- ], BankServiceBase.prototype, "sendPayment");
805
+ ], BankServiceBase.prototype, "sendPayment", 1);
791
806
  __decorateClass([
792
807
  backendSdk.action("get-bank-accounts")
793
- ], BankServiceBase.prototype, "getBankAccounts");
808
+ ], BankServiceBase.prototype, "getBankAccounts", 1);
794
809
  __decorateClass([
795
810
  backendSdk.action("getBatches")
796
- ], BankServiceBase.prototype, "getBatches");
811
+ ], BankServiceBase.prototype, "getBatches", 1);
812
+ BankServiceBase = __decorateClass([
813
+ backendSdk.service("bank")
814
+ ], BankServiceBase);
797
815
  function defineBankService({
798
816
  configAccounts
799
817
  }) {
@@ -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.CBNQZ5Pd.cjs';
3
+ import { P as PaymentSelectType, B as BatchSelectType, t as tables, a as PaymentInsertType } from '../shared/bank.DiMNzl60.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.BULPVep1.cjs';
7
+ import { C as ConfigEnvironmentBankAccount, I as IBankConnector, a as ConfigBankAccount, b as ConnectorKey, B as BankAccountWithLastSync } from '../shared/bank.BlmUZQ6s.cjs';
8
8
  import 'drizzle-orm/sqlite-core';
9
9
  import 'drizzle-orm';
10
10
  import '@develit-io/general-codes';
@@ -157,6 +157,8 @@ declare const simulateDepositInputSchema: z.ZodObject<{
157
157
  AVAX: "AVAX";
158
158
  }>;
159
159
  bankingVs: z.ZodString;
160
+ bankingSs: z.ZodString;
161
+ bankingKs: z.ZodString;
160
162
  message: z.ZodString;
161
163
  creditorIban: z.ZodString;
162
164
  creditorHolderName: z.ZodString;
@@ -197,7 +199,6 @@ interface GetBatchesOutput {
197
199
 
198
200
  declare const BankServiceBase_base: (abstract new (ctx: ExecutionContext, env: BankEnv) => WorkerEntrypoint<BankEnv, {}>) & (abstract new (...args: any[]) => _develit_io_backend_sdk.DevelitWorkerMethods);
199
201
  declare class BankServiceBase extends BankServiceBase_base {
200
- readonly name: string;
201
202
  readonly configAccounts: ConfigEnvironmentBankAccount;
202
203
  readonly db: DrizzleD1Database<typeof tables>;
203
204
  protected bankConnector: IBankConnector;
@@ -210,10 +211,10 @@ declare class BankServiceBase extends BankServiceBase_base {
210
211
  addPaymentsToBatch({ paymentsToBatch, }: {
211
212
  paymentsToBatch: SendPaymentInput[];
212
213
  }): Promise<IRPCResponse<{
214
+ status: "PREPARED" | "FAILED" | "COMPLETED" | "OPEN" | "WAITING_FOR_PROCESSING" | "PROCESSING" | "READY_TO_SIGN" | null;
213
215
  batchPaymentInitiatedAt: Date | null;
214
216
  authorizationUrls: string | string[] | null;
215
217
  accountId: string | null;
216
- status: "OPEN" | "WAITING_FOR_PROCESSING" | "PROCESSING" | "READY_TO_SIGN" | "PREPARED" | "COMPLETED" | "FAILED" | null;
217
218
  payments: PaymentInsertType[];
218
219
  metadata: object | null;
219
220
  id: string;
@@ -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.CBNQZ5Pd.mjs';
3
+ import { P as PaymentSelectType, B as BatchSelectType, t as tables, a as PaymentInsertType } from '../shared/bank.DiMNzl60.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.Dxfp5h5B.mjs';
7
+ import { C as ConfigEnvironmentBankAccount, I as IBankConnector, a as ConfigBankAccount, b as ConnectorKey, B as BankAccountWithLastSync } from '../shared/bank.tyFkXmr8.mjs';
8
8
  import 'drizzle-orm/sqlite-core';
9
9
  import 'drizzle-orm';
10
10
  import '@develit-io/general-codes';
@@ -157,6 +157,8 @@ declare const simulateDepositInputSchema: z.ZodObject<{
157
157
  AVAX: "AVAX";
158
158
  }>;
159
159
  bankingVs: z.ZodString;
160
+ bankingSs: z.ZodString;
161
+ bankingKs: z.ZodString;
160
162
  message: z.ZodString;
161
163
  creditorIban: z.ZodString;
162
164
  creditorHolderName: z.ZodString;
@@ -197,7 +199,6 @@ interface GetBatchesOutput {
197
199
 
198
200
  declare const BankServiceBase_base: (abstract new (ctx: ExecutionContext, env: BankEnv) => WorkerEntrypoint<BankEnv, {}>) & (abstract new (...args: any[]) => _develit_io_backend_sdk.DevelitWorkerMethods);
199
201
  declare class BankServiceBase extends BankServiceBase_base {
200
- readonly name: string;
201
202
  readonly configAccounts: ConfigEnvironmentBankAccount;
202
203
  readonly db: DrizzleD1Database<typeof tables>;
203
204
  protected bankConnector: IBankConnector;
@@ -210,10 +211,10 @@ declare class BankServiceBase extends BankServiceBase_base {
210
211
  addPaymentsToBatch({ paymentsToBatch, }: {
211
212
  paymentsToBatch: SendPaymentInput[];
212
213
  }): Promise<IRPCResponse<{
214
+ status: "PREPARED" | "FAILED" | "COMPLETED" | "OPEN" | "WAITING_FOR_PROCESSING" | "PROCESSING" | "READY_TO_SIGN" | null;
213
215
  batchPaymentInitiatedAt: Date | null;
214
216
  authorizationUrls: string | string[] | null;
215
217
  accountId: string | null;
216
- status: "OPEN" | "WAITING_FOR_PROCESSING" | "PROCESSING" | "READY_TO_SIGN" | "PREPARED" | "COMPLETED" | "FAILED" | null;
217
218
  payments: PaymentInsertType[];
218
219
  metadata: object | null;
219
220
  id: string;
@@ -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.CBNQZ5Pd.js';
3
+ import { P as PaymentSelectType, B as BatchSelectType, t as tables, a as PaymentInsertType } from '../shared/bank.DiMNzl60.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.BYxCT5rk.js';
7
+ import { C as ConfigEnvironmentBankAccount, I as IBankConnector, a as ConfigBankAccount, b as ConnectorKey, B as BankAccountWithLastSync } from '../shared/bank.j2Z-uViN.js';
8
8
  import 'drizzle-orm/sqlite-core';
9
9
  import 'drizzle-orm';
10
10
  import '@develit-io/general-codes';
@@ -157,6 +157,8 @@ declare const simulateDepositInputSchema: z.ZodObject<{
157
157
  AVAX: "AVAX";
158
158
  }>;
159
159
  bankingVs: z.ZodString;
160
+ bankingSs: z.ZodString;
161
+ bankingKs: z.ZodString;
160
162
  message: z.ZodString;
161
163
  creditorIban: z.ZodString;
162
164
  creditorHolderName: z.ZodString;
@@ -197,7 +199,6 @@ interface GetBatchesOutput {
197
199
 
198
200
  declare const BankServiceBase_base: (abstract new (ctx: ExecutionContext, env: BankEnv) => WorkerEntrypoint<BankEnv, {}>) & (abstract new (...args: any[]) => _develit_io_backend_sdk.DevelitWorkerMethods);
199
201
  declare class BankServiceBase extends BankServiceBase_base {
200
- readonly name: string;
201
202
  readonly configAccounts: ConfigEnvironmentBankAccount;
202
203
  readonly db: DrizzleD1Database<typeof tables>;
203
204
  protected bankConnector: IBankConnector;
@@ -210,10 +211,10 @@ declare class BankServiceBase extends BankServiceBase_base {
210
211
  addPaymentsToBatch({ paymentsToBatch, }: {
211
212
  paymentsToBatch: SendPaymentInput[];
212
213
  }): Promise<IRPCResponse<{
214
+ status: "PREPARED" | "FAILED" | "COMPLETED" | "OPEN" | "WAITING_FOR_PROCESSING" | "PROCESSING" | "READY_TO_SIGN" | null;
213
215
  batchPaymentInitiatedAt: Date | null;
214
216
  authorizationUrls: string | string[] | null;
215
217
  accountId: string | null;
216
- status: "OPEN" | "WAITING_FOR_PROCESSING" | "PROCESSING" | "READY_TO_SIGN" | "PREPARED" | "COMPLETED" | "FAILED" | null;
217
218
  payments: PaymentInsertType[];
218
219
  metadata: object | null;
219
220
  id: string;
@@ -1,16 +1,16 @@
1
- import { uuidv4, useResult, createInternalError, develitWorker, first, RPCResponse, action } from '@develit-io/backend-sdk';
2
- import { P as PAYMENT_TYPES, t as tables, F as FinbricksConnector, M as MockConnector, a as MockCobsConnector, E as ErsteConnector, g as getPaymentDirection } from '../shared/bank.TOYdvcg7.mjs';
1
+ import { uuidv4, useResult, createInternalError, develitWorker, first, RPCResponse, action, service } from '@develit-io/backend-sdk';
2
+ import { P as PAYMENT_TYPES, t as tables, F as FinbricksConnector, M as MockConnector, a as MockCobsConnector, E as ErsteConnector, g as getPaymentDirection } from '../shared/bank.DZS4d3MJ.mjs';
3
3
  import { WorkerEntrypoint } from 'cloudflare:workers';
4
4
  import { drizzle } from 'drizzle-orm/d1';
5
5
  import { z } from 'zod';
6
6
  import { CURRENCY_CODES } from '@develit-io/general-codes';
7
+ import 'jose';
7
8
  import { eq, and, inArray, desc, sql } from 'drizzle-orm';
8
9
  import superjson from 'superjson';
9
10
  import '../shared/bank.BeH-ZCJJ.mjs';
10
11
  import 'drizzle-orm/sqlite-core';
11
12
  import 'drizzle-orm/relations';
12
13
  import 'date-fns';
13
- import 'jose';
14
14
 
15
15
  const sendPaymentInputSchema = z.object({
16
16
  refId: z.string(),
@@ -37,6 +37,8 @@ const simulateDepositInputSchema = z.object({
37
37
  amount: z.number(),
38
38
  currency: z.enum(CURRENCY_CODES),
39
39
  bankingVs: z.string().max(10),
40
+ bankingSs: z.string().max(10),
41
+ bankingKs: z.string().max(10),
40
42
  message: z.string(),
41
43
  creditorIban: z.string().max(34),
42
44
  creditorHolderName: z.string(),
@@ -122,6 +124,12 @@ class FioConnector extends FinbricksConnector {
122
124
  }
123
125
  }
124
126
 
127
+ class MonetaConnector extends FinbricksConnector {
128
+ constructor(config) {
129
+ super("MONETA", config);
130
+ }
131
+ }
132
+
125
133
  const initiateConnector = (bank, env) => {
126
134
  switch (bank) {
127
135
  case "ERSTE":
@@ -152,6 +160,12 @@ const initiateConnector = (bank, env) => {
152
160
  MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
153
161
  PRIVATE_KEY_PEM: env.FINBRICKS_PRIVATE_KEY_PEM
154
162
  });
163
+ case "MONETA":
164
+ return new MonetaConnector({
165
+ BASE_URI: env.FINBRICKS_BASE_URI,
166
+ MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
167
+ PRIVATE_KEY_PEM: env.FINBRICKS_PRIVATE_KEY_PEM
168
+ });
155
169
  default:
156
170
  return new MockConnector();
157
171
  }
@@ -210,17 +224,16 @@ const seperateSupportedPayments = (mappedPayments, accounts) => {
210
224
  var __defProp = Object.defineProperty;
211
225
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
212
226
  var __decorateClass = (decorators, target, key, kind) => {
213
- var result = __getOwnPropDesc(target, key) ;
227
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
214
228
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
215
229
  if (decorator = decorators[i])
216
- result = (decorator(target, key, result) ) || result;
217
- if (result) __defProp(target, key, result);
230
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
231
+ if (kind && result) __defProp(target, key, result);
218
232
  return result;
219
233
  };
220
- class BankServiceBase extends develitWorker(WorkerEntrypoint) {
234
+ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
221
235
  constructor(ctx, env, configAccounts) {
222
236
  super(ctx, env);
223
- this.name = "bank-service";
224
237
  this.configAccounts = configAccounts;
225
238
  this.db = drizzle(this.env.BANK_D1, { schema: tables });
226
239
  }
@@ -318,9 +331,7 @@ class BankServiceBase extends develitWorker(WorkerEntrypoint) {
318
331
  );
319
332
  const token = await this.env.BANK_KV.get(`${connectorKey}:token`);
320
333
  if (!token) throw createInternalError("Provider not authorized");
321
- await this.bankConnector.authenticate({
322
- token
323
- });
334
+ await this.bankConnector.authenticate({ token });
324
335
  }
325
336
  );
326
337
  }
@@ -649,6 +660,8 @@ class BankServiceBase extends develitWorker(WorkerEntrypoint) {
649
660
  amount,
650
661
  currency,
651
662
  bankingVs,
663
+ bankingSs,
664
+ bankingKs,
652
665
  message,
653
666
  creditorIban,
654
667
  creditorHolderName,
@@ -666,6 +679,8 @@ class BankServiceBase extends develitWorker(WorkerEntrypoint) {
666
679
  initiatedAt: /* @__PURE__ */ new Date(),
667
680
  processedAt: /* @__PURE__ */ new Date(),
668
681
  vs: bankingVs,
682
+ ss: bankingSs,
683
+ ks: bankingKs,
669
684
  message,
670
685
  creditorIban,
671
686
  creditorHolderName,
@@ -746,46 +761,49 @@ class BankServiceBase extends develitWorker(WorkerEntrypoint) {
746
761
  }
747
762
  );
748
763
  }
749
- }
764
+ };
750
765
  __decorateClass([
751
766
  action("synchronize-accounts")
752
- ], BankServiceBase.prototype, "syncAccounts");
767
+ ], BankServiceBase.prototype, "syncAccounts", 1);
753
768
  __decorateClass([
754
769
  action("scheduled")
755
- ], BankServiceBase.prototype, "scheduled");
770
+ ], BankServiceBase.prototype, "scheduled", 1);
756
771
  __decorateClass([
757
772
  action("add-payments-to-batch")
758
- ], BankServiceBase.prototype, "addPaymentsToBatch");
773
+ ], BankServiceBase.prototype, "addPaymentsToBatch", 1);
759
774
  __decorateClass([
760
775
  action("process-batch")
761
- ], BankServiceBase.prototype, "processBatch");
776
+ ], BankServiceBase.prototype, "processBatch", 1);
762
777
  __decorateClass([
763
778
  action("queue-handler")
764
- ], BankServiceBase.prototype, "queue");
779
+ ], BankServiceBase.prototype, "queue", 1);
765
780
  __decorateClass([
766
781
  action("get-erste-code-uri")
767
- ], BankServiceBase.prototype, "getErsteCodeURI");
782
+ ], BankServiceBase.prototype, "getErsteCodeURI", 1);
768
783
  __decorateClass([
769
784
  action("save-erste-code")
770
- ], BankServiceBase.prototype, "saveErsteCode");
785
+ ], BankServiceBase.prototype, "saveErsteCode", 1);
771
786
  __decorateClass([
772
787
  action("save-or-update-payments")
773
- ], BankServiceBase.prototype, "saveOrUpdatePayments");
788
+ ], BankServiceBase.prototype, "saveOrUpdatePayments", 1);
774
789
  __decorateClass([
775
790
  action("simulate-deposit")
776
- ], BankServiceBase.prototype, "simulateDeposit");
791
+ ], BankServiceBase.prototype, "simulateDeposit", 1);
777
792
  __decorateClass([
778
793
  action("set-last-sync-at")
779
- ], BankServiceBase.prototype, "setLastSyncAt");
794
+ ], BankServiceBase.prototype, "setLastSyncAt", 1);
780
795
  __decorateClass([
781
796
  action("send-payment")
782
- ], BankServiceBase.prototype, "sendPayment");
797
+ ], BankServiceBase.prototype, "sendPayment", 1);
783
798
  __decorateClass([
784
799
  action("get-bank-accounts")
785
- ], BankServiceBase.prototype, "getBankAccounts");
800
+ ], BankServiceBase.prototype, "getBankAccounts", 1);
786
801
  __decorateClass([
787
802
  action("getBatches")
788
- ], BankServiceBase.prototype, "getBatches");
803
+ ], BankServiceBase.prototype, "getBatches", 1);
804
+ BankServiceBase = __decorateClass([
805
+ service("bank")
806
+ ], BankServiceBase);
789
807
  function defineBankService({
790
808
  configAccounts
791
809
  }) {
@@ -1,4 +1,4 @@
1
- import { B as BankServiceWranglerConfig } from '../shared/bank.DxGqqFhD.cjs';
1
+ import { B as BankServiceWranglerConfig } from '../shared/bank.CJFy17-g.cjs';
2
2
 
3
3
  declare function defineBankServiceWrangler(config: BankServiceWranglerConfig): {
4
4
  vars: {
@@ -17,7 +17,9 @@ declare function defineBankServiceWrangler(config: BankServiceWranglerConfig): {
17
17
  ERSTE_CLIENT_SECRET: string;
18
18
  ERSTE_CLIENT_ID: string;
19
19
  };
20
- triggers: string[];
20
+ triggers: {
21
+ crons: string[];
22
+ };
21
23
  kv_namespaces: {
22
24
  binding: string;
23
25
  id: string;
@@ -54,7 +56,6 @@ declare function defineBankServiceWrangler(config: BankServiceWranglerConfig): {
54
56
  invocation_logs: boolean;
55
57
  };
56
58
  };
57
- preview_urls: boolean;
58
59
  workers_dev: boolean;
59
60
  keep_vars: boolean;
60
61
  };
@@ -1,4 +1,4 @@
1
- import { B as BankServiceWranglerConfig } from '../shared/bank.DxGqqFhD.mjs';
1
+ import { B as BankServiceWranglerConfig } from '../shared/bank.CJFy17-g.mjs';
2
2
 
3
3
  declare function defineBankServiceWrangler(config: BankServiceWranglerConfig): {
4
4
  vars: {
@@ -17,7 +17,9 @@ declare function defineBankServiceWrangler(config: BankServiceWranglerConfig): {
17
17
  ERSTE_CLIENT_SECRET: string;
18
18
  ERSTE_CLIENT_ID: string;
19
19
  };
20
- triggers: string[];
20
+ triggers: {
21
+ crons: string[];
22
+ };
21
23
  kv_namespaces: {
22
24
  binding: string;
23
25
  id: string;
@@ -54,7 +56,6 @@ declare function defineBankServiceWrangler(config: BankServiceWranglerConfig): {
54
56
  invocation_logs: boolean;
55
57
  };
56
58
  };
57
- preview_urls: boolean;
58
59
  workers_dev: boolean;
59
60
  keep_vars: boolean;
60
61
  };
@@ -1,4 +1,4 @@
1
- import { B as BankServiceWranglerConfig } from '../shared/bank.DxGqqFhD.js';
1
+ import { B as BankServiceWranglerConfig } from '../shared/bank.CJFy17-g.js';
2
2
 
3
3
  declare function defineBankServiceWrangler(config: BankServiceWranglerConfig): {
4
4
  vars: {
@@ -17,7 +17,9 @@ declare function defineBankServiceWrangler(config: BankServiceWranglerConfig): {
17
17
  ERSTE_CLIENT_SECRET: string;
18
18
  ERSTE_CLIENT_ID: string;
19
19
  };
20
- triggers: string[];
20
+ triggers: {
21
+ crons: string[];
22
+ };
21
23
  kv_namespaces: {
22
24
  binding: string;
23
25
  id: string;
@@ -54,7 +56,6 @@ declare function defineBankServiceWrangler(config: BankServiceWranglerConfig): {
54
56
  invocation_logs: boolean;
55
57
  };
56
58
  };
57
- preview_urls: boolean;
58
59
  workers_dev: boolean;
59
60
  keep_vars: boolean;
60
61
  };
@@ -1,6 +1,6 @@
1
1
  import { Environment } from '@develit-io/backend-sdk';
2
2
  import { BANK_CODES, CURRENCY_CODES, CODES } from '@develit-io/general-codes';
3
- import { a as PaymentInsertType, t as tables } from './bank.CBNQZ5Pd.js';
3
+ import { a as PaymentInsertType, t as tables } from './bank.DiMNzl60.cjs';
4
4
  import { DrizzleD1Database } from 'drizzle-orm/d1';
5
5
 
6
6
  declare const PAYMENT_TYPES: readonly ["SEPA", "SWIFT", "IFSC", "DOMESTIC"];
@@ -25,14 +25,10 @@ type BankCode = (typeof BANK_CODES)[number];
25
25
  declare const COUNTRY_CODES: ["AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BO" | "BQ" | "BA" | "BW" | "BR" | "IO" | "VG" | "BG" | "BF" | "BI" | "KH" | "CM" | "CA" | "CV" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CK" | "CR" | "HR" | "CW" | "CY" | "CZ" | "CD" | "DK" | "DJ" | "DM" | "DO" | "TL" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GR" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "GY" | "HT" | "HN" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IM" | "IL" | "IT" | "CI" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "XK" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LI" | "LT" | "LU" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MR" | "MU" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "NA" | "NP" | "NL" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "KP" | "NO" | "OM" | "PK" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "CG" | "RE" | "RO" | "RU" | "RW" | "BL" | "KN" | "LC" | "MF" | "VC" | "WS" | "SM" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SX" | "SK" | "SI" | "SO" | "ZA" | "KR" | "SS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SZ" | "SE" | "CH" | "TW" | "TJ" | "TZ" | "TH" | "TG" | "TO" | "TT" | "TN" | "TR" | "TM" | "UM" | "VI" | "UG" | "UA" | "AE" | "GB" | "UZ" | "VU" | "VE" | "VN" | "WF" | "EH" | "YE" | "ZM" | "ZW", ...("AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BO" | "BQ" | "BA" | "BW" | "BR" | "IO" | "VG" | "BG" | "BF" | "BI" | "KH" | "CM" | "CA" | "CV" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CK" | "CR" | "HR" | "CW" | "CY" | "CZ" | "CD" | "DK" | "DJ" | "DM" | "DO" | "TL" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GR" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "GY" | "HT" | "HN" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IM" | "IL" | "IT" | "CI" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "XK" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LI" | "LT" | "LU" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MR" | "MU" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "NA" | "NP" | "NL" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "KP" | "NO" | "OM" | "PK" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "CG" | "RE" | "RO" | "RU" | "RW" | "BL" | "KN" | "LC" | "MF" | "VC" | "WS" | "SM" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SX" | "SK" | "SI" | "SO" | "ZA" | "KR" | "SS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SZ" | "SE" | "CH" | "TW" | "TJ" | "TZ" | "TH" | "TG" | "TO" | "TT" | "TN" | "TR" | "TM" | "UM" | "VI" | "UG" | "UA" | "AE" | "GB" | "UZ" | "VU" | "VE" | "VN" | "WF" | "EH" | "YE" | "ZM" | "ZW")[]];
26
26
  type CountryCode = (typeof COUNTRY_CODES)[number];
27
27
 
28
- interface SyncLog {
29
- lastSyncedAt: Date;
30
- }
31
-
32
28
  interface BankAccountWithLastSync extends ConfigBankAccount {
33
29
  lastSyncAt: SyncLog;
34
30
  }
35
- type ConnectorKey = 'ERSTE' | 'FINBRICKS' | 'MOCK' | 'CREDITAS' | 'MOCK_COBS' | 'FIO';
31
+ type ConnectorKey = 'ERSTE' | 'FINBRICKS' | 'MOCK' | 'CREDITAS' | 'MOCK_COBS' | 'FIO' | 'MONETA';
36
32
  interface ConfigBankAccount {
37
33
  connectorKey: ConnectorKey;
38
34
  id: string;
@@ -51,6 +47,10 @@ interface ConfigEnvironmentBankAccount {
51
47
  productionAccounts: ConfigBankAccount[];
52
48
  }
53
49
 
50
+ interface SyncLog {
51
+ lastSyncedAt: Date;
52
+ }
53
+
54
54
  type WithStatus<T extends {
55
55
  status: PaymentStatus;
56
56
  }, S extends PaymentStatus> = Omit<T, 'status'> & {
@@ -77,9 +77,15 @@ type AuthInput = {
77
77
  token: string;
78
78
  refreshToken?: string;
79
79
  };
80
+ type AccountConnection = {
81
+ clientId: string;
82
+ redirectUrl: string;
83
+ };
80
84
  declare abstract class IBankConnector {
81
85
  abstract connectorKey: ConnectorKey;
82
86
  abstract authenticate(code: AuthInput): Promise<string>;
87
+ abstract connectUserAccount(): Promise<AccountConnection>;
88
+ abstract listAccounts(): Promise<[]>;
83
89
  abstract preparePayment(payment: IncomingPaymentMessage): Promise<PaymentPreparedInsertType>;
84
90
  abstract initiateBatchFromPayments({ payments, }: {
85
91
  payments: PaymentPreparedInsertType[];
@@ -91,6 +97,12 @@ declare abstract class IBankConnector {
91
97
  db: DrizzleD1Database<typeof tables>;
92
98
  env: Environment;
93
99
  }): Promise<PaymentInsertType[]>;
100
+ abstract getPaymentStatus({ paymentId, }: {
101
+ paymentId: string;
102
+ }): Promise<PaymentStatus>;
103
+ abstract getBatchStatus({ batchId, }: {
104
+ batchId: string;
105
+ }): Promise<BatchStatus>;
94
106
  }
95
107
 
96
108
  interface IncomingPaymentMessage extends PaymentInsertType {
@@ -98,5 +110,5 @@ interface IncomingPaymentMessage extends PaymentInsertType {
98
110
  interface OutgoingPaymentMessage extends PaymentInsertType {
99
111
  }
100
112
 
101
- export { IBankConnector as I, BATCH_STATUSES as l, PAYMENT_TYPES as n, PAYMENT_STATUSES as q, PAYMENT_DIRECTIONS as s, COUNTRY_CODES as u };
102
- export type { AuthInput as A, BankAccountWithLastSync as B, ConfigEnvironmentBankAccount as C, OutgoingPaymentMessage as O, PaymentPreparedInsertType as P, SyncLog as S, ConfigBankAccount as a, ConnectorKey as b, CurrencyCode as c, BankCode as d, CountryCode as e, IncomingPaymentMessage as f, InitiatedBatch as g, InitiatedPayment as h, BatchMetadata as i, Currency as j, PaymentFailedInsertType as k, BatchStatus as m, PaymentType as o, paymentInitializedInsertType as p, PaymentStatus as r, PaymentDirection as t };
113
+ export { IBankConnector as I, BATCH_STATUSES as o, PAYMENT_TYPES as q, PAYMENT_STATUSES as s, PAYMENT_DIRECTIONS as t, COUNTRY_CODES as v };
114
+ export type { AccountConnection as A, BankAccountWithLastSync as B, ConfigEnvironmentBankAccount as C, OutgoingPaymentMessage as O, PaymentPreparedInsertType as P, SyncLog as S, ConfigBankAccount as a, ConnectorKey as b, CurrencyCode as c, BankCode as d, CountryCode as e, AuthInput as f, IncomingPaymentMessage as g, InitiatedBatch as h, InitiatedPayment as i, PaymentStatus as j, BatchStatus as k, BatchMetadata as l, Currency as m, PaymentFailedInsertType as n, paymentInitializedInsertType as p, PaymentType as r, PaymentDirection as u };
@@ -3,7 +3,9 @@ interface BankServiceEnvironmentConfig {
3
3
  max_batch_size?: number;
4
4
  max_batch_timeout?: number;
5
5
  };
6
- triggers: string[];
6
+ triggers: {
7
+ crons: string[];
8
+ };
7
9
  kv: {
8
10
  id: string;
9
11
  };