@develit-services/bank 6.1.4 → 6.2.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/dist/base.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
3
  const backendSdk = require('@develit-io/backend-sdk');
4
- const paymentDirection = require('./shared/bank.Bu_Hmsem.cjs');
4
+ const paymentDirection = require('./shared/bank.BrZjHUNG.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
8
  require('jose');
9
- const bank = require('./shared/bank.DZPFxiu7.cjs');
9
+ const bank = require('./shared/bank.DIR_r2s2.cjs');
10
10
  const zod = require('zod');
11
11
  const database_schema = require('./shared/bank.Ca3jzmIb.cjs');
12
12
  const generalCodes = require('@develit-io/general-codes');
package/dist/base.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  import { uuidv4, first, buildMultiFilterConditions as buildMultiFilterConditions$1, bankAccountMetadataSchema, structuredAddressSchema, workflowInstanceStatusSchema, develitWorker, createInternalError, action, service } from '@develit-io/backend-sdk';
2
- import { G as tables, g as accountInsertSchema, H as relations, o as isProcessedStatus, p as isTerminalStatus, L as getNonTerminalPaymentRequestsQuery, x as toIncomingPayment, N as calculateCzechIban, j as assignAccount, u as toBatchedPayment, y as toPaymentRequestInsert, a as FinbricksClient, F as FINBRICKS_ENDPOINTS } from './shared/bank.DfTsWbsY.mjs';
2
+ import { G as tables, g as accountInsertSchema, H as relations, o as isProcessedStatus, p as isTerminalStatus, L as getNonTerminalPaymentRequestsQuery, x as toIncomingPayment, N as calculateCzechIban, j as assignAccount, u as toBatchedPayment, y as toPaymentRequestInsert, a as FinbricksClient, F as FINBRICKS_ENDPOINTS } from './shared/bank.BTysRSoT.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
6
  import 'jose';
7
- import { h as encrypt, d as createCredentialsResolver, i as initiateConnector, e as updatePaymentRequestStatusCommand, a as getPaymentRequestsByBatchIdQuery, g as getBatchByIdQuery, u as upsertBatchCommand, j as importAesKey, f as createPaymentCommand, b as getAccountByIdQuery } from './shared/bank.BfBGaZs8.mjs';
7
+ import { h as encrypt, d as createCredentialsResolver, i as initiateConnector, e as updatePaymentRequestStatusCommand, a as getPaymentRequestsByBatchIdQuery, g as getBatchByIdQuery, u as upsertBatchCommand, j as importAesKey, f as createPaymentCommand, b as getAccountByIdQuery } from './shared/bank.Dfog9v5Q.mjs';
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, e as PAYMENT_REQUEST_STATUSES } from './shared/bank.BT7HayCV.mjs';
10
10
  import { CURRENCY_CODES } from '@develit-io/general-codes';
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  const backendSdk = require('@develit-io/backend-sdk');
4
- const paymentDirection = require('../shared/bank.Bu_Hmsem.cjs');
4
+ const paymentDirection = require('../shared/bank.BrZjHUNG.cjs');
5
5
  const batchLifecycle = require('../shared/bank.NF8bZBy0.cjs');
6
6
  const drizzleOrm = require('drizzle-orm');
7
- const bank = require('../shared/bank.DZPFxiu7.cjs');
7
+ const bank = require('../shared/bank.DIR_r2s2.cjs');
8
8
  const cloudflare_workers = require('cloudflare:workers');
9
9
  const cloudflare_workflows = require('cloudflare:workflows');
10
10
  const d1 = require('drizzle-orm/d1');
@@ -1,8 +1,8 @@
1
1
  import { first, uuidv4, asNonEmpty } from '@develit-io/backend-sdk';
