@develit-services/bank 6.1.2 → 6.1.3

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.CKX4Wnq8.cjs');
4
+ const paymentDirection = require('./shared/bank.Dzl159tr.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.bJ5o0Ck0.cjs');
9
+ const bank = require('./shared/bank.Bwe8T2eH.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.d.cts CHANGED
@@ -1,7 +1,7 @@
1
- import { B as BatchSelectType, P as PaymentRequestSelectType, A as AccountSelectType, a as PaymentSelectType, L as LastSyncMetadata, C as ConnectorConfig, t as tables, b as ConnectorKey, c as ConfigEnvironmentBank, I as IBankConnector, d as PaymentType, e as CurrencyCode, H as HandleAuthorizationCallbackInput, f as HandleAuthorizationCallbackOutput } from './shared/bank.C7zoSV8F.cjs';
2
- import { S as SendPaymentInput, a as SendPaymentOutput, b as SendPaymentSyncInput, c as SendPaymentSyncOutput, F as FinbricksSupportedBanksResponse } from './shared/bank.Dtw4Amqo.cjs';
3
1
  import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
4
2
  import { WorkflowInstanceStatus, IRPCResponse } from '@develit-io/backend-sdk';
3
+ import { B as BatchSelectType, P as PaymentRequestSelectType, A as AccountSelectType, a as PaymentSelectType, L as LastSyncMetadata, C as ConnectorConfig, t as tables, b as ConnectorKey, c as ConfigEnvironmentBank, I as IBankConnector, d as PaymentType, e as CurrencyCode, H as HandleAuthorizationCallbackInput, f as HandleAuthorizationCallbackOutput } from './shared/bank.C7zoSV8F.cjs';
4
+ import { S as SendPaymentInput, a as SendPaymentOutput, b as SendPaymentSyncInput, c as SendPaymentSyncOutput, F as FinbricksSupportedBanksResponse } from './shared/bank.Dtw4Amqo.cjs';
5
5
  import { WorkerEntrypoint } from 'cloudflare:workers';
6
6
  import { DrizzleD1Database } from 'drizzle-orm/d1';
7
7
  import { z } from 'zod';
package/dist/base.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import { B as BatchSelectType, P as PaymentRequestSelectType, A as AccountSelectType, a as PaymentSelectType, L as LastSyncMetadata, C as ConnectorConfig, t as tables, b as ConnectorKey, c as ConfigEnvironmentBank, I as IBankConnector, d as PaymentType, e as CurrencyCode, H as HandleAuthorizationCallbackInput, f as HandleAuthorizationCallbackOutput } from './shared/bank.C7zoSV8F.mjs';
2
- import { S as SendPaymentInput, a as SendPaymentOutput, b as SendPaymentSyncInput, c as SendPaymentSyncOutput, F as FinbricksSupportedBanksResponse } from './shared/bank.BBNHHD0v.mjs';
3
1
  import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
4
2
  import { WorkflowInstanceStatus, IRPCResponse } from '@develit-io/backend-sdk';
3
+ import { B as BatchSelectType, P as PaymentRequestSelectType, A as AccountSelectType, a as PaymentSelectType, L as LastSyncMetadata, C as ConnectorConfig, t as tables, b as ConnectorKey, c as ConfigEnvironmentBank, I as IBankConnector, d as PaymentType, e as CurrencyCode, H as HandleAuthorizationCallbackInput, f as HandleAuthorizationCallbackOutput } from './shared/bank.C7zoSV8F.mjs';
4
+ import { S as SendPaymentInput, a as SendPaymentOutput, b as SendPaymentSyncInput, c as SendPaymentSyncOutput, F as FinbricksSupportedBanksResponse } from './shared/bank.BBNHHD0v.mjs';
5
5
  import { WorkerEntrypoint } from 'cloudflare:workers';
6
6
  import { DrizzleD1Database } from 'drizzle-orm/d1';
7
7
  import { z } from 'zod';
package/dist/base.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { B as BatchSelectType, P as PaymentRequestSelectType, A as AccountSelectType, a as PaymentSelectType, L as LastSyncMetadata, C as ConnectorConfig, t as tables, b as ConnectorKey, c as ConfigEnvironmentBank, I as IBankConnector, d as PaymentType, e as CurrencyCode, H as HandleAuthorizationCallbackInput, f as HandleAuthorizationCallbackOutput } from './shared/bank.C7zoSV8F.js';
2
- import { S as SendPaymentInput, a as SendPaymentOutput, b as SendPaymentSyncInput, c as SendPaymentSyncOutput, F as FinbricksSupportedBanksResponse } from './shared/bank.BO2rCT2t.js';
3
1
  import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
4
2
  import { WorkflowInstanceStatus, IRPCResponse } from '@develit-io/backend-sdk';
3
+ import { B as BatchSelectType, P as PaymentRequestSelectType, A as AccountSelectType, a as PaymentSelectType, L as LastSyncMetadata, C as ConnectorConfig, t as tables, b as ConnectorKey, c as ConfigEnvironmentBank, I as IBankConnector, d as PaymentType, e as CurrencyCode, H as HandleAuthorizationCallbackInput, f as HandleAuthorizationCallbackOutput } from './shared/bank.C7zoSV8F.js';
4
+ import { S as SendPaymentInput, a as SendPaymentOutput, b as SendPaymentSyncInput, c as SendPaymentSyncOutput, F as FinbricksSupportedBanksResponse } from './shared/bank.BO2rCT2t.js';
5
5
  import { WorkerEntrypoint } from 'cloudflare:workers';
6
6
  import { DrizzleD1Database } from 'drizzle-orm/d1';
7
7
  import { z } from 'zod';
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.CyI5L9Lw.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.B-y4t5NI.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.DGFcfhen.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.BCO2CIVM.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.CKX4Wnq8.cjs');
4
+ const paymentDirection = require('../shared/bank.Dzl159tr.cjs');
5
5
  const batchLifecycle = require('../shared/bank.NF8bZBy0.cjs');
6
6
  const drizzleOrm = require('drizzle-orm');
7
- const bank = require('../shared/bank.bJ5o0Ck0.cjs');
7
+ const bank = require('../shared/bank.Bwe8T2eH.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.CyI5L9Lw.mjs';
2
+ import { G as tables, H as relations, v as toBatchedPaymentFromPaymentRequest, z as toPreparedPayment, m as isPaymentCompleted } from '../shared/bank.B-y4t5NI.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.DGFcfhen.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.BCO2CIVM.mjs';
6
6
  import { WorkflowEntrypoint } from 'cloudflare:workers';
7
7
  import { NonRetryableError } from 'cloudflare:workflows';
8
8
  import { drizzle } from 'drizzle-orm/d1';
@@ -910,6 +910,23 @@ class FinbricksConnector extends IBankConnector {
910
910
  supportsPaymentType(paymentType) {
911
911
  return paymentType === "DOMESTIC" || paymentType === "SEPA" || paymentType === "SWIFT";
912
912
  }
913
+ /**
914
+ * ČSOB mandates the UDT and we are an obliged entity, so a missing one must
915
+ * fail the payment — buildUltimateCreditor used to drop it silently instead.
916
+ */
917
+ assertUltimateCreditor(creditor, options) {
918
+ if (this.PROVIDER !== "CSOB") return;
919
+ if (buildUltimateCreditor(creditor, options)) return;
920
+ const missing = [
921
+ !creditor.holderName && "holder name",
922
+ !(creditor.address?.streetName ?? creditor.address?.buildingNumber) && "street address"
923
+ ].filter(Boolean);
924
+ throw createInternalError(null, {
925
+ status: 422,
926
+ code: "VALID-B-019",
927
+ message: `\u010CSOB requires the recipient (UDT) in the payment's free-text field, but the creditor${creditor.holderName ? ` "${creditor.holderName}"` : ""} is missing its ${missing.join(" and ")}. Complete the counterparty data and retry.`
928
+ });
929
+ }
913
930
  async getClientId(accountId) {
914
931
  if (!this.resolveCredentials) {
915
932
  throw createInternalError(null, {
@@ -1092,6 +1109,11 @@ class FinbricksConnector extends IBankConnector {
1092
1109
  message: `Batch for unauthorized client with iban: ${payments[0].debtor.iban}`
1093
1110
  });
1094
1111
  await this.getClientId(authorizedClient.id);
1112
+ for (const p of payments) {
1113
+ this.assertUltimateCreditor(p.creditor, {
1114
+ stripDiacritics: p.currency !== "CZK"
1115
+ });
1116
+ }
1095
1117
  const [response, error] = await useResult(
1096
1118
  this.finbricks.request({
1097
1119
  endpoint: FINBRICKS_ENDPOINTS.TRANSACTION_BATCH_INIT,
@@ -1161,6 +1183,9 @@ class FinbricksConnector extends IBankConnector {
1161
1183
  ks: payment.ks
1162
1184
  });
1163
1185
  const remittanceBase = [reference, payment.message?.trim()].filter(Boolean).join(" ") || void 0;
1186
+ this.assertUltimateCreditor(payment.creditor, {
1187
+ stripDiacritics: payment.currency !== "CZK"
1188
+ });
1164
1189
  const unstructured = this.PROVIDER === "CSOB" ? composeWithUltimateCreditor(remittanceBase, payment.creditor, {
1165
1190
  stripDiacritics: payment.currency !== "CZK"
1166
1191
  }) : remittanceBase?.slice(0, 140) || void 0;
@@ -1236,9 +1261,9 @@ class FinbricksConnector extends IBankConnector {
1236
1261
  ss: payment.ss,
1237
1262
  ks: payment.ks
1238
1263
  });
1239
- const udt = this.PROVIDER === "CSOB" ? buildUltimateCreditor(payment.creditor, {
1240
- stripDiacritics: payment.currency !== "CZK"
1241
- }) : void 0;
1264
+ const udtOptions = { stripDiacritics: payment.currency !== "CZK" };
1265
+ this.assertUltimateCreditor(payment.creditor, udtOptions);
1266
+ const udt = this.PROVIDER === "CSOB" ? buildUltimateCreditor(payment.creditor, udtOptions) : void 0;
1242
1267
  const reserved = (reference ? reference.length + 1 : 0) + (udt ? udt.length + 2 : 0);
1243
1268
  const base = [message.slice(0, Math.max(0, 140 - reserved)), reference].filter(Boolean).join(" ");
1244
1269
  const combined = udt ? base ? `${base}, ${udt}` : udt : base;
@@ -1307,29 +1332,57 @@ class FinbricksConnector extends IBankConnector {
1307
1332
  (acc) => acc.iban === payment.debtor.iban
1308
1333
  );
1309
1334
  await this.getClientId(debtorAccount.id);
1335
+ const debtorIban = resolveCzechDomesticIban(payment.debtor);
1336
+ const creditorIban = resolveCzechDomesticIban(payment.creditor);
1337
+ if (!creditorIban || !payment.creditor.holderName) {
1338
+ throw createInternalError(null, {
1339
+ status: 422,
1340
+ code: "VALID-B-018",
1341
+ message: `Domestic payment needs the creditor's ${!creditorIban ? "IBAN (or account number + bank code)" : "name"}.`
1342
+ });
1343
+ }
1344
+ const udtOptions = { stripDiacritics: false };
1345
+ this.assertUltimateCreditor(payment.creditor, udtOptions);
1346
+ const composed = this.PROVIDER === "CSOB" ? composeWithUltimateCreditor(
1347
+ payment.message,
1348
+ payment.creditor,
1349
+ udtOptions
1350
+ ) : payment.message?.trim() || void 0;
1351
+ const unstructured = this.PROVIDER === "CSOB" && (composed?.length ?? 0) < 3 ? "Platba" : composed;
1310
1352
  const [response, error] = await useResult(
1311
1353
  this.finbricks.request({
1312
1354
  endpoint: FINBRICKS_ENDPOINTS.TRANSACTION_INIT,
1313
1355
  method: "POST",
1314
1356
  body: {
1315
- merchantId: this.finbricks.MERCHANT_ID,
1316
- merchantTransactionId: payment.id,
1317
- totalPrice: payment.amount,
1318
- debtorAccountIban: resolveCzechDomesticIban(payment.debtor),
1319
- creditorAccountIban: resolveCzechDomesticIban(payment.creditor),
1320
- creditorName: payment.creditor.holderName,
1321
- description: this.PROVIDER === "CSOB" ? composeWithUltimateCreditor(payment.message, payment.creditor, {
1322
- // This rail is CZK-only (it sends no currency), and CZ domestic
1323
- // clearing accepts diacritics unlike the foreign rail.
1324
- stripDiacritics: false
1325
- }) : payment.message,
1326
- variableSymbol: payment.vs ?? (payment.ss ? void 0 : autoVariableSymbol(payment.id)),
1327
- specificSymbol: payment.ss,
1328
- constantSymbol: payment.ks,
1357
+ merchantIdentification: {
1358
+ merchantId: this.finbricks.MERCHANT_ID
1359
+ // TEMP: clientId disabled per client request — do not send.
1360
+ // clientId,
1361
+ },
1362
+ paymentIdentification: {
1363
+ merchantTransactionId: payment.id,
1364
+ czechSymbols: {
1365
+ variableSymbol: payment.vs ?? (payment.ss ? void 0 : autoVariableSymbol(payment.id)),
1366
+ specificSymbol: payment.ss ?? void 0,
1367
+ constantSymbol: payment.ks ?? void 0
1368
+ }
1369
+ },
1370
+ amount: {
1371
+ value: payment.amount,
1372
+ currency: payment.currency ?? "CZK"
1373
+ },
1374
+ debtor: {
1375
+ ...debtorIban && {
1376
+ accountIdentification: { value: debtorIban, type: "IBAN" }
1377
+ },
1378
+ paymentProvider: this.PROVIDER
1379
+ },
1380
+ creditor: {
1381
+ accountIdentification: { value: creditorIban, type: "IBAN" },
1382
+ creditorName: payment.creditor.holderName.slice(0, 100)
1383
+ },
1384
+ ...unstructured && { remittanceInformation: { unstructured } },
1329
1385
  callbackUrl: `${this.finbricks.REDIRECT_URI}?type=paymentRequest&paymentRequestId=${payment.id}`,
1330
- // TEMP: clientId disabled per client request — do not send.
1331
- // clientId,
1332
- paymentProvider: this.PROVIDER,
1333
1386
  instructionPriority: toFinbricksPriority(payment.instructionPriority)
1334
1387
  }
1335
1388
  })
@@ -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.CyI5L9Lw.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.B-y4t5NI.mjs';
3
3
  import { uuidv4 } from '@develit-io/backend-sdk';
4
4
  import './bank.BT7HayCV.mjs';
5
5
  import 'date-fns';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const drizzleOrm = require('drizzle-orm');
4
- const paymentDirection = require('./bank.CKX4Wnq8.cjs');
4
+ const paymentDirection = require('./bank.Dzl159tr.cjs');
5
5
  const backendSdk = require('@develit-io/backend-sdk');
6
6
  require('./bank.Ca3jzmIb.cjs');
7
7
  require('date-fns');
@@ -912,6 +912,23 @@ class FinbricksConnector extends IBankConnector {
912
912
  supportsPaymentType(paymentType) {
913
913
  return paymentType === "DOMESTIC" || paymentType === "SEPA" || paymentType === "SWIFT";
914
914
  }
915
+ /**
916
+ * ČSOB mandates the UDT and we are an obliged entity, so a missing one must
917
+ * fail the payment — buildUltimateCreditor used to drop it silently instead.
918
+ */
919
+ assertUltimateCreditor(creditor, options) {
920
+ if (this.PROVIDER !== "CSOB") return;
921
+ if (buildUltimateCreditor(creditor, options)) return;
922
+ const missing = [
923
+ !creditor.holderName && "holder name",
924
+ !(creditor.address?.streetName ?? creditor.address?.buildingNumber) && "street address"
925
+ ].filter(Boolean);
926
+ throw backendSdk.createInternalError(null, {
927
+ status: 422,
928
+ code: "VALID-B-019",
929
+ message: `\u010CSOB requires the recipient (UDT) in the payment's free-text field, but the creditor${creditor.holderName ? ` "${creditor.holderName}"` : ""} is missing its ${missing.join(" and ")}. Complete the counterparty data and retry.`
930
+ });
931
+ }
915
932
  async getClientId(accountId) {
916
933
  if (!this.resolveCredentials) {
917
934
  throw backendSdk.createInternalError(null, {
@@ -1094,6 +1111,11 @@ class FinbricksConnector extends IBankConnector {
1094
1111
  message: `Batch for unauthorized client with iban: ${payments[0].debtor.iban}`
1095
1112
  });
1096
1113
  await this.getClientId(authorizedClient.id);
1114
+ for (const p of payments) {
1115
+ this.assertUltimateCreditor(p.creditor, {
1116
+ stripDiacritics: p.currency !== "CZK"
1117
+ });
1118
+ }
1097
1119
  const [response, error] = await backendSdk.useResult(
1098
1120
  this.finbricks.request({
1099
1121
  endpoint: FINBRICKS_ENDPOINTS.TRANSACTION_BATCH_INIT,
@@ -1163,6 +1185,9 @@ class FinbricksConnector extends IBankConnector {
1163
1185
  ks: payment.ks
1164
1186
  });
1165
1187
  const remittanceBase = [reference, payment.message?.trim()].filter(Boolean).join(" ") || void 0;
1188
+ this.assertUltimateCreditor(payment.creditor, {
1189
+ stripDiacritics: payment.currency !== "CZK"
1190
+ });
1166
1191
  const unstructured = this.PROVIDER === "CSOB" ? composeWithUltimateCreditor(remittanceBase, payment.creditor, {
1167
1192
  stripDiacritics: payment.currency !== "CZK"
1168
1193
  }) : remittanceBase?.slice(0, 140) || void 0;
@@ -1238,9 +1263,9 @@ class FinbricksConnector extends IBankConnector {
1238
1263
  ss: payment.ss,
1239
1264
  ks: payment.ks
1240
1265
  });
1241
- const udt = this.PROVIDER === "CSOB" ? buildUltimateCreditor(payment.creditor, {
1242
- stripDiacritics: payment.currency !== "CZK"
1243
- }) : void 0;
1266
+ const udtOptions = { stripDiacritics: payment.currency !== "CZK" };
1267
+ this.assertUltimateCreditor(payment.creditor, udtOptions);
1268
+ const udt = this.PROVIDER === "CSOB" ? buildUltimateCreditor(payment.creditor, udtOptions) : void 0;
1244
1269
  const reserved = (reference ? reference.length + 1 : 0) + (udt ? udt.length + 2 : 0);
1245
1270
  const base = [message.slice(0, Math.max(0, 140 - reserved)), reference].filter(Boolean).join(" ");
1246
1271
  const combined = udt ? base ? `${base}, ${udt}` : udt : base;
@@ -1309,29 +1334,57 @@ class FinbricksConnector extends IBankConnector {
1309
1334
  (acc) => acc.iban === payment.debtor.iban
1310
1335
  );
1311
1336
  await this.getClientId(debtorAccount.id);
1337
+ const debtorIban = resolveCzechDomesticIban(payment.debtor);
1338
+ const creditorIban = resolveCzechDomesticIban(payment.creditor);
1339
+ if (!creditorIban || !payment.creditor.holderName) {
1340
+ throw backendSdk.createInternalError(null, {
1341
+ status: 422,
1342
+ code: "VALID-B-018",
1343
+ message: `Domestic payment needs the creditor's ${!creditorIban ? "IBAN (or account number + bank code)" : "name"}.`
1344
+ });
1345
+ }
1346
+ const udtOptions = { stripDiacritics: false };
1347
+ this.assertUltimateCreditor(payment.creditor, udtOptions);
1348
+ const composed = this.PROVIDER === "CSOB" ? composeWithUltimateCreditor(
1349
+ payment.message,
1350
+ payment.creditor,
1351
+ udtOptions
1352
+ ) : payment.message?.trim() || void 0;
1353
+ const unstructured = this.PROVIDER === "CSOB" && (composed?.length ?? 0) < 3 ? "Platba" : composed;
1312
1354
  const [response, error] = await backendSdk.useResult(
1313
1355
  this.finbricks.request({
1314
1356
  endpoint: FINBRICKS_ENDPOINTS.TRANSACTION_INIT,
1315
1357
  method: "POST",
1316
1358
  body: {
1317
- merchantId: this.finbricks.MERCHANT_ID,
1318
- merchantTransactionId: payment.id,
1319
- totalPrice: payment.amount,
1320
- debtorAccountIban: resolveCzechDomesticIban(payment.debtor),
1321
- creditorAccountIban: resolveCzechDomesticIban(payment.creditor),
1322
- creditorName: payment.creditor.holderName,
1323
- description: this.PROVIDER === "CSOB" ? composeWithUltimateCreditor(payment.message, payment.creditor, {
1324
- // This rail is CZK-only (it sends no currency), and CZ domestic
1325
- // clearing accepts diacritics unlike the foreign rail.
1326
- stripDiacritics: false
1327
- }) : payment.message,
1328
- variableSymbol: payment.vs ?? (payment.ss ? void 0 : autoVariableSymbol(payment.id)),
1329
- specificSymbol: payment.ss,
1330
- constantSymbol: payment.ks,
1359
+ merchantIdentification: {
1360
+ merchantId: this.finbricks.MERCHANT_ID
1361
+ // TEMP: clientId disabled per client request — do not send.
1362
+ // clientId,
1363
+ },
1364
+ paymentIdentification: {
1365
+ merchantTransactionId: payment.id,
1366
+ czechSymbols: {
1367
+ variableSymbol: payment.vs ?? (payment.ss ? void 0 : autoVariableSymbol(payment.id)),
1368
+ specificSymbol: payment.ss ?? void 0,
1369
+ constantSymbol: payment.ks ?? void 0
1370
+ }
1371
+ },
1372
+ amount: {
1373
+ value: payment.amount,
1374
+ currency: payment.currency ?? "CZK"
1375
+ },
1376
+ debtor: {
1377
+ ...debtorIban && {
1378
+ accountIdentification: { value: debtorIban, type: "IBAN" }
1379
+ },
1380
+ paymentProvider: this.PROVIDER
1381
+ },
1382
+ creditor: {
1383
+ accountIdentification: { value: creditorIban, type: "IBAN" },
1384
+ creditorName: payment.creditor.holderName.slice(0, 100)
1385
+ },
1386
+ ...unstructured && { remittanceInformation: { unstructured } },
1331
1387
  callbackUrl: `${this.finbricks.REDIRECT_URI}?type=paymentRequest&paymentRequestId=${payment.id}`,
1332
- // TEMP: clientId disabled per client request — do not send.
1333
- // clientId,
1334
- paymentProvider: this.PROVIDER,
1335
1388
  instructionPriority: toFinbricksPriority(payment.instructionPriority)
1336
1389
  }
1337
1390
  })
package/dist/types.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const paymentDirection = require('./shared/bank.CKX4Wnq8.cjs');
3
+ const paymentDirection = require('./shared/bank.Dzl159tr.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
@@ -1,9 +1,9 @@
1
+ import { BankAccountMetadata, BaseEvent } from '@develit-io/backend-sdk';
1
2
  import { I as IBankConnector, b as ConnectorKey, g as ConnectedAccount, d as PaymentType, h as CredentialsResolver, i as AccountCredentialsInsertType, j as AccountInsertType, k as BatchedPayment, l as InitiatedBatch, m as IncomingPayment, n as InitiatedPayment, A as AccountSelectType, o as ParsedBankPayment, p as PaymentRequestStatus, q as AuthorizationCallbackResult, r as BatchMetadata, s as Currency, a as PaymentSelectType, P as PaymentRequestSelectType, u as AccountAssignedPayment, v as PreparedPayment, w as CompletedPayment, x as PaymentRequestInsertType } from './shared/bank.C7zoSV8F.cjs';
2
3
  export { y as ACCOUNT_STATUSES, z as AccountCredentialsPatchType, D as AccountCredentialsSelectType, E as AccountCredentialsUpdateType, F as AccountPatchType, G as AccountStatus, J as AccountUpdateType, K as AuthorizedBatch, M as BASE_TERMINAL_STATUSES, N as BATCH_MODES, O as BATCH_STATUES, O as BATCH_STATUSES, Q as BankAccountWithLastSync, R as BankCode, S as BatchInsertType, T as BatchLifecycle, U as BatchMode, V as BatchPayment, B as BatchSelectType, W as BatchStatus, X as CHARGE_BEARERS, Y as CONNECTOR_KEYS, Z as COUNTRY_CODES, _ as CREDENTIALS_TYPES, $ as ChargeBearer, a0 as CompletedBatch, c as ConfigEnvironmentBank, C as ConnectorConfig, a1 as CountryCode, a2 as CredentialsType, e as CurrencyCode, a3 as INSTRUCTION_PRIORITIES, a4 as InstructionPriority, L as LastSyncMetadata, a5 as PAYMENT_DIRECTIONS, a6 as PAYMENT_REQUEST_STATUSES, a7 as PAYMENT_STATUSES, a8 as PAYMENT_TYPES, a9 as PaymentDirection, aa as PaymentFailedInsertType, ab as PaymentInsertType, ac as PaymentLifecycle, ad as PaymentPreparedInsertType, ae as PaymentStatus, af as ProcessingBatch, ag as ReadyToSignBatch, ah as ResolvedCredentials, ai as TOKEN_TYPES, aj as TokenType, ak as accountCredentialsInsertSchema, al as accountCredentialsSelectSchema, am as accountCredentialsUpdateSchema, an as accountInsertSchema, ao as accountSelectSchema, ap as accountUpdateSchema, aq as hasPaymentAccountAssigned, ar as isBatchAuthorized, as as isBatchCompleted, at as isBatchFailed, au as isBatchInitiated, av as isBatchProcessing, aw as isBatchReadyToSign, ax as isPaymentCompleted, ay as isPendingStatus, az as isProcessedStatus, aA as isTerminalStatus } from './shared/bank.C7zoSV8F.cjs';
3
4
  import { d as FinbricksAccount, R as ReferenceType, S as SendPaymentInput } from './shared/bank.Dtw4Amqo.cjs';
4
5
  export { e as FinbricksAccountTransactionsResponse, f as FinbricksAccountsListResponse, g as FinbricksAuthTokenResponse, h as FinbricksBatchResponse, i as FinbricksConnectAccountResponse, j as FinbricksPaymentResponse, k as FinbricksSupportedBank, F as FinbricksSupportedBanksResponse, b as SendPaymentSyncInput } from './shared/bank.Dtw4Amqo.cjs';
5
6
  import { z } from 'zod';
6
- import { BaseEvent } from '@develit-io/backend-sdk';
7
7
  import * as drizzle_orm_zod from 'drizzle-orm/zod';
8
8
  import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
9
9
  export { BANK_CODES, CURRENCY_CODES } from '@develit-io/general-codes';
@@ -148,6 +148,52 @@ type FinbricksSepaPaymentBody = {
148
148
  instructionPriority?: 'NORM' | 'INST';
149
149
  callbackUrl: string;
150
150
  };
151
+ type FinbricksDomesticPaymentBody = {
152
+ merchantIdentification: {
153
+ merchantId: string;
154
+ clientId?: string;
155
+ };
156
+ paymentIdentification: {
157
+ merchantTransactionId: string;
158
+ endToEndIdentification?: string;
159
+ czechSymbols?: {
160
+ variableSymbol?: string;
161
+ specificSymbol?: string;
162
+ constantSymbol?: string;
163
+ };
164
+ };
165
+ amount: {
166
+ value: number;
167
+ currency: string;
168
+ };
169
+ debtor: {
170
+ accountIdentification?: {
171
+ value: string;
172
+ type: 'IBAN' | 'PHONE' | 'EMAIL' | 'TAXID';
173
+ };
174
+ debtorName?: string;
175
+ paymentProvider: FinbricksProvider;
176
+ };
177
+ creditor: {
178
+ accountIdentification: {
179
+ value: string;
180
+ type: 'IBAN' | 'PHONE' | 'EMAIL' | 'TAXID';
181
+ };
182
+ creditorName: string;
183
+ postalAddress?: {
184
+ streetName?: string;
185
+ buildingNumber?: string;
186
+ town?: string;
187
+ country?: string;
188
+ postalCode?: string;
189
+ };
190
+ };
191
+ remittanceInformation?: {
192
+ unstructured?: string;
193
+ };
194
+ instructionPriority?: 'NORM' | 'INST';
195
+ callbackUrl: string;
196
+ };
151
197
  type FinbricksForeignPaymentBody = {
152
198
  merchantIdentification: {
153
199
  merchantId: string;
@@ -288,6 +334,13 @@ declare abstract class FinbricksConnector extends IBankConnector {
288
334
  protected readonly finbricks: FinbricksClient;
289
335
  protected readonly PROVIDER: FinbricksProvider;
290
336
  constructor(provider: FinbricksProvider, { BASE_URI, MERCHANT_ID, PRIVATE_KEY_PEM, REDIRECT_URI, connectedAccounts, resolveCredentials, }: FinbricksConnectorConfig);
337
+ /**
338
+ * ČSOB mandates the UDT and we are an obliged entity, so a missing one must
339
+ * fail the payment — buildUltimateCreditor used to drop it silently instead.
340
+ */
341
+ protected assertUltimateCreditor(creditor: BankAccountMetadata, options: {
342
+ stripDiacritics: boolean;
343
+ }): void;
291
344
  private getClientId;
292
345
  getAuthUri({ ott }: {
293
346
  ott: string;
@@ -1330,4 +1383,4 @@ declare function toPaymentRequestInsert(payment: AccountAssignedPayment, batchId
1330
1383
  declare function toBatchedPaymentFromPaymentRequest(sp: PaymentRequestSelectType): BatchedPayment;
1331
1384
 
1332
1385
  export { AccountAssignedPayment, AccountCredentialsInsertType, AccountInsertType, AccountSelectType, BatchMetadata, BatchedPayment, CompletedPayment, ConnectedAccount, ConnectorKey, CredentialsResolver, CsobConnector, Currency, DbuConnector, ErsteConnector, FINBRICKS_ENDPOINTS, FinbricksAccount, FinbricksClient, FinbricksConnector, IBankConnector, IncomingPayment, IncomingPayment as IncomingPaymentMessage, InitiatedBatch, InitiatedPayment, KBConnector, MockCobsConnector, MockConnector, ParsedBankPayment, PaymentRequestInsertType, PaymentRequestSelectType, PaymentRequestStatus, PaymentSelectType, PaymentType, PreparedPayment, SendPaymentInput, assignAccount, dbuAccountConfigSchema, ottInsertSchema, ottSelectSchema, ottUpdateSchema, signFinbricksJws, toBatchedPayment, toBatchedPaymentFromPaymentRequest, toCompletedPayment, toIncomingPayment, toPaymentRequestInsert, toPreparedPayment, useFinbricksFetch };
1333
- export type { BankPaymentEvent, BankPaymentRequestEvent, DbuAccountConfig, DbuConnectorConfig, ErsteAuthenticationResponse, ErsteBatchPaymentInitiationResponse, ErsteIncomingPaymentResponse, ErsteObtainAuthorizationURLResponse, ErstePaymentInitiationResponse, FinbricksBatchBody, FinbricksBatchStatus, FinbricksConnectAccountBody, FinbricksConnectorConfig, FinbricksEndpoint, FinbricksEndpointPath, FinbricksFetchConfig, FinbricksForeignPaymentBody, FinbricksGetBatchStatusBody, FinbricksGetBatchStatusResponse, FinbricksGetTransactionStatusResponse, FinbricksJWSData, FinbricksPaymentBody, FinbricksProvider, FinbricksRequestInit, FinbricksSepaPaymentBody, FinbricksSupportedBanksQuery, FinbricksTransactionStatus, OneTimeTokenInsertType, OneTimeTokenPatchType, OneTimeTokenSelectType, OneTimeTokenUpdateType };
1386
+ export type { BankPaymentEvent, BankPaymentRequestEvent, DbuAccountConfig, DbuConnectorConfig, ErsteAuthenticationResponse, ErsteBatchPaymentInitiationResponse, ErsteIncomingPaymentResponse, ErsteObtainAuthorizationURLResponse, ErstePaymentInitiationResponse, FinbricksBatchBody, FinbricksBatchStatus, FinbricksConnectAccountBody, FinbricksConnectorConfig, FinbricksDomesticPaymentBody, FinbricksEndpoint, FinbricksEndpointPath, FinbricksFetchConfig, FinbricksForeignPaymentBody, FinbricksGetBatchStatusBody, FinbricksGetBatchStatusResponse, FinbricksGetTransactionStatusResponse, FinbricksJWSData, FinbricksPaymentBody, FinbricksProvider, FinbricksRequestInit, FinbricksSepaPaymentBody, FinbricksSupportedBanksQuery, FinbricksTransactionStatus, OneTimeTokenInsertType, OneTimeTokenPatchType, OneTimeTokenSelectType, OneTimeTokenUpdateType };
package/dist/types.d.mts CHANGED
@@ -1,9 +1,9 @@
1
+ import { BankAccountMetadata, BaseEvent } from '@develit-io/backend-sdk';
1
2
  import { I as IBankConnector, b as ConnectorKey, g as ConnectedAccount, d as PaymentType, h as CredentialsResolver, i as AccountCredentialsInsertType, j as AccountInsertType, k as BatchedPayment, l as InitiatedBatch, m as IncomingPayment, n as InitiatedPayment, A as AccountSelectType, o as ParsedBankPayment, p as PaymentRequestStatus, q as AuthorizationCallbackResult, r as BatchMetadata, s as Currency, a as PaymentSelectType, P as PaymentRequestSelectType, u as AccountAssignedPayment, v as PreparedPayment, w as CompletedPayment, x as PaymentRequestInsertType } from './shared/bank.C7zoSV8F.mjs';
2
3
  export { y as ACCOUNT_STATUSES, z as AccountCredentialsPatchType, D as AccountCredentialsSelectType, E as AccountCredentialsUpdateType, F as AccountPatchType, G as AccountStatus, J as AccountUpdateType, K as AuthorizedBatch, M as BASE_TERMINAL_STATUSES, N as BATCH_MODES, O as BATCH_STATUES, O as BATCH_STATUSES, Q as BankAccountWithLastSync, R as BankCode, S as BatchInsertType, T as BatchLifecycle, U as BatchMode, V as BatchPayment, B as BatchSelectType, W as BatchStatus, X as CHARGE_BEARERS, Y as CONNECTOR_KEYS, Z as COUNTRY_CODES, _ as CREDENTIALS_TYPES, $ as ChargeBearer, a0 as CompletedBatch, c as ConfigEnvironmentBank, C as ConnectorConfig, a1 as CountryCode, a2 as CredentialsType, e as CurrencyCode, a3 as INSTRUCTION_PRIORITIES, a4 as InstructionPriority, L as LastSyncMetadata, a5 as PAYMENT_DIRECTIONS, a6 as PAYMENT_REQUEST_STATUSES, a7 as PAYMENT_STATUSES, a8 as PAYMENT_TYPES, a9 as PaymentDirection, aa as PaymentFailedInsertType, ab as PaymentInsertType, ac as PaymentLifecycle, ad as PaymentPreparedInsertType, ae as PaymentStatus, af as ProcessingBatch, ag as ReadyToSignBatch, ah as ResolvedCredentials, ai as TOKEN_TYPES, aj as TokenType, ak as accountCredentialsInsertSchema, al as accountCredentialsSelectSchema, am as accountCredentialsUpdateSchema, an as accountInsertSchema, ao as accountSelectSchema, ap as accountUpdateSchema, aq as hasPaymentAccountAssigned, ar as isBatchAuthorized, as as isBatchCompleted, at as isBatchFailed, au as isBatchInitiated, av as isBatchProcessing, aw as isBatchReadyToSign, ax as isPaymentCompleted, ay as isPendingStatus, az as isProcessedStatus, aA as isTerminalStatus } from './shared/bank.C7zoSV8F.mjs';
3
4
  import { d as FinbricksAccount, R as ReferenceType, S as SendPaymentInput } from './shared/bank.BBNHHD0v.mjs';
4
5
  export { e as FinbricksAccountTransactionsResponse, f as FinbricksAccountsListResponse, g as FinbricksAuthTokenResponse, h as FinbricksBatchResponse, i as FinbricksConnectAccountResponse, j as FinbricksPaymentResponse, k as FinbricksSupportedBank, F as FinbricksSupportedBanksResponse, b as SendPaymentSyncInput } from './shared/bank.BBNHHD0v.mjs';
5
6
  import { z } from 'zod';
6
- import { BaseEvent } from '@develit-io/backend-sdk';
7
7
  import * as drizzle_orm_zod from 'drizzle-orm/zod';
8
8
  import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
9
9
  export { BANK_CODES, CURRENCY_CODES } from '@develit-io/general-codes';
@@ -148,6 +148,52 @@ type FinbricksSepaPaymentBody = {
148
148
  instructionPriority?: 'NORM' | 'INST';
149
149
  callbackUrl: string;
150
150
  };
151
+ type FinbricksDomesticPaymentBody = {
152
+ merchantIdentification: {
153
+ merchantId: string;
154
+ clientId?: string;
155
+ };
156
+ paymentIdentification: {
157
+ merchantTransactionId: string;
158
+ endToEndIdentification?: string;
159
+ czechSymbols?: {
160
+ variableSymbol?: string;
161
+ specificSymbol?: string;
162
+ constantSymbol?: string;
163
+ };
164
+ };
165
+ amount: {
166
+ value: number;
167
+ currency: string;
168
+ };
169
+ debtor: {
170
+ accountIdentification?: {
171
+ value: string;
172
+ type: 'IBAN' | 'PHONE' | 'EMAIL' | 'TAXID';
173
+ };
174
+ debtorName?: string;
175
+ paymentProvider: FinbricksProvider;
176
+ };
177
+ creditor: {
178
+ accountIdentification: {
179
+ value: string;
180
+ type: 'IBAN' | 'PHONE' | 'EMAIL' | 'TAXID';
181
+ };
182
+ creditorName: string;
183
+ postalAddress?: {
184
+ streetName?: string;
185
+ buildingNumber?: string;
186
+ town?: string;
187
+ country?: string;
188
+ postalCode?: string;
189
+ };
190
+ };
191
+ remittanceInformation?: {
192
+ unstructured?: string;
193
+ };
194
+ instructionPriority?: 'NORM' | 'INST';
195
+ callbackUrl: string;
196
+ };
151
197
  type FinbricksForeignPaymentBody = {
152
198
  merchantIdentification: {
153
199
  merchantId: string;
@@ -288,6 +334,13 @@ declare abstract class FinbricksConnector extends IBankConnector {
288
334
  protected readonly finbricks: FinbricksClient;
289
335
  protected readonly PROVIDER: FinbricksProvider;
290
336
  constructor(provider: FinbricksProvider, { BASE_URI, MERCHANT_ID, PRIVATE_KEY_PEM, REDIRECT_URI, connectedAccounts, resolveCredentials, }: FinbricksConnectorConfig);
337
+ /**
338
+ * ČSOB mandates the UDT and we are an obliged entity, so a missing one must
339
+ * fail the payment — buildUltimateCreditor used to drop it silently instead.
340
+ */
341
+ protected assertUltimateCreditor(creditor: BankAccountMetadata, options: {
342
+ stripDiacritics: boolean;
343
+ }): void;
291
344
  private getClientId;
292
345
  getAuthUri({ ott }: {
293
346
  ott: string;
@@ -1330,4 +1383,4 @@ declare function toPaymentRequestInsert(payment: AccountAssignedPayment, batchId
1330
1383
  declare function toBatchedPaymentFromPaymentRequest(sp: PaymentRequestSelectType): BatchedPayment;
1331
1384
 
1332
1385
  export { AccountAssignedPayment, AccountCredentialsInsertType, AccountInsertType, AccountSelectType, BatchMetadata, BatchedPayment, CompletedPayment, ConnectedAccount, ConnectorKey, CredentialsResolver, CsobConnector, Currency, DbuConnector, ErsteConnector, FINBRICKS_ENDPOINTS, FinbricksAccount, FinbricksClient, FinbricksConnector, IBankConnector, IncomingPayment, IncomingPayment as IncomingPaymentMessage, InitiatedBatch, InitiatedPayment, KBConnector, MockCobsConnector, MockConnector, ParsedBankPayment, PaymentRequestInsertType, PaymentRequestSelectType, PaymentRequestStatus, PaymentSelectType, PaymentType, PreparedPayment, SendPaymentInput, assignAccount, dbuAccountConfigSchema, ottInsertSchema, ottSelectSchema, ottUpdateSchema, signFinbricksJws, toBatchedPayment, toBatchedPaymentFromPaymentRequest, toCompletedPayment, toIncomingPayment, toPaymentRequestInsert, toPreparedPayment, useFinbricksFetch };
1333
- export type { BankPaymentEvent, BankPaymentRequestEvent, DbuAccountConfig, DbuConnectorConfig, ErsteAuthenticationResponse, ErsteBatchPaymentInitiationResponse, ErsteIncomingPaymentResponse, ErsteObtainAuthorizationURLResponse, ErstePaymentInitiationResponse, FinbricksBatchBody, FinbricksBatchStatus, FinbricksConnectAccountBody, FinbricksConnectorConfig, FinbricksEndpoint, FinbricksEndpointPath, FinbricksFetchConfig, FinbricksForeignPaymentBody, FinbricksGetBatchStatusBody, FinbricksGetBatchStatusResponse, FinbricksGetTransactionStatusResponse, FinbricksJWSData, FinbricksPaymentBody, FinbricksProvider, FinbricksRequestInit, FinbricksSepaPaymentBody, FinbricksSupportedBanksQuery, FinbricksTransactionStatus, OneTimeTokenInsertType, OneTimeTokenPatchType, OneTimeTokenSelectType, OneTimeTokenUpdateType };
1386
+ export type { BankPaymentEvent, BankPaymentRequestEvent, DbuAccountConfig, DbuConnectorConfig, ErsteAuthenticationResponse, ErsteBatchPaymentInitiationResponse, ErsteIncomingPaymentResponse, ErsteObtainAuthorizationURLResponse, ErstePaymentInitiationResponse, FinbricksBatchBody, FinbricksBatchStatus, FinbricksConnectAccountBody, FinbricksConnectorConfig, FinbricksDomesticPaymentBody, FinbricksEndpoint, FinbricksEndpointPath, FinbricksFetchConfig, FinbricksForeignPaymentBody, FinbricksGetBatchStatusBody, FinbricksGetBatchStatusResponse, FinbricksGetTransactionStatusResponse, FinbricksJWSData, FinbricksPaymentBody, FinbricksProvider, FinbricksRequestInit, FinbricksSepaPaymentBody, FinbricksSupportedBanksQuery, FinbricksTransactionStatus, OneTimeTokenInsertType, OneTimeTokenPatchType, OneTimeTokenSelectType, OneTimeTokenUpdateType };
package/dist/types.d.ts CHANGED
@@ -1,9 +1,9 @@
1
+ import { BankAccountMetadata, BaseEvent } from '@develit-io/backend-sdk';
1
2
  import { I as IBankConnector, b as ConnectorKey, g as ConnectedAccount, d as PaymentType, h as CredentialsResolver, i as AccountCredentialsInsertType, j as AccountInsertType, k as BatchedPayment, l as InitiatedBatch, m as IncomingPayment, n as InitiatedPayment, A as AccountSelectType, o as ParsedBankPayment, p as PaymentRequestStatus, q as AuthorizationCallbackResult, r as BatchMetadata, s as Currency, a as PaymentSelectType, P as PaymentRequestSelectType, u as AccountAssignedPayment, v as PreparedPayment, w as CompletedPayment, x as PaymentRequestInsertType } from './shared/bank.C7zoSV8F.js';
2
3
  export { y as ACCOUNT_STATUSES, z as AccountCredentialsPatchType, D as AccountCredentialsSelectType, E as AccountCredentialsUpdateType, F as AccountPatchType, G as AccountStatus, J as AccountUpdateType, K as AuthorizedBatch, M as BASE_TERMINAL_STATUSES, N as BATCH_MODES, O as BATCH_STATUES, O as BATCH_STATUSES, Q as BankAccountWithLastSync, R as BankCode, S as BatchInsertType, T as BatchLifecycle, U as BatchMode, V as BatchPayment, B as BatchSelectType, W as BatchStatus, X as CHARGE_BEARERS, Y as CONNECTOR_KEYS, Z as COUNTRY_CODES, _ as CREDENTIALS_TYPES, $ as ChargeBearer, a0 as CompletedBatch, c as ConfigEnvironmentBank, C as ConnectorConfig, a1 as CountryCode, a2 as CredentialsType, e as CurrencyCode, a3 as INSTRUCTION_PRIORITIES, a4 as InstructionPriority, L as LastSyncMetadata, a5 as PAYMENT_DIRECTIONS, a6 as PAYMENT_REQUEST_STATUSES, a7 as PAYMENT_STATUSES, a8 as PAYMENT_TYPES, a9 as PaymentDirection, aa as PaymentFailedInsertType, ab as PaymentInsertType, ac as PaymentLifecycle, ad as PaymentPreparedInsertType, ae as PaymentStatus, af as ProcessingBatch, ag as ReadyToSignBatch, ah as ResolvedCredentials, ai as TOKEN_TYPES, aj as TokenType, ak as accountCredentialsInsertSchema, al as accountCredentialsSelectSchema, am as accountCredentialsUpdateSchema, an as accountInsertSchema, ao as accountSelectSchema, ap as accountUpdateSchema, aq as hasPaymentAccountAssigned, ar as isBatchAuthorized, as as isBatchCompleted, at as isBatchFailed, au as isBatchInitiated, av as isBatchProcessing, aw as isBatchReadyToSign, ax as isPaymentCompleted, ay as isPendingStatus, az as isProcessedStatus, aA as isTerminalStatus } from './shared/bank.C7zoSV8F.js';
3
4
  import { d as FinbricksAccount, R as ReferenceType, S as SendPaymentInput } from './shared/bank.BO2rCT2t.js';
4
5
  export { e as FinbricksAccountTransactionsResponse, f as FinbricksAccountsListResponse, g as FinbricksAuthTokenResponse, h as FinbricksBatchResponse, i as FinbricksConnectAccountResponse, j as FinbricksPaymentResponse, k as FinbricksSupportedBank, F as FinbricksSupportedBanksResponse, b as SendPaymentSyncInput } from './shared/bank.BO2rCT2t.js';
5
6
  import { z } from 'zod';
6
- import { BaseEvent } from '@develit-io/backend-sdk';
7
7
  import * as drizzle_orm_zod from 'drizzle-orm/zod';
8
8
  import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
9
9
  export { BANK_CODES, CURRENCY_CODES } from '@develit-io/general-codes';
@@ -148,6 +148,52 @@ type FinbricksSepaPaymentBody = {
148
148
  instructionPriority?: 'NORM' | 'INST';
149
149
  callbackUrl: string;
150
150
  };
151
+ type FinbricksDomesticPaymentBody = {
152
+ merchantIdentification: {
153
+ merchantId: string;
154
+ clientId?: string;
155
+ };
156
+ paymentIdentification: {
157
+ merchantTransactionId: string;
158
+ endToEndIdentification?: string;
159
+ czechSymbols?: {
160
+ variableSymbol?: string;
161
+ specificSymbol?: string;
162
+ constantSymbol?: string;
163
+ };
164
+ };
165
+ amount: {
166
+ value: number;
167
+ currency: string;
168
+ };
169
+ debtor: {
170
+ accountIdentification?: {
171
+ value: string;
172
+ type: 'IBAN' | 'PHONE' | 'EMAIL' | 'TAXID';
173
+ };
174
+ debtorName?: string;
175
+ paymentProvider: FinbricksProvider;
176
+ };
177
+ creditor: {
178
+ accountIdentification: {
179
+ value: string;
180
+ type: 'IBAN' | 'PHONE' | 'EMAIL' | 'TAXID';
181
+ };
182
+ creditorName: string;
183
+ postalAddress?: {
184
+ streetName?: string;
185
+ buildingNumber?: string;
186
+ town?: string;
187
+ country?: string;
188
+ postalCode?: string;
189
+ };
190
+ };
191
+ remittanceInformation?: {
192
+ unstructured?: string;
193
+ };
194
+ instructionPriority?: 'NORM' | 'INST';
195
+ callbackUrl: string;
196
+ };
151
197
  type FinbricksForeignPaymentBody = {
152
198
  merchantIdentification: {
153
199
  merchantId: string;
@@ -288,6 +334,13 @@ declare abstract class FinbricksConnector extends IBankConnector {
288
334
  protected readonly finbricks: FinbricksClient;
289
335
  protected readonly PROVIDER: FinbricksProvider;
290
336
  constructor(provider: FinbricksProvider, { BASE_URI, MERCHANT_ID, PRIVATE_KEY_PEM, REDIRECT_URI, connectedAccounts, resolveCredentials, }: FinbricksConnectorConfig);
337
+ /**
338
+ * ČSOB mandates the UDT and we are an obliged entity, so a missing one must
339
+ * fail the payment — buildUltimateCreditor used to drop it silently instead.
340
+ */
341
+ protected assertUltimateCreditor(creditor: BankAccountMetadata, options: {
342
+ stripDiacritics: boolean;
343
+ }): void;
291
344
  private getClientId;
292
345
  getAuthUri({ ott }: {
293
346
  ott: string;
@@ -1330,4 +1383,4 @@ declare function toPaymentRequestInsert(payment: AccountAssignedPayment, batchId
1330
1383
  declare function toBatchedPaymentFromPaymentRequest(sp: PaymentRequestSelectType): BatchedPayment;
1331
1384
 
1332
1385
  export { AccountAssignedPayment, AccountCredentialsInsertType, AccountInsertType, AccountSelectType, BatchMetadata, BatchedPayment, CompletedPayment, ConnectedAccount, ConnectorKey, CredentialsResolver, CsobConnector, Currency, DbuConnector, ErsteConnector, FINBRICKS_ENDPOINTS, FinbricksAccount, FinbricksClient, FinbricksConnector, IBankConnector, IncomingPayment, IncomingPayment as IncomingPaymentMessage, InitiatedBatch, InitiatedPayment, KBConnector, MockCobsConnector, MockConnector, ParsedBankPayment, PaymentRequestInsertType, PaymentRequestSelectType, PaymentRequestStatus, PaymentSelectType, PaymentType, PreparedPayment, SendPaymentInput, assignAccount, dbuAccountConfigSchema, ottInsertSchema, ottSelectSchema, ottUpdateSchema, signFinbricksJws, toBatchedPayment, toBatchedPaymentFromPaymentRequest, toCompletedPayment, toIncomingPayment, toPaymentRequestInsert, toPreparedPayment, useFinbricksFetch };
1333
- export type { BankPaymentEvent, BankPaymentRequestEvent, DbuAccountConfig, DbuConnectorConfig, ErsteAuthenticationResponse, ErsteBatchPaymentInitiationResponse, ErsteIncomingPaymentResponse, ErsteObtainAuthorizationURLResponse, ErstePaymentInitiationResponse, FinbricksBatchBody, FinbricksBatchStatus, FinbricksConnectAccountBody, FinbricksConnectorConfig, FinbricksEndpoint, FinbricksEndpointPath, FinbricksFetchConfig, FinbricksForeignPaymentBody, FinbricksGetBatchStatusBody, FinbricksGetBatchStatusResponse, FinbricksGetTransactionStatusResponse, FinbricksJWSData, FinbricksPaymentBody, FinbricksProvider, FinbricksRequestInit, FinbricksSepaPaymentBody, FinbricksSupportedBanksQuery, FinbricksTransactionStatus, OneTimeTokenInsertType, OneTimeTokenPatchType, OneTimeTokenSelectType, OneTimeTokenUpdateType };
1386
+ export type { BankPaymentEvent, BankPaymentRequestEvent, DbuAccountConfig, DbuConnectorConfig, ErsteAuthenticationResponse, ErsteBatchPaymentInitiationResponse, ErsteIncomingPaymentResponse, ErsteObtainAuthorizationURLResponse, ErstePaymentInitiationResponse, FinbricksBatchBody, FinbricksBatchStatus, FinbricksConnectAccountBody, FinbricksConnectorConfig, FinbricksDomesticPaymentBody, FinbricksEndpoint, FinbricksEndpointPath, FinbricksFetchConfig, FinbricksForeignPaymentBody, FinbricksGetBatchStatusBody, FinbricksGetBatchStatusResponse, FinbricksGetTransactionStatusResponse, FinbricksJWSData, FinbricksPaymentBody, FinbricksProvider, FinbricksRequestInit, FinbricksSepaPaymentBody, FinbricksSupportedBanksQuery, FinbricksTransactionStatus, OneTimeTokenInsertType, OneTimeTokenPatchType, OneTimeTokenSelectType, OneTimeTokenUpdateType };
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.CyI5L9Lw.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.B-y4t5NI.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.2",
3
+ "version": "6.1.3",
4
4
  "author": "Develit.io s.r.o.",
5
5
  "type": "module",
6
6
  "exports": {