@develit-services/bank 0.0.29 → 0.0.30
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 +130 -4
- package/dist/export/worker.d.cts +161 -3
- package/dist/export/worker.d.mts +161 -3
- package/dist/export/worker.d.ts +161 -3
- package/dist/export/worker.mjs +131 -5
- package/dist/export/wrangler.cjs +1 -11
- package/dist/export/wrangler.d.cts +7 -7
- package/dist/export/wrangler.d.mts +7 -7
- package/dist/export/wrangler.d.ts +7 -7
- package/dist/export/wrangler.mjs +1 -11
- package/dist/shared/{bank.DXzEZPsO.cjs → bank.BMRBXGF1.cjs} +2 -1
- package/dist/shared/{bank.CWt0unt2.d.cts → bank.CtUeOz8i.d.ts} +1 -1
- package/dist/shared/{bank.DS18_iuS.d.mts → bank.D8o86NLF.d.mts} +1 -1
- package/dist/shared/{bank.By8Vh0l5.d.ts → bank.DUalSuEK.d.cts} +1 -1
- package/dist/shared/{bank.5CiXtVIb.mjs → bank.DbNuuGvb.mjs} +1 -1
- package/dist/shared/{bank.BeJh7l2V.cjs → bank.DuY4d2y_.cjs} +1 -1
- package/dist/shared/{bank.07oMM145.d.cts → bank.Nf6oaNfB.d.cts} +19 -0
- package/dist/shared/{bank.07oMM145.d.mts → bank.Nf6oaNfB.d.mts} +19 -0
- package/dist/shared/{bank.07oMM145.d.ts → bank.Nf6oaNfB.d.ts} +19 -0
- package/dist/shared/{bank.Ce4ZEpjD.mjs → bank.YCUhOduX.mjs} +2 -1
- package/dist/types.cjs +2 -2
- package/dist/types.d.cts +4 -4
- package/dist/types.d.mts +4 -4
- package/dist/types.d.ts +4 -4
- package/dist/types.mjs +2 -2
- package/package.json +1 -1
package/dist/database/schema.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { f as account, g as accountCredentials, c as batch, o as ott, d as payment, e as paymentRelations } from '../shared/bank.
|
|
1
|
+
export { f as account, g as accountCredentials, c as batch, o as ott, d as payment, e as paymentRelations } from '../shared/bank.Nf6oaNfB.cjs';
|
|
2
2
|
import 'drizzle-orm/sqlite-core';
|
|
3
3
|
import 'drizzle-orm';
|
|
4
4
|
import 'zod';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { f as account, g as accountCredentials, c as batch, o as ott, d as payment, e as paymentRelations } from '../shared/bank.
|
|
1
|
+
export { f as account, g as accountCredentials, c as batch, o as ott, d as payment, e as paymentRelations } from '../shared/bank.Nf6oaNfB.mjs';
|
|
2
2
|
import 'drizzle-orm/sqlite-core';
|
|
3
3
|
import 'drizzle-orm';
|
|
4
4
|
import 'zod';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { f as account, g as accountCredentials, c as batch, o as ott, d as payment, e as paymentRelations } from '../shared/bank.
|
|
1
|
+
export { f as account, g as accountCredentials, c as batch, o as ott, d as payment, e as paymentRelations } from '../shared/bank.Nf6oaNfB.js';
|
|
2
2
|
import 'drizzle-orm/sqlite-core';
|
|
3
3
|
import 'drizzle-orm';
|
|
4
4
|
import 'zod';
|
package/dist/database/schema.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { y as account, z as accountCredentials, r as batch, x as ott, v as payment, w as paymentRelations } from '../shared/bank.
|
|
1
|
+
export { y as account, z as accountCredentials, r as batch, x as ott, v as payment, w as paymentRelations } from '../shared/bank.YCUhOduX.mjs';
|
|
2
2
|
import '@develit-io/backend-sdk';
|
|
3
3
|
import 'drizzle-orm';
|
|
4
4
|
import '@develit-io/general-codes';
|
package/dist/export/worker.cjs
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const backendSdk = require('@develit-io/backend-sdk');
|
|
6
|
-
const database_schema = require('../shared/bank.
|
|
6
|
+
const database_schema = require('../shared/bank.BMRBXGF1.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
11
|
require('jose');
|
|
12
12
|
const drizzleOrm = require('drizzle-orm');
|
|
13
|
-
const mockCobs_connector = require('../shared/bank.
|
|
13
|
+
const mockCobs_connector = require('../shared/bank.DuY4d2y_.cjs');
|
|
14
14
|
const superjson = require('superjson');
|
|
15
15
|
require('drizzle-zod');
|
|
16
16
|
require('drizzle-orm/sqlite-core');
|
|
@@ -149,6 +149,83 @@ const getAccountByIbanQuery = async (db, { iban }) => {
|
|
|
149
149
|
return await db.select().from(database_schema.tables.account).where(drizzleOrm.eq(database_schema.tables.account.iban, iban)).get();
|
|
150
150
|
};
|
|
151
151
|
|
|
152
|
+
const getAllAccountsQuery = async (db) => {
|
|
153
|
+
const accountsWithExpiration = await db.select().from(database_schema.tables.account).leftJoin(
|
|
154
|
+
database_schema.tables.accountCredentials,
|
|
155
|
+
drizzleOrm.eq(database_schema.tables.accountCredentials.accountId, database_schema.tables.account.id)
|
|
156
|
+
);
|
|
157
|
+
return accountsWithExpiration.map(({ account, account_credentials }) => {
|
|
158
|
+
return {
|
|
159
|
+
...account,
|
|
160
|
+
expiresAt: account_credentials?.expiresAt
|
|
161
|
+
};
|
|
162
|
+
});
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const buildMultiFilterConditions = (column, value) => {
|
|
166
|
+
if (value === void 0) return void 0;
|
|
167
|
+
if (Array.isArray(value)) {
|
|
168
|
+
return value.length > 0 ? drizzleOrm.inArray(column, value) : void 0;
|
|
169
|
+
}
|
|
170
|
+
return drizzleOrm.eq(column, value);
|
|
171
|
+
};
|
|
172
|
+
const buildRangeFilterConditions = (column, minValue, maxValue) => {
|
|
173
|
+
const conditions = [];
|
|
174
|
+
if (minValue !== void 0) {
|
|
175
|
+
conditions.push(drizzleOrm.gte(column, minValue));
|
|
176
|
+
}
|
|
177
|
+
if (maxValue !== void 0) {
|
|
178
|
+
conditions.push(drizzleOrm.lte(column, maxValue));
|
|
179
|
+
}
|
|
180
|
+
if (conditions.length === 0) return void 0;
|
|
181
|
+
if (conditions.length === 1) return conditions[0];
|
|
182
|
+
return drizzleOrm.and(...conditions);
|
|
183
|
+
};
|
|
184
|
+
const resolveColumn = (table, column, fallback = "updatedAt") => {
|
|
185
|
+
const key = column && column in table ? column : fallback;
|
|
186
|
+
return table[key];
|
|
187
|
+
};
|
|
188
|
+
const getPaymentsWithPaginationQuery = async (db, {
|
|
189
|
+
limit,
|
|
190
|
+
page,
|
|
191
|
+
sort,
|
|
192
|
+
filterPaymentAccountId,
|
|
193
|
+
filterPaymentAmount,
|
|
194
|
+
filterPaymentCurrency,
|
|
195
|
+
filterPaymentDateFrom,
|
|
196
|
+
filterPaymentDateTo,
|
|
197
|
+
filterPaymentStatus,
|
|
198
|
+
filterPaymentyDirection
|
|
199
|
+
}) => {
|
|
200
|
+
const whereConditions = drizzleOrm.and(
|
|
201
|
+
buildMultiFilterConditions(
|
|
202
|
+
database_schema.tables.payment.accountId,
|
|
203
|
+
filterPaymentAccountId
|
|
204
|
+
),
|
|
205
|
+
buildMultiFilterConditions(database_schema.tables.payment.amount, filterPaymentAmount),
|
|
206
|
+
buildMultiFilterConditions(database_schema.tables.payment.currency, filterPaymentCurrency),
|
|
207
|
+
buildRangeFilterConditions(
|
|
208
|
+
database_schema.tables.payment.createdAt,
|
|
209
|
+
filterPaymentDateFrom,
|
|
210
|
+
filterPaymentDateTo
|
|
211
|
+
),
|
|
212
|
+
buildMultiFilterConditions(database_schema.tables.payment.status, filterPaymentStatus),
|
|
213
|
+
buildMultiFilterConditions(
|
|
214
|
+
database_schema.tables.payment.direction,
|
|
215
|
+
filterPaymentyDirection
|
|
216
|
+
)
|
|
217
|
+
);
|
|
218
|
+
const sortColumn = resolveColumn(database_schema.tables.payment, sort.column);
|
|
219
|
+
const [{ totalCount }] = await db.select({
|
|
220
|
+
totalCount: drizzleOrm.sql`count(*)`
|
|
221
|
+
}).from(database_schema.tables.payment).where(whereConditions);
|
|
222
|
+
const payments = await db.select().from(database_schema.tables.payment).where(whereConditions).limit(limit).offset((page - 1) * limit).orderBy(sort.direction === "asc" ? drizzleOrm.asc(sortColumn) : drizzleOrm.desc(sortColumn));
|
|
223
|
+
return {
|
|
224
|
+
payments,
|
|
225
|
+
totalCount
|
|
226
|
+
};
|
|
227
|
+
};
|
|
228
|
+
|
|
152
229
|
class CreditasConnector extends database_schema.FinbricksConnector {
|
|
153
230
|
constructor(config) {
|
|
154
231
|
super("CREDITAS", config);
|
|
@@ -331,6 +408,31 @@ const processBatchInputSchema = zod.z.object({
|
|
|
331
408
|
batch: zod.z.custom()
|
|
332
409
|
});
|
|
333
410
|
|
|
411
|
+
const ALLOWED_PAYMENT_FILTERS = {
|
|
412
|
+
ACCOUNT_ID: "filterPaymentAccountId",
|
|
413
|
+
AMOUNT: "filterPaymentAmount",
|
|
414
|
+
CURRENCY: "filterPaymentCurrency",
|
|
415
|
+
DIRECTION: "filterPaymentyDirection",
|
|
416
|
+
FROM: "filterPaymentDateFrom",
|
|
417
|
+
TO: "filterPaymentDateTo",
|
|
418
|
+
STATUS: "filterPaymentStatus"
|
|
419
|
+
};
|
|
420
|
+
const getPaymentsInputSchema = zod.z.object({
|
|
421
|
+
page: zod.z.number().positive(),
|
|
422
|
+
limit: zod.z.number().positive(),
|
|
423
|
+
sort: zod.z.object({
|
|
424
|
+
column: zod.z.enum(["createdAt", "updatedAt", "amount"]),
|
|
425
|
+
direction: zod.z.enum(["asc", "desc"])
|
|
426
|
+
}),
|
|
427
|
+
[ALLOWED_PAYMENT_FILTERS.ACCOUNT_ID]: zod.z.union([zod.z.uuid(), zod.z.uuid().array()]).optional(),
|
|
428
|
+
[ALLOWED_PAYMENT_FILTERS.AMOUNT]: zod.z.union([zod.z.number(), zod.z.number().array()]).optional(),
|
|
429
|
+
[ALLOWED_PAYMENT_FILTERS.CURRENCY]: zod.z.union([zod.z.enum(generalCodes.CURRENCY_CODES), zod.z.enum(generalCodes.CURRENCY_CODES).array()]).optional(),
|
|
430
|
+
[ALLOWED_PAYMENT_FILTERS.DIRECTION]: zod.z.union([zod.z.enum(database_schema.PAYMENT_DIRECTIONS), zod.z.enum(database_schema.PAYMENT_DIRECTIONS).array()]).optional(),
|
|
431
|
+
[ALLOWED_PAYMENT_FILTERS.FROM]: zod.z.date().optional(),
|
|
432
|
+
[ALLOWED_PAYMENT_FILTERS.TO]: zod.z.date().optional(),
|
|
433
|
+
[ALLOWED_PAYMENT_FILTERS.STATUS]: zod.z.union([zod.z.enum(database_schema.PAYMENT_STATUSES), zod.z.enum(database_schema.PAYMENT_STATUSES).array()]).optional()
|
|
434
|
+
});
|
|
435
|
+
|
|
334
436
|
var __defProp = Object.defineProperty;
|
|
335
437
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
336
438
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -352,7 +454,16 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
|
|
|
352
454
|
return this.allowedProviders;
|
|
353
455
|
}
|
|
354
456
|
async getAccounts() {
|
|
355
|
-
return await this.db
|
|
457
|
+
return await getAllAccountsQuery(this.db);
|
|
458
|
+
}
|
|
459
|
+
async getPayments(input) {
|
|
460
|
+
return this.handleAction(
|
|
461
|
+
{ data: input, schema: getPaymentsInputSchema },
|
|
462
|
+
{ successMessage: "Payments fetched successfully" },
|
|
463
|
+
async (pagination) => {
|
|
464
|
+
return await getPaymentsWithPaginationQuery(this.db, pagination);
|
|
465
|
+
}
|
|
466
|
+
);
|
|
356
467
|
}
|
|
357
468
|
accountFetchInterval(connectorKey) {
|
|
358
469
|
switch (connectorKey) {
|
|
@@ -508,6 +619,7 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
|
|
|
508
619
|
const mappedPayments = paymentsToBatch.map(
|
|
509
620
|
(payment) => ({
|
|
510
621
|
id: backendSdk.uuidv4(),
|
|
622
|
+
accountId: "",
|
|
511
623
|
refId: payment.refId,
|
|
512
624
|
connectorKey: "MOCK",
|
|
513
625
|
amount: payment.amount,
|
|
@@ -563,7 +675,8 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
|
|
|
563
675
|
(payment) => payment.debtorIban === acc.iban && payment.currency === acc.currency
|
|
564
676
|
).map((payment) => ({
|
|
565
677
|
...payment,
|
|
566
|
-
connectorKey: acc.connectorKey
|
|
678
|
+
connectorKey: acc.connectorKey,
|
|
679
|
+
accountId: acc.id
|
|
567
680
|
}));
|
|
568
681
|
if (newPayments.length === 0) {
|
|
569
682
|
continue;
|
|
@@ -922,10 +1035,20 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
|
|
|
922
1035
|
debtorHolderName,
|
|
923
1036
|
connectorKey
|
|
924
1037
|
}) => {
|
|
1038
|
+
const account = await getAccountByIbanQuery(this.db, {
|
|
1039
|
+
iban: creditorIban
|
|
1040
|
+
});
|
|
1041
|
+
if (!account)
|
|
1042
|
+
throw backendSdk.createInternalError(null, {
|
|
1043
|
+
message: "Unsupported account",
|
|
1044
|
+
code: "UNSUPPORTED_ACCOUNT",
|
|
1045
|
+
status: 422
|
|
1046
|
+
});
|
|
925
1047
|
const payment = {
|
|
926
1048
|
id: backendSdk.uuidv4(),
|
|
927
1049
|
amount,
|
|
928
1050
|
connectorKey,
|
|
1051
|
+
accountId: account.id,
|
|
929
1052
|
direction: "INCOMING",
|
|
930
1053
|
paymentType: "DOMESTIC",
|
|
931
1054
|
currency,
|
|
@@ -1017,6 +1140,9 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
|
|
|
1017
1140
|
);
|
|
1018
1141
|
}
|
|
1019
1142
|
};
|
|
1143
|
+
__decorateClass([
|
|
1144
|
+
backendSdk.action("get-payments")
|
|
1145
|
+
], BankServiceBase.prototype, "getPayments", 1);
|
|
1020
1146
|
__decorateClass([
|
|
1021
1147
|
backendSdk.action("synchronize-accounts")
|
|
1022
1148
|
], BankServiceBase.prototype, "syncAccounts", 1);
|
package/dist/export/worker.d.cts
CHANGED
|
@@ -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.
|
|
3
|
+
import { P as PaymentSelectType, B as BatchSelectType, t as tables, a as PaymentInsertType } from '../shared/bank.Nf6oaNfB.cjs';
|
|
4
4
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
5
5
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
6
6
|
import { z } from 'zod';
|
|
7
|
-
import { A as AccountSelectType, C as ConfigEnvironmentBank, I as IBankConnector, a as ConnectorKey, B as BankAccountWithLastSync } from '../shared/bank.
|
|
7
|
+
import { A as AccountSelectType, C as ConfigEnvironmentBank, I as IBankConnector, a as ConnectorKey, B as BankAccountWithLastSync } from '../shared/bank.DUalSuEK.cjs';
|
|
8
8
|
import 'drizzle-orm/sqlite-core';
|
|
9
9
|
import 'drizzle-orm';
|
|
10
10
|
import '@develit-io/general-codes';
|
|
@@ -246,6 +246,162 @@ declare const processBatchInputSchema: z.ZodObject<{
|
|
|
246
246
|
interface ProcessBatchInput extends z.infer<typeof processBatchInputSchema> {
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
+
declare const getPaymentsInputSchema: z.ZodObject<{
|
|
250
|
+
page: z.ZodNumber;
|
|
251
|
+
limit: z.ZodNumber;
|
|
252
|
+
sort: z.ZodObject<{
|
|
253
|
+
column: z.ZodEnum<{
|
|
254
|
+
amount: "amount";
|
|
255
|
+
createdAt: "createdAt";
|
|
256
|
+
updatedAt: "updatedAt";
|
|
257
|
+
}>;
|
|
258
|
+
direction: z.ZodEnum<{
|
|
259
|
+
asc: "asc";
|
|
260
|
+
desc: "desc";
|
|
261
|
+
}>;
|
|
262
|
+
}, z.core.$strip>;
|
|
263
|
+
filterPaymentAccountId: z.ZodOptional<z.ZodUnion<readonly [z.ZodUUID, z.ZodArray<z.ZodUUID>]>>;
|
|
264
|
+
filterPaymentAmount: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>;
|
|
265
|
+
filterPaymentCurrency: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
266
|
+
CZK: "CZK";
|
|
267
|
+
EUR: "EUR";
|
|
268
|
+
USD: "USD";
|
|
269
|
+
PLN: "PLN";
|
|
270
|
+
RON: "RON";
|
|
271
|
+
GBP: "GBP";
|
|
272
|
+
RUB: "RUB";
|
|
273
|
+
HUF: "HUF";
|
|
274
|
+
CHF: "CHF";
|
|
275
|
+
DKK: "DKK";
|
|
276
|
+
SEK: "SEK";
|
|
277
|
+
HRK: "HRK";
|
|
278
|
+
NOK: "NOK";
|
|
279
|
+
BGN: "BGN";
|
|
280
|
+
TRY: "TRY";
|
|
281
|
+
AUD: "AUD";
|
|
282
|
+
CAD: "CAD";
|
|
283
|
+
JPY: "JPY";
|
|
284
|
+
CNY: "CNY";
|
|
285
|
+
INR: "INR";
|
|
286
|
+
BRL: "BRL";
|
|
287
|
+
MXN: "MXN";
|
|
288
|
+
ZAR: "ZAR";
|
|
289
|
+
SGD: "SGD";
|
|
290
|
+
HKD: "HKD";
|
|
291
|
+
KRW: "KRW";
|
|
292
|
+
MYR: "MYR";
|
|
293
|
+
THB: "THB";
|
|
294
|
+
IDR: "IDR";
|
|
295
|
+
PHP: "PHP";
|
|
296
|
+
AED: "AED";
|
|
297
|
+
SAR: "SAR";
|
|
298
|
+
ILS: "ILS";
|
|
299
|
+
EGP: "EGP";
|
|
300
|
+
NGN: "NGN";
|
|
301
|
+
PKR: "PKR";
|
|
302
|
+
COP: "COP";
|
|
303
|
+
CLP: "CLP";
|
|
304
|
+
PEN: "PEN";
|
|
305
|
+
VND: "VND";
|
|
306
|
+
KZT: "KZT";
|
|
307
|
+
UAH: "UAH";
|
|
308
|
+
BTC: "BTC";
|
|
309
|
+
ETH: "ETH";
|
|
310
|
+
ADA: "ADA";
|
|
311
|
+
DOT: "DOT";
|
|
312
|
+
ATOM: "ATOM";
|
|
313
|
+
XRP: "XRP";
|
|
314
|
+
LTC: "LTC";
|
|
315
|
+
SOL: "SOL";
|
|
316
|
+
DOGE: "DOGE";
|
|
317
|
+
MATIC: "MATIC";
|
|
318
|
+
AVAX: "AVAX";
|
|
319
|
+
}>, z.ZodArray<z.ZodEnum<{
|
|
320
|
+
CZK: "CZK";
|
|
321
|
+
EUR: "EUR";
|
|
322
|
+
USD: "USD";
|
|
323
|
+
PLN: "PLN";
|
|
324
|
+
RON: "RON";
|
|
325
|
+
GBP: "GBP";
|
|
326
|
+
RUB: "RUB";
|
|
327
|
+
HUF: "HUF";
|
|
328
|
+
CHF: "CHF";
|
|
329
|
+
DKK: "DKK";
|
|
330
|
+
SEK: "SEK";
|
|
331
|
+
HRK: "HRK";
|
|
332
|
+
NOK: "NOK";
|
|
333
|
+
BGN: "BGN";
|
|
334
|
+
TRY: "TRY";
|
|
335
|
+
AUD: "AUD";
|
|
336
|
+
CAD: "CAD";
|
|
337
|
+
JPY: "JPY";
|
|
338
|
+
CNY: "CNY";
|
|
339
|
+
INR: "INR";
|
|
340
|
+
BRL: "BRL";
|
|
341
|
+
MXN: "MXN";
|
|
342
|
+
ZAR: "ZAR";
|
|
343
|
+
SGD: "SGD";
|
|
344
|
+
HKD: "HKD";
|
|
345
|
+
KRW: "KRW";
|
|
346
|
+
MYR: "MYR";
|
|
347
|
+
THB: "THB";
|
|
348
|
+
IDR: "IDR";
|
|
349
|
+
PHP: "PHP";
|
|
350
|
+
AED: "AED";
|
|
351
|
+
SAR: "SAR";
|
|
352
|
+
ILS: "ILS";
|
|
353
|
+
EGP: "EGP";
|
|
354
|
+
NGN: "NGN";
|
|
355
|
+
PKR: "PKR";
|
|
356
|
+
COP: "COP";
|
|
357
|
+
CLP: "CLP";
|
|
358
|
+
PEN: "PEN";
|
|
359
|
+
VND: "VND";
|
|
360
|
+
KZT: "KZT";
|
|
361
|
+
UAH: "UAH";
|
|
362
|
+
BTC: "BTC";
|
|
363
|
+
ETH: "ETH";
|
|
364
|
+
ADA: "ADA";
|
|
365
|
+
DOT: "DOT";
|
|
366
|
+
ATOM: "ATOM";
|
|
367
|
+
XRP: "XRP";
|
|
368
|
+
LTC: "LTC";
|
|
369
|
+
SOL: "SOL";
|
|
370
|
+
DOGE: "DOGE";
|
|
371
|
+
MATIC: "MATIC";
|
|
372
|
+
AVAX: "AVAX";
|
|
373
|
+
}>>]>>;
|
|
374
|
+
filterPaymentyDirection: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
375
|
+
INCOMING: "INCOMING";
|
|
376
|
+
OUTGOING: "OUTGOING";
|
|
377
|
+
}>, z.ZodArray<z.ZodEnum<{
|
|
378
|
+
INCOMING: "INCOMING";
|
|
379
|
+
OUTGOING: "OUTGOING";
|
|
380
|
+
}>>]>>;
|
|
381
|
+
filterPaymentDateFrom: z.ZodOptional<z.ZodDate>;
|
|
382
|
+
filterPaymentDateTo: z.ZodOptional<z.ZodDate>;
|
|
383
|
+
filterPaymentStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
384
|
+
PREPARED: "PREPARED";
|
|
385
|
+
INITIALIZED: "INITIALIZED";
|
|
386
|
+
FAILED: "FAILED";
|
|
387
|
+
PENDING: "PENDING";
|
|
388
|
+
COMPLETED: "COMPLETED";
|
|
389
|
+
CREATED: "CREATED";
|
|
390
|
+
}>, z.ZodArray<z.ZodEnum<{
|
|
391
|
+
PREPARED: "PREPARED";
|
|
392
|
+
INITIALIZED: "INITIALIZED";
|
|
393
|
+
FAILED: "FAILED";
|
|
394
|
+
PENDING: "PENDING";
|
|
395
|
+
COMPLETED: "COMPLETED";
|
|
396
|
+
CREATED: "CREATED";
|
|
397
|
+
}>>]>>;
|
|
398
|
+
}, z.core.$strip>;
|
|
399
|
+
type GetPaymentsInput = z.input<typeof getPaymentsInputSchema>;
|
|
400
|
+
type GetPaymentsOutput = {
|
|
401
|
+
payments: PaymentSelectType[];
|
|
402
|
+
totalCount: number;
|
|
403
|
+
};
|
|
404
|
+
|
|
249
405
|
declare const BankServiceBase_base: (abstract new (ctx: ExecutionContext, env: BankEnv) => WorkerEntrypoint<BankEnv, {}>) & (abstract new (...args: any[]) => _develit_io_backend_sdk.DevelitWorkerMethods);
|
|
250
406
|
declare class BankServiceBase extends BankServiceBase_base {
|
|
251
407
|
readonly db: DrizzleD1Database<typeof tables>;
|
|
@@ -254,6 +410,7 @@ declare class BankServiceBase extends BankServiceBase_base {
|
|
|
254
410
|
constructor(ctx: ExecutionContext, env: BankEnv, config: ConfigEnvironmentBank);
|
|
255
411
|
getAllowedProviders(): ConnectorKey[];
|
|
256
412
|
getAccounts(): Promise<{
|
|
413
|
+
expiresAt: Date | undefined;
|
|
257
414
|
connectorKey: "ERSTE" | "FINBRICKS" | "MOCK" | "CREDITAS" | "MOCK_COBS" | "FIO" | "MONETA";
|
|
258
415
|
status: "AUTHORIZED" | "DISABLED" | "EXPIRED";
|
|
259
416
|
sync: boolean;
|
|
@@ -273,6 +430,7 @@ declare class BankServiceBase extends BankServiceBase_base {
|
|
|
273
430
|
updatedAt: Date | null;
|
|
274
431
|
deletedAt: Date | null;
|
|
275
432
|
}[]>;
|
|
433
|
+
getPayments(input: GetPaymentsInput): Promise<IRPCResponse<GetPaymentsOutput>>;
|
|
276
434
|
accountFetchInterval(connectorKey: ConnectorKey): number;
|
|
277
435
|
syncAccounts(): Promise<IRPCResponse<void>>;
|
|
278
436
|
scheduled(controller: ScheduledController): Promise<void>;
|
|
@@ -286,9 +444,9 @@ declare class BankServiceBase extends BankServiceBase_base {
|
|
|
286
444
|
createdAt: Date | null;
|
|
287
445
|
updatedAt: Date | null;
|
|
288
446
|
deletedAt: Date | null;
|
|
447
|
+
accountId: string | null;
|
|
289
448
|
batchPaymentInitiatedAt: Date | null;
|
|
290
449
|
authorizationUrls: string | string[] | null;
|
|
291
|
-
accountId: string | null;
|
|
292
450
|
payments: PaymentInsertType[];
|
|
293
451
|
metadata: object | null;
|
|
294
452
|
}[] | undefined>>;
|
package/dist/export/worker.d.mts
CHANGED
|
@@ -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.
|
|
3
|
+
import { P as PaymentSelectType, B as BatchSelectType, t as tables, a as PaymentInsertType } from '../shared/bank.Nf6oaNfB.mjs';
|
|
4
4
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
5
5
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
6
6
|
import { z } from 'zod';
|
|
7
|
-
import { A as AccountSelectType, C as ConfigEnvironmentBank, I as IBankConnector, a as ConnectorKey, B as BankAccountWithLastSync } from '../shared/bank.
|
|
7
|
+
import { A as AccountSelectType, C as ConfigEnvironmentBank, I as IBankConnector, a as ConnectorKey, B as BankAccountWithLastSync } from '../shared/bank.D8o86NLF.mjs';
|
|
8
8
|
import 'drizzle-orm/sqlite-core';
|
|
9
9
|
import 'drizzle-orm';
|
|
10
10
|
import '@develit-io/general-codes';
|
|
@@ -246,6 +246,162 @@ declare const processBatchInputSchema: z.ZodObject<{
|
|
|
246
246
|
interface ProcessBatchInput extends z.infer<typeof processBatchInputSchema> {
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
+
declare const getPaymentsInputSchema: z.ZodObject<{
|
|
250
|
+
page: z.ZodNumber;
|
|
251
|
+
limit: z.ZodNumber;
|
|
252
|
+
sort: z.ZodObject<{
|
|
253
|
+
column: z.ZodEnum<{
|
|
254
|
+
amount: "amount";
|
|
255
|
+
createdAt: "createdAt";
|
|
256
|
+
updatedAt: "updatedAt";
|
|
257
|
+
}>;
|
|
258
|
+
direction: z.ZodEnum<{
|
|
259
|
+
asc: "asc";
|
|
260
|
+
desc: "desc";
|
|
261
|
+
}>;
|
|
262
|
+
}, z.core.$strip>;
|
|
263
|
+
filterPaymentAccountId: z.ZodOptional<z.ZodUnion<readonly [z.ZodUUID, z.ZodArray<z.ZodUUID>]>>;
|
|
264
|
+
filterPaymentAmount: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>;
|
|
265
|
+
filterPaymentCurrency: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
266
|
+
CZK: "CZK";
|
|
267
|
+
EUR: "EUR";
|
|
268
|
+
USD: "USD";
|
|
269
|
+
PLN: "PLN";
|
|
270
|
+
RON: "RON";
|
|
271
|
+
GBP: "GBP";
|
|
272
|
+
RUB: "RUB";
|
|
273
|
+
HUF: "HUF";
|
|
274
|
+
CHF: "CHF";
|
|
275
|
+
DKK: "DKK";
|
|
276
|
+
SEK: "SEK";
|
|
277
|
+
HRK: "HRK";
|
|
278
|
+
NOK: "NOK";
|
|
279
|
+
BGN: "BGN";
|
|
280
|
+
TRY: "TRY";
|
|
281
|
+
AUD: "AUD";
|
|
282
|
+
CAD: "CAD";
|
|
283
|
+
JPY: "JPY";
|
|
284
|
+
CNY: "CNY";
|
|
285
|
+
INR: "INR";
|
|
286
|
+
BRL: "BRL";
|
|
287
|
+
MXN: "MXN";
|
|
288
|
+
ZAR: "ZAR";
|
|
289
|
+
SGD: "SGD";
|
|
290
|
+
HKD: "HKD";
|
|
291
|
+
KRW: "KRW";
|
|
292
|
+
MYR: "MYR";
|
|
293
|
+
THB: "THB";
|
|
294
|
+
IDR: "IDR";
|
|
295
|
+
PHP: "PHP";
|
|
296
|
+
AED: "AED";
|
|
297
|
+
SAR: "SAR";
|
|
298
|
+
ILS: "ILS";
|
|
299
|
+
EGP: "EGP";
|
|
300
|
+
NGN: "NGN";
|
|
301
|
+
PKR: "PKR";
|
|
302
|
+
COP: "COP";
|
|
303
|
+
CLP: "CLP";
|
|
304
|
+
PEN: "PEN";
|
|
305
|
+
VND: "VND";
|
|
306
|
+
KZT: "KZT";
|
|
307
|
+
UAH: "UAH";
|
|
308
|
+
BTC: "BTC";
|
|
309
|
+
ETH: "ETH";
|
|
310
|
+
ADA: "ADA";
|
|
311
|
+
DOT: "DOT";
|
|
312
|
+
ATOM: "ATOM";
|
|
313
|
+
XRP: "XRP";
|
|
314
|
+
LTC: "LTC";
|
|
315
|
+
SOL: "SOL";
|
|
316
|
+
DOGE: "DOGE";
|
|
317
|
+
MATIC: "MATIC";
|
|
318
|
+
AVAX: "AVAX";
|
|
319
|
+
}>, z.ZodArray<z.ZodEnum<{
|
|
320
|
+
CZK: "CZK";
|
|
321
|
+
EUR: "EUR";
|
|
322
|
+
USD: "USD";
|
|
323
|
+
PLN: "PLN";
|
|
324
|
+
RON: "RON";
|
|
325
|
+
GBP: "GBP";
|
|
326
|
+
RUB: "RUB";
|
|
327
|
+
HUF: "HUF";
|
|
328
|
+
CHF: "CHF";
|
|
329
|
+
DKK: "DKK";
|
|
330
|
+
SEK: "SEK";
|
|
331
|
+
HRK: "HRK";
|
|
332
|
+
NOK: "NOK";
|
|
333
|
+
BGN: "BGN";
|
|
334
|
+
TRY: "TRY";
|
|
335
|
+
AUD: "AUD";
|
|
336
|
+
CAD: "CAD";
|
|
337
|
+
JPY: "JPY";
|
|
338
|
+
CNY: "CNY";
|
|
339
|
+
INR: "INR";
|
|
340
|
+
BRL: "BRL";
|
|
341
|
+
MXN: "MXN";
|
|
342
|
+
ZAR: "ZAR";
|
|
343
|
+
SGD: "SGD";
|
|
344
|
+
HKD: "HKD";
|
|
345
|
+
KRW: "KRW";
|
|
346
|
+
MYR: "MYR";
|
|
347
|
+
THB: "THB";
|
|
348
|
+
IDR: "IDR";
|
|
349
|
+
PHP: "PHP";
|
|
350
|
+
AED: "AED";
|
|
351
|
+
SAR: "SAR";
|
|
352
|
+
ILS: "ILS";
|
|
353
|
+
EGP: "EGP";
|
|
354
|
+
NGN: "NGN";
|
|
355
|
+
PKR: "PKR";
|
|
356
|
+
COP: "COP";
|
|
357
|
+
CLP: "CLP";
|
|
358
|
+
PEN: "PEN";
|
|
359
|
+
VND: "VND";
|
|
360
|
+
KZT: "KZT";
|
|
361
|
+
UAH: "UAH";
|
|
362
|
+
BTC: "BTC";
|
|
363
|
+
ETH: "ETH";
|
|
364
|
+
ADA: "ADA";
|
|
365
|
+
DOT: "DOT";
|
|
366
|
+
ATOM: "ATOM";
|
|
367
|
+
XRP: "XRP";
|
|
368
|
+
LTC: "LTC";
|
|
369
|
+
SOL: "SOL";
|
|
370
|
+
DOGE: "DOGE";
|
|
371
|
+
MATIC: "MATIC";
|
|
372
|
+
AVAX: "AVAX";
|
|
373
|
+
}>>]>>;
|
|
374
|
+
filterPaymentyDirection: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
375
|
+
INCOMING: "INCOMING";
|
|
376
|
+
OUTGOING: "OUTGOING";
|
|
377
|
+
}>, z.ZodArray<z.ZodEnum<{
|
|
378
|
+
INCOMING: "INCOMING";
|
|
379
|
+
OUTGOING: "OUTGOING";
|
|
380
|
+
}>>]>>;
|
|
381
|
+
filterPaymentDateFrom: z.ZodOptional<z.ZodDate>;
|
|
382
|
+
filterPaymentDateTo: z.ZodOptional<z.ZodDate>;
|
|
383
|
+
filterPaymentStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
384
|
+
PREPARED: "PREPARED";
|
|
385
|
+
INITIALIZED: "INITIALIZED";
|
|
386
|
+
FAILED: "FAILED";
|
|
387
|
+
PENDING: "PENDING";
|
|
388
|
+
COMPLETED: "COMPLETED";
|
|
389
|
+
CREATED: "CREATED";
|
|
390
|
+
}>, z.ZodArray<z.ZodEnum<{
|
|
391
|
+
PREPARED: "PREPARED";
|
|
392
|
+
INITIALIZED: "INITIALIZED";
|
|
393
|
+
FAILED: "FAILED";
|
|
394
|
+
PENDING: "PENDING";
|
|
395
|
+
COMPLETED: "COMPLETED";
|
|
396
|
+
CREATED: "CREATED";
|
|
397
|
+
}>>]>>;
|
|
398
|
+
}, z.core.$strip>;
|
|
399
|
+
type GetPaymentsInput = z.input<typeof getPaymentsInputSchema>;
|
|
400
|
+
type GetPaymentsOutput = {
|
|
401
|
+
payments: PaymentSelectType[];
|
|
402
|
+
totalCount: number;
|
|
403
|
+
};
|
|
404
|
+
|
|
249
405
|
declare const BankServiceBase_base: (abstract new (ctx: ExecutionContext, env: BankEnv) => WorkerEntrypoint<BankEnv, {}>) & (abstract new (...args: any[]) => _develit_io_backend_sdk.DevelitWorkerMethods);
|
|
250
406
|
declare class BankServiceBase extends BankServiceBase_base {
|
|
251
407
|
readonly db: DrizzleD1Database<typeof tables>;
|
|
@@ -254,6 +410,7 @@ declare class BankServiceBase extends BankServiceBase_base {
|
|
|
254
410
|
constructor(ctx: ExecutionContext, env: BankEnv, config: ConfigEnvironmentBank);
|
|
255
411
|
getAllowedProviders(): ConnectorKey[];
|
|
256
412
|
getAccounts(): Promise<{
|
|
413
|
+
expiresAt: Date | undefined;
|
|
257
414
|
connectorKey: "ERSTE" | "FINBRICKS" | "MOCK" | "CREDITAS" | "MOCK_COBS" | "FIO" | "MONETA";
|
|
258
415
|
status: "AUTHORIZED" | "DISABLED" | "EXPIRED";
|
|
259
416
|
sync: boolean;
|
|
@@ -273,6 +430,7 @@ declare class BankServiceBase extends BankServiceBase_base {
|
|
|
273
430
|
updatedAt: Date | null;
|
|
274
431
|
deletedAt: Date | null;
|
|
275
432
|
}[]>;
|
|
433
|
+
getPayments(input: GetPaymentsInput): Promise<IRPCResponse<GetPaymentsOutput>>;
|
|
276
434
|
accountFetchInterval(connectorKey: ConnectorKey): number;
|
|
277
435
|
syncAccounts(): Promise<IRPCResponse<void>>;
|
|
278
436
|
scheduled(controller: ScheduledController): Promise<void>;
|
|
@@ -286,9 +444,9 @@ declare class BankServiceBase extends BankServiceBase_base {
|
|
|
286
444
|
createdAt: Date | null;
|
|
287
445
|
updatedAt: Date | null;
|
|
288
446
|
deletedAt: Date | null;
|
|
447
|
+
accountId: string | null;
|
|
289
448
|
batchPaymentInitiatedAt: Date | null;
|
|
290
449
|
authorizationUrls: string | string[] | null;
|
|
291
|
-
accountId: string | null;
|
|
292
450
|
payments: PaymentInsertType[];
|
|
293
451
|
metadata: object | null;
|
|
294
452
|
}[] | undefined>>;
|