@develit-services/bank 0.0.43 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/database/schema.cjs +1 -1
- package/dist/database/schema.d.cts +1 -1
- package/dist/database/schema.d.mts +1 -1
- package/dist/database/schema.d.ts +1 -1
- package/dist/database/schema.mjs +1 -1
- package/dist/export/worker.cjs +115 -567
- package/dist/export/worker.d.cts +86 -19
- package/dist/export/worker.d.mts +87 -18
- package/dist/export/worker.d.ts +86 -19
- package/dist/export/worker.mjs +107 -556
- package/dist/export/workflows.cjs +21 -0
- package/dist/export/workflows.d.cts +2 -0
- package/dist/export/workflows.d.mts +2 -0
- package/dist/export/workflows.d.ts +2 -0
- package/dist/export/workflows.mjs +15 -0
- package/dist/export/wrangler.cjs +7 -0
- package/dist/export/wrangler.d.cts +5 -0
- package/dist/export/wrangler.d.mts +5 -0
- package/dist/export/wrangler.d.ts +5 -0
- package/dist/export/wrangler.mjs +7 -0
- package/dist/shared/{bank.BVzOzXdX.cjs → bank.3YYIj-n6.cjs} +11 -9
- package/dist/shared/{bank.6WoCPIFy.mjs → bank.B72e0ibs.mjs} +1 -1
- package/dist/shared/{bank.BPcrbUBa.cjs → bank.BgpXGC_1.cjs} +1 -1
- package/dist/shared/{bank.B7uB4cyW.d.cts → bank.BriEYREq.d.cts} +6 -6
- package/dist/shared/{bank.B7uB4cyW.d.mts → bank.BriEYREq.d.mts} +6 -6
- package/dist/shared/{bank.B7uB4cyW.d.ts → bank.BriEYREq.d.ts} +6 -6
- package/dist/shared/bank.CH22Zrdv.d.cts +20 -0
- package/dist/shared/bank.CH22Zrdv.d.mts +20 -0
- package/dist/shared/bank.CH22Zrdv.d.ts +20 -0
- package/dist/shared/{bank.BWcFhTu1.mjs → bank.CcKNlFRd.mjs} +11 -9
- package/dist/shared/{bank.C9Z9B0Po.d.ts → bank.DSZbtb1J.d.mts} +40 -36
- package/dist/shared/{bank.B_JR9YGK.d.cts → bank.Ddhhr_rz.d.ts} +40 -36
- package/dist/shared/{bank.Dadvg35r.d.mts → bank.DqRaP8LS.d.cts} +40 -36
- package/dist/shared/bank.GMK4QNvo.cjs +276 -0
- package/dist/shared/bank.jyyw3_3-.mjs +267 -0
- package/dist/types.cjs +2 -2
- package/dist/types.d.cts +16 -9
- package/dist/types.d.mts +16 -9
- package/dist/types.d.ts +16 -9
- package/dist/types.mjs +2 -2
- package/package.json +6 -1
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { WorkflowEntrypoint } from 'cloudflare:workers';
|
|
2
|
+
import { NonRetryableError } from 'cloudflare:workflows';
|
|
3
|
+
import { drizzle } from 'drizzle-orm/d1';
|
|
4
|
+
import { t as tables, F as FinbricksConnector, M as MockConnector, E as ErsteConnector, v as getPaymentDirection } from './bank.CcKNlFRd.mjs';
|
|
5
|
+
import '@develit-io/backend-sdk';
|
|
6
|
+
import { eq, inArray } from 'drizzle-orm';
|
|
7
|
+
import { M as MockCobsConnector } from './bank.B72e0ibs.mjs';
|
|
8
|
+
import 'jose';
|
|
9
|
+
import '@develit-io/general-codes';
|
|
10
|
+
|
|
11
|
+
const createPaymentCommand = (db, { payment }) => {
|
|
12
|
+
return {
|
|
13
|
+
command: db.insert(tables.payment).values(payment).returning()
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const updatePaymentCommand = (db, { payment }) => {
|
|
18
|
+
return {
|
|
19
|
+
command: db.update(tables.payment).set(payment).where(eq(tables.payment.id, payment.id)).returning()
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const updateAccountLastSyncCommand = (db, { lastSyncedAt, accountId }) => {
|
|
24
|
+
const command = db.update(tables.account).set({
|
|
25
|
+
lastSyncedAt
|
|
26
|
+
}).where(eq(tables.account.id, accountId)).returning();
|
|
27
|
+
return {
|
|
28
|
+
command
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const getAccountByIdQuery = async (db, { accountId }) => {
|
|
33
|
+
return await db.select().from(tables.account).where(eq(tables.account.id, accountId)).get();
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const getCredentialsByAccountId = async (db, { accountId }) => {
|
|
37
|
+
const cred = await db.select().from(tables.accountCredentials).where(eq(tables.accountCredentials.accountId, accountId)).get();
|
|
38
|
+
return cred;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const getPaymentsByBankRefIdsQuery = async (db, { ids }) => {
|
|
42
|
+
return await db.select().from(tables.payment).where(inArray(tables.payment.bankRefId, ids));
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
class CreditasConnector extends FinbricksConnector {
|
|
46
|
+
constructor(config) {
|
|
47
|
+
super("CREDITAS", config);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
class FioConnector extends FinbricksConnector {
|
|
52
|
+
constructor(config) {
|
|
53
|
+
super("FIO", config);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
class MonetaConnector extends FinbricksConnector {
|
|
58
|
+
constructor(config) {
|
|
59
|
+
super("MONETA", config);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const initiateConnector = ({
|
|
64
|
+
bank,
|
|
65
|
+
env,
|
|
66
|
+
connectedAccounts
|
|
67
|
+
}) => {
|
|
68
|
+
switch (bank) {
|
|
69
|
+
case "ERSTE":
|
|
70
|
+
return new ErsteConnector({
|
|
71
|
+
API_KEY: env.ERSTE_API_KEY,
|
|
72
|
+
CLIENT_ID: env.ERSTE_CLIENT_ID,
|
|
73
|
+
CLIENT_SECRET: env.ERSTE_CLIENT_SECRET,
|
|
74
|
+
REDIRECT_URI: env.REDIRECT_URI,
|
|
75
|
+
AUTH_URI: env.ERSTE_AUTH_URI,
|
|
76
|
+
PAYMENTS_URI: env.ERSTE_PAYMENTS_URI,
|
|
77
|
+
ACCOUNTS_URI: env.ERSTE_ACCOUNTS_URI,
|
|
78
|
+
connectedAccounts
|
|
79
|
+
});
|
|
80
|
+
case "CREDITAS":
|
|
81
|
+
return new CreditasConnector({
|
|
82
|
+
BASE_URI: env.FINBRICKS_BASE_URI,
|
|
83
|
+
MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
|
|
84
|
+
PRIVATE_KEY_PEM: env.FINBRICKS_PRIVATE_KEY_PEM,
|
|
85
|
+
REDIRECT_URI: env.REDIRECT_URI,
|
|
86
|
+
connectedAccounts
|
|
87
|
+
});
|
|
88
|
+
case "MOCK_COBS":
|
|
89
|
+
return new MockCobsConnector({
|
|
90
|
+
BASE_URI: env.FINBRICKS_BASE_URI,
|
|
91
|
+
MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
|
|
92
|
+
PRIVATE_KEY_PEM: env.FINBRICKS_PRIVATE_KEY_PEM,
|
|
93
|
+
REDIRECT_URI: env.REDIRECT_URI,
|
|
94
|
+
connectedAccounts
|
|
95
|
+
});
|
|
96
|
+
case "FIO":
|
|
97
|
+
return new FioConnector({
|
|
98
|
+
BASE_URI: env.FINBRICKS_BASE_URI,
|
|
99
|
+
MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
|
|
100
|
+
PRIVATE_KEY_PEM: env.FINBRICKS_PRIVATE_KEY_PEM,
|
|
101
|
+
REDIRECT_URI: env.REDIRECT_URI,
|
|
102
|
+
connectedAccounts
|
|
103
|
+
});
|
|
104
|
+
case "MONETA":
|
|
105
|
+
return new MonetaConnector({
|
|
106
|
+
BASE_URI: env.FINBRICKS_BASE_URI,
|
|
107
|
+
MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
|
|
108
|
+
PRIVATE_KEY_PEM: env.FINBRICKS_PRIVATE_KEY_PEM,
|
|
109
|
+
REDIRECT_URI: env.REDIRECT_URI,
|
|
110
|
+
connectedAccounts
|
|
111
|
+
});
|
|
112
|
+
default:
|
|
113
|
+
return new MockConnector();
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
function pushToQueue(queue, message) {
|
|
118
|
+
if (!Array.isArray(message)) return queue.send(message, { contentType: "v8" });
|
|
119
|
+
return queue.sendBatch(
|
|
120
|
+
message.map((m) => ({
|
|
121
|
+
body: m,
|
|
122
|
+
contentType: "v8"
|
|
123
|
+
}))
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
class SyncAccountPaymentsWorkflow extends WorkflowEntrypoint {
|
|
127
|
+
async run(event, step) {
|
|
128
|
+
const { accountId } = event.payload;
|
|
129
|
+
const db = drizzle(this.env.BANK_D1, { schema: tables });
|
|
130
|
+
while (true) {
|
|
131
|
+
const account = await step.do("load account", async () => {
|
|
132
|
+
const account2 = await getAccountByIdQuery(db, { accountId });
|
|
133
|
+
if (!account2) {
|
|
134
|
+
throw new NonRetryableError(`Bank account not found: ${accountId}`);
|
|
135
|
+
}
|
|
136
|
+
return account2;
|
|
137
|
+
});
|
|
138
|
+
if (!account.lastSyncedAt) {
|
|
139
|
+
return { status: "skipped_no_last_sync" };
|
|
140
|
+
}
|
|
141
|
+
const credentials = await step.do(
|
|
142
|
+
"load account credentials",
|
|
143
|
+
async () => {
|
|
144
|
+
const credentials2 = await getCredentialsByAccountId(db, { accountId });
|
|
145
|
+
if (!credentials2) {
|
|
146
|
+
throw new NonRetryableError(
|
|
147
|
+
`No credentials found for account: ${accountId}`
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
return credentials2;
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
const connector = await step.do(
|
|
154
|
+
`init ${account.connectorKey} connector`,
|
|
155
|
+
async () => {
|
|
156
|
+
return initiateConnector({
|
|
157
|
+
env: this.env,
|
|
158
|
+
bank: account.connectorKey,
|
|
159
|
+
connectedAccounts: [
|
|
160
|
+
{
|
|
161
|
+
...account,
|
|
162
|
+
iban: account.iban,
|
|
163
|
+
token: credentials.value
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
const payments = await step.do(
|
|
170
|
+
"fetch bank payments",
|
|
171
|
+
{
|
|
172
|
+
retries: { limit: 5, delay: 2e3, backoff: "constant" },
|
|
173
|
+
timeout: "30 seconds"
|
|
174
|
+
},
|
|
175
|
+
async () => {
|
|
176
|
+
const fetched = await connector.getAllAccountPayments({
|
|
177
|
+
environment: this.env.ENVIRONMENT,
|
|
178
|
+
db,
|
|
179
|
+
account,
|
|
180
|
+
filter: { dateFrom: account.lastSyncedAt }
|
|
181
|
+
});
|
|
182
|
+
return fetched.map((p) => ({
|
|
183
|
+
...p,
|
|
184
|
+
direction: getPaymentDirection(p, account.iban)
|
|
185
|
+
}));
|
|
186
|
+
}
|
|
187
|
+
);
|
|
188
|
+
if (payments.length === 0) {
|
|
189
|
+
return { status: "no_new_payments" };
|
|
190
|
+
}
|
|
191
|
+
const bankRefIds = payments.map((payment) => payment.bankRefId).filter(Boolean);
|
|
192
|
+
const existing = await step.do("load existing payments", async () => {
|
|
193
|
+
return await getPaymentsByBankRefIdsQuery(db, {
|
|
194
|
+
ids: bankRefIds
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
const paymentsToUpdate = payments.filter(
|
|
198
|
+
(p) => existing.some((e) => e.bankRefId === p.bankRefId)
|
|
199
|
+
);
|
|
200
|
+
if (paymentsToUpdate.length)
|
|
201
|
+
await step.do("update existing payments", async () => {
|
|
202
|
+
const commands = paymentsToUpdate.map(
|
|
203
|
+
(p) => updatePaymentCommand(db, { payment: p }).command
|
|
204
|
+
);
|
|
205
|
+
await db.batch([commands[0], ...commands.slice(1)]);
|
|
206
|
+
await pushToQueue(
|
|
207
|
+
this.env.QUEUE_BUS_QUEUE,
|
|
208
|
+
paymentsToUpdate.map((p) => ({
|
|
209
|
+
eventType: "BANK_PAYMENT",
|
|
210
|
+
eventSignal: "paymentUpdated",
|
|
211
|
+
bankPayment: p,
|
|
212
|
+
metadata: {
|
|
213
|
+
correlationId: p.correlationId,
|
|
214
|
+
entityId: p.id,
|
|
215
|
+
idempotencySuffix: p.status,
|
|
216
|
+
timestamp: (/* @__PURE__ */ new Date()).toDateString()
|
|
217
|
+
}
|
|
218
|
+
}))
|
|
219
|
+
);
|
|
220
|
+
});
|
|
221
|
+
const paymentsToCreate = payments.filter(
|
|
222
|
+
(p) => !existing.some((e) => e.bankRefId === p.bankRefId)
|
|
223
|
+
);
|
|
224
|
+
if (paymentsToCreate.length)
|
|
225
|
+
await step.do("create new payments", async () => {
|
|
226
|
+
const commands = paymentsToCreate.map(
|
|
227
|
+
(p) => createPaymentCommand(db, { payment: p }).command
|
|
228
|
+
);
|
|
229
|
+
await db.batch([commands[0], ...commands.slice(1)]);
|
|
230
|
+
await pushToQueue(
|
|
231
|
+
this.env.QUEUE_BUS_QUEUE,
|
|
232
|
+
paymentsToCreate.map((p) => ({
|
|
233
|
+
eventType: "BANK_PAYMENT",
|
|
234
|
+
eventSignal: "paymentCreated",
|
|
235
|
+
bankPayment: p,
|
|
236
|
+
metadata: {
|
|
237
|
+
correlationId: p.correlationId,
|
|
238
|
+
entityId: p.id,
|
|
239
|
+
timestamp: (/* @__PURE__ */ new Date()).toDateString()
|
|
240
|
+
}
|
|
241
|
+
}))
|
|
242
|
+
);
|
|
243
|
+
});
|
|
244
|
+
await step.do("determine new lastSyncedAt", async () => {
|
|
245
|
+
const latest = payments.reduce((current, p) => {
|
|
246
|
+
return new Date(p.createdAt).getTime() > new Date(current.createdAt).getTime() ? p : current;
|
|
247
|
+
}, payments[0]);
|
|
248
|
+
await updateAccountLastSyncCommand(db, {
|
|
249
|
+
accountId: account.id,
|
|
250
|
+
lastSyncedAt: latest.createdAt
|
|
251
|
+
}).command.execute();
|
|
252
|
+
return latest.createdAt;
|
|
253
|
+
});
|
|
254
|
+
await step.sleep(
|
|
255
|
+
"Sleep for next sync",
|
|
256
|
+
`${account.syncIntervalS} seconds`
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
const workflows = {
|
|
263
|
+
__proto__: null,
|
|
264
|
+
SyncAccountPaymentsWorkflow: SyncAccountPaymentsWorkflow
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
export { SyncAccountPaymentsWorkflow as S, updateAccountLastSyncCommand as a, getCredentialsByAccountId as b, createPaymentCommand as c, getPaymentsByBankRefIdsQuery as g, initiateConnector as i, updatePaymentCommand as u, workflows as w };
|
package/dist/types.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const database_schema = require('./shared/bank.
|
|
4
|
-
const mockCobs_connector = require('./shared/bank.
|
|
3
|
+
const database_schema = require('./shared/bank.3YYIj-n6.cjs');
|
|
4
|
+
const mockCobs_connector = require('./shared/bank.BgpXGC_1.cjs');
|
|
5
5
|
const generalCodes = require('@develit-io/general-codes');
|
|
6
6
|
require('@develit-io/backend-sdk');
|
|
7
7
|
require('drizzle-orm/sqlite-core');
|
package/dist/types.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { I as IBankConnector, b as IncomingPaymentMessage, c as InitiatedPayment, a as ConnectorKey, d as ConnectedAccount, e as AccountCredentialsInsertType, f as AccountInsertType, P as PaymentPreparedInsertType, g as InitiatedBatch, B as BatchMetadata, A as AccountSelectType, h as PaymentStatus, i as BatchStatus, j as CurrencyCode, k as BankCode, l as CountryCode, m as AuthInput, n as Currency } from './shared/bank.
|
|
2
|
-
export { D as ACCOUNT_STATUSES, Y as AccountCredentialsPatchType, Z as AccountCredentialsSelectType, X as AccountCredentialsUpdateType, S as AccountPatchType, E as AccountStatus, R as AccountUpdateType, q as BATCH_STATUES, q as BATCH_STATUSES, G as BankAccountWithLastSync, t as CHARGE_BEARERS, H as CONNECTOR_KEYS, F as COUNTRY_CODES, J as CREDENTIALS_TYPES, u as ChargeBearer, C as ConfigEnvironmentBank, K as CredentialsType, v as INSTRUCTION_PRIORITIES, w as InstructionPriority, O as OutgoingPaymentMessage, y as PAYMENT_DIRECTIONS, x as PAYMENT_STATUSES, r as PAYMENT_TYPES, z as PaymentDirection, o as PaymentFailedInsertType, s as PaymentType, T as TOKEN_TYPES, L as TokenType, U as accountCredentialsInsertSchema, W as accountCredentialsSelectSchema, V as accountCredentialsUpdateSchema, M as accountInsertSchema, Q as accountSelectSchema, N as accountUpdateSchema, p as paymentInitializedInsertType } from './shared/bank.
|
|
3
|
-
import { a as PaymentInsertType, t as tables, P as PaymentSelectType } from './shared/bank.
|
|
4
|
-
export { b as BatchInsertType, B as BatchSelectType, p as paymentInsertTypeZod } from './shared/bank.
|
|
1
|
+
import { I as IBankConnector, b as IncomingPaymentMessage, c as InitiatedPayment, a as ConnectorKey, d as ConnectedAccount, e as AccountCredentialsInsertType, f as AccountInsertType, P as PaymentPreparedInsertType, g as InitiatedBatch, B as BatchMetadata, A as AccountSelectType, h as PaymentStatus, i as BatchStatus, j as CurrencyCode, k as BankCode, l as CountryCode, m as AuthInput, n as Currency } from './shared/bank.DqRaP8LS.cjs';
|
|
2
|
+
export { D as ACCOUNT_STATUSES, Y as AccountCredentialsPatchType, Z as AccountCredentialsSelectType, X as AccountCredentialsUpdateType, S as AccountPatchType, E as AccountStatus, R as AccountUpdateType, q as BATCH_STATUES, q as BATCH_STATUSES, G as BankAccountWithLastSync, t as CHARGE_BEARERS, H as CONNECTOR_KEYS, F as COUNTRY_CODES, J as CREDENTIALS_TYPES, u as ChargeBearer, C as ConfigEnvironmentBank, K as CredentialsType, v as INSTRUCTION_PRIORITIES, w as InstructionPriority, O as OutgoingPaymentMessage, y as PAYMENT_DIRECTIONS, x as PAYMENT_STATUSES, r as PAYMENT_TYPES, z as PaymentDirection, o as PaymentFailedInsertType, s as PaymentType, T as TOKEN_TYPES, L as TokenType, U as accountCredentialsInsertSchema, W as accountCredentialsSelectSchema, V as accountCredentialsUpdateSchema, M as accountInsertSchema, Q as accountSelectSchema, N as accountUpdateSchema, p as paymentInitializedInsertType } from './shared/bank.DqRaP8LS.cjs';
|
|
3
|
+
import { a as PaymentInsertType, t as tables, P as PaymentSelectType } from './shared/bank.BriEYREq.cjs';
|
|
4
|
+
export { b as BatchInsertType, B as BatchSelectType, p as paymentInsertTypeZod } from './shared/bank.BriEYREq.cjs';
|
|
5
5
|
import { Environment, BaseEvent } from '@develit-io/backend-sdk';
|
|
6
6
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
7
7
|
export { b as BankServiceEnv, a as BankServiceEnvironmentConfig, B as BankServiceWranglerConfig } from './shared/bank.BchnXQDL.cjs';
|
|
@@ -59,8 +59,12 @@ declare class ErsteConnector extends IBankConnector {
|
|
|
59
59
|
signId: string;
|
|
60
60
|
signHash: string;
|
|
61
61
|
}): Promise<string>;
|
|
62
|
-
getAllAccountPayments({ account, }: {
|
|
62
|
+
getAllAccountPayments({ account, filter, }: {
|
|
63
63
|
account: AccountSelectType;
|
|
64
|
+
filter: {
|
|
65
|
+
dateFrom: Date;
|
|
66
|
+
dateTo?: Date;
|
|
67
|
+
};
|
|
64
68
|
}): Promise<PaymentInsertType[]>;
|
|
65
69
|
getPaymentStatus(_: {
|
|
66
70
|
paymentId: string;
|
|
@@ -414,10 +418,13 @@ declare abstract class FinbricksConnector extends IBankConnector {
|
|
|
414
418
|
}): Promise<InitiatedBatch>;
|
|
415
419
|
initiateSEPAPayment(payment: IncomingPaymentMessage): Promise<InitiatedPayment>;
|
|
416
420
|
initiateSinglePayment(payment: PaymentPreparedInsertType): Promise<InitiatedPayment>;
|
|
417
|
-
getAllAccountPayments({ account, }: {
|
|
421
|
+
getAllAccountPayments({ account, filter, }: {
|
|
418
422
|
account: AccountSelectType;
|
|
419
|
-
|
|
420
|
-
|
|
423
|
+
environment: Environment;
|
|
424
|
+
filter: {
|
|
425
|
+
dateFrom: Date;
|
|
426
|
+
dateTo?: Date;
|
|
427
|
+
};
|
|
421
428
|
}): Promise<PaymentInsertType[]>;
|
|
422
429
|
getPaymentStatus({ paymentId, }: {
|
|
423
430
|
paymentId: string;
|
|
@@ -600,7 +607,7 @@ interface ErsteObtainAuthorizationURLResponse {
|
|
|
600
607
|
|
|
601
608
|
type BankPaymentEvent = BaseEvent & {
|
|
602
609
|
eventType: 'BANK_PAYMENT';
|
|
603
|
-
eventSignal: '
|
|
610
|
+
eventSignal: 'paymentCreated' | 'paymentCompleted' | 'paymentFailed' | 'paymentUpdated';
|
|
604
611
|
bankPayment: Partial<PaymentSelectType>;
|
|
605
612
|
};
|
|
606
613
|
|
package/dist/types.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { I as IBankConnector, b as IncomingPaymentMessage, c as InitiatedPayment, a as ConnectorKey, d as ConnectedAccount, e as AccountCredentialsInsertType, f as AccountInsertType, P as PaymentPreparedInsertType, g as InitiatedBatch, B as BatchMetadata, A as AccountSelectType, h as PaymentStatus, i as BatchStatus, j as CurrencyCode, k as BankCode, l as CountryCode, m as AuthInput, n as Currency } from './shared/bank.
|
|
2
|
-
export { D as ACCOUNT_STATUSES, Y as AccountCredentialsPatchType, Z as AccountCredentialsSelectType, X as AccountCredentialsUpdateType, S as AccountPatchType, E as AccountStatus, R as AccountUpdateType, q as BATCH_STATUES, q as BATCH_STATUSES, G as BankAccountWithLastSync, t as CHARGE_BEARERS, H as CONNECTOR_KEYS, F as COUNTRY_CODES, J as CREDENTIALS_TYPES, u as ChargeBearer, C as ConfigEnvironmentBank, K as CredentialsType, v as INSTRUCTION_PRIORITIES, w as InstructionPriority, O as OutgoingPaymentMessage, y as PAYMENT_DIRECTIONS, x as PAYMENT_STATUSES, r as PAYMENT_TYPES, z as PaymentDirection, o as PaymentFailedInsertType, s as PaymentType, T as TOKEN_TYPES, L as TokenType, U as accountCredentialsInsertSchema, W as accountCredentialsSelectSchema, V as accountCredentialsUpdateSchema, M as accountInsertSchema, Q as accountSelectSchema, N as accountUpdateSchema, p as paymentInitializedInsertType } from './shared/bank.
|
|
3
|
-
import { a as PaymentInsertType, t as tables, P as PaymentSelectType } from './shared/bank.
|
|
4
|
-
export { b as BatchInsertType, B as BatchSelectType, p as paymentInsertTypeZod } from './shared/bank.
|
|
1
|
+
import { I as IBankConnector, b as IncomingPaymentMessage, c as InitiatedPayment, a as ConnectorKey, d as ConnectedAccount, e as AccountCredentialsInsertType, f as AccountInsertType, P as PaymentPreparedInsertType, g as InitiatedBatch, B as BatchMetadata, A as AccountSelectType, h as PaymentStatus, i as BatchStatus, j as CurrencyCode, k as BankCode, l as CountryCode, m as AuthInput, n as Currency } from './shared/bank.DSZbtb1J.mjs';
|
|
2
|
+
export { D as ACCOUNT_STATUSES, Y as AccountCredentialsPatchType, Z as AccountCredentialsSelectType, X as AccountCredentialsUpdateType, S as AccountPatchType, E as AccountStatus, R as AccountUpdateType, q as BATCH_STATUES, q as BATCH_STATUSES, G as BankAccountWithLastSync, t as CHARGE_BEARERS, H as CONNECTOR_KEYS, F as COUNTRY_CODES, J as CREDENTIALS_TYPES, u as ChargeBearer, C as ConfigEnvironmentBank, K as CredentialsType, v as INSTRUCTION_PRIORITIES, w as InstructionPriority, O as OutgoingPaymentMessage, y as PAYMENT_DIRECTIONS, x as PAYMENT_STATUSES, r as PAYMENT_TYPES, z as PaymentDirection, o as PaymentFailedInsertType, s as PaymentType, T as TOKEN_TYPES, L as TokenType, U as accountCredentialsInsertSchema, W as accountCredentialsSelectSchema, V as accountCredentialsUpdateSchema, M as accountInsertSchema, Q as accountSelectSchema, N as accountUpdateSchema, p as paymentInitializedInsertType } from './shared/bank.DSZbtb1J.mjs';
|
|
3
|
+
import { a as PaymentInsertType, t as tables, P as PaymentSelectType } from './shared/bank.BriEYREq.mjs';
|
|
4
|
+
export { b as BatchInsertType, B as BatchSelectType, p as paymentInsertTypeZod } from './shared/bank.BriEYREq.mjs';
|
|
5
5
|
import { Environment, BaseEvent } from '@develit-io/backend-sdk';
|
|
6
6
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
7
7
|
export { b as BankServiceEnv, a as BankServiceEnvironmentConfig, B as BankServiceWranglerConfig } from './shared/bank.BchnXQDL.mjs';
|
|
@@ -59,8 +59,12 @@ declare class ErsteConnector extends IBankConnector {
|
|
|
59
59
|
signId: string;
|
|
60
60
|
signHash: string;
|
|
61
61
|
}): Promise<string>;
|
|
62
|
-
getAllAccountPayments({ account, }: {
|
|
62
|
+
getAllAccountPayments({ account, filter, }: {
|
|
63
63
|
account: AccountSelectType;
|
|
64
|
+
filter: {
|
|
65
|
+
dateFrom: Date;
|
|
66
|
+
dateTo?: Date;
|
|
67
|
+
};
|
|
64
68
|
}): Promise<PaymentInsertType[]>;
|
|
65
69
|
getPaymentStatus(_: {
|
|
66
70
|
paymentId: string;
|
|
@@ -414,10 +418,13 @@ declare abstract class FinbricksConnector extends IBankConnector {
|
|
|
414
418
|
}): Promise<InitiatedBatch>;
|
|
415
419
|
initiateSEPAPayment(payment: IncomingPaymentMessage): Promise<InitiatedPayment>;
|
|
416
420
|
initiateSinglePayment(payment: PaymentPreparedInsertType): Promise<InitiatedPayment>;
|
|
417
|
-
getAllAccountPayments({ account, }: {
|
|
421
|
+
getAllAccountPayments({ account, filter, }: {
|
|
418
422
|
account: AccountSelectType;
|
|
419
|
-
|
|
420
|
-
|
|
423
|
+
environment: Environment;
|
|
424
|
+
filter: {
|
|
425
|
+
dateFrom: Date;
|
|
426
|
+
dateTo?: Date;
|
|
427
|
+
};
|
|
421
428
|
}): Promise<PaymentInsertType[]>;
|
|
422
429
|
getPaymentStatus({ paymentId, }: {
|
|
423
430
|
paymentId: string;
|
|
@@ -600,7 +607,7 @@ interface ErsteObtainAuthorizationURLResponse {
|
|
|
600
607
|
|
|
601
608
|
type BankPaymentEvent = BaseEvent & {
|
|
602
609
|
eventType: 'BANK_PAYMENT';
|
|
603
|
-
eventSignal: '
|
|
610
|
+
eventSignal: 'paymentCreated' | 'paymentCompleted' | 'paymentFailed' | 'paymentUpdated';
|
|
604
611
|
bankPayment: Partial<PaymentSelectType>;
|
|
605
612
|
};
|
|
606
613
|
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { I as IBankConnector, b as IncomingPaymentMessage, c as InitiatedPayment, a as ConnectorKey, d as ConnectedAccount, e as AccountCredentialsInsertType, f as AccountInsertType, P as PaymentPreparedInsertType, g as InitiatedBatch, B as BatchMetadata, A as AccountSelectType, h as PaymentStatus, i as BatchStatus, j as CurrencyCode, k as BankCode, l as CountryCode, m as AuthInput, n as Currency } from './shared/bank.
|
|
2
|
-
export { D as ACCOUNT_STATUSES, Y as AccountCredentialsPatchType, Z as AccountCredentialsSelectType, X as AccountCredentialsUpdateType, S as AccountPatchType, E as AccountStatus, R as AccountUpdateType, q as BATCH_STATUES, q as BATCH_STATUSES, G as BankAccountWithLastSync, t as CHARGE_BEARERS, H as CONNECTOR_KEYS, F as COUNTRY_CODES, J as CREDENTIALS_TYPES, u as ChargeBearer, C as ConfigEnvironmentBank, K as CredentialsType, v as INSTRUCTION_PRIORITIES, w as InstructionPriority, O as OutgoingPaymentMessage, y as PAYMENT_DIRECTIONS, x as PAYMENT_STATUSES, r as PAYMENT_TYPES, z as PaymentDirection, o as PaymentFailedInsertType, s as PaymentType, T as TOKEN_TYPES, L as TokenType, U as accountCredentialsInsertSchema, W as accountCredentialsSelectSchema, V as accountCredentialsUpdateSchema, M as accountInsertSchema, Q as accountSelectSchema, N as accountUpdateSchema, p as paymentInitializedInsertType } from './shared/bank.
|
|
3
|
-
import { a as PaymentInsertType, t as tables, P as PaymentSelectType } from './shared/bank.
|
|
4
|
-
export { b as BatchInsertType, B as BatchSelectType, p as paymentInsertTypeZod } from './shared/bank.
|
|
1
|
+
import { I as IBankConnector, b as IncomingPaymentMessage, c as InitiatedPayment, a as ConnectorKey, d as ConnectedAccount, e as AccountCredentialsInsertType, f as AccountInsertType, P as PaymentPreparedInsertType, g as InitiatedBatch, B as BatchMetadata, A as AccountSelectType, h as PaymentStatus, i as BatchStatus, j as CurrencyCode, k as BankCode, l as CountryCode, m as AuthInput, n as Currency } from './shared/bank.Ddhhr_rz.js';
|
|
2
|
+
export { D as ACCOUNT_STATUSES, Y as AccountCredentialsPatchType, Z as AccountCredentialsSelectType, X as AccountCredentialsUpdateType, S as AccountPatchType, E as AccountStatus, R as AccountUpdateType, q as BATCH_STATUES, q as BATCH_STATUSES, G as BankAccountWithLastSync, t as CHARGE_BEARERS, H as CONNECTOR_KEYS, F as COUNTRY_CODES, J as CREDENTIALS_TYPES, u as ChargeBearer, C as ConfigEnvironmentBank, K as CredentialsType, v as INSTRUCTION_PRIORITIES, w as InstructionPriority, O as OutgoingPaymentMessage, y as PAYMENT_DIRECTIONS, x as PAYMENT_STATUSES, r as PAYMENT_TYPES, z as PaymentDirection, o as PaymentFailedInsertType, s as PaymentType, T as TOKEN_TYPES, L as TokenType, U as accountCredentialsInsertSchema, W as accountCredentialsSelectSchema, V as accountCredentialsUpdateSchema, M as accountInsertSchema, Q as accountSelectSchema, N as accountUpdateSchema, p as paymentInitializedInsertType } from './shared/bank.Ddhhr_rz.js';
|
|
3
|
+
import { a as PaymentInsertType, t as tables, P as PaymentSelectType } from './shared/bank.BriEYREq.js';
|
|
4
|
+
export { b as BatchInsertType, B as BatchSelectType, p as paymentInsertTypeZod } from './shared/bank.BriEYREq.js';
|
|
5
5
|
import { Environment, BaseEvent } from '@develit-io/backend-sdk';
|
|
6
6
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
7
7
|
export { b as BankServiceEnv, a as BankServiceEnvironmentConfig, B as BankServiceWranglerConfig } from './shared/bank.BchnXQDL.js';
|
|
@@ -59,8 +59,12 @@ declare class ErsteConnector extends IBankConnector {
|
|
|
59
59
|
signId: string;
|
|
60
60
|
signHash: string;
|
|
61
61
|
}): Promise<string>;
|
|
62
|
-
getAllAccountPayments({ account, }: {
|
|
62
|
+
getAllAccountPayments({ account, filter, }: {
|
|
63
63
|
account: AccountSelectType;
|
|
64
|
+
filter: {
|
|
65
|
+
dateFrom: Date;
|
|
66
|
+
dateTo?: Date;
|
|
67
|
+
};
|
|
64
68
|
}): Promise<PaymentInsertType[]>;
|
|
65
69
|
getPaymentStatus(_: {
|
|
66
70
|
paymentId: string;
|
|
@@ -414,10 +418,13 @@ declare abstract class FinbricksConnector extends IBankConnector {
|
|
|
414
418
|
}): Promise<InitiatedBatch>;
|
|
415
419
|
initiateSEPAPayment(payment: IncomingPaymentMessage): Promise<InitiatedPayment>;
|
|
416
420
|
initiateSinglePayment(payment: PaymentPreparedInsertType): Promise<InitiatedPayment>;
|
|
417
|
-
getAllAccountPayments({ account, }: {
|
|
421
|
+
getAllAccountPayments({ account, filter, }: {
|
|
418
422
|
account: AccountSelectType;
|
|
419
|
-
|
|
420
|
-
|
|
423
|
+
environment: Environment;
|
|
424
|
+
filter: {
|
|
425
|
+
dateFrom: Date;
|
|
426
|
+
dateTo?: Date;
|
|
427
|
+
};
|
|
421
428
|
}): Promise<PaymentInsertType[]>;
|
|
422
429
|
getPaymentStatus({ paymentId, }: {
|
|
423
430
|
paymentId: string;
|
|
@@ -600,7 +607,7 @@ interface ErsteObtainAuthorizationURLResponse {
|
|
|
600
607
|
|
|
601
608
|
type BankPaymentEvent = BaseEvent & {
|
|
602
609
|
eventType: 'BANK_PAYMENT';
|
|
603
|
-
eventSignal: '
|
|
610
|
+
eventSignal: 'paymentCreated' | 'paymentCompleted' | 'paymentFailed' | 'paymentUpdated';
|
|
604
611
|
bankPayment: Partial<PaymentSelectType>;
|
|
605
612
|
};
|
|
606
613
|
|
package/dist/types.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { A as ACCOUNT_STATUSES, B as BATCH_STATUES, B as BATCH_STATUSES, C as CHARGE_BEARERS, g as CONNECTOR_KEYS, f as COUNTRY_CODES, h as CREDENTIALS_TYPES, E as ErsteConnector, b as FINBRICKS_ENDPOINTS, a as FinbricksClient, F as FinbricksConnector, I as IBankConnector, c as INSTRUCTION_PRIORITIES, M as MockConnector, e as PAYMENT_DIRECTIONS, d as PAYMENT_STATUSES, P as PAYMENT_TYPES, T as TOKEN_TYPES, l as accountCredentialsInsertSchema, n as accountCredentialsSelectSchema, m as accountCredentialsUpdateSchema, i as accountInsertSchema, k as accountSelectSchema, j as accountUpdateSchema, o as ottInsertSchema, r as ottSelectSchema, q as ottUpdateSchema, p as paymentInsertTypeZod, s as signFinbricksJws, u as useFinbricksFetch } from './shared/bank.
|
|
2
|
-
export { M as MockCobsConnector } from './shared/bank.
|
|
1
|
+
export { A as ACCOUNT_STATUSES, B as BATCH_STATUES, B as BATCH_STATUSES, C as CHARGE_BEARERS, g as CONNECTOR_KEYS, f as COUNTRY_CODES, h as CREDENTIALS_TYPES, E as ErsteConnector, b as FINBRICKS_ENDPOINTS, a as FinbricksClient, F as FinbricksConnector, I as IBankConnector, c as INSTRUCTION_PRIORITIES, M as MockConnector, e as PAYMENT_DIRECTIONS, d as PAYMENT_STATUSES, P as PAYMENT_TYPES, T as TOKEN_TYPES, l as accountCredentialsInsertSchema, n as accountCredentialsSelectSchema, m as accountCredentialsUpdateSchema, i as accountInsertSchema, k as accountSelectSchema, j as accountUpdateSchema, o as ottInsertSchema, r as ottSelectSchema, q as ottUpdateSchema, p as paymentInsertTypeZod, s as signFinbricksJws, u as useFinbricksFetch } from './shared/bank.CcKNlFRd.mjs';
|
|
2
|
+
export { M as MockCobsConnector } from './shared/bank.B72e0ibs.mjs';
|
|
3
3
|
export { BANK_CODES, CURRENCY_CODES } from '@develit-io/general-codes';
|
|
4
4
|
import '@develit-io/backend-sdk';
|
|
5
5
|
import 'drizzle-orm/sqlite-core';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@develit-services/bank",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"author": "Develit.io s.r.o.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
"import": "./dist/export/worker.mjs",
|
|
15
15
|
"require": "./dist/export/worker.cjs"
|
|
16
16
|
},
|
|
17
|
+
"./workflows": {
|
|
18
|
+
"types": "./dist/export/workflows.d.ts",
|
|
19
|
+
"import": "./dist/export/workflows.mjs",
|
|
20
|
+
"require": "./dist/export/workflows.cjs"
|
|
21
|
+
},
|
|
17
22
|
"./db-schema": {
|
|
18
23
|
"types": "./dist/database/schema.d.ts",
|
|
19
24
|
"import": "./dist/database/schema.mjs",
|