2
- import { G as tables, H as relations, v as toBatchedPaymentFromPaymentRequest, z as toPreparedPayment, m as isPaymentCompleted } from '../shared/bank.DfTsWbsY.mjs';
2
+ import { G as tables, H as relations, v as toBatchedPaymentFromPaymentRequest, z as toPreparedPayment, m as isPaymentCompleted } from '../shared/bank.BTysRSoT.mjs';
3
3
  import { i as isBatchAuthorized, b as isBatchFailed, d as isBatchProcessing } from '../shared/bank.XqSw509X.mjs';
4
4
  import { sql, and, eq, inArray } from 'drizzle-orm';
5
- import { g as getBatchByIdQuery, a as getPaymentRequestsByBatchIdQuery, c as checksum, u as upsertBatchCommand, b as getAccountByIdQuery, d as createCredentialsResolver, i as initiateConnector, e as updatePaymentRequestStatusCommand, f as createPaymentCommand } from '../shared/bank.BfBGaZs8.mjs';
5
+ import { g as getBatchByIdQuery, a as getPaymentRequestsByBatchIdQuery, c as checksum, u as upsertBatchCommand, b as getAccountByIdQuery, d as createCredentialsResolver, i as initiateConnector, e as updatePaymentRequestStatusCommand, f as createPaymentCommand } from '../shared/bank.Dfog9v5Q.mjs';
6
6
  import { WorkflowEntrypoint } from 'cloudflare:workers';
7
7
  import { NonRetryableError } from 'cloudflare:workflows';
8
8
  import { drizzle } from 'drizzle-orm/d1';
