@develit-services/bank 1.0.0 → 1.1.1
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.mjs +1 -1
- package/dist/export/worker.cjs +3 -3
- package/dist/export/worker.mjs +3 -3
- package/dist/export/workflows.cjs +3 -3
- package/dist/export/workflows.mjs +3 -3
- package/dist/shared/{bank.BXGLMl7o.cjs → bank.B4xJAf0f.cjs} +5 -5
- package/dist/shared/{bank.Qg6TA8fX.cjs → bank.B5nOIsGC.cjs} +1 -1
- package/dist/shared/{bank.B4EjD9Ok.mjs → bank.BxbQdO7w.mjs} +5 -5
- package/dist/shared/{bank.CiB2ECAF.mjs → bank.DMsXwzJn.mjs} +1 -1
- package/dist/shared/{bank.BbltNpz3.cjs → bank.f7ykgYdD.cjs} +7 -3
- package/dist/shared/{bank.B9-zZrEf.mjs → bank.rcoRRywt.mjs} +7 -3
- package/dist/types.cjs +2 -2
- package/dist/types.mjs +2 -2
- package/package.json +1 -1
package/dist/database/schema.cjs
CHANGED
package/dist/database/schema.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { x as account, y as accountCredentials, z as batch, D as ott, E as payment, F as paymentRelations, G as paymentRequest, H as paymentRequestRelations } from '../shared/bank.
|
|
1
|
+
export { x as account, y as accountCredentials, z as batch, D as ott, E as payment, F as paymentRelations, G as paymentRequest, H as paymentRequestRelations } from '../shared/bank.DMsXwzJn.mjs';
|
|
2
2
|
import '@develit-io/backend-sdk';
|
|
3
3
|
import 'drizzle-orm/sqlite-core';
|
|
4
4
|
import 'date-fns';
|
package/dist/export/worker.cjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
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.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');
|
|
12
12
|
require('date-fns');
|
|
13
13
|
require('node:crypto');
|
|
14
|
-
const credentialsResolver = require('../shared/bank.
|
|
14
|
+
const credentialsResolver = require('../shared/bank.f7ykgYdD.cjs');
|
|
15
15
|
require('drizzle-orm/sqlite-core');
|
|
16
16
|
require('drizzle-orm/relations');
|
|
17
17
|
require('drizzle-zod');
|
package/dist/export/worker.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
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.
|
|
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.DMsXwzJn.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.BxbQdO7w.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.rcoRRywt.mjs';
|
|
13
13
|
import 'drizzle-orm/sqlite-core';
|
|
14
14
|
import 'drizzle-orm/relations';
|
|
15
15
|
import 'drizzle-zod';
|
|
@@ -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.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
|
-
const credentialsResolver = require('../shared/bank.
|
|
8
|
+
const credentialsResolver = require('../shared/bank.f7ykgYdD.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');
|
|
@@ -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.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
|
-
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.rcoRRywt.mjs';
|
|
7
7
|
import { WorkflowEntrypoint } from 'cloudflare:workers';
|
|
8
8
|
import { NonRetryableError } from 'cloudflare:workflows';
|
|
9
9
|
import { drizzle } from 'drizzle-orm/d1';
|
|
@@ -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');
|
|
@@ -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) => {
|
|
@@ -480,11 +480,11 @@ 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),
|
|
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(
|
|
@@ -226,7 +226,7 @@ const payment = sqliteCore.sqliteTable(
|
|
|
226
226
|
debtorIban: sqliteCore.text("debtor_iban")
|
|
227
227
|
},
|
|
228
228
|
(t) => [
|
|
229
|
-
sqliteCore.unique().on(t.connectorKey, t.bankRefId),
|
|
229
|
+
sqliteCore.unique().on(t.connectorKey, t.accountId, t.bankRefId),
|
|
230
230
|
sqliteCore.index("payment_account_id_idx").on(t.accountId),
|
|
231
231
|
sqliteCore.index("payment_account_id_status_idx").on(t.accountId, t.status),
|
|
232
232
|
sqliteCore.index("payment_account_id_created_at_idx").on(t.accountId, t.createdAt),
|
|
@@ -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.DMsXwzJn.mjs';
|
|
5
5
|
import 'drizzle-orm';
|
|
6
6
|
import { importPKCS8, SignJWT } from 'jose';
|
|
7
7
|
import 'node:crypto';
|
|
@@ -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) => {
|
|
@@ -478,11 +478,11 @@ const mapFinbricksTransactionToPayment = (tx, account) => {
|
|
|
478
478
|
correlationId: uuidv4(),
|
|
479
479
|
connectorKey: account.connectorKey,
|
|
480
480
|
accountId: account.id,
|
|
481
|
-
bankRefId: tx.fbxReference,
|
|
481
|
+
bankRefId: tx.fbxReference ?? tx.entryReference,
|
|
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(
|
|
@@ -224,7 +224,7 @@ const payment = sqliteTable(
|
|
|
224
224
|
debtorIban: text("debtor_iban")
|
|
225
225
|
},
|
|
226
226
|
(t) => [
|
|
227
|
-
unique().on(t.connectorKey, t.bankRefId),
|
|
227
|
+
unique().on(t.connectorKey, t.accountId, t.bankRefId),
|
|
228
228
|
index("payment_account_id_idx").on(t.accountId),
|
|
229
229
|
index("payment_account_id_status_idx").on(t.accountId, t.status),
|
|
230
230
|
index("payment_account_id_created_at_idx").on(t.accountId, t.createdAt),
|
|
@@ -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.B5nOIsGC.cjs');
|
|
5
5
|
const backendSdk = require('@develit-io/backend-sdk');
|
|
6
6
|
require('date-fns');
|
|
7
7
|
require('jose');
|
|
@@ -15,8 +15,12 @@ const createPaymentCommand = (db, { payment }) => {
|
|
|
15
15
|
creditorIban: payment.creditor.iban,
|
|
16
16
|
debtorIban: payment.debtor.iban
|
|
17
17
|
}).onConflictDoUpdate({
|
|
18
|
-
// Unique index: (connector_key, bank_ref_id)
|
|
19
|
-
target: [
|
|
18
|
+
// Unique index: (connector_key, account_id, bank_ref_id)
|
|
19
|
+
target: [
|
|
20
|
+
database_schema.tables.payment.connectorKey,
|
|
21
|
+
database_schema.tables.payment.accountId,
|
|
22
|
+
database_schema.tables.payment.bankRefId
|
|
23
|
+
],
|
|
20
24
|
set: {
|
|
21
25
|
status: drizzleOrm.sql`excluded.status`,
|
|
22
26
|
statusReason: drizzleOrm.sql`excluded.status_reason`,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { sql, and, eq, isNull } from 'drizzle-orm';
|
|
2
|
-
import { v as tables } from './bank.
|
|
2
|
+
import { v as tables } from './bank.DMsXwzJn.mjs';
|
|
3
3
|
import { uuidv4 } from '@develit-io/backend-sdk';
|
|
4
4
|
import 'date-fns';
|
|
5
5
|
import 'jose';
|
|
@@ -13,8 +13,12 @@ const createPaymentCommand = (db, { payment }) => {
|
|
|
13
13
|
creditorIban: payment.creditor.iban,
|
|
14
14
|
debtorIban: payment.debtor.iban
|
|
15
15
|
}).onConflictDoUpdate({
|
|
16
|
-
// Unique index: (connector_key, bank_ref_id)
|
|
17
|
-
target: [
|
|
16
|
+
// Unique index: (connector_key, account_id, bank_ref_id)
|
|
17
|
+
target: [
|
|
18
|
+
tables.payment.connectorKey,
|
|
19
|
+
tables.payment.accountId,
|
|
20
|
+
tables.payment.bankRefId
|
|
21
|
+
],
|
|
18
22
|
set: {
|
|
19
23
|
status: sql`excluded.status`,
|
|
20
24
|
statusReason: sql`excluded.status_reason`,
|
package/dist/types.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const mock_connector = require('./shared/bank.
|
|
4
|
-
const database_schema = require('./shared/bank.
|
|
3
|
+
const mock_connector = require('./shared/bank.B4xJAf0f.cjs');
|
|
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');
|
|
7
7
|
require('@develit-io/backend-sdk');
|
package/dist/types.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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.
|
|
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.
|
|
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
|
+
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';
|
|
5
5
|
import '@develit-io/backend-sdk';
|