@develit-services/bank 0.8.12 → 0.8.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/export/worker.cjs +11 -2
- package/dist/export/worker.mjs +11 -2
- package/dist/export/workflows.cjs +1 -1
- package/dist/export/workflows.mjs +1 -1
- package/dist/shared/{bank.CUvVxlHy.cjs → bank.DxK5hIgy.cjs} +3 -37
- package/dist/shared/{bank.D-O_gmmZ.mjs → bank.tjCvxaMD.mjs} +3 -37
- package/dist/types.cjs +1 -1
- package/dist/types.d.cts +1 -1
- package/dist/types.d.mts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.mjs +1 -1
- package/package.json +1 -1
package/dist/export/worker.cjs
CHANGED
|
@@ -5,7 +5,7 @@ const drizzle = require('../shared/bank.Cev1E9sk.cjs');
|
|
|
5
5
|
const drizzleOrm = require('drizzle-orm');
|
|
6
6
|
const cloudflare_workers = require('cloudflare:workers');
|
|
7
7
|
const d1 = require('drizzle-orm/d1');
|
|
8
|
-
const mock_connector = require('../shared/bank.
|
|
8
|
+
const mock_connector = require('../shared/bank.DxK5hIgy.cjs');
|
|
9
9
|
require('jose');
|
|
10
10
|
const zod = require('zod');
|
|
11
11
|
const paymentRequest_schema = require('../shared/bank.BBXoZ5QU.cjs');
|
|
@@ -766,9 +766,18 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
|
|
|
766
766
|
processedAt: newStatus === "COMPLETED" ? /* @__PURE__ */ new Date() : void 0
|
|
767
767
|
}).command.execute();
|
|
768
768
|
statusChanged++;
|
|
769
|
+
const signalMap = {
|
|
770
|
+
OPENED: "paymentRequestOpened",
|
|
771
|
+
AUTHORIZED: "paymentRequestAuthorized",
|
|
772
|
+
COMPLETED: "paymentRequestCompleted",
|
|
773
|
+
BOOKED: "paymentRequestBooked",
|
|
774
|
+
SETTLED: "paymentRequestSettled",
|
|
775
|
+
REJECTED: "paymentRequestRejected",
|
|
776
|
+
CLOSED: "paymentRequestClosed"
|
|
777
|
+
};
|
|
769
778
|
eventsToEmit.push({
|
|
770
779
|
eventType: "BANK_PAYMENT_REQUEST",
|
|
771
|
-
eventSignal:
|
|
780
|
+
eventSignal: signalMap[newStatus],
|
|
772
781
|
paymentRequest: { ...pr, status: newStatus },
|
|
773
782
|
metadata: {
|
|
774
783
|
correlationId: pr.correlationId,
|
package/dist/export/worker.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { t as tables, h as encrypt, d as createCredentialsResolver, e as updateP
|
|
|
3
3
|
import { eq, sql, and, like, asc, desc, inArray, gte, lte, isNull, count, not } 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.tjCvxaMD.mjs';
|
|
7
7
|
import 'jose';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import { 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 } from '../shared/bank.CXBeULUL.mjs';
|
|
@@ -764,9 +764,18 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
|
|
|
764
764
|
processedAt: newStatus === "COMPLETED" ? /* @__PURE__ */ new Date() : void 0
|
|
765
765
|
}).command.execute();
|
|
766
766
|
statusChanged++;
|
|
767
|
+
const signalMap = {
|
|
768
|
+
OPENED: "paymentRequestOpened",
|
|
769
|
+
AUTHORIZED: "paymentRequestAuthorized",
|
|
770
|
+
COMPLETED: "paymentRequestCompleted",
|
|
771
|
+
BOOKED: "paymentRequestBooked",
|
|
772
|
+
SETTLED: "paymentRequestSettled",
|
|
773
|
+
REJECTED: "paymentRequestRejected",
|
|
774
|
+
CLOSED: "paymentRequestClosed"
|
|
775
|
+
};
|
|
767
776
|
eventsToEmit.push({
|
|
768
777
|
eventType: "BANK_PAYMENT_REQUEST",
|
|
769
|
-
eventSignal:
|
|
778
|
+
eventSignal: signalMap[newStatus],
|
|
770
779
|
paymentRequest: { ...pr, status: newStatus },
|
|
771
780
|
metadata: {
|
|
772
781
|
correlationId: pr.correlationId,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const backendSdk = require('@develit-io/backend-sdk');
|
|
4
4
|
const drizzle = require('../shared/bank.Cev1E9sk.cjs');
|
|
5
5
|
const batchLifecycle = require('../shared/bank.BsIiXsFH.cjs');
|
|
6
|
-
const mock_connector = require('../shared/bank.
|
|
6
|
+
const mock_connector = require('../shared/bank.DxK5hIgy.cjs');
|
|
7
7
|
const drizzleOrm = require('drizzle-orm');
|
|
8
8
|
const cloudflare_workers = require('cloudflare:workers');
|
|
9
9
|
const cloudflare_workflows = require('cloudflare:workflows');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { first, uuidv4, asNonEmpty } from '@develit-io/backend-sdk';
|
|
2
2
|
import { t as tables, 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.xB9eTN77.mjs';
|
|
3
3
|
import { i as isBatchAuthorized, b as isBatchFailed, d as isBatchProcessing, f as isPaymentCompleted } from '../shared/bank.vz1uqEYa.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.tjCvxaMD.mjs';
|
|
5
5
|
import { eq, and, inArray } from 'drizzle-orm';
|
|
6
6
|
import { WorkflowEntrypoint } from 'cloudflare:workers';
|
|
7
7
|
import { NonRetryableError } from 'cloudflare:workflows';
|
|
@@ -1269,30 +1269,6 @@ const calculateCzechIban = (accountNumber, bankCode) => {
|
|
|
1269
1269
|
return `CZ${checkDigits}${basicIban}`;
|
|
1270
1270
|
};
|
|
1271
1271
|
|
|
1272
|
-
function parseFlatAddress(addr, fallbackCountry) {
|
|
1273
|
-
if (!addr) {
|
|
1274
|
-
return {
|
|
1275
|
-
streetName: null,
|
|
1276
|
-
buildingNumber: null,
|
|
1277
|
-
city: null,
|
|
1278
|
-
zip: null,
|
|
1279
|
-
countryCode: fallbackCountry
|
|
1280
|
-
};
|
|
1281
|
-
}
|
|
1282
|
-
const parts = addr.split(",").map((p) => p.trim());
|
|
1283
|
-
const streetPart = parts[0];
|
|
1284
|
-
const cityPart = parts[1];
|
|
1285
|
-
const countryCode = parts[2]?.trim() || fallbackCountry;
|
|
1286
|
-
const streetMatch = streetPart?.match(/^(.+?)\s+(\d+\w*)$/);
|
|
1287
|
-
const cityMatch = cityPart?.match(/^(\d[\d ]*?)\s+(.+)$/);
|
|
1288
|
-
return {
|
|
1289
|
-
streetName: streetMatch?.[1] ?? streetPart ?? null,
|
|
1290
|
-
buildingNumber: streetMatch?.[2] ?? null,
|
|
1291
|
-
city: cityMatch?.[2] ?? cityPart ?? null,
|
|
1292
|
-
zip: cityMatch?.[1]?.replace(/\s/g, "") ?? null,
|
|
1293
|
-
countryCode
|
|
1294
|
-
};
|
|
1295
|
-
}
|
|
1296
1272
|
class DbuConnector extends IBankConnector {
|
|
1297
1273
|
constructor({
|
|
1298
1274
|
BASE_URL,
|
|
@@ -1614,15 +1590,7 @@ class DbuConnector extends IBankConnector {
|
|
|
1614
1590
|
specSymbol: payment.ss,
|
|
1615
1591
|
constSymbol: payment.ks,
|
|
1616
1592
|
uniqueExternalId: payment.id,
|
|
1617
|
-
with4EyeApproval: "Y"
|
|
1618
|
-
debtorAddress: parseFlatAddress(
|
|
1619
|
-
payment.debtor.address,
|
|
1620
|
-
payment.debtor.countryCode || "CZ"
|
|
1621
|
-
),
|
|
1622
|
-
creditorAddress: parseFlatAddress(
|
|
1623
|
-
payment.creditor.address,
|
|
1624
|
-
payment.creditor.countryCode || "CZ"
|
|
1625
|
-
)
|
|
1593
|
+
with4EyeApproval: "Y"
|
|
1626
1594
|
};
|
|
1627
1595
|
const response = await this.makeRequest(
|
|
1628
1596
|
"/required-transactions",
|
|
@@ -1669,8 +1637,6 @@ class DbuConnector extends IBankConnector {
|
|
|
1669
1637
|
filter
|
|
1670
1638
|
}) {
|
|
1671
1639
|
try {
|
|
1672
|
-
const dateFrom = dateFns.format(filter.dateFrom, "yyyy-MM-dd");
|
|
1673
|
-
const dateTo = dateFns.format(filter.dateTo || /* @__PURE__ */ new Date(), "yyyy-MM-dd");
|
|
1674
1640
|
const allPayments = [];
|
|
1675
1641
|
let offset = 0;
|
|
1676
1642
|
const limit = 10;
|
|
@@ -1688,8 +1654,8 @@ class DbuConnector extends IBankConnector {
|
|
|
1688
1654
|
// 'filter.mainAccount': account.number!,
|
|
1689
1655
|
// Date filtering
|
|
1690
1656
|
"filter.idAccount": account.bankRefId,
|
|
1691
|
-
|
|
1692
|
-
|
|
1657
|
+
// 'filter.validFromStart': dateFrom,
|
|
1658
|
+
// 'filter.validFromEnd': dateTo,
|
|
1693
1659
|
// Pagination parameters
|
|
1694
1660
|
offset: offset.toString(),
|
|
1695
1661
|
limit: limit.toString()
|
|
@@ -1267,30 +1267,6 @@ const calculateCzechIban = (accountNumber, bankCode) => {
|
|
|
1267
1267
|
return `CZ${checkDigits}${basicIban}`;
|
|
1268
1268
|
};
|
|
1269
1269
|
|
|
1270
|
-
function parseFlatAddress(addr, fallbackCountry) {
|
|
1271
|
-
if (!addr) {
|
|
1272
|
-
return {
|
|
1273
|
-
streetName: null,
|
|
1274
|
-
buildingNumber: null,
|
|
1275
|
-
city: null,
|
|
1276
|
-
zip: null,
|
|
1277
|
-
countryCode: fallbackCountry
|
|
1278
|
-
};
|
|
1279
|
-
}
|
|
1280
|
-
const parts = addr.split(",").map((p) => p.trim());
|
|
1281
|
-
const streetPart = parts[0];
|
|
1282
|
-
const cityPart = parts[1];
|
|
1283
|
-
const countryCode = parts[2]?.trim() || fallbackCountry;
|
|
1284
|
-
const streetMatch = streetPart?.match(/^(.+?)\s+(\d+\w*)$/);
|
|
1285
|
-
const cityMatch = cityPart?.match(/^(\d[\d ]*?)\s+(.+)$/);
|
|
1286
|
-
return {
|
|
1287
|
-
streetName: streetMatch?.[1] ?? streetPart ?? null,
|
|
1288
|
-
buildingNumber: streetMatch?.[2] ?? null,
|
|
1289
|
-
city: cityMatch?.[2] ?? cityPart ?? null,
|
|
1290
|
-
zip: cityMatch?.[1]?.replace(/\s/g, "") ?? null,
|
|
1291
|
-
countryCode
|
|
1292
|
-
};
|
|
1293
|
-
}
|
|
1294
1270
|
class DbuConnector extends IBankConnector {
|
|
1295
1271
|
constructor({
|
|
1296
1272
|
BASE_URL,
|
|
@@ -1612,15 +1588,7 @@ class DbuConnector extends IBankConnector {
|
|
|
1612
1588
|
specSymbol: payment.ss,
|
|
1613
1589
|
constSymbol: payment.ks,
|
|
1614
1590
|
uniqueExternalId: payment.id,
|
|
1615
|
-
with4EyeApproval: "Y"
|
|
1616
|
-
debtorAddress: parseFlatAddress(
|
|
1617
|
-
payment.debtor.address,
|
|
1618
|
-
payment.debtor.countryCode || "CZ"
|
|
1619
|
-
),
|
|
1620
|
-
creditorAddress: parseFlatAddress(
|
|
1621
|
-
payment.creditor.address,
|
|
1622
|
-
payment.creditor.countryCode || "CZ"
|
|
1623
|
-
)
|
|
1591
|
+
with4EyeApproval: "Y"
|
|
1624
1592
|
};
|
|
1625
1593
|
const response = await this.makeRequest(
|
|
1626
1594
|
"/required-transactions",
|
|
@@ -1667,8 +1635,6 @@ class DbuConnector extends IBankConnector {
|
|
|
1667
1635
|
filter
|
|
1668
1636
|
}) {
|
|
1669
1637
|
try {
|
|
1670
|
-
const dateFrom = format(filter.dateFrom, "yyyy-MM-dd");
|
|
1671
|
-
const dateTo = format(filter.dateTo || /* @__PURE__ */ new Date(), "yyyy-MM-dd");
|
|
1672
1638
|
const allPayments = [];
|
|
1673
1639
|
let offset = 0;
|
|
1674
1640
|
const limit = 10;
|
|
@@ -1686,8 +1652,8 @@ class DbuConnector extends IBankConnector {
|
|
|
1686
1652
|
// 'filter.mainAccount': account.number!,
|
|
1687
1653
|
// Date filtering
|
|
1688
1654
|
"filter.idAccount": account.bankRefId,
|
|
1689
|
-
|
|
1690
|
-
|
|
1655
|
+
// 'filter.validFromStart': dateFrom,
|
|
1656
|
+
// 'filter.validFromEnd': dateTo,
|
|
1691
1657
|
// Pagination parameters
|
|
1692
1658
|
offset: offset.toString(),
|
|
1693
1659
|
limit: limit.toString()
|
package/dist/types.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const mock_connector = require('./shared/bank.
|
|
3
|
+
const mock_connector = require('./shared/bank.DxK5hIgy.cjs');
|
|
4
4
|
const paymentRequest_schema = require('./shared/bank.BBXoZ5QU.cjs');
|
|
5
5
|
const batchLifecycle = require('./shared/bank.BsIiXsFH.cjs');
|
|
6
6
|
const generalCodes = require('@develit-io/general-codes');
|
package/dist/types.d.cts
CHANGED
|
@@ -630,7 +630,7 @@ type BankPaymentEvent = BaseEvent & {
|
|
|
630
630
|
};
|
|
631
631
|
type BankPaymentRequestEvent = BaseEvent & {
|
|
632
632
|
eventType: 'BANK_PAYMENT_REQUEST';
|
|
633
|
-
eventSignal: '
|
|
633
|
+
eventSignal: 'paymentRequestOpened' | 'paymentRequestAuthorized' | 'paymentRequestCompleted' | 'paymentRequestBooked' | 'paymentRequestSettled' | 'paymentRequestRejected' | 'paymentRequestClosed';
|
|
634
634
|
paymentRequest: PaymentRequestSelectType;
|
|
635
635
|
};
|
|
636
636
|
|
package/dist/types.d.mts
CHANGED
|
@@ -630,7 +630,7 @@ type BankPaymentEvent = BaseEvent & {
|
|
|
630
630
|
};
|
|
631
631
|
type BankPaymentRequestEvent = BaseEvent & {
|
|
632
632
|
eventType: 'BANK_PAYMENT_REQUEST';
|
|
633
|
-
eventSignal: '
|
|
633
|
+
eventSignal: 'paymentRequestOpened' | 'paymentRequestAuthorized' | 'paymentRequestCompleted' | 'paymentRequestBooked' | 'paymentRequestSettled' | 'paymentRequestRejected' | 'paymentRequestClosed';
|
|
634
634
|
paymentRequest: PaymentRequestSelectType;
|
|
635
635
|
};
|
|
636
636
|
|
package/dist/types.d.ts
CHANGED
|
@@ -630,7 +630,7 @@ type BankPaymentEvent = BaseEvent & {
|
|
|
630
630
|
};
|
|
631
631
|
type BankPaymentRequestEvent = BaseEvent & {
|
|
632
632
|
eventType: 'BANK_PAYMENT_REQUEST';
|
|
633
|
-
eventSignal: '
|
|
633
|
+
eventSignal: 'paymentRequestOpened' | 'paymentRequestAuthorized' | 'paymentRequestCompleted' | 'paymentRequestBooked' | 'paymentRequestSettled' | 'paymentRequestRejected' | 'paymentRequestClosed';
|
|
634
634
|
paymentRequest: PaymentRequestSelectType;
|
|
635
635
|
};
|
|
636
636
|
|
package/dist/types.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { C as CsobConnector, D as DbuConnector, E as ErsteConnector, F as FINBRICKS_ENDPOINTS, a as FinbricksClient, b as FinbricksConnector, I as IBankConnector, K as KBConnector, M as MockCobsConnector, c as MockConnector, d as assignAccount, s as signFinbricksJws, t as toBatchedPayment, e as toBatchedPaymentFromPaymentRequest, f as toCompletedPayment, g as toIncomingPayment, h as toPaymentRequestInsert, i as toPreparedPayment, u as useFinbricksFetch } from './shared/bank.
|
|
1
|
+
export { C as CsobConnector, D as DbuConnector, E as ErsteConnector, F as FINBRICKS_ENDPOINTS, a as FinbricksClient, b as FinbricksConnector, I as IBankConnector, K as KBConnector, M as MockCobsConnector, c as MockConnector, d as assignAccount, s as signFinbricksJws, t as toBatchedPayment, e as toBatchedPaymentFromPaymentRequest, f as toCompletedPayment, g as toIncomingPayment, h as toPaymentRequestInsert, i as toPreparedPayment, u as useFinbricksFetch } from './shared/bank.tjCvxaMD.mjs';
|
|
2
2
|
export { A as ACCOUNT_STATUSES, B as BATCH_MODES, a as BATCH_STATUES, a as BATCH_STATUSES, C as CHARGE_BEARERS, b as CONNECTOR_KEYS, c as COUNTRY_CODES, d as CREDENTIALS_TYPES, I as INSTRUCTION_PRIORITIES, P as PAYMENT_DIRECTIONS, e as PAYMENT_REQUEST_STATUSES, f as PAYMENT_STATUSES, g as PAYMENT_TYPES, T as TOKEN_TYPES, h as accountCredentialsInsertSchema, i as accountCredentialsSelectSchema, j as accountCredentialsUpdateSchema, k as accountInsertSchema, l as accountSelectSchema, m as accountUpdateSchema, o as ottInsertSchema, n as ottSelectSchema, p as ottUpdateSchema } from './shared/bank.CXBeULUL.mjs';
|
|
3
3
|
export { h as hasPaymentAccountAssigned, i as isBatchAuthorized, a as isBatchCompleted, b as isBatchFailed, c as isBatchInitiated, d as isBatchProcessing, e as isBatchReadyToSign, f as isPaymentCompleted } from './shared/bank.vz1uqEYa.mjs';
|
|
4
4
|
export { BANK_CODES, CURRENCY_CODES } from '@develit-io/general-codes';
|