@@ -220,7 +220,7 @@ const FINBRICKS_ENDPOINTS = {
220
220
  ACCOUNT_LIST: "/account/list",
221
221
  ACCOUNT_BALANCE: "/account/balance",
222
222
  ACCOUNT_TRANSACTIONS: "/account/transactions",
223
- TRANSACTION_INIT: "/transaction/platform/init",
223
+ TRANSACTION_INIT: "/transaction/platform/domestic/init",
224
224
  TRANSACTION_STATUS: "/transaction/platform/status",
225
225
  TRANSACTION_SEPA_INIT: "/transaction/platform/sepa/init",
226
226
  TRANSACTION_FOREIGN_INIT: "/transaction/platform/foreign/init",
@@ -881,12 +881,13 @@ function mapToFinbricksAddress(addr) {
881
881
  }
882
882
  const town = addr.city?.trim();
883
883
  const country = addr.countryCode?.trim();
884
- return {
884
+ const mapped = {
885
885
  ...streetName && { streetName },
886
886
  ...buildingNumber && { buildingNumber },
887
887
  ...town && { town },
888
888
  ...country && { country }
889
889
  };
890
+ return Object.keys(mapped).length > 0 ? mapped : void 0;
890
891
  }
891
892
  class FinbricksConnector extends IBankConnector {
892
893
  constructor(provider, {
@@ -1351,7 +1352,9 @@ class FinbricksConnector extends IBankConnector {
1351
1352
  payment.creditor,
1352
1353
  udtOptions
1353
1354
  ) : payment.message?.trim() || void 0;
1354
- const unstructured = this.PROVIDER === "CSOB" && (composed?.length ?? 0) < 3 ? "Platba" : composed;
1355
+ const unstructured = this.PROVIDER === "CSOB" && (composed?.length ?? 0) < 3 ? "Platba" : composed?.slice(0, 140);
1356
+ const creditorAddress = mapToFinbricksAddress(payment.creditor.address);
1357
+ const bankRefId = uuidv4();
1355
1358
  const [response, error] = await useResult(
1356
1359
  this.finbricks.request({
1357
1360
  endpoint: FINBRICKS_ENDPOINTS.TRANSACTION_INIT,
@@ -1363,7 +1366,7 @@ class FinbricksConnector extends IBankConnector {
1363
1366
  // clientId,
1364
1367
  },
1365
1368
  paymentIdentification: {
1366
- merchantTransactionId: payment.id,
1369
+ merchantTransactionId: bankRefId,
1367
1370
  czechSymbols: {
1368
1371
  variableSymbol: payment.vs ?? (payment.ss ? void 0 : autoVariableSymbol(payment.id)),
1369
1372
  specificSymbol: payment.ss ?? void 0,
@@ -1378,11 +1381,13 @@ class FinbricksConnector extends IBankConnector {
1378
1381
  ...debtorIban && {
1379
1382
  accountIdentification: { value: debtorIban, type: "IBAN" }
1380
1383
  },
1384
+ debtorName: payment.debtor.holderName?.slice(0, 100),
1381
1385
  paymentProvider: this.PROVIDER
1382
1386
  },
1383
1387
  creditor: {
1384
1388
  accountIdentification: { value: creditorIban, type: "IBAN" },
1385
- creditorName: payment.creditor.holderName.slice(0, 100)
1389
+ creditorName: payment.creditor.holderName.slice(0, 100),
1390
+ ...creditorAddress && { postalAddress: creditorAddress }
1386
1391
  },
1387
1392
  ...unstructured && { remittanceInformation: { unstructured } },
1388
1393
  callbackUrl: `${this.finbricks.REDIRECT_URI}?type=paymentRequest&paymentRequestId=${payment.id}`,
@@ -1400,6 +1405,7 @@ class FinbricksConnector extends IBankConnector {
1400
1405
  authorizationUrl: response.redirectUrl,
1401
1406
  payment: {
1402
1407
  ...payment,
1408
+ bankRefId,
1403
1409
  status: "OPENED",
1404
1410
  initiatedAt: /* @__PURE__ */ new Date()
1405
1411
  }
@@ -222,7 +222,7 @@ const FINBRICKS_ENDPOINTS = {
222
222
  ACCOUNT_LIST: "/account/list",
223
223
  ACCOUNT_BALANCE: "/account/balance",
224
224
  ACCOUNT_TRANSACTIONS: "/account/transactions",
225
- TRANSACTION_INIT: "/transaction/platform/init",
225
+ TRANSACTION_INIT: "/transaction/platform/domestic/init",
226
226
  TRANSACTION_STATUS: "/transaction/platform/status",
227
227
  TRANSACTION_SEPA_INIT: "/transaction/platform/sepa/init",
228
228
  TRANSACTION_FOREIGN_INIT: "/transaction/platform/foreign/init",
@@ -883,12 +883,13 @@ function mapToFinbricksAddress(addr) {
883
883
  }
884
884
  const town = addr.city?.trim();
885
885
  const country = addr.countryCode?.trim();
886
- return {
886
+ const mapped = {
887
887
  ...streetName && { streetName },
888
888
  ...buildingNumber && { buildingNumber },
889
889
  ...town && { town },
890
890
  ...country && { country }
891
891
  };
892
+ return Object.keys(mapped).length > 0 ? mapped : void 0;
892
893
  }
893
894
  class FinbricksConnector extends IBankConnector {
894
895
  constructor(provider, {
@@ -1353,7 +1354,9 @@ class FinbricksConnector extends IBankConnector {
1353
1354
  payment.creditor,
1354
1355
  udtOptions
1355
1356
  ) : payment.message?.trim() || void 0;
1356
- const unstructured = this.PROVIDER === "CSOB" && (composed?.length ?? 0) < 3 ? "Platba" : composed;
1357
+ const unstructured = this.PROVIDER === "CSOB" && (composed?.length ?? 0) < 3 ? "Platba" : composed?.slice(0, 140);
1358
+ const creditorAddress = mapToFinbricksAddress(payment.creditor.address);
1359
+ const bankRefId = backendSdk.uuidv4();
1357
1360
  const [response, error] = await backendSdk.useResult(
1358
1361
  this.finbricks.request({
1359
1362
  endpoint: FINBRICKS_ENDPOINTS.TRANSACTION_INIT,
@@ -1365,7 +1368,7 @@ class FinbricksConnector extends IBankConnector {
1365
1368
  // clientId,
1366
1369
  },
1367
1370
  paymentIdentification: {
1368
- merchantTransactionId: payment.id,
1371
+ merchantTransactionId: bankRefId,
1369
1372
  czechSymbols: {
1370
1373
  variableSymbol: payment.vs ?? (payment.ss ? void 0 : autoVariableSymbol(payment.id)),
1371
1374
  specificSymbol: payment.ss ?? void 0,
@@ -1380,11 +1383,13 @@ class FinbricksConnector extends IBankConnector {
1380
1383
  ...debtorIban && {
1381
1384
  accountIdentification: { value: debtorIban, type: "IBAN" }
1382
1385
  },
1386
+ debtorName: payment.debtor.holderName?.slice(0, 100),
1383
1387
  paymentProvider: this.PROVIDER
1384
1388
  },
1385
1389
  creditor: {
1386
1390
  accountIdentification: { value: creditorIban, type: "IBAN" },
1387
- creditorName: payment.creditor.holderName.slice(0, 100)
1391
+ creditorName: payment.creditor.holderName.slice(0, 100),
1392
+ ...creditorAddress && { postalAddress: creditorAddress }
1388
1393
  },
1389
1394
  ...unstructured && { remittanceInformation: { unstructured } },
1390
1395
  callbackUrl: `${this.finbricks.REDIRECT_URI}?type=paymentRequest&paymentRequestId=${payment.id}`,
@@ -1402,6 +1407,7 @@ class FinbricksConnector extends IBankConnector {
1402
1407
  authorizationUrl: response.redirectUrl,
1403
1408
  payment: {
1404
1409
  ...payment,
1410
+ bankRefId,
1405
1411
  status: "OPENED",
1406
1412
  initiatedAt: /* @__PURE__ */ new Date()
1407
1413
  }
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const drizzleOrm = require('drizzle-orm');
4
- const paymentDirection = require('./bank.Bu_Hmsem.cjs');
4
+ const paymentDirection = require('./bank.BrZjHUNG.cjs');
5
5
  const backendSdk = require('@develit-io/backend-sdk');
6
6
  require('./bank.Ca3jzmIb.cjs');
7
7
  require('date-fns');
@@ -1,5 +1,5 @@
1
1
  import { sql, and, eq, isNull } from 'drizzle-orm';
2
- import { G as tables, b as FinbricksConnector, J as buildEndToEndId, c as MockConnector, D as DbuConnector, C as CsobConnector, K as KBConnector, M as MockCobsConnector, E as ErsteConnector } from './bank.DfTsWbsY.mjs';
2
+ import { G as tables, b as FinbricksConnector, J as buildEndToEndId, c as MockConnector, D as DbuConnector, C as CsobConnector, K as KBConnector, M as MockCobsConnector, E as ErsteConnector } from './bank.BTysRSoT.mjs';
3
3
  import { uuidv4 } from '@develit-io/backend-sdk';
4
4
  import './bank.BT7HayCV.mjs';
5
5
  import 'date-fns';
package/dist/types.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const paymentDirection = require('./shared/bank.Bu_Hmsem.cjs');
3
+ const paymentDirection = require('./shared/bank.BrZjHUNG.cjs');
4
4
  const database_schema = require('./shared/bank.Ca3jzmIb.cjs');
5
5
  const batchLifecycle = require('./shared/bank.NF8bZBy0.cjs');
6
6
  const generalCodes = require('@develit-io/general-codes');
package/dist/types.d.cts CHANGED
@@ -298,7 +298,7 @@ declare const FINBRICKS_ENDPOINTS: {
298
298
  readonly ACCOUNT_LIST: "/account/list";
299
299
  readonly ACCOUNT_BALANCE: "/account/balance";
300
300
  readonly ACCOUNT_TRANSACTIONS: "/account/transactions";
301
- readonly TRANSACTION_INIT: "/transaction/platform/init";
301
+ readonly TRANSACTION_INIT: "/transaction/platform/domestic/init";
302
302
  readonly TRANSACTION_STATUS: "/transaction/platform/status";
303
303
  readonly TRANSACTION_SEPA_INIT: "/transaction/platform/sepa/init";
304
304
  readonly TRANSACTION_FOREIGN_INIT: "/transaction/platform/foreign/init";
package/dist/types.d.mts CHANGED
@@ -298,7 +298,7 @@ declare const FINBRICKS_ENDPOINTS: {
298
298
  readonly ACCOUNT_LIST: "/account/list";
299
299
  readonly ACCOUNT_BALANCE: "/account/balance";
300
300
  readonly ACCOUNT_TRANSACTIONS: "/account/transactions";
301
- readonly TRANSACTION_INIT: "/transaction/platform/init";
301
+ readonly TRANSACTION_INIT: "/transaction/platform/domestic/init";
302
302
  readonly TRANSACTION_STATUS: "/transaction/platform/status";
303
303
  readonly TRANSACTION_SEPA_INIT: "/transaction/platform/sepa/init";
304
304
  readonly TRANSACTION_FOREIGN_INIT: "/transaction/platform/foreign/init";
package/dist/types.d.ts CHANGED
@@ -298,7 +298,7 @@ declare const FINBRICKS_ENDPOINTS: {
298
298
  readonly ACCOUNT_LIST: "/account/list";
299
299
  readonly ACCOUNT_BALANCE: "/account/balance";
300
300
  readonly ACCOUNT_TRANSACTIONS: "/account/transactions";
301
- readonly TRANSACTION_INIT: "/transaction/platform/init";
301
+ readonly TRANSACTION_INIT: "/transaction/platform/domestic/init";
302
302
  readonly TRANSACTION_STATUS: "/transaction/platform/status";
303
303
  readonly TRANSACTION_SEPA_INIT: "/transaction/platform/sepa/init";
304
304
  readonly TRANSACTION_FOREIGN_INIT: "/transaction/platform/foreign/init";
package/dist/types.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { B as BASE_TERMINAL_STATUSES, 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 accountCredentialsInsertSchema, e as accountCredentialsSelectSchema, f as accountCredentialsUpdateSchema, g as accountInsertSchema, h as accountSelectSchema, i as accountUpdateSchema, j as assignAccount, k as dbuAccountConfigSchema, l as hasPaymentAccountAssigned, m as isPaymentCompleted, n as isPendingStatus, o as isProcessedStatus, p as isTerminalStatus, q as ottInsertSchema, r as ottSelectSchema, s as ottUpdateSchema, t as signFinbricksJws, u as toBatchedPayment, v as toBatchedPaymentFromPaymentRequest, w as toCompletedPayment, x as toIncomingPayment, y as toPaymentRequestInsert, z as toPreparedPayment, A as useFinbricksFetch } from './shared/bank.DfTsWbsY.mjs';
1
+ export { B as BASE_TERMINAL_STATUSES, 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 accountCredentialsInsertSchema, e as accountCredentialsSelectSchema, f as accountCredentialsUpdateSchema, g as accountInsertSchema, h as accountSelectSchema, i as accountUpdateSchema, j as assignAccount, k as dbuAccountConfigSchema, l as hasPaymentAccountAssigned, m as isPaymentCompleted, n as isPendingStatus, o as isProcessedStatus, p as isTerminalStatus, q as ottInsertSchema, r as ottSelectSchema, s as ottUpdateSchema, t as signFinbricksJws, u as toBatchedPayment, v as toBatchedPaymentFromPaymentRequest, w as toCompletedPayment, x as toIncomingPayment, y as toPaymentRequestInsert, z as toPreparedPayment, A as useFinbricksFetch } from './shared/bank.BTysRSoT.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 } from './shared/bank.BT7HayCV.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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@develit-services/bank",
3
- "version": "6.1.4",
3
+ "version": "6.2.0",
4
4
  "author": "Develit.io s.r.o.",
5
5
  "type": "module",
6
6
  "exports": {