@develit-services/bank 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/export/worker.cjs +12 -4
- package/dist/export/worker.mjs +12 -4
- package/dist/export/workflows.cjs +19 -8
- package/dist/export/workflows.mjs +19 -8
- package/dist/export/wrangler.cjs +12 -7
- package/dist/export/wrangler.d.cts +4 -5
- package/dist/export/wrangler.d.mts +4 -5
- package/dist/export/wrangler.d.ts +4 -5
- package/dist/export/wrangler.mjs +12 -7
- package/dist/shared/{bank.DinCwx0P.mjs → bank.B-ZnLUcL.mjs} +36 -18
- package/dist/shared/{bank.CfSZTfWS.cjs → bank.BJroS_i3.cjs} +36 -18
- package/dist/types.cjs +1 -1
- package/dist/types.mjs +1 -1
- package/package.json +3 -3
package/dist/export/worker.cjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const backendSdk = require('@develit-io/backend-sdk');
|
|
4
|
+
const drizzle = require('../shared/bank.DEvSNsEs.cjs');
|
|
4
5
|
const cloudflare_workers = require('cloudflare:workers');
|
|
5
6
|
const d1 = require('drizzle-orm/d1');
|
|
6
|
-
const drizzle = require('../shared/bank.DEvSNsEs.cjs');
|
|
7
|
-
const mock_connector = require('../shared/bank.CfSZTfWS.cjs');
|
|
8
7
|
const zod = require('zod');
|
|
9
8
|
const payment_schema = require('../shared/bank.BeIpkWR-.cjs');
|
|
10
9
|
const generalCodes = require('@develit-io/general-codes');
|
|
@@ -12,6 +11,7 @@ require('date-fns');
|
|
|
12
11
|
require('jose');
|
|
13
12
|
const drizzleOrm = require('drizzle-orm');
|
|
14
13
|
require('node:crypto');
|
|
14
|
+
const mock_connector = require('../shared/bank.BJroS_i3.cjs');
|
|
15
15
|
require('../shared/bank.c38V_FCq.cjs');
|
|
16
16
|
require('drizzle-orm/relations');
|
|
17
17
|
require('drizzle-orm/sqlite-core');
|
|
@@ -455,7 +455,11 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
|
|
|
455
455
|
}
|
|
456
456
|
let connectedAccounts = [];
|
|
457
457
|
if (!skipAccounts) {
|
|
458
|
-
const encryptionKey = await drizzle.importAesKey(
|
|
458
|
+
const encryptionKey = await drizzle.importAesKey(
|
|
459
|
+
(await this.env.SECRETS_STORE.get({
|
|
460
|
+
secretName: "BANK_SERVICE_ENCRYPTION_KEY"
|
|
461
|
+
})).data?.secretValue || ""
|
|
462
|
+
);
|
|
459
463
|
const accounts = await this._getConnectedAccounts();
|
|
460
464
|
const accountsForConnector = accounts.filter(
|
|
461
465
|
(acc) => acc.connectorKey === connectorKey
|
|
@@ -906,7 +910,11 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
|
|
|
906
910
|
accountId: acc.id
|
|
907
911
|
}).command
|
|
908
912
|
);
|
|
909
|
-
const encryptionKey = await drizzle.importAesKey(
|
|
913
|
+
const encryptionKey = await drizzle.importAesKey(
|
|
914
|
+
(await this.env.SECRETS_STORE.get({
|
|
915
|
+
secretName: "BANK_SERVICE_ENCRYPTION_KEY"
|
|
916
|
+
})).data?.secretValue || ""
|
|
917
|
+
);
|
|
910
918
|
const createAccountCredentials = (await Promise.all(
|
|
911
919
|
credentials.map(
|
|
912
920
|
async (cr) => createAccountCredentialsCommand(this.db, encryptionKey, {
|
package/dist/export/worker.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { uuidv4, first, bankAccountMetadataSchema, workflowInstanceStatusSchema, develitWorker, createInternalError, action, service } from '@develit-io/backend-sdk';
|
|
2
|
+
import { t as tables, e as encrypt, i as importAesKey, b as getCredentialsByAccountId, u as upsertBatchCommand, g as getBatchByIdQuery, d as createPaymentCommand, a as getAccountByIdQuery } from '../shared/bank.B51e8oDT.mjs';
|
|
2
3
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
3
4
|
import { drizzle } from 'drizzle-orm/d1';
|
|
4
|
-
import { t as tables, e as encrypt, i as importAesKey, b as getCredentialsByAccountId, u as upsertBatchCommand, g as getBatchByIdQuery, d as createPaymentCommand, a as getAccountByIdQuery } from '../shared/bank.B51e8oDT.mjs';
|
|
5
|
-
import { i as initiateConnector, t as toIncomingPayment, d as assignAccount, e as toBatchedPayment } from '../shared/bank.DinCwx0P.mjs';
|
|
6
5
|
import { z } from 'zod';
|
|
7
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.qc8ALZwm.mjs';
|
|
8
7
|
import { CURRENCY_CODES } from '@develit-io/general-codes';
|
|
@@ -10,6 +9,7 @@ import 'date-fns';
|
|
|
10
9
|
import 'jose';
|
|
11
10
|
import { eq, sql, inArray, and, asc, desc, gte, lte } from 'drizzle-orm';
|
|
12
11
|
import 'node:crypto';
|
|
12
|
+
import { i as initiateConnector, t as toIncomingPayment, d as assignAccount, e as toBatchedPayment } from '../shared/bank.B-ZnLUcL.mjs';
|
|
13
13
|
import '../shared/bank.BUSlmr6r.mjs';
|
|
14
14
|
import 'drizzle-orm/relations';
|
|
15
15
|
import 'drizzle-orm/sqlite-core';
|
|
@@ -453,7 +453,11 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
|
|
|
453
453
|
}
|
|
454
454
|
let connectedAccounts = [];
|
|
455
455
|
if (!skipAccounts) {
|
|
456
|
-
const encryptionKey = await importAesKey(
|
|
456
|
+
const encryptionKey = await importAesKey(
|
|
457
|
+
(await this.env.SECRETS_STORE.get({
|
|
458
|
+
secretName: "BANK_SERVICE_ENCRYPTION_KEY"
|
|
459
|
+
})).data?.secretValue || ""
|
|
460
|
+
);
|
|
457
461
|
const accounts = await this._getConnectedAccounts();
|
|
458
462
|
const accountsForConnector = accounts.filter(
|
|
459
463
|
(acc) => acc.connectorKey === connectorKey
|
|
@@ -904,7 +908,11 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
|
|
|
904
908
|
accountId: acc.id
|
|
905
909
|
}).command
|
|
906
910
|
);
|
|
907
|
-
const encryptionKey = await importAesKey(
|
|
911
|
+
const encryptionKey = await importAesKey(
|
|
912
|
+
(await this.env.SECRETS_STORE.get({
|
|
913
|
+
secretName: "BANK_SERVICE_ENCRYPTION_KEY"
|
|
914
|
+
})).data?.secretValue || ""
|
|
915
|
+
);
|
|
908
916
|
const createAccountCredentials = (await Promise.all(
|
|
909
917
|
credentials.map(
|
|
910
918
|
async (cr) => createAccountCredentialsCommand(this.db, encryptionKey, {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const backendSdk = require('@develit-io/backend-sdk');
|
|
4
|
-
const cloudflare_workers = require('cloudflare:workers');
|
|
5
|
-
const cloudflare_workflows = require('cloudflare:workflows');
|
|
6
|
-
const d1 = require('drizzle-orm/d1');
|
|
7
4
|
const drizzle = require('../shared/bank.DEvSNsEs.cjs');
|
|
8
5
|
const batchLifecycle = require('../shared/bank.Bg3Pdwm4.cjs');
|
|
9
|
-
const mock_connector = require('../shared/bank.
|
|
6
|
+
const mock_connector = require('../shared/bank.BJroS_i3.cjs');
|
|
10
7
|
const drizzleOrm = require('drizzle-orm');
|
|
8
|
+
const cloudflare_workers = require('cloudflare:workers');
|
|
9
|
+
const cloudflare_workflows = require('cloudflare:workflows');
|
|
10
|
+
const d1 = require('drizzle-orm/d1');
|
|
11
11
|
require('../shared/bank.c38V_FCq.cjs');
|
|
12
12
|
require('../shared/bank.BeIpkWR-.cjs');
|
|
13
13
|
require('drizzle-orm/relations');
|
|
@@ -98,7 +98,11 @@ class BankProcessBatch extends cloudflare_workers.WorkflowEntrypoint {
|
|
|
98
98
|
if (!account) {
|
|
99
99
|
throw new cloudflare_workflows.NonRetryableError(`Account not found: ${batch.accountId}`);
|
|
100
100
|
}
|
|
101
|
-
const encryptionKey = await drizzle.importAesKey(
|
|
101
|
+
const encryptionKey = await drizzle.importAesKey(
|
|
102
|
+
(await this.env.SECRETS_STORE.get({
|
|
103
|
+
secretName: "BANK_SERVICE_ENCRYPTION_KEY"
|
|
104
|
+
})).data?.secretValue || ""
|
|
105
|
+
);
|
|
102
106
|
const credentials = await drizzle.getCredentialsByAccountId(db, encryptionKey, {
|
|
103
107
|
accountId: account.id
|
|
104
108
|
});
|
|
@@ -112,7 +116,7 @@ class BankProcessBatch extends cloudflare_workers.WorkflowEntrypoint {
|
|
|
112
116
|
`Credentials have expired for account: ${account.id}`
|
|
113
117
|
);
|
|
114
118
|
}
|
|
115
|
-
const connector = mock_connector.initiateConnector({
|
|
119
|
+
const connector = await mock_connector.initiateConnector({
|
|
116
120
|
env: this.env,
|
|
117
121
|
bank: account.connectorKey,
|
|
118
122
|
connectedAccounts: [
|
|
@@ -245,6 +249,9 @@ class BankSyncAccountPayments extends cloudflare_workers.WorkflowEntrypoint {
|
|
|
245
249
|
async run(event, step) {
|
|
246
250
|
const { accountId } = event.payload;
|
|
247
251
|
const db = d1.drizzle(this.env.BANK_D1, { schema: drizzle.tables });
|
|
252
|
+
if (!accountId) {
|
|
253
|
+
throw new cloudflare_workflows.NonRetryableError(`Haven't obtained accountId to load.`);
|
|
254
|
+
}
|
|
248
255
|
while (true) {
|
|
249
256
|
const now = /* @__PURE__ */ new Date();
|
|
250
257
|
const account = await step.do("load account", async () => {
|
|
@@ -265,7 +272,11 @@ class BankSyncAccountPayments extends cloudflare_workers.WorkflowEntrypoint {
|
|
|
265
272
|
timeout: "30 seconds"
|
|
266
273
|
},
|
|
267
274
|
async () => {
|
|
268
|
-
const encryptionKey = await drizzle.importAesKey(
|
|
275
|
+
const encryptionKey = await drizzle.importAesKey(
|
|
276
|
+
(await this.env.SECRETS_STORE.get({
|
|
277
|
+
secretName: "BANK_SERVICE_ENCRYPTION_KEY"
|
|
278
|
+
})).data?.secretValue || ""
|
|
279
|
+
);
|
|
269
280
|
const credentials = await drizzle.getCredentialsByAccountId(
|
|
270
281
|
db,
|
|
271
282
|
encryptionKey,
|
|
@@ -281,7 +292,7 @@ class BankSyncAccountPayments extends cloudflare_workers.WorkflowEntrypoint {
|
|
|
281
292
|
`Credentials have expired for account: ${accountId}`
|
|
282
293
|
);
|
|
283
294
|
}
|
|
284
|
-
const connector = mock_connector.initiateConnector({
|
|
295
|
+
const connector = await mock_connector.initiateConnector({
|
|
285
296
|
env: this.env,
|
|
286
297
|
bank: account.connectorKey,
|
|
287
298
|
connectedAccounts: [
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { first, uuidv4, asNonEmpty } from '@develit-io/backend-sdk';
|
|
2
|
-
import { WorkflowEntrypoint } from 'cloudflare:workers';
|
|
3
|
-
import { NonRetryableError } from 'cloudflare:workflows';
|
|
4
|
-
import { drizzle } from 'drizzle-orm/d1';
|
|
5
2
|
import { t as tables, g as getBatchByIdQuery, c as checksum, u as upsertBatchCommand, a as getAccountByIdQuery, i as importAesKey, b as getCredentialsByAccountId, d as createPaymentCommand } from '../shared/bank.B51e8oDT.mjs';
|
|
6
3
|
import { d as isBatchSigned, j as isBatchFailed, g as isBatchOpen, a as isPaymentCompleted } from '../shared/bank.Dpx6PvkA.mjs';
|
|
7
|
-
import { f as toPreparedPayment, i as initiateConnector, g as toCompletedPayment } from '../shared/bank.
|
|
4
|
+
import { f as toPreparedPayment, i as initiateConnector, g as toCompletedPayment } from '../shared/bank.B-ZnLUcL.mjs';
|
|
8
5
|
import { eq } from 'drizzle-orm';
|
|
6
|
+
import { WorkflowEntrypoint } from 'cloudflare:workers';
|
|
7
|
+
import { NonRetryableError } from 'cloudflare:workflows';
|
|
8
|
+
import { drizzle } from 'drizzle-orm/d1';
|
|
9
9
|
import '../shared/bank.BUSlmr6r.mjs';
|
|
10
10
|
import '../shared/bank.qc8ALZwm.mjs';
|
|
11
11
|
import 'drizzle-orm/relations';
|
|
@@ -96,7 +96,11 @@ class BankProcessBatch extends WorkflowEntrypoint {
|
|
|
96
96
|
if (!account) {
|
|
97
97
|
throw new NonRetryableError(`Account not found: ${batch.accountId}`);
|
|
98
98
|
}
|
|
99
|
-
const encryptionKey = await importAesKey(
|
|
99
|
+
const encryptionKey = await importAesKey(
|
|
100
|
+
(await this.env.SECRETS_STORE.get({
|
|
101
|
+
secretName: "BANK_SERVICE_ENCRYPTION_KEY"
|
|
102
|
+
})).data?.secretValue || ""
|
|
103
|
+
);
|
|
100
104
|
const credentials = await getCredentialsByAccountId(db, encryptionKey, {
|
|
101
105
|
accountId: account.id
|
|
102
106
|
});
|
|
@@ -110,7 +114,7 @@ class BankProcessBatch extends WorkflowEntrypoint {
|
|
|
110
114
|
`Credentials have expired for account: ${account.id}`
|
|
111
115
|
);
|
|
112
116
|
}
|
|
113
|
-
const connector = initiateConnector({
|
|
117
|
+
const connector = await initiateConnector({
|
|
114
118
|
env: this.env,
|
|
115
119
|
bank: account.connectorKey,
|
|
116
120
|
connectedAccounts: [
|
|
@@ -243,6 +247,9 @@ class BankSyncAccountPayments extends WorkflowEntrypoint {
|
|
|
243
247
|
async run(event, step) {
|
|
244
248
|
const { accountId } = event.payload;
|
|
245
249
|
const db = drizzle(this.env.BANK_D1, { schema: tables });
|
|
250
|
+
if (!accountId) {
|
|
251
|
+
throw new NonRetryableError(`Haven't obtained accountId to load.`);
|
|
252
|
+
}
|
|
246
253
|
while (true) {
|
|
247
254
|
const now = /* @__PURE__ */ new Date();
|
|
248
255
|
const account = await step.do("load account", async () => {
|
|
@@ -263,7 +270,11 @@ class BankSyncAccountPayments extends WorkflowEntrypoint {
|
|
|
263
270
|
timeout: "30 seconds"
|
|
264
271
|
},
|
|
265
272
|
async () => {
|
|
266
|
-
const encryptionKey = await importAesKey(
|
|
273
|
+
const encryptionKey = await importAesKey(
|
|
274
|
+
(await this.env.SECRETS_STORE.get({
|
|
275
|
+
secretName: "BANK_SERVICE_ENCRYPTION_KEY"
|
|
276
|
+
})).data?.secretValue || ""
|
|
277
|
+
);
|
|
267
278
|
const credentials = await getCredentialsByAccountId(
|
|
268
279
|
db,
|
|
269
280
|
encryptionKey,
|
|
@@ -279,7 +290,7 @@ class BankSyncAccountPayments extends WorkflowEntrypoint {
|
|
|
279
290
|
`Credentials have expired for account: ${accountId}`
|
|
280
291
|
);
|
|
281
292
|
}
|
|
282
|
-
const connector = initiateConnector({
|
|
293
|
+
const connector = await initiateConnector({
|
|
283
294
|
env: this.env,
|
|
284
295
|
bank: account.connectorKey,
|
|
285
296
|
connectedAccounts: [
|
package/dist/export/wrangler.cjs
CHANGED
|
@@ -10,16 +10,15 @@ function defineBankServiceWrangler(config) {
|
|
|
10
10
|
name
|
|
11
11
|
}),
|
|
12
12
|
vars: {
|
|
13
|
-
// Secrets
|
|
14
|
-
ENCRYPTION_KEY: "[SECRET]",
|
|
15
|
-
FINBRICKS_PRIVATE_KEY_PEM: "[SECRET]",
|
|
16
|
-
ERSTE_API_KEY: "[SECRET]",
|
|
17
|
-
ERSTE_CLIENT_SECRET: "[SECRET]",
|
|
18
|
-
ERSTE_CLIENT_ID: "[SECRET]",
|
|
19
|
-
// Variables
|
|
20
13
|
...envs.local.vars,
|
|
21
14
|
ENVIRONMENT: "localhost"
|
|
22
15
|
},
|
|
16
|
+
services: [
|
|
17
|
+
{
|
|
18
|
+
binding: "SECRETS_STORE",
|
|
19
|
+
service: `${project}-secrets-store`
|
|
20
|
+
}
|
|
21
|
+
],
|
|
23
22
|
triggers: envs.local.triggers,
|
|
24
23
|
kv_namespaces: [
|
|
25
24
|
{
|
|
@@ -81,6 +80,12 @@ function defineBankServiceWrangler(config) {
|
|
|
81
80
|
...envCfg.vars,
|
|
82
81
|
ENVIRONMENT: envName
|
|
83
82
|
},
|
|
83
|
+
services: [
|
|
84
|
+
{
|
|
85
|
+
binding: "SECRETS_STORE",
|
|
86
|
+
service: `${project}-secrets-store-${envName}`
|
|
87
|
+
}
|
|
88
|
+
],
|
|
84
89
|
triggers: envs.local.triggers,
|
|
85
90
|
d1_databases: [
|
|
86
91
|
{
|
|
@@ -14,12 +14,11 @@ declare function defineBankServiceWrangler(config: BankServiceWranglerConfig): {
|
|
|
14
14
|
DBUCS_BASE_URI: string;
|
|
15
15
|
DBUCS_USERNAME: string;
|
|
16
16
|
REDIRECT_URI: string;
|
|
17
|
-
ENCRYPTION_KEY: string;
|
|
18
|
-
FINBRICKS_PRIVATE_KEY_PEM: string;
|
|
19
|
-
ERSTE_API_KEY: string;
|
|
20
|
-
ERSTE_CLIENT_SECRET: string;
|
|
21
|
-
ERSTE_CLIENT_ID: string;
|
|
22
17
|
};
|
|
18
|
+
services: {
|
|
19
|
+
binding: string;
|
|
20
|
+
service: string;
|
|
21
|
+
}[];
|
|
23
22
|
triggers: {
|
|
24
23
|
crons: string[];
|
|
25
24
|
};
|
|
@@ -14,12 +14,11 @@ declare function defineBankServiceWrangler(config: BankServiceWranglerConfig): {
|
|
|
14
14
|
DBUCS_BASE_URI: string;
|
|
15
15
|
DBUCS_USERNAME: string;
|
|
16
16
|
REDIRECT_URI: string;
|
|
17
|
-
ENCRYPTION_KEY: string;
|
|
18
|
-
FINBRICKS_PRIVATE_KEY_PEM: string;
|
|
19
|
-
ERSTE_API_KEY: string;
|
|
20
|
-
ERSTE_CLIENT_SECRET: string;
|
|
21
|
-
ERSTE_CLIENT_ID: string;
|
|
22
17
|
};
|
|
18
|
+
services: {
|
|
19
|
+
binding: string;
|
|
20
|
+
service: string;
|
|
21
|
+
}[];
|
|
23
22
|
triggers: {
|
|
24
23
|
crons: string[];
|
|
25
24
|
};
|
|
@@ -14,12 +14,11 @@ declare function defineBankServiceWrangler(config: BankServiceWranglerConfig): {
|
|
|
14
14
|
DBUCS_BASE_URI: string;
|
|
15
15
|
DBUCS_USERNAME: string;
|
|
16
16
|
REDIRECT_URI: string;
|
|
17
|
-
ENCRYPTION_KEY: string;
|
|
18
|
-
FINBRICKS_PRIVATE_KEY_PEM: string;
|
|
19
|
-
ERSTE_API_KEY: string;
|
|
20
|
-
ERSTE_CLIENT_SECRET: string;
|
|
21
|
-
ERSTE_CLIENT_ID: string;
|
|
22
17
|
};
|
|
18
|
+
services: {
|
|
19
|
+
binding: string;
|
|
20
|
+
service: string;
|
|
21
|
+
}[];
|
|
23
22
|
triggers: {
|
|
24
23
|
crons: string[];
|
|
25
24
|
};
|
package/dist/export/wrangler.mjs
CHANGED
|
@@ -8,16 +8,15 @@ function defineBankServiceWrangler(config) {
|
|
|
8
8
|
name
|
|
9
9
|
}),
|
|
10
10
|
vars: {
|
|
11
|
-
// Secrets
|
|
12
|
-
ENCRYPTION_KEY: "[SECRET]",
|
|
13
|
-
FINBRICKS_PRIVATE_KEY_PEM: "[SECRET]",
|
|
14
|
-
ERSTE_API_KEY: "[SECRET]",
|
|
15
|
-
ERSTE_CLIENT_SECRET: "[SECRET]",
|
|
16
|
-
ERSTE_CLIENT_ID: "[SECRET]",
|
|
17
|
-
// Variables
|
|
18
11
|
...envs.local.vars,
|
|
19
12
|
ENVIRONMENT: "localhost"
|
|
20
13
|
},
|
|
14
|
+
services: [
|
|
15
|
+
{
|
|
16
|
+
binding: "SECRETS_STORE",
|
|
17
|
+
service: `${project}-secrets-store`
|
|
18
|
+
}
|
|
19
|
+
],
|
|
21
20
|
triggers: envs.local.triggers,
|
|
22
21
|
kv_namespaces: [
|
|
23
22
|
{
|
|
@@ -79,6 +78,12 @@ function defineBankServiceWrangler(config) {
|
|
|
79
78
|
...envCfg.vars,
|
|
80
79
|
ENVIRONMENT: envName
|
|
81
80
|
},
|
|
81
|
+
services: [
|
|
82
|
+
{
|
|
83
|
+
binding: "SECRETS_STORE",
|
|
84
|
+
service: `${project}-secrets-store-${envName}`
|
|
85
|
+
}
|
|
86
|
+
],
|
|
82
87
|
triggers: envs.local.triggers,
|
|
83
88
|
d1_databases: [
|
|
84
89
|
{
|
|
@@ -748,27 +748,27 @@ class FinbricksConnector extends IBankConnector {
|
|
|
748
748
|
}
|
|
749
749
|
}
|
|
750
750
|
|
|
751
|
-
class
|
|
751
|
+
class AirBankConnector extends FinbricksConnector {
|
|
752
752
|
constructor(config) {
|
|
753
|
-
super("
|
|
753
|
+
super("AIRBANK", config);
|
|
754
754
|
}
|
|
755
755
|
}
|
|
756
756
|
|
|
757
|
-
class
|
|
757
|
+
class CreditasConnector extends FinbricksConnector {
|
|
758
758
|
constructor(config) {
|
|
759
|
-
super("
|
|
759
|
+
super("CREDITAS", config);
|
|
760
760
|
}
|
|
761
761
|
}
|
|
762
762
|
|
|
763
|
-
class
|
|
763
|
+
class CSASConnector extends FinbricksConnector {
|
|
764
764
|
constructor(config) {
|
|
765
|
-
super("
|
|
765
|
+
super("CSAS", config);
|
|
766
766
|
}
|
|
767
767
|
}
|
|
768
768
|
|
|
769
|
-
class
|
|
769
|
+
class FioConnector extends FinbricksConnector {
|
|
770
770
|
constructor(config) {
|
|
771
|
-
super("
|
|
771
|
+
super("FIO", config);
|
|
772
772
|
}
|
|
773
773
|
}
|
|
774
774
|
|
|
@@ -786,7 +786,7 @@ const getPaymentDirection = (payment, iban) => {
|
|
|
786
786
|
return "OUTGOING";
|
|
787
787
|
};
|
|
788
788
|
|
|
789
|
-
const initiateConnector = ({
|
|
789
|
+
const initiateConnector = async ({
|
|
790
790
|
bank,
|
|
791
791
|
env,
|
|
792
792
|
connectedAccounts
|
|
@@ -794,9 +794,15 @@ const initiateConnector = ({
|
|
|
794
794
|
switch (bank) {
|
|
795
795
|
case "ERSTE":
|
|
796
796
|
return new ErsteConnector({
|
|
797
|
-
API_KEY: env.
|
|
798
|
-
|
|
799
|
-
|
|
797
|
+
API_KEY: (await env.SECRETS_STORE.get({
|
|
798
|
+
secretName: "BANK_SERVICE_ERSTE_API_KEY"
|
|
799
|
+
})).data?.secretValue || "",
|
|
800
|
+
CLIENT_ID: (await env.SECRETS_STORE.get({
|
|
801
|
+
secretName: "BANK_SERVICE_ERSTE_CLIENT_ID"
|
|
802
|
+
})).data?.secretValue || "",
|
|
803
|
+
CLIENT_SECRET: (await env.SECRETS_STORE.get({
|
|
804
|
+
secretName: "BANK_SERVICE_ERSTE_CLIENT_SECRET"
|
|
805
|
+
})).data?.secretValue || "",
|
|
800
806
|
REDIRECT_URI: env.REDIRECT_URI,
|
|
801
807
|
AUTH_URI: env.ERSTE_AUTH_URI,
|
|
802
808
|
PAYMENTS_URI: env.ERSTE_PAYMENTS_URI,
|
|
@@ -807,7 +813,9 @@ const initiateConnector = ({
|
|
|
807
813
|
return new CreditasConnector({
|
|
808
814
|
BASE_URI: env.FINBRICKS_BASE_URI,
|
|
809
815
|
MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
|
|
810
|
-
PRIVATE_KEY_PEM: env.
|
|
816
|
+
PRIVATE_KEY_PEM: (await env.SECRETS_STORE.get({
|
|
817
|
+
secretName: "BANK_SERVICE_FINBRICKS_PRIVATE_KEY_PEM"
|
|
818
|
+
})).data?.secretValue || "",
|
|
811
819
|
REDIRECT_URI: env.REDIRECT_URI,
|
|
812
820
|
connectedAccounts
|
|
813
821
|
});
|
|
@@ -815,7 +823,9 @@ const initiateConnector = ({
|
|
|
815
823
|
return new MockCobsConnector({
|
|
816
824
|
BASE_URI: env.FINBRICKS_BASE_URI,
|
|
817
825
|
MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
|
|
818
|
-
PRIVATE_KEY_PEM: env.
|
|
826
|
+
PRIVATE_KEY_PEM: (await env.SECRETS_STORE.get({
|
|
827
|
+
secretName: "BANK_SERVICE_FINBRICKS_PRIVATE_KEY_PEM"
|
|
828
|
+
})).data?.secretValue || "",
|
|
819
829
|
REDIRECT_URI: env.REDIRECT_URI,
|
|
820
830
|
connectedAccounts
|
|
821
831
|
});
|
|
@@ -823,7 +833,9 @@ const initiateConnector = ({
|
|
|
823
833
|
return new FioConnector({
|
|
824
834
|
BASE_URI: env.FINBRICKS_BASE_URI,
|
|
825
835
|
MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
|
|
826
|
-
PRIVATE_KEY_PEM: env.
|
|
836
|
+
PRIVATE_KEY_PEM: (await env.SECRETS_STORE.get({
|
|
837
|
+
secretName: "BANK_SERVICE_FINBRICKS_PRIVATE_KEY_PEM"
|
|
838
|
+
})).data?.secretValue || "",
|
|
827
839
|
REDIRECT_URI: env.REDIRECT_URI,
|
|
828
840
|
connectedAccounts
|
|
829
841
|
});
|
|
@@ -831,7 +843,9 @@ const initiateConnector = ({
|
|
|
831
843
|
return new MonetaConnector({
|
|
832
844
|
BASE_URI: env.FINBRICKS_BASE_URI,
|
|
833
845
|
MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
|
|
834
|
-
PRIVATE_KEY_PEM: env.
|
|
846
|
+
PRIVATE_KEY_PEM: (await env.SECRETS_STORE.get({
|
|
847
|
+
secretName: "BANK_SERVICE_FINBRICKS_PRIVATE_KEY_PEM"
|
|
848
|
+
})).data?.secretValue || "",
|
|
835
849
|
REDIRECT_URI: env.REDIRECT_URI,
|
|
836
850
|
connectedAccounts
|
|
837
851
|
});
|
|
@@ -839,7 +853,9 @@ const initiateConnector = ({
|
|
|
839
853
|
return new AirBankConnector({
|
|
840
854
|
BASE_URI: env.FINBRICKS_BASE_URI,
|
|
841
855
|
MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
|
|
842
|
-
PRIVATE_KEY_PEM: env.
|
|
856
|
+
PRIVATE_KEY_PEM: (await env.SECRETS_STORE.get({
|
|
857
|
+
secretName: "BANK_SERVICE_FINBRICKS_PRIVATE_KEY_PEM"
|
|
858
|
+
})).data?.secretValue || "",
|
|
843
859
|
REDIRECT_URI: env.REDIRECT_URI,
|
|
844
860
|
connectedAccounts
|
|
845
861
|
});
|
|
@@ -847,7 +863,9 @@ const initiateConnector = ({
|
|
|
847
863
|
return new CSASConnector({
|
|
848
864
|
BASE_URI: env.FINBRICKS_BASE_URI,
|
|
849
865
|
MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
|
|
850
|
-
PRIVATE_KEY_PEM: env.
|
|
866
|
+
PRIVATE_KEY_PEM: (await env.SECRETS_STORE.get({
|
|
867
|
+
secretName: "BANK_SERVICE_FINBRICKS_PRIVATE_KEY_PEM"
|
|
868
|
+
})).data?.secretValue || "",
|
|
851
869
|
REDIRECT_URI: env.REDIRECT_URI,
|
|
852
870
|
connectedAccounts
|
|
853
871
|
});
|
|
@@ -750,27 +750,27 @@ class FinbricksConnector extends IBankConnector {
|
|
|
750
750
|
}
|
|
751
751
|
}
|
|
752
752
|
|
|
753
|
-
class
|
|
753
|
+
class AirBankConnector extends FinbricksConnector {
|
|
754
754
|
constructor(config) {
|
|
755
|
-
super("
|
|
755
|
+
super("AIRBANK", config);
|
|
756
756
|
}
|
|
757
757
|
}
|
|
758
758
|
|
|
759
|
-
class
|
|
759
|
+
class CreditasConnector extends FinbricksConnector {
|
|
760
760
|
constructor(config) {
|
|
761
|
-
super("
|
|
761
|
+
super("CREDITAS", config);
|
|
762
762
|
}
|
|
763
763
|
}
|
|
764
764
|
|
|
765
|
-
class
|
|
765
|
+
class CSASConnector extends FinbricksConnector {
|
|
766
766
|
constructor(config) {
|
|
767
|
-
super("
|
|
767
|
+
super("CSAS", config);
|
|
768
768
|
}
|
|
769
769
|
}
|
|
770
770
|
|
|
771
|
-
class
|
|
771
|
+
class FioConnector extends FinbricksConnector {
|
|
772
772
|
constructor(config) {
|
|
773
|
-
super("
|
|
773
|
+
super("FIO", config);
|
|
774
774
|
}
|
|
775
775
|
}
|
|
776
776
|
|
|
@@ -788,7 +788,7 @@ const getPaymentDirection = (payment, iban) => {
|
|
|
788
788
|
return "OUTGOING";
|
|
789
789
|
};
|
|
790
790
|
|
|
791
|
-
const initiateConnector = ({
|
|
791
|
+
const initiateConnector = async ({
|
|
792
792
|
bank,
|
|
793
793
|
env,
|
|
794
794
|
connectedAccounts
|
|
@@ -796,9 +796,15 @@ const initiateConnector = ({
|
|
|
796
796
|
switch (bank) {
|
|
797
797
|
case "ERSTE":
|
|
798
798
|
return new ErsteConnector({
|
|
799
|
-
API_KEY: env.
|
|
800
|
-
|
|
801
|
-
|
|
799
|
+
API_KEY: (await env.SECRETS_STORE.get({
|
|
800
|
+
secretName: "BANK_SERVICE_ERSTE_API_KEY"
|
|
801
|
+
})).data?.secretValue || "",
|
|
802
|
+
CLIENT_ID: (await env.SECRETS_STORE.get({
|
|
803
|
+
secretName: "BANK_SERVICE_ERSTE_CLIENT_ID"
|
|
804
|
+
})).data?.secretValue || "",
|
|
805
|
+
CLIENT_SECRET: (await env.SECRETS_STORE.get({
|
|
806
|
+
secretName: "BANK_SERVICE_ERSTE_CLIENT_SECRET"
|
|
807
|
+
})).data?.secretValue || "",
|
|
802
808
|
REDIRECT_URI: env.REDIRECT_URI,
|
|
803
809
|
AUTH_URI: env.ERSTE_AUTH_URI,
|
|
804
810
|
PAYMENTS_URI: env.ERSTE_PAYMENTS_URI,
|
|
@@ -809,7 +815,9 @@ const initiateConnector = ({
|
|
|
809
815
|
return new CreditasConnector({
|
|
810
816
|
BASE_URI: env.FINBRICKS_BASE_URI,
|
|
811
817
|
MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
|
|
812
|
-
PRIVATE_KEY_PEM: env.
|
|
818
|
+
PRIVATE_KEY_PEM: (await env.SECRETS_STORE.get({
|
|
819
|
+
secretName: "BANK_SERVICE_FINBRICKS_PRIVATE_KEY_PEM"
|
|
820
|
+
})).data?.secretValue || "",
|
|
813
821
|
REDIRECT_URI: env.REDIRECT_URI,
|
|
814
822
|
connectedAccounts
|
|
815
823
|
});
|
|
@@ -817,7 +825,9 @@ const initiateConnector = ({
|
|
|
817
825
|
return new MockCobsConnector({
|
|
818
826
|
BASE_URI: env.FINBRICKS_BASE_URI,
|
|
819
827
|
MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
|
|
820
|
-
PRIVATE_KEY_PEM: env.
|
|
828
|
+
PRIVATE_KEY_PEM: (await env.SECRETS_STORE.get({
|
|
829
|
+
secretName: "BANK_SERVICE_FINBRICKS_PRIVATE_KEY_PEM"
|
|
830
|
+
})).data?.secretValue || "",
|
|
821
831
|
REDIRECT_URI: env.REDIRECT_URI,
|
|
822
832
|
connectedAccounts
|
|
823
833
|
});
|
|
@@ -825,7 +835,9 @@ const initiateConnector = ({
|
|
|
825
835
|
return new FioConnector({
|
|
826
836
|
BASE_URI: env.FINBRICKS_BASE_URI,
|
|
827
837
|
MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
|
|
828
|
-
PRIVATE_KEY_PEM: env.
|
|
838
|
+
PRIVATE_KEY_PEM: (await env.SECRETS_STORE.get({
|
|
839
|
+
secretName: "BANK_SERVICE_FINBRICKS_PRIVATE_KEY_PEM"
|
|
840
|
+
})).data?.secretValue || "",
|
|
829
841
|
REDIRECT_URI: env.REDIRECT_URI,
|
|
830
842
|
connectedAccounts
|
|
831
843
|
});
|
|
@@ -833,7 +845,9 @@ const initiateConnector = ({
|
|
|
833
845
|
return new MonetaConnector({
|
|
834
846
|
BASE_URI: env.FINBRICKS_BASE_URI,
|
|
835
847
|
MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
|
|
836
|
-
PRIVATE_KEY_PEM: env.
|
|
848
|
+
PRIVATE_KEY_PEM: (await env.SECRETS_STORE.get({
|
|
849
|
+
secretName: "BANK_SERVICE_FINBRICKS_PRIVATE_KEY_PEM"
|
|
850
|
+
})).data?.secretValue || "",
|
|
837
851
|
REDIRECT_URI: env.REDIRECT_URI,
|
|
838
852
|
connectedAccounts
|
|
839
853
|
});
|
|
@@ -841,7 +855,9 @@ const initiateConnector = ({
|
|
|
841
855
|
return new AirBankConnector({
|
|
842
856
|
BASE_URI: env.FINBRICKS_BASE_URI,
|
|
843
857
|
MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
|
|
844
|
-
PRIVATE_KEY_PEM: env.
|
|
858
|
+
PRIVATE_KEY_PEM: (await env.SECRETS_STORE.get({
|
|
859
|
+
secretName: "BANK_SERVICE_FINBRICKS_PRIVATE_KEY_PEM"
|
|
860
|
+
})).data?.secretValue || "",
|
|
845
861
|
REDIRECT_URI: env.REDIRECT_URI,
|
|
846
862
|
connectedAccounts
|
|
847
863
|
});
|
|
@@ -849,7 +865,9 @@ const initiateConnector = ({
|
|
|
849
865
|
return new CSASConnector({
|
|
850
866
|
BASE_URI: env.FINBRICKS_BASE_URI,
|
|
851
867
|
MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
|
|
852
|
-
PRIVATE_KEY_PEM: env.
|
|
868
|
+
PRIVATE_KEY_PEM: (await env.SECRETS_STORE.get({
|
|
869
|
+
secretName: "BANK_SERVICE_FINBRICKS_PRIVATE_KEY_PEM"
|
|
870
|
+
})).data?.secretValue || "",
|
|
853
871
|
REDIRECT_URI: env.REDIRECT_URI,
|
|
854
872
|
connectedAccounts
|
|
855
873
|
});
|
package/dist/types.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const mock_connector = require('./shared/bank.
|
|
3
|
+
const mock_connector = require('./shared/bank.BJroS_i3.cjs');
|
|
4
4
|
const payment_schema = require('./shared/bank.BeIpkWR-.cjs');
|
|
5
5
|
const batchLifecycle = require('./shared/bank.Bg3Pdwm4.cjs');
|
|
6
6
|
const generalCodes = require('@develit-io/general-codes');
|
package/dist/types.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { D as DbuConnector, E as ErsteConnector, c as FINBRICKS_ENDPOINTS, b as FinbricksClient, F as FinbricksConnector, I as IBankConnector, M as MockCobsConnector, a as MockConnector, d as assignAccount, h as batchTransform, s as signFinbricksJws, e as toBatchedPayment, g as toCompletedPayment, t as toIncomingPayment, f as toPreparedPayment, u as useFinbricksFetch } from './shared/bank.
|
|
1
|
+
export { D as DbuConnector, E as ErsteConnector, c as FINBRICKS_ENDPOINTS, b as FinbricksClient, F as FinbricksConnector, I as IBankConnector, M as MockCobsConnector, a as MockConnector, d as assignAccount, h as batchTransform, s as signFinbricksJws, e as toBatchedPayment, g as toCompletedPayment, t as toIncomingPayment, f as toPreparedPayment, u as useFinbricksFetch } from './shared/bank.B-ZnLUcL.mjs';
|
|
2
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.qc8ALZwm.mjs';
|
|
3
3
|
export { h as hasPaymentAccountAssigned, f as isBatchCompleted, j as isBatchFailed, b as isBatchInitiated, g as isBatchOpen, e as isBatchProcessing, c as isBatchReadyToSign, d as isBatchSigned, a as isPaymentCompleted, i as isPaymentPrepared } from './shared/bank.Dpx6PvkA.mjs';
|
|
4
4
|
export { BANK_CODES, CURRENCY_CODES } from '@develit-io/general-codes';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@develit-services/bank",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"author": "Develit.io s.r.o.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -35,13 +35,13 @@
|
|
|
35
35
|
"./dist"
|
|
36
36
|
],
|
|
37
37
|
"scripts": {
|
|
38
|
-
"dev": "wrangler dev --port 9232 --persist-to ../../.wrangler/state",
|
|
38
|
+
"dev": "wrangler dev --port 9232 --persist-to ../../.wrangler/state -c ./wrangler.jsonc -c ../../apps/secrets-store/wrangler.jsonc",
|
|
39
39
|
"wrangler:generate": "bunx develit wrangler:generate --types",
|
|
40
40
|
"db:init": "wrangler d1 execute develit-bank --local --persist-to ../../.wrangler/state --command=\"SELECT 'Creating database...' AS status;\"",
|
|
41
41
|
"db:generate": "drizzle-kit generate",
|
|
42
42
|
"db:migrate": "drizzle-kit migrate",
|
|
43
43
|
"db:explore": "drizzle-kit studio",
|
|
44
|
-
"types": "
|
|
44
|
+
"types": "bash typegen.sh",
|
|
45
45
|
"lint": "biome check",
|
|
46
46
|
"lint:fix": "biome check --fix",
|
|
47
47
|
"test": "vitest",
|