@develit-services/bank 0.8.20 → 1.0.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/README.md +33 -0
- package/dist/database/schema.cjs +1 -1
- package/dist/database/schema.d.cts +2 -1
- package/dist/database/schema.d.mts +2 -1
- package/dist/database/schema.d.ts +2 -1
- package/dist/database/schema.mjs +1 -1
- package/dist/export/worker.cjs +6 -6
- package/dist/export/worker.d.cts +2089 -945
- package/dist/export/worker.d.mts +2089 -945
- package/dist/export/worker.d.ts +2089 -945
- package/dist/export/worker.mjs +7 -7
- package/dist/export/workflows.cjs +5 -5
- package/dist/export/workflows.mjs +5 -5
- package/dist/export/wrangler.d.cts +2 -1
- package/dist/export/wrangler.d.mts +2 -1
- package/dist/export/wrangler.d.ts +2 -1
- package/dist/shared/{bank.Cwg6oHMM.mjs → bank.B4EjD9Ok.mjs} +43 -7
- package/dist/shared/{bank.CPLR0Ul7.mjs → bank.B9-zZrEf.mjs} +1 -1
- package/dist/shared/{bank.DWsHTK_n.cjs → bank.BXGLMl7o.cjs} +43 -7
- package/dist/shared/{bank.vGCuP898.cjs → bank.BbltNpz3.cjs} +1 -1
- package/dist/shared/{bank.DMjtitKo.d.cts → bank.CVJosema.d.cts} +1 -0
- package/dist/shared/{bank.DMjtitKo.d.mts → bank.CVJosema.d.mts} +1 -0
- package/dist/shared/{bank.DMjtitKo.d.ts → bank.CVJosema.d.ts} +1 -0
- package/dist/shared/{bank.ESTBT4J6.mjs → bank.CiB2ECAF.mjs} +10 -4
- package/dist/shared/{bank.DfTdMAi9.d.ts → bank.DAfpDA5W.d.mts} +890 -17
- package/dist/shared/{bank.BOY6AI1t.d.cts → bank.DB0MCjZ8.d.cts} +1795 -1633
- package/dist/shared/{bank.BOY6AI1t.d.mts → bank.DB0MCjZ8.d.mts} +1795 -1633
- package/dist/shared/{bank.BOY6AI1t.d.ts → bank.DB0MCjZ8.d.ts} +1795 -1633
- package/dist/shared/{bank.jRGa7MKk.d.mts → bank.DaEiUdrR.d.ts} +890 -17
- package/dist/shared/{bank.o95cOH_P.cjs → bank.Qg6TA8fX.cjs} +9 -3
- package/dist/shared/{bank.Bo01T_MM.d.cts → bank.n1wkvbjN.d.cts} +890 -17
- package/dist/types.cjs +2 -2
- package/dist/types.d.cts +13 -8
- package/dist/types.d.mts +13 -8
- package/dist/types.d.ts +13 -8
- package/dist/types.mjs +2 -2
- package/package.json +1 -1
package/dist/export/worker.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { uuidv4, first, buildMultiFilterConditions as buildMultiFilterConditions$1, bankAccountMetadataSchema, workflowInstanceStatusSchema, develitWorker, createInternalError, action, service } from '@develit-io/backend-sdk';
|
|
2
|
-
import { v as tables, I as INSTRUCTION_PRIORITIES, C as CHARGE_BEARERS, g as PAYMENT_TYPES, b as CONNECTOR_KEYS, a as BATCH_STATUSES, f as PAYMENT_STATUSES, P as PAYMENT_DIRECTIONS, k as accountInsertSchema, e as PAYMENT_REQUEST_STATUSES, q as isProcessedStatus, r as isTerminalStatus, w as getNonTerminalPaymentRequestsQuery } from '../shared/bank.
|
|
1
|
+
import { uuidv4, first, buildMultiFilterConditions as buildMultiFilterConditions$1, bankAccountMetadataSchema, structuredAddressSchema, workflowInstanceStatusSchema, develitWorker, createInternalError, action, service } from '@develit-io/backend-sdk';
|
|
2
|
+
import { v as tables, I as INSTRUCTION_PRIORITIES, C as CHARGE_BEARERS, g as PAYMENT_TYPES, b as CONNECTOR_KEYS, a as BATCH_STATUSES, f as PAYMENT_STATUSES, P as PAYMENT_DIRECTIONS, k as accountInsertSchema, e as PAYMENT_REQUEST_STATUSES, q as isProcessedStatus, r as isTerminalStatus, w as getNonTerminalPaymentRequestsQuery } from '../shared/bank.CiB2ECAF.mjs';
|
|
3
3
|
import { eq, sql, and, like, asc, desc, inArray, gte, lte, isNull, count } from 'drizzle-orm';
|
|
4
4
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
5
5
|
import { drizzle } from 'drizzle-orm/d1';
|
|
6
|
-
import { j as initiateConnector, g as toIncomingPayment, d as assignAccount, t as toBatchedPayment, h as toPaymentRequestInsert, a as FinbricksClient, F as FINBRICKS_ENDPOINTS } from '../shared/bank.
|
|
6
|
+
import { j as initiateConnector, g as toIncomingPayment, d as assignAccount, t as toBatchedPayment, h as toPaymentRequestInsert, a as FinbricksClient, F as FINBRICKS_ENDPOINTS } from '../shared/bank.B4EjD9Ok.mjs';
|
|
7
7
|
import 'jose';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import { CURRENCY_CODES } from '@develit-io/general-codes';
|
|
10
10
|
import 'date-fns';
|
|
11
11
|
import 'node:crypto';
|
|
12
|
-
import { h as encrypt, d as createCredentialsResolver, e as updatePaymentRequestStatusCommand, a as getPaymentRequestsByBatchIdQuery, g as getBatchByIdQuery, u as upsertBatchCommand, i as importAesKey, f as createPaymentCommand, b as getAccountByIdQuery } from '../shared/bank.
|
|
12
|
+
import { h as encrypt, d as createCredentialsResolver, e as updatePaymentRequestStatusCommand, a as getPaymentRequestsByBatchIdQuery, g as getBatchByIdQuery, u as upsertBatchCommand, i as importAesKey, f as createPaymentCommand, b as getAccountByIdQuery } from '../shared/bank.B9-zZrEf.mjs';
|
|
13
13
|
import 'drizzle-orm/sqlite-core';
|
|
14
14
|
import 'drizzle-orm/relations';
|
|
15
15
|
import 'drizzle-zod';
|
|
@@ -351,7 +351,7 @@ function buildPaymentRequestEvent(pr) {
|
|
|
351
351
|
metadata: {
|
|
352
352
|
correlationId: pr.correlationId,
|
|
353
353
|
entityId: pr.id,
|
|
354
|
-
timestamp:
|
|
354
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
355
355
|
}
|
|
356
356
|
};
|
|
357
357
|
}
|
|
@@ -387,7 +387,7 @@ const authorizeAccountInputSchema = z.object({
|
|
|
387
387
|
syncIntervalS: z.number().int().positive().optional(),
|
|
388
388
|
startSync: z.boolean().optional(),
|
|
389
389
|
lastSyncAt: z.date().optional(),
|
|
390
|
-
address:
|
|
390
|
+
address: structuredAddressSchema.optional()
|
|
391
391
|
});
|
|
392
392
|
|
|
393
393
|
const simulateDepositInputSchema = z.object({
|
|
@@ -1187,7 +1187,7 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
|
|
|
1187
1187
|
metadata: {
|
|
1188
1188
|
correlationId: createdPayment.correlationId,
|
|
1189
1189
|
entityId: createdPayment.id,
|
|
1190
|
-
timestamp:
|
|
1190
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
1191
1191
|
}
|
|
1192
1192
|
});
|
|
1193
1193
|
return createdPayment;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const backendSdk = require('@develit-io/backend-sdk');
|
|
4
|
-
const database_schema = require('../shared/bank.
|
|
4
|
+
const database_schema = require('../shared/bank.Qg6TA8fX.cjs');
|
|
5
5
|
const batchLifecycle = require('../shared/bank.NF8bZBy0.cjs');
|
|
6
|
-
const mock_connector = require('../shared/bank.
|
|
6
|
+
const mock_connector = require('../shared/bank.BXGLMl7o.cjs');
|
|
7
7
|
const drizzleOrm = require('drizzle-orm');
|
|
8
|
-
const credentialsResolver = require('../shared/bank.
|
|
8
|
+
const credentialsResolver = require('../shared/bank.BbltNpz3.cjs');
|
|
9
9
|
const cloudflare_workers = require('cloudflare:workers');
|
|
10
10
|
const cloudflare_workflows = require('cloudflare:workflows');
|
|
11
11
|
const d1 = require('drizzle-orm/d1');
|
|
@@ -247,7 +247,7 @@ class BankProcessBatch extends cloudflare_workers.WorkflowEntrypoint {
|
|
|
247
247
|
metadata: {
|
|
248
248
|
correlationId: backendSdk.uuidv4(),
|
|
249
249
|
entityId: payment.id,
|
|
250
|
-
timestamp:
|
|
250
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
251
251
|
}
|
|
252
252
|
}));
|
|
253
253
|
await pushToQueue$1(
|
|
@@ -407,7 +407,7 @@ class BankSyncAccountPayments extends cloudflare_workers.WorkflowEntrypoint {
|
|
|
407
407
|
metadata: {
|
|
408
408
|
correlationId: p.parsed.correlationId,
|
|
409
409
|
entityId: p.parsed.id,
|
|
410
|
-
timestamp:
|
|
410
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
411
411
|
}
|
|
412
412
|
}))
|
|
413
413
|
);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { first, uuidv4, asNonEmpty } from '@develit-io/backend-sdk';
|
|
2
|
-
import { v as tables, o as isPaymentCompleted } from '../shared/bank.
|
|
2
|
+
import { v as tables, o as isPaymentCompleted } from '../shared/bank.CiB2ECAF.mjs';
|
|
3
3
|
import { i as isBatchAuthorized, b as isBatchFailed, d as isBatchProcessing } from '../shared/bank.XqSw509X.mjs';
|
|
4
|
-
import { e as toBatchedPaymentFromPaymentRequest, i as toPreparedPayment, j as initiateConnector } from '../shared/bank.
|
|
4
|
+
import { e as toBatchedPaymentFromPaymentRequest, i as toPreparedPayment, j as initiateConnector } from '../shared/bank.B4EjD9Ok.mjs';
|
|
5
5
|
import { eq, and, inArray } from 'drizzle-orm';
|
|
6
|
-
import { g as getBatchByIdQuery, a as getPaymentRequestsByBatchIdQuery, c as checksum, u as upsertBatchCommand, b as getAccountByIdQuery, d as createCredentialsResolver, e as updatePaymentRequestStatusCommand, f as createPaymentCommand } from '../shared/bank.
|
|
6
|
+
import { g as getBatchByIdQuery, a as getPaymentRequestsByBatchIdQuery, c as checksum, u as upsertBatchCommand, b as getAccountByIdQuery, d as createCredentialsResolver, e as updatePaymentRequestStatusCommand, f as createPaymentCommand } from '../shared/bank.B9-zZrEf.mjs';
|
|
7
7
|
import { WorkflowEntrypoint } from 'cloudflare:workers';
|
|
8
8
|
import { NonRetryableError } from 'cloudflare:workflows';
|
|
9
9
|
import { drizzle } from 'drizzle-orm/d1';
|
|
@@ -245,7 +245,7 @@ class BankProcessBatch extends WorkflowEntrypoint {
|
|
|
245
245
|
metadata: {
|
|
246
246
|
correlationId: uuidv4(),
|
|
247
247
|
entityId: payment.id,
|
|
248
|
-
timestamp:
|
|
248
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
249
249
|
}
|
|
250
250
|
}));
|
|
251
251
|
await pushToQueue$1(
|
|
@@ -405,7 +405,7 @@ class BankSyncAccountPayments extends WorkflowEntrypoint {
|
|
|
405
405
|
metadata: {
|
|
406
406
|
correlationId: p.parsed.correlationId,
|
|
407
407
|
entityId: p.parsed.id,
|
|
408
|
-
timestamp:
|
|
408
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
409
409
|
}
|
|
410
410
|
}))
|
|
411
411
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BankServiceWranglerConfig } from '../shared/bank.
|
|
1
|
+
import { B as BankServiceWranglerConfig } from '../shared/bank.CVJosema.cjs';
|
|
2
2
|
|
|
3
3
|
declare function defineBankServiceWrangler(config: BankServiceWranglerConfig): {
|
|
4
4
|
vars: {
|
|
@@ -12,6 +12,7 @@ declare function defineBankServiceWrangler(config: BankServiceWranglerConfig): {
|
|
|
12
12
|
BANK_AUTH_RECIPIENT: string;
|
|
13
13
|
DBUCS_BASE_URI: string;
|
|
14
14
|
DBUCS_USERNAME: string;
|
|
15
|
+
DBUCS_APPLICATION_CODE: string;
|
|
15
16
|
DBUCS_TX_AUTH_URI: string;
|
|
16
17
|
REDIRECT_URI: string;
|
|
17
18
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BankServiceWranglerConfig } from '../shared/bank.
|
|
1
|
+
import { B as BankServiceWranglerConfig } from '../shared/bank.CVJosema.mjs';
|
|
2
2
|
|
|
3
3
|
declare function defineBankServiceWrangler(config: BankServiceWranglerConfig): {
|
|
4
4
|
vars: {
|
|
@@ -12,6 +12,7 @@ declare function defineBankServiceWrangler(config: BankServiceWranglerConfig): {
|
|
|
12
12
|
BANK_AUTH_RECIPIENT: string;
|
|
13
13
|
DBUCS_BASE_URI: string;
|
|
14
14
|
DBUCS_USERNAME: string;
|
|
15
|
+
DBUCS_APPLICATION_CODE: string;
|
|
15
16
|
DBUCS_TX_AUTH_URI: string;
|
|
16
17
|
REDIRECT_URI: string;
|
|
17
18
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BankServiceWranglerConfig } from '../shared/bank.
|
|
1
|
+
import { B as BankServiceWranglerConfig } from '../shared/bank.CVJosema.js';
|
|
2
2
|
|
|
3
3
|
declare function defineBankServiceWrangler(config: BankServiceWranglerConfig): {
|
|
4
4
|
vars: {
|
|
@@ -12,6 +12,7 @@ declare function defineBankServiceWrangler(config: BankServiceWranglerConfig): {
|
|
|
12
12
|
BANK_AUTH_RECIPIENT: string;
|
|
13
13
|
DBUCS_BASE_URI: string;
|
|
14
14
|
DBUCS_USERNAME: string;
|
|
15
|
+
DBUCS_APPLICATION_CODE: string;
|
|
15
16
|
DBUCS_TX_AUTH_URI: string;
|
|
16
17
|
REDIRECT_URI: string;
|
|
17
18
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { uuidv4, createInternalError, useResult } from '@develit-io/backend-sdk';
|
|
2
2
|
import { format, parseISO } from 'date-fns';
|
|
3
3
|
import { CURRENCY_CODES } from '@develit-io/general-codes';
|
|
4
|
-
import './bank.
|
|
4
|
+
import './bank.CiB2ECAF.mjs';
|
|
5
5
|
import 'drizzle-orm';
|
|
6
6
|
import { importPKCS8, SignJWT } from 'jose';
|
|
7
7
|
import 'node:crypto';
|
|
@@ -496,7 +496,14 @@ const mapFinbricksTransactionToPayment = (tx, account) => {
|
|
|
496
496
|
)[0] : account.number || void 0,
|
|
497
497
|
bankCode: isIncoming ? account.bankCode || void 0 : related?.creditorAccount?.identification?.other?.identification ? related.creditorAccount.identification.other.identification.split(
|
|
498
498
|
"/"
|
|
499
|
-
)[1] : account.bankCode || void 0
|
|
499
|
+
)[1] : account.bankCode || void 0,
|
|
500
|
+
address: related?.creditor?.postalAddress ? {
|
|
501
|
+
streetName: related.creditor.postalAddress.streetName,
|
|
502
|
+
buildingNumber: related.creditor.postalAddress.buildingNumber,
|
|
503
|
+
city: related.creditor.postalAddress.townName,
|
|
504
|
+
postalCode: related.creditor.postalAddress.postCode,
|
|
505
|
+
countryCode: related.creditor.postalAddress.country
|
|
506
|
+
} : void 0
|
|
500
507
|
},
|
|
501
508
|
debtor: {
|
|
502
509
|
holderName: related?.debtorAccount?.name || related?.debtor?.name || "Unknown",
|
|
@@ -506,7 +513,14 @@ const mapFinbricksTransactionToPayment = (tx, account) => {
|
|
|
506
513
|
)[0] : account.number || void 0 : account.number || void 0,
|
|
507
514
|
bankCode: isIncoming ? related?.debtorAccount?.identification?.other?.identification ? related.debtorAccount.identification.other.identification.split(
|
|
508
515
|
"/"
|
|
509
|
-
)[1] : account.bankCode || void 0 : account.bankCode || void 0
|
|
516
|
+
)[1] : account.bankCode || void 0 : account.bankCode || void 0,
|
|
517
|
+
address: related?.debtor?.postalAddress ? {
|
|
518
|
+
streetName: related.debtor.postalAddress.streetName,
|
|
519
|
+
buildingNumber: related.debtor.postalAddress.buildingNumber,
|
|
520
|
+
city: related.debtor.postalAddress.townName,
|
|
521
|
+
postalCode: related.debtor.postalAddress.postCode,
|
|
522
|
+
countryCode: related.debtor.postalAddress.country
|
|
523
|
+
} : void 0
|
|
510
524
|
},
|
|
511
525
|
direction: isIncoming ? "INCOMING" : "OUTGOING"
|
|
512
526
|
};
|
|
@@ -520,6 +534,15 @@ function autoVariableSymbol(paymentId) {
|
|
|
520
534
|
}
|
|
521
535
|
return String(Math.abs(hash) % 1e10).padStart(10, "0");
|
|
522
536
|
}
|
|
537
|
+
function mapToFinbricksAddress(addr) {
|
|
538
|
+
if (!addr) return void 0;
|
|
539
|
+
return {
|
|
540
|
+
...addr.streetName && { streetName: addr.streetName },
|
|
541
|
+
...addr.buildingNumber && { buildingNumber: addr.buildingNumber },
|
|
542
|
+
...addr.city && { town: addr.city },
|
|
543
|
+
...addr.countryCode && { country: addr.countryCode }
|
|
544
|
+
};
|
|
545
|
+
}
|
|
523
546
|
class FinbricksConnector extends IBankConnector {
|
|
524
547
|
constructor(provider, {
|
|
525
548
|
BASE_URI,
|
|
@@ -767,6 +790,7 @@ class FinbricksConnector extends IBankConnector {
|
|
|
767
790
|
(acc) => acc.iban === payment.debtorIban
|
|
768
791
|
);
|
|
769
792
|
const clientId = await this.getClientId(debtorAccount.id);
|
|
793
|
+
const creditorAddress = mapToFinbricksAddress(payment.creditor.address);
|
|
770
794
|
const bankRefId = uuidv4();
|
|
771
795
|
const [response, error] = await useResult(
|
|
772
796
|
this.finbricks.request({
|
|
@@ -798,7 +822,8 @@ class FinbricksConnector extends IBankConnector {
|
|
|
798
822
|
type: "IBAN",
|
|
799
823
|
value: payment.creditor.iban
|
|
800
824
|
},
|
|
801
|
-
creditorName: payment.creditor.holderName || ""
|
|
825
|
+
creditorName: payment.creditor.holderName || "",
|
|
826
|
+
...creditorAddress && { postalAddress: creditorAddress }
|
|
802
827
|
},
|
|
803
828
|
callbackUrl: `${this.finbricks.REDIRECT_URI}?type=paymentRequest&paymentRequestId=${payment.id}`
|
|
804
829
|
}
|
|
@@ -830,6 +855,7 @@ class FinbricksConnector extends IBankConnector {
|
|
|
830
855
|
(acc) => acc.iban === payment.debtorIban
|
|
831
856
|
);
|
|
832
857
|
const clientId = await this.getClientId(debtorAccount.id);
|
|
858
|
+
const creditorAddress = mapToFinbricksAddress(payment.creditor.address);
|
|
833
859
|
const bankRefId = uuidv4();
|
|
834
860
|
const [response, error] = await useResult(
|
|
835
861
|
this.finbricks.request({
|
|
@@ -852,7 +878,8 @@ class FinbricksConnector extends IBankConnector {
|
|
|
852
878
|
},
|
|
853
879
|
creditor: {
|
|
854
880
|
creditorAccountIban: payment.creditor.iban,
|
|
855
|
-
creditorName: payment.creditor.holderName
|
|
881
|
+
creditorName: payment.creditor.holderName,
|
|
882
|
+
...creditorAddress && { postalAddress: creditorAddress }
|
|
856
883
|
},
|
|
857
884
|
callbackUrl: `${this.finbricks.REDIRECT_URI}?type=paymentRequest&paymentRequestId=${payment.id}`
|
|
858
885
|
}
|
|
@@ -1212,6 +1239,7 @@ const initiateConnector = async ({
|
|
|
1212
1239
|
return new DbuConnector({
|
|
1213
1240
|
BASE_URL: env.DBUCS_BASE_URI,
|
|
1214
1241
|
USERNAME: env.DBUCS_USERNAME,
|
|
1242
|
+
APPLICATION_CODE: env.DBUCS_APPLICATION_CODE,
|
|
1215
1243
|
KV: env.BANK_KV,
|
|
1216
1244
|
API: env.DBU_CBS_BACKOFFICE_DEV,
|
|
1217
1245
|
REDIRECT_URI: env.REDIRECT_URI,
|
|
@@ -1271,6 +1299,7 @@ class DbuConnector extends IBankConnector {
|
|
|
1271
1299
|
constructor({
|
|
1272
1300
|
BASE_URL,
|
|
1273
1301
|
USERNAME,
|
|
1302
|
+
APPLICATION_CODE,
|
|
1274
1303
|
KV,
|
|
1275
1304
|
API,
|
|
1276
1305
|
REDIRECT_URI,
|
|
@@ -1282,6 +1311,7 @@ class DbuConnector extends IBankConnector {
|
|
|
1282
1311
|
this.connectedAccounts = [];
|
|
1283
1312
|
this.baseUrl = BASE_URL;
|
|
1284
1313
|
this.username = USERNAME;
|
|
1314
|
+
this.applicationCode = APPLICATION_CODE;
|
|
1285
1315
|
this.kv = KV;
|
|
1286
1316
|
this.api = API;
|
|
1287
1317
|
this.redirectUri = REDIRECT_URI;
|
|
@@ -1381,11 +1411,13 @@ class DbuConnector extends IBankConnector {
|
|
|
1381
1411
|
number: transaction.accountNumberCredit,
|
|
1382
1412
|
bankCode: transaction.bankCodeCredit,
|
|
1383
1413
|
iban: creditorIban
|
|
1414
|
+
// Note: DBU API does not provide address data in transaction responses
|
|
1384
1415
|
},
|
|
1385
1416
|
debtor: {
|
|
1386
1417
|
number: transaction.accountNumberDebit,
|
|
1387
1418
|
bankCode: transaction.bankCodeDebit,
|
|
1388
1419
|
iban: debtorIban
|
|
1420
|
+
// Note: DBU API does not provide address data in transaction responses
|
|
1389
1421
|
},
|
|
1390
1422
|
debtorIban
|
|
1391
1423
|
};
|
|
@@ -1543,7 +1575,8 @@ class DbuConnector extends IBankConnector {
|
|
|
1543
1575
|
specSymbol: payment.ss,
|
|
1544
1576
|
constSymbol: payment.ks,
|
|
1545
1577
|
uniqueExternalId: payment.id,
|
|
1546
|
-
standardPaymentFallback: "N"
|
|
1578
|
+
standardPaymentFallback: "N",
|
|
1579
|
+
applicationCode: this.applicationCode
|
|
1547
1580
|
};
|
|
1548
1581
|
const response = await this.makeRequest(
|
|
1549
1582
|
"/required-transactions/instant-payments",
|
|
@@ -1590,7 +1623,8 @@ class DbuConnector extends IBankConnector {
|
|
|
1590
1623
|
specSymbol: payment.ss,
|
|
1591
1624
|
constSymbol: payment.ks,
|
|
1592
1625
|
uniqueExternalId: payment.id,
|
|
1593
|
-
with4EyeApproval: "Y"
|
|
1626
|
+
with4EyeApproval: "Y",
|
|
1627
|
+
applicationCode: this.applicationCode
|
|
1594
1628
|
};
|
|
1595
1629
|
const response = await this.makeRequest(
|
|
1596
1630
|
"/required-transactions",
|
|
@@ -2009,6 +2043,7 @@ class ErsteConnector extends IBankConnector {
|
|
|
2009
2043
|
bankCode: payment.entryDetails.transactionDetails.relatedParties.debtorAccount?.identification.other?.identification ? payment.entryDetails.transactionDetails.relatedParties.debtorAccount.identification.other.identification.split(
|
|
2010
2044
|
"/"
|
|
2011
2045
|
)[1] : void 0
|
|
2046
|
+
// Note: Erste API does not provide postalAddress in transaction responses
|
|
2012
2047
|
},
|
|
2013
2048
|
creditor: {
|
|
2014
2049
|
holderName: payment.entryDetails.transactionDetails.relatedParties.creditor?.name,
|
|
@@ -2019,6 +2054,7 @@ class ErsteConnector extends IBankConnector {
|
|
|
2019
2054
|
bankCode: payment.entryDetails.transactionDetails.relatedParties.creditorAccount?.identification.other?.identification ? payment.entryDetails.transactionDetails.relatedParties.creditorAccount.identification.other.identification.split(
|
|
2020
2055
|
"/"
|
|
2021
2056
|
)[1] : void 0
|
|
2057
|
+
// Note: Erste API does not provide postalAddress in transaction responses
|
|
2022
2058
|
},
|
|
2023
2059
|
paymentType: "DOMESTIC",
|
|
2024
2060
|
direction: "INCOMING",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const backendSdk = require('@develit-io/backend-sdk');
|
|
4
4
|
const dateFns = require('date-fns');
|
|
5
5
|
const generalCodes = require('@develit-io/general-codes');
|
|
6
|
-
require('./bank.
|
|
6
|
+
require('./bank.Qg6TA8fX.cjs');
|
|
7
7
|
require('drizzle-orm');
|
|
8
8
|
const jose = require('jose');
|
|
9
9
|
require('node:crypto');
|
|
@@ -498,7 +498,14 @@ const mapFinbricksTransactionToPayment = (tx, account) => {
|
|
|
498
498
|
)[0] : account.number || void 0,
|
|
499
499
|
bankCode: isIncoming ? account.bankCode || void 0 : related?.creditorAccount?.identification?.other?.identification ? related.creditorAccount.identification.other.identification.split(
|
|
500
500
|
"/"
|
|
501
|
-
)[1] : account.bankCode || void 0
|
|
501
|
+
)[1] : account.bankCode || void 0,
|
|
502
|
+
address: related?.creditor?.postalAddress ? {
|
|
503
|
+
streetName: related.creditor.postalAddress.streetName,
|
|
504
|
+
buildingNumber: related.creditor.postalAddress.buildingNumber,
|
|
505
|
+
city: related.creditor.postalAddress.townName,
|
|
506
|
+
postalCode: related.creditor.postalAddress.postCode,
|
|
507
|
+
countryCode: related.creditor.postalAddress.country
|
|
508
|
+
} : void 0
|
|
502
509
|
},
|
|
503
510
|
debtor: {
|
|
504
511
|
holderName: related?.debtorAccount?.name || related?.debtor?.name || "Unknown",
|
|
@@ -508,7 +515,14 @@ const mapFinbricksTransactionToPayment = (tx, account) => {
|
|
|
508
515
|
)[0] : account.number || void 0 : account.number || void 0,
|
|
509
516
|
bankCode: isIncoming ? related?.debtorAccount?.identification?.other?.identification ? related.debtorAccount.identification.other.identification.split(
|
|
510
517
|
"/"
|
|
511
|
-
)[1] : account.bankCode || void 0 : account.bankCode || void 0
|
|
518
|
+
)[1] : account.bankCode || void 0 : account.bankCode || void 0,
|
|
519
|
+
address: related?.debtor?.postalAddress ? {
|
|
520
|
+
streetName: related.debtor.postalAddress.streetName,
|
|
521
|
+
buildingNumber: related.debtor.postalAddress.buildingNumber,
|
|
522
|
+
city: related.debtor.postalAddress.townName,
|
|
523
|
+
postalCode: related.debtor.postalAddress.postCode,
|
|
524
|
+
countryCode: related.debtor.postalAddress.country
|
|
525
|
+
} : void 0
|
|
512
526
|
},
|
|
513
527
|
direction: isIncoming ? "INCOMING" : "OUTGOING"
|
|
514
528
|
};
|
|
@@ -522,6 +536,15 @@ function autoVariableSymbol(paymentId) {
|
|
|
522
536
|
}
|
|
523
537
|
return String(Math.abs(hash) % 1e10).padStart(10, "0");
|
|
524
538
|
}
|
|
539
|
+
function mapToFinbricksAddress(addr) {
|
|
540
|
+
if (!addr) return void 0;
|
|
541
|
+
return {
|
|
542
|
+
...addr.streetName && { streetName: addr.streetName },
|
|
543
|
+
...addr.buildingNumber && { buildingNumber: addr.buildingNumber },
|
|
544
|
+
...addr.city && { town: addr.city },
|
|
545
|
+
...addr.countryCode && { country: addr.countryCode }
|
|
546
|
+
};
|
|
547
|
+
}
|
|
525
548
|
class FinbricksConnector extends IBankConnector {
|
|
526
549
|
constructor(provider, {
|
|
527
550
|
BASE_URI,
|
|
@@ -769,6 +792,7 @@ class FinbricksConnector extends IBankConnector {
|
|
|
769
792
|
(acc) => acc.iban === payment.debtorIban
|
|
770
793
|
);
|
|
771
794
|
const clientId = await this.getClientId(debtorAccount.id);
|
|
795
|
+
const creditorAddress = mapToFinbricksAddress(payment.creditor.address);
|
|
772
796
|
const bankRefId = backendSdk.uuidv4();
|
|
773
797
|
const [response, error] = await backendSdk.useResult(
|
|
774
798
|
this.finbricks.request({
|
|
@@ -800,7 +824,8 @@ class FinbricksConnector extends IBankConnector {
|
|
|
800
824
|
type: "IBAN",
|
|
801
825
|
value: payment.creditor.iban
|
|
802
826
|
},
|
|
803
|
-
creditorName: payment.creditor.holderName || ""
|
|
827
|
+
creditorName: payment.creditor.holderName || "",
|
|
828
|
+
...creditorAddress && { postalAddress: creditorAddress }
|
|
804
829
|
},
|
|
805
830
|
callbackUrl: `${this.finbricks.REDIRECT_URI}?type=paymentRequest&paymentRequestId=${payment.id}`
|
|
806
831
|
}
|
|
@@ -832,6 +857,7 @@ class FinbricksConnector extends IBankConnector {
|
|
|
832
857
|
(acc) => acc.iban === payment.debtorIban
|
|
833
858
|
);
|
|
834
859
|
const clientId = await this.getClientId(debtorAccount.id);
|
|
860
|
+
const creditorAddress = mapToFinbricksAddress(payment.creditor.address);
|
|
835
861
|
const bankRefId = backendSdk.uuidv4();
|
|
836
862
|
const [response, error] = await backendSdk.useResult(
|
|
837
863
|
this.finbricks.request({
|
|
@@ -854,7 +880,8 @@ class FinbricksConnector extends IBankConnector {
|
|
|
854
880
|
},
|
|
855
881
|
creditor: {
|
|
856
882
|
creditorAccountIban: payment.creditor.iban,
|
|
857
|
-
creditorName: payment.creditor.holderName
|
|
883
|
+
creditorName: payment.creditor.holderName,
|
|
884
|
+
...creditorAddress && { postalAddress: creditorAddress }
|
|
858
885
|
},
|
|
859
886
|
callbackUrl: `${this.finbricks.REDIRECT_URI}?type=paymentRequest&paymentRequestId=${payment.id}`
|
|
860
887
|
}
|
|
@@ -1214,6 +1241,7 @@ const initiateConnector = async ({
|
|
|
1214
1241
|
return new DbuConnector({
|
|
1215
1242
|
BASE_URL: env.DBUCS_BASE_URI,
|
|
1216
1243
|
USERNAME: env.DBUCS_USERNAME,
|
|
1244
|
+
APPLICATION_CODE: env.DBUCS_APPLICATION_CODE,
|
|
1217
1245
|
KV: env.BANK_KV,
|
|
1218
1246
|
API: env.DBU_CBS_BACKOFFICE_DEV,
|
|
1219
1247
|
REDIRECT_URI: env.REDIRECT_URI,
|
|
@@ -1273,6 +1301,7 @@ class DbuConnector extends IBankConnector {
|
|
|
1273
1301
|
constructor({
|
|
1274
1302
|
BASE_URL,
|
|
1275
1303
|
USERNAME,
|
|
1304
|
+
APPLICATION_CODE,
|
|
1276
1305
|
KV,
|
|
1277
1306
|
API,
|
|
1278
1307
|
REDIRECT_URI,
|
|
@@ -1284,6 +1313,7 @@ class DbuConnector extends IBankConnector {
|
|
|
1284
1313
|
this.connectedAccounts = [];
|
|
1285
1314
|
this.baseUrl = BASE_URL;
|
|
1286
1315
|
this.username = USERNAME;
|
|
1316
|
+
this.applicationCode = APPLICATION_CODE;
|
|
1287
1317
|
this.kv = KV;
|
|
1288
1318
|
this.api = API;
|
|
1289
1319
|
this.redirectUri = REDIRECT_URI;
|
|
@@ -1383,11 +1413,13 @@ class DbuConnector extends IBankConnector {
|
|
|
1383
1413
|
number: transaction.accountNumberCredit,
|
|
1384
1414
|
bankCode: transaction.bankCodeCredit,
|
|
1385
1415
|
iban: creditorIban
|
|
1416
|
+
// Note: DBU API does not provide address data in transaction responses
|
|
1386
1417
|
},
|
|
1387
1418
|
debtor: {
|
|
1388
1419
|
number: transaction.accountNumberDebit,
|
|
1389
1420
|
bankCode: transaction.bankCodeDebit,
|
|
1390
1421
|
iban: debtorIban
|
|
1422
|
+
// Note: DBU API does not provide address data in transaction responses
|
|
1391
1423
|
},
|
|
1392
1424
|
debtorIban
|
|
1393
1425
|
};
|
|
@@ -1545,7 +1577,8 @@ class DbuConnector extends IBankConnector {
|
|
|
1545
1577
|
specSymbol: payment.ss,
|
|
1546
1578
|
constSymbol: payment.ks,
|
|
1547
1579
|
uniqueExternalId: payment.id,
|
|
1548
|
-
standardPaymentFallback: "N"
|
|
1580
|
+
standardPaymentFallback: "N",
|
|
1581
|
+
applicationCode: this.applicationCode
|
|
1549
1582
|
};
|
|
1550
1583
|
const response = await this.makeRequest(
|
|
1551
1584
|
"/required-transactions/instant-payments",
|
|
@@ -1592,7 +1625,8 @@ class DbuConnector extends IBankConnector {
|
|
|
1592
1625
|
specSymbol: payment.ss,
|
|
1593
1626
|
constSymbol: payment.ks,
|
|
1594
1627
|
uniqueExternalId: payment.id,
|
|
1595
|
-
with4EyeApproval: "Y"
|
|
1628
|
+
with4EyeApproval: "Y",
|
|
1629
|
+
applicationCode: this.applicationCode
|
|
1596
1630
|
};
|
|
1597
1631
|
const response = await this.makeRequest(
|
|
1598
1632
|
"/required-transactions",
|
|
@@ -2011,6 +2045,7 @@ class ErsteConnector extends IBankConnector {
|
|
|
2011
2045
|
bankCode: payment.entryDetails.transactionDetails.relatedParties.debtorAccount?.identification.other?.identification ? payment.entryDetails.transactionDetails.relatedParties.debtorAccount.identification.other.identification.split(
|
|
2012
2046
|
"/"
|
|
2013
2047
|
)[1] : void 0
|
|
2048
|
+
// Note: Erste API does not provide postalAddress in transaction responses
|
|
2014
2049
|
},
|
|
2015
2050
|
creditor: {
|
|
2016
2051
|
holderName: payment.entryDetails.transactionDetails.relatedParties.creditor?.name,
|
|
@@ -2021,6 +2056,7 @@ class ErsteConnector extends IBankConnector {
|
|
|
2021
2056
|
bankCode: payment.entryDetails.transactionDetails.relatedParties.creditorAccount?.identification.other?.identification ? payment.entryDetails.transactionDetails.relatedParties.creditorAccount.identification.other.identification.split(
|
|
2022
2057
|
"/"
|
|
2023
2058
|
)[1] : void 0
|
|
2059
|
+
// Note: Erste API does not provide postalAddress in transaction responses
|
|
2024
2060
|
},
|
|
2025
2061
|
paymentType: "DOMESTIC",
|
|
2026
2062
|
direction: "INCOMING",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const drizzleOrm = require('drizzle-orm');
|
|
4
|
-
const database_schema = require('./bank.
|
|
4
|
+
const database_schema = require('./bank.Qg6TA8fX.cjs');
|
|
5
5
|
const backendSdk = require('@develit-io/backend-sdk');
|
|
6
6
|
require('date-fns');
|
|
7
7
|
require('jose');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bankAccount, base } from '@develit-io/backend-sdk';
|
|
1
|
+
import { bankAccount, base, structuredAddressSchema } from '@develit-io/backend-sdk';
|
|
2
2
|
import { sqliteTable, text, integer, unique, real, index } from 'drizzle-orm/sqlite-core';
|
|
3
3
|
import 'date-fns';
|
|
4
4
|
import 'jose';
|
|
@@ -123,9 +123,15 @@ const account = sqliteTable(
|
|
|
123
123
|
(t) => [unique().on(t.iban)]
|
|
124
124
|
);
|
|
125
125
|
|
|
126
|
-
const accountInsertSchema = createInsertSchema(account)
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
const accountInsertSchema = createInsertSchema(account).extend({
|
|
127
|
+
address: structuredAddressSchema.nullable().optional()
|
|
128
|
+
});
|
|
129
|
+
const accountUpdateSchema = createUpdateSchema(account).extend({
|
|
130
|
+
address: structuredAddressSchema.nullable().optional()
|
|
131
|
+
});
|
|
132
|
+
const accountSelectSchema = createSelectSchema(account).extend({
|
|
133
|
+
address: structuredAddressSchema.nullable().optional()
|
|
134
|
+
});
|
|
129
135
|
|
|
130
136
|
const accountCredentials = sqliteTable("account_credentials", {
|
|
131
137
|
...base,
|