@develit-services/bank 0.8.20 → 1.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/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 +2083 -939
- package/dist/export/worker.d.mts +2083 -939
- package/dist/export/worker.d.ts +2083 -939
- 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.jRGa7MKk.d.mts → bank.5WIfKLgm.d.ts} +890 -17
- package/dist/shared/{bank.o95cOH_P.cjs → bank.B5nOIsGC.cjs} +10 -4
- package/dist/shared/{bank.BOY6AI1t.d.cts → bank.BECp1kh0.d.cts} +1789 -1627
- package/dist/shared/{bank.BOY6AI1t.d.mts → bank.BECp1kh0.d.mts} +1789 -1627
- package/dist/shared/{bank.BOY6AI1t.d.ts → bank.BECp1kh0.d.ts} +1789 -1627
- package/dist/shared/{bank.DWsHTK_n.cjs → bank.BMLgGhBY.cjs} +44 -8
- 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.DfTdMAi9.d.ts → bank.CX7-ohgB.d.mts} +890 -17
- package/dist/shared/{bank.ESTBT4J6.mjs → bank.DMsXwzJn.mjs} +11 -5
- package/dist/shared/{bank.Cwg6oHMM.mjs → bank.DTnA4eC9.mjs} +44 -8
- package/dist/shared/{bank.vGCuP898.cjs → bank.f7ykgYdD.cjs} +7 -3
- package/dist/shared/{bank.CPLR0Ul7.mjs → bank.rcoRRywt.mjs} +7 -3
- package/dist/shared/{bank.Bo01T_MM.d.cts → bank.yUQZ6PWV.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
|
@@ -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.B5nOIsGC.cjs');
|
|
7
7
|
require('drizzle-orm');
|
|
8
8
|
const jose = require('jose');
|
|
9
9
|
require('node:crypto');
|
|
@@ -480,7 +480,7 @@ const mapFinbricksTransactionToPayment = (tx, account) => {
|
|
|
480
480
|
correlationId: backendSdk.uuidv4(),
|
|
481
481
|
connectorKey: account.connectorKey,
|
|
482
482
|
accountId: account.id,
|
|
483
|
-
bankRefId: tx.fbxReference,
|
|
483
|
+
bankRefId: tx.fbxReference ?? tx.entryReference,
|
|
484
484
|
amount: tx.amount?.value || 0,
|
|
485
485
|
currency: tx.amount?.currency || "CZK",
|
|
486
486
|
paymentType: detectPaymentType(tx, isIncoming),
|
|
@@ -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",
|