@develit-services/bank 1.1.0 → 1.1.2
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 +14 -12
- package/dist/export/worker.mjs +14 -12
- package/dist/export/workflows.cjs +1 -1
- package/dist/export/workflows.mjs +1 -1
- package/dist/shared/{bank.BMLgGhBY.cjs → bank.B4xJAf0f.cjs} +3 -3
- package/dist/shared/{bank.DTnA4eC9.mjs → bank.BxbQdO7w.mjs} +3 -3
- package/dist/types.cjs +1 -1
- package/dist/types.mjs +1 -1
- package/package.json +1 -1
package/dist/export/worker.cjs
CHANGED
|
@@ -5,7 +5,7 @@ const database_schema = require('../shared/bank.B5nOIsGC.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.B4xJAf0f.cjs');
|
|
9
9
|
require('jose');
|
|
10
10
|
const zod = require('zod');
|
|
11
11
|
const generalCodes = require('@develit-io/general-codes');
|
|
@@ -1096,7 +1096,10 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
|
|
|
1096
1096
|
...upsertAccounts,
|
|
1097
1097
|
...createAccountCredentials
|
|
1098
1098
|
]);
|
|
1099
|
-
const
|
|
1099
|
+
const newAccountIbans = accounts.map((a) => a.iban);
|
|
1100
|
+
const { accounts: fetchedAccounts } = await this._getAccounts({
|
|
1101
|
+
filterIbans: newAccountIbans
|
|
1102
|
+
});
|
|
1100
1103
|
if (!fetchedAccounts)
|
|
1101
1104
|
throw backendSdk.createInternalError(null, {
|
|
1102
1105
|
message: "Account not found",
|
|
@@ -1104,10 +1107,7 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
|
|
|
1104
1107
|
status: 404
|
|
1105
1108
|
});
|
|
1106
1109
|
if (startSync) {
|
|
1107
|
-
const
|
|
1108
|
-
const accountsToSync = fetchedAccounts.filter(
|
|
1109
|
-
(a) => newAccountIbans.has(a.iban)
|
|
1110
|
-
);
|
|
1110
|
+
const accountsToSync = fetchedAccounts;
|
|
1111
1111
|
for (const account of accountsToSync) {
|
|
1112
1112
|
const { error } = await this.syncAccount({
|
|
1113
1113
|
accountId: account.id
|
|
@@ -1207,10 +1207,10 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
|
|
|
1207
1207
|
data.currency,
|
|
1208
1208
|
data.creditor
|
|
1209
1209
|
);
|
|
1210
|
-
const { accounts } = await this._getAccounts(
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1210
|
+
const { accounts } = await this._getAccounts({
|
|
1211
|
+
filterIbans: [incomingPayment.debtorIban]
|
|
1212
|
+
});
|
|
1213
|
+
const account = accounts[0];
|
|
1214
1214
|
if (!account) {
|
|
1215
1215
|
throw backendSdk.createInternalError(null, {
|
|
1216
1216
|
message: `No account found for IBAN ${incomingPayment.debtorIban}`,
|
|
@@ -1345,8 +1345,10 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
|
|
|
1345
1345
|
p.creditor
|
|
1346
1346
|
);
|
|
1347
1347
|
}
|
|
1348
|
-
const { accounts } = await this._getAccounts(
|
|
1349
|
-
|
|
1348
|
+
const { accounts } = await this._getAccounts({
|
|
1349
|
+
filterIbans: [debtorIban]
|
|
1350
|
+
});
|
|
1351
|
+
const account = accounts[0];
|
|
1350
1352
|
if (!account) {
|
|
1351
1353
|
throw backendSdk.createInternalError(null, {
|
|
1352
1354
|
message: `No account found for IBAN ${debtorIban}`,
|
package/dist/export/worker.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { v as tables, I as INSTRUCTION_PRIORITIES, C as CHARGE_BEARERS, g as PAY
|
|
|
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.BxbQdO7w.mjs';
|
|
7
7
|
import 'jose';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import { CURRENCY_CODES } from '@develit-io/general-codes';
|
|
@@ -1094,7 +1094,10 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
|
|
|
1094
1094
|
...upsertAccounts,
|
|
1095
1095
|
...createAccountCredentials
|
|
1096
1096
|
]);
|
|
1097
|
-
const
|
|
1097
|
+
const newAccountIbans = accounts.map((a) => a.iban);
|
|
1098
|
+
const { accounts: fetchedAccounts } = await this._getAccounts({
|
|
1099
|
+
filterIbans: newAccountIbans
|
|
1100
|
+
});
|
|
1098
1101
|
if (!fetchedAccounts)
|
|
1099
1102
|
throw createInternalError(null, {
|
|
1100
1103
|
message: "Account not found",
|
|
@@ -1102,10 +1105,7 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
|
|
|
1102
1105
|
status: 404
|
|
1103
1106
|
});
|
|
1104
1107
|
if (startSync) {
|
|
1105
|
-
const
|
|
1106
|
-
const accountsToSync = fetchedAccounts.filter(
|
|
1107
|
-
(a) => newAccountIbans.has(a.iban)
|
|
1108
|
-
);
|
|
1108
|
+
const accountsToSync = fetchedAccounts;
|
|
1109
1109
|
for (const account of accountsToSync) {
|
|
1110
1110
|
const { error } = await this.syncAccount({
|
|
1111
1111
|
accountId: account.id
|
|
@@ -1205,10 +1205,10 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
|
|
|
1205
1205
|
data.currency,
|
|
1206
1206
|
data.creditor
|
|
1207
1207
|
);
|
|
1208
|
-
const { accounts } = await this._getAccounts(
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1208
|
+
const { accounts } = await this._getAccounts({
|
|
1209
|
+
filterIbans: [incomingPayment.debtorIban]
|
|
1210
|
+
});
|
|
1211
|
+
const account = accounts[0];
|
|
1212
1212
|
if (!account) {
|
|
1213
1213
|
throw createInternalError(null, {
|
|
1214
1214
|
message: `No account found for IBAN ${incomingPayment.debtorIban}`,
|
|
@@ -1343,8 +1343,10 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
|
|
|
1343
1343
|
p.creditor
|
|
1344
1344
|
);
|
|
1345
1345
|
}
|
|
1346
|
-
const { accounts } = await this._getAccounts(
|
|
1347
|
-
|
|
1346
|
+
const { accounts } = await this._getAccounts({
|
|
1347
|
+
filterIbans: [debtorIban]
|
|
1348
|
+
});
|
|
1349
|
+
const account = accounts[0];
|
|
1348
1350
|
if (!account) {
|
|
1349
1351
|
throw createInternalError(null, {
|
|
1350
1352
|
message: `No account found for IBAN ${debtorIban}`,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const backendSdk = require('@develit-io/backend-sdk');
|
|
4
4
|
const database_schema = require('../shared/bank.B5nOIsGC.cjs');
|
|
5
5
|
const batchLifecycle = require('../shared/bank.NF8bZBy0.cjs');
|
|
6
|
-
const mock_connector = require('../shared/bank.
|
|
6
|
+
const mock_connector = require('../shared/bank.B4xJAf0f.cjs');
|
|
7
7
|
const drizzleOrm = require('drizzle-orm');
|
|
8
8
|
const credentialsResolver = require('../shared/bank.f7ykgYdD.cjs');
|
|
9
9
|
const cloudflare_workers = require('cloudflare:workers');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { first, uuidv4, asNonEmpty } from '@develit-io/backend-sdk';
|
|
2
2
|
import { v as tables, o as isPaymentCompleted } from '../shared/bank.DMsXwzJn.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.BxbQdO7w.mjs';
|
|
5
5
|
import { eq, and, inArray } from 'drizzle-orm';
|
|
6
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.rcoRRywt.mjs';
|
|
7
7
|
import { WorkflowEntrypoint } from 'cloudflare:workers';
|
|
@@ -349,7 +349,7 @@ const FINBRICKS_ENDPOINTS = {
|
|
|
349
349
|
BANK_INFO: "/status/bankInfo"
|
|
350
350
|
};
|
|
351
351
|
|
|
352
|
-
const mapFinbricksStatus = (status) => {
|
|
352
|
+
const mapFinbricksStatus = (status, hasBookingDate) => {
|
|
353
353
|
switch (status) {
|
|
354
354
|
case "BOOK":
|
|
355
355
|
return "BOOKED";
|
|
@@ -366,7 +366,7 @@ const mapFinbricksStatus = (status) => {
|
|
|
366
366
|
case "INFO":
|
|
367
367
|
return "INFO";
|
|
368
368
|
default:
|
|
369
|
-
return "PENDING";
|
|
369
|
+
return hasBookingDate ? "BOOKED" : "PENDING";
|
|
370
370
|
}
|
|
371
371
|
};
|
|
372
372
|
const mapFinbricksTransactionStatus = (status) => {
|
|
@@ -484,7 +484,7 @@ const mapFinbricksTransactionToPayment = (tx, account) => {
|
|
|
484
484
|
amount: tx.amount?.value || 0,
|
|
485
485
|
currency: tx.amount?.currency || "CZK",
|
|
486
486
|
paymentType: detectPaymentType(tx, isIncoming),
|
|
487
|
-
status: mapFinbricksStatus(tx.status),
|
|
487
|
+
status: mapFinbricksStatus(tx.status, !!tx.bookingDate?.date),
|
|
488
488
|
message: tx.entryDetails.transactionDetails?.remittanceInformation?.unstructured || tx.entryDetails.transactionDetails?.additionalRemittanceInformation || tx.entryDetails.transactionDetails?.additionalTransactionInformation || null,
|
|
489
489
|
processedAt: new Date(tx.bookingDate.date),
|
|
490
490
|
...mapReferencesToPayment(
|
|
@@ -347,7 +347,7 @@ const FINBRICKS_ENDPOINTS = {
|
|
|
347
347
|
BANK_INFO: "/status/bankInfo"
|
|
348
348
|
};
|
|
349
349
|
|
|
350
|
-
const mapFinbricksStatus = (status) => {
|
|
350
|
+
const mapFinbricksStatus = (status, hasBookingDate) => {
|
|
351
351
|
switch (status) {
|
|
352
352
|
case "BOOK":
|
|
353
353
|
return "BOOKED";
|
|
@@ -364,7 +364,7 @@ const mapFinbricksStatus = (status) => {
|
|
|
364
364
|
case "INFO":
|
|
365
365
|
return "INFO";
|
|
366
366
|
default:
|
|
367
|
-
return "PENDING";
|
|
367
|
+
return hasBookingDate ? "BOOKED" : "PENDING";
|
|
368
368
|
}
|
|
369
369
|
};
|
|
370
370
|
const mapFinbricksTransactionStatus = (status) => {
|
|
@@ -482,7 +482,7 @@ const mapFinbricksTransactionToPayment = (tx, account) => {
|
|
|
482
482
|
amount: tx.amount?.value || 0,
|
|
483
483
|
currency: tx.amount?.currency || "CZK",
|
|
484
484
|
paymentType: detectPaymentType(tx, isIncoming),
|
|
485
|
-
status: mapFinbricksStatus(tx.status),
|
|
485
|
+
status: mapFinbricksStatus(tx.status, !!tx.bookingDate?.date),
|
|
486
486
|
message: tx.entryDetails.transactionDetails?.remittanceInformation?.unstructured || tx.entryDetails.transactionDetails?.additionalRemittanceInformation || tx.entryDetails.transactionDetails?.additionalTransactionInformation || null,
|
|
487
487
|
processedAt: new Date(tx.bookingDate.date),
|
|
488
488
|
...mapReferencesToPayment(
|
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.B4xJAf0f.cjs');
|
|
4
4
|
const database_schema = require('./shared/bank.B5nOIsGC.cjs');
|
|
5
5
|
const batchLifecycle = require('./shared/bank.NF8bZBy0.cjs');
|
|
6
6
|
const generalCodes = require('@develit-io/general-codes');
|
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.BxbQdO7w.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, n as hasPaymentAccountAssigned, o as isPaymentCompleted, p as isPendingStatus, q as isProcessedStatus, r as isTerminalStatus, s as ottInsertSchema, t as ottSelectSchema, u as ottUpdateSchema } from './shared/bank.DMsXwzJn.mjs';
|
|
3
3
|
export { i as isBatchAuthorized, a as isBatchCompleted, b as isBatchFailed, c as isBatchInitiated, d as isBatchProcessing, e as isBatchReadyToSign } from './shared/bank.XqSw509X.mjs';
|
|
4
4
|
export { BANK_CODES, CURRENCY_CODES } from '@develit-io/general-codes';
|