@develit-services/bank 0.2.0 → 0.2.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.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const database_schema = require('../shared/bank.DCUsXXjG.cjs');
3
+ const database_schema = require('../shared/bank.CWAToo_g.cjs');
4
4
  require('@develit-io/backend-sdk');
5
5
  require('drizzle-orm/sqlite-core');
6
6
  require('date-fns');
@@ -1,4 +1,4 @@
1
- export { D as account, G as accountCredentials, w as batch, z as ott, x as payment, y as paymentRelations } from '../shared/bank.BTcR2cZW.mjs';
1
+ export { z as account, D as accountCredentials, v as batch, y as ott, w as payment, x as paymentRelations } from '../shared/bank.B0uSWeRe.mjs';
2
2
  import '@develit-io/backend-sdk';
3
3
  import 'drizzle-orm/sqlite-core';
4
4
  import 'date-fns';
@@ -3,17 +3,17 @@
3
3
  const backendSdk = require('@develit-io/backend-sdk');
4
4
  const cloudflare_workers = require('cloudflare:workers');
5
5
  const d1 = require('drizzle-orm/d1');
6
- const database_schema = require('../shared/bank.DCUsXXjG.cjs');
6
+ const database_schema = require('../shared/bank.CWAToo_g.cjs');
7
7
  require('jose');
8
8
  const generalCodes = require('@develit-io/general-codes');
9
9
  const zod = require('zod');
10
- const bank = require('../shared/bank.U_QWeuG5.cjs');
10
+ const bank = require('../shared/bank.CEraaQIT.cjs');
11
11
  const drizzleOrm = require('drizzle-orm');
12
12
  require('drizzle-orm/sqlite-core');
13
13
  require('date-fns');
14
14
  require('drizzle-zod');
15
15
  require('drizzle-orm/relations');
16
- require('../shared/bank.Dp5YErpd.cjs');
16
+ require('../shared/bank.B8QzFnJl.cjs');
17
17
 
18
18
  const upsertAccountCommand = (db, { account }) => {
19
19
  const id = account.id || backendSdk.uuidv4();
@@ -1,17 +1,17 @@
1
1
  import { uuidv4, bankAccountMetadataSchema, workflowInstanceStatusSchema, develitWorker, createInternalError, first, action, service } from '@develit-io/backend-sdk';
2
2
  import { WorkerEntrypoint } from 'cloudflare:workers';
3
3
  import { drizzle } from 'drizzle-orm/d1';
4
- import { t as tables, c as INSTRUCTION_PRIORITIES, C as CHARGE_BEARERS, P as PAYMENT_TYPES, g as CONNECTOR_KEYS, B as BATCH_STATUSES, d as PAYMENT_STATUSES, e as PAYMENT_DIRECTIONS, i as accountInsertSchema, M as MockConnector, F as FinbricksConnector, E as ErsteConnector } from '../shared/bank.BTcR2cZW.mjs';
4
+ import { t as tables, c as INSTRUCTION_PRIORITIES, C as CHARGE_BEARERS, P as PAYMENT_TYPES, g as CONNECTOR_KEYS, B as BATCH_STATUSES, d as PAYMENT_STATUSES, e as PAYMENT_DIRECTIONS, i as accountInsertSchema, M as MockConnector, F as FinbricksConnector, E as ErsteConnector } from '../shared/bank.B0uSWeRe.mjs';
5
5
  import 'jose';
6
6
  import { CURRENCY_CODES } from '@develit-io/general-codes';
7
7
  import { z } from 'zod';
8
- import { g as getCredentialsByAccountId, i as initiateConnector, c as createPaymentCommand, u as updatePaymentCommand, a as updateAccountLastSyncCommand } from '../shared/bank.B6xe3pyX.mjs';
8
+ import { g as getCredentialsByAccountId, i as initiateConnector, c as createPaymentCommand, u as updatePaymentCommand, a as updateAccountLastSyncCommand } from '../shared/bank.CXUMEJH4.mjs';
9
9
  import { eq, inArray, and, sql, asc, desc, gte, lte } from 'drizzle-orm';
10
10
  import 'drizzle-orm/sqlite-core';
11
11
  import 'date-fns';
12
12
  import 'drizzle-zod';
13
13
  import 'drizzle-orm/relations';
14
- import '../shared/bank.BgD9dJ3A.mjs';
14
+ import '../shared/bank.CjZRgRoJ.mjs';
15
15
 
16
16
  const upsertAccountCommand = (db, { account }) => {
17
17
  const id = account.id || uuidv4();
@@ -3,9 +3,9 @@
3
3
  const cloudflare_workers = require('cloudflare:workers');
4
4
  const cloudflare_workflows = require('cloudflare:workflows');
5
5
  const d1 = require('drizzle-orm/d1');
6
- const database_schema = require('../shared/bank.DCUsXXjG.cjs');
6
+ const database_schema = require('../shared/bank.CWAToo_g.cjs');
7
7
  const backendSdk = require('@develit-io/backend-sdk');
8
- const bank = require('../shared/bank.U_QWeuG5.cjs');
8
+ const bank = require('../shared/bank.CEraaQIT.cjs');
9
9
  const drizzleOrm = require('drizzle-orm');
10
10
  require('drizzle-orm/sqlite-core');
11
11
  require('date-fns');
@@ -14,7 +14,7 @@ require('zod');
14
14
  require('jose');
15
15
  require('drizzle-zod');
16
16
  require('drizzle-orm/relations');
17
- require('../shared/bank.Dp5YErpd.cjs');
17
+ require('../shared/bank.B8QzFnJl.cjs');
18
18
 
19
19
  const getAccountByIdQuery = async (db, { accountId }) => {
20
20
  return await db.select().from(database_schema.tables.account).where(drizzleOrm.eq(database_schema.tables.account.id, accountId)).get();
@@ -78,19 +78,12 @@ class SyncAccountPaymentsWorkflow extends cloudflare_workers.WorkflowEntrypoint
78
78
  }
79
79
  ]
80
80
  });
81
- const fetched = await connector.getAllAccountPayments({
81
+ return await connector.getAllAccountPayments({
82
82
  environment: this.env.ENVIRONMENT,
83
83
  db,
84
84
  account,
85
85
  filter: { dateFrom: account.lastSyncedAt }
86
86
  });
87
- return fetched.map((p) => ({
88
- ...p,
89
- parsed: {
90
- ...p.parsed,
91
- direction: database_schema.getPaymentDirection(p.parsed, account.iban)
92
- }
93
- }));
94
87
  }
95
88
  );
96
89
  if (payments.length) {
@@ -1,9 +1,9 @@
1
1
  import { WorkflowEntrypoint } from 'cloudflare:workers';
2
2
  import { NonRetryableError } from 'cloudflare:workflows';
3
3
  import { drizzle } from 'drizzle-orm/d1';
4
- import { t as tables, v as getPaymentDirection } from '../shared/bank.BTcR2cZW.mjs';
4
+ import { t as tables } from '../shared/bank.B0uSWeRe.mjs';
5
5
  import { asNonEmpty } from '@develit-io/backend-sdk';
6
- import { g as getCredentialsByAccountId, i as initiateConnector, u as updatePaymentCommand, c as createPaymentCommand, a as updateAccountLastSyncCommand } from '../shared/bank.B6xe3pyX.mjs';
6
+ import { g as getCredentialsByAccountId, i as initiateConnector, u as updatePaymentCommand, c as createPaymentCommand, a as updateAccountLastSyncCommand } from '../shared/bank.CXUMEJH4.mjs';
7
7
  import { eq, inArray } from 'drizzle-orm';
8
8
  import 'drizzle-orm/sqlite-core';
9
9
  import 'date-fns';
@@ -12,7 +12,7 @@ import 'zod';
12
12
  import 'jose';
13
13
  import 'drizzle-zod';
14
14
  import 'drizzle-orm/relations';
15
- import '../shared/bank.BgD9dJ3A.mjs';
15
+ import '../shared/bank.CjZRgRoJ.mjs';
16
16
 
17
17
  const getAccountByIdQuery = async (db, { accountId }) => {
18
18
  return await db.select().from(tables.account).where(eq(tables.account.id, accountId)).get();
@@ -76,19 +76,12 @@ class SyncAccountPaymentsWorkflow extends WorkflowEntrypoint {
76
76
  }
77
77
  ]
78
78
  });
79
- const fetched = await connector.getAllAccountPayments({
79
+ return await connector.getAllAccountPayments({
80
80
  environment: this.env.ENVIRONMENT,
81
81
  db,
82
82
  account,
83
83
  filter: { dateFrom: account.lastSyncedAt }
84
84
  });
85
- return fetched.map((p) => ({
86
- ...p,
87
- parsed: {
88
- ...p.parsed,
89
- direction: getPaymentDirection(p.parsed, account.iban)
90
- }
91
- }));
92
85
  }
93
86
  );
94
87
  if (payments.length) {
@@ -215,7 +215,7 @@ const mapFinbricksTransactionToPayment = (tx, account) => {
215
215
  tx.entryDetails.transactionDetails?.remittanceInformation?.structured?.creditorReferenceInformation?.reference || tx.entryDetails.transactionDetails?.references?.endToEndIdentification
216
216
  ),
217
217
  creditor: {
218
- holderName: related?.creditor?.name || "Unknown",
218
+ holderName: related?.creditorAccount?.name || related?.creditor?.name || "Unknown",
219
219
  iban: isIncoming ? account.iban || void 0 : related.creditorAccount?.identification?.iban || account.iban || void 0,
220
220
  number: isIncoming ? account.number || void 0 : related.creditorAccount?.identification?.other?.identification ? related.creditorAccount.identification.other.identification.split(
221
221
  "/"
@@ -225,7 +225,7 @@ const mapFinbricksTransactionToPayment = (tx, account) => {
225
225
  )[1] : account.bankCode || void 0
226
226
  },
227
227
  debtor: {
228
- holderName: related?.debtor?.name || "Unknown",
228
+ holderName: related?.debtorAccount?.name || related?.debtor?.name || "Unknown",
229
229
  iban: isIncoming ? related.debtorAccount?.identification?.iban || account.iban || void 0 : account.iban ?? void 0,
230
230
  number: isIncoming ? related.debtorAccount?.identification?.other?.identification ? related.debtorAccount.identification.other.identification.split(
231
231
  "/"
@@ -993,6 +993,7 @@ class ErsteConnector extends IBankConnector {
993
993
  },
994
994
  paymentType: "DOMESTIC",
995
995
  direction: "INCOMING",
996
+ //TO BE SET LATER ↓
996
997
  message: payment.entryDetails.transactionDetails.remittanceInformation?.unstructured,
997
998
  vs: symbols.vs,
998
999
  ss: symbols.ss,
@@ -1283,4 +1284,4 @@ const schema = {
1283
1284
 
1284
1285
  const tables = schema;
1285
1286
 
1286
- export { ACCOUNT_STATUSES as A, BATCH_STATUSES as B, CHARGE_BEARERS as C, account as D, ErsteConnector as E, FinbricksConnector as F, accountCredentials as G, IBankConnector as I, MockConnector as M, PAYMENT_TYPES as P, TOKEN_TYPES as T, FinbricksClient as a, FINBRICKS_ENDPOINTS as b, INSTRUCTION_PRIORITIES as c, PAYMENT_STATUSES as d, PAYMENT_DIRECTIONS as e, COUNTRY_CODES as f, CONNECTOR_KEYS as g, CREDENTIALS_TYPES as h, accountInsertSchema as i, accountUpdateSchema as j, accountSelectSchema as k, accountCredentialsInsertSchema as l, accountCredentialsUpdateSchema as m, accountCredentialsSelectSchema as n, ottInsertSchema as o, paymentInsertTypeZod as p, ottUpdateSchema as q, ottSelectSchema as r, signFinbricksJws as s, tables as t, useFinbricksFetch as u, getPaymentDirection as v, batch as w, payment as x, paymentRelations as y, ott as z };
1287
+ export { ACCOUNT_STATUSES as A, BATCH_STATUSES as B, CHARGE_BEARERS as C, accountCredentials as D, ErsteConnector as E, FinbricksConnector as F, IBankConnector as I, MockConnector as M, PAYMENT_TYPES as P, TOKEN_TYPES as T, FinbricksClient as a, FINBRICKS_ENDPOINTS as b, INSTRUCTION_PRIORITIES as c, PAYMENT_STATUSES as d, PAYMENT_DIRECTIONS as e, COUNTRY_CODES as f, CONNECTOR_KEYS as g, CREDENTIALS_TYPES as h, accountInsertSchema as i, accountUpdateSchema as j, accountSelectSchema as k, accountCredentialsInsertSchema as l, accountCredentialsUpdateSchema as m, accountCredentialsSelectSchema as n, ottInsertSchema as o, paymentInsertTypeZod as p, ottUpdateSchema as q, ottSelectSchema as r, signFinbricksJws as s, tables as t, useFinbricksFetch as u, batch as v, payment as w, paymentRelations as x, ott as y, account as z };
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const database_schema = require('./bank.DCUsXXjG.cjs');
3
+ const database_schema = require('./bank.CWAToo_g.cjs');
4
4
 
5
5
  class MockCobsConnector extends database_schema.FinbricksConnector {
6
6
  constructor(config) {
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- const database_schema = require('./bank.DCUsXXjG.cjs');
3
+ const database_schema = require('./bank.CWAToo_g.cjs');
4
4
  const drizzleOrm = require('drizzle-orm');
5
- const mockCobs_connector = require('./bank.Dp5YErpd.cjs');
5
+ const mockCobs_connector = require('./bank.B8QzFnJl.cjs');
6
6
  require('jose');
7
7
  require('@develit-io/general-codes');
8
8
 
@@ -217,7 +217,7 @@ const mapFinbricksTransactionToPayment = (tx, account) => {
217
217
  tx.entryDetails.transactionDetails?.remittanceInformation?.structured?.creditorReferenceInformation?.reference || tx.entryDetails.transactionDetails?.references?.endToEndIdentification
218
218
  ),
219
219
  creditor: {
220
- holderName: related?.creditor?.name || "Unknown",
220
+ holderName: related?.creditorAccount?.name || related?.creditor?.name || "Unknown",
221
221
  iban: isIncoming ? account.iban || void 0 : related.creditorAccount?.identification?.iban || account.iban || void 0,
222
222
  number: isIncoming ? account.number || void 0 : related.creditorAccount?.identification?.other?.identification ? related.creditorAccount.identification.other.identification.split(
223
223
  "/"
@@ -227,7 +227,7 @@ const mapFinbricksTransactionToPayment = (tx, account) => {
227
227
  )[1] : account.bankCode || void 0
228
228
  },
229
229
  debtor: {
230
- holderName: related?.debtor?.name || "Unknown",
230
+ holderName: related?.debtorAccount?.name || related?.debtor?.name || "Unknown",
231
231
  iban: isIncoming ? related.debtorAccount?.identification?.iban || account.iban || void 0 : account.iban ?? void 0,
232
232
  number: isIncoming ? related.debtorAccount?.identification?.other?.identification ? related.debtorAccount.identification.other.identification.split(
233
233
  "/"
@@ -995,6 +995,7 @@ class ErsteConnector extends IBankConnector {
995
995
  },
996
996
  paymentType: "DOMESTIC",
997
997
  direction: "INCOMING",
998
+ //TO BE SET LATER ↓
998
999
  message: payment.entryDetails.transactionDetails.remittanceInformation?.unstructured,
999
1000
  vs: symbols.vs,
1000
1001
  ss: symbols.ss,
@@ -1311,7 +1312,6 @@ exports.accountInsertSchema = accountInsertSchema;
1311
1312
  exports.accountSelectSchema = accountSelectSchema;
1312
1313
  exports.accountUpdateSchema = accountUpdateSchema;
1313
1314
  exports.batch = batch;
1314
- exports.getPaymentDirection = getPaymentDirection;
1315
1315
  exports.ott = ott;
1316
1316
  exports.ottInsertSchema = ottInsertSchema;
1317
1317
  exports.ottSelectSchema = ottSelectSchema;
@@ -1,6 +1,6 @@
1
- import { t as tables, F as FinbricksConnector, M as MockConnector, E as ErsteConnector } from './bank.BTcR2cZW.mjs';
1
+ import { t as tables, F as FinbricksConnector, M as MockConnector, E as ErsteConnector } from './bank.B0uSWeRe.mjs';
2
2
  import { eq } from 'drizzle-orm';
3
- import { M as MockCobsConnector } from './bank.BgD9dJ3A.mjs';
3
+ import { M as MockCobsConnector } from './bank.CjZRgRoJ.mjs';
4
4
  import 'jose';
5
5
  import '@develit-io/general-codes';
6
6
 
@@ -1,4 +1,4 @@
1
- import { F as FinbricksConnector } from './bank.BTcR2cZW.mjs';
1
+ import { F as FinbricksConnector } from './bank.B0uSWeRe.mjs';
2
2
 
3
3
  class MockCobsConnector extends FinbricksConnector {
4
4
  constructor(config) {
package/dist/types.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const database_schema = require('./shared/bank.DCUsXXjG.cjs');
4
- const mockCobs_connector = require('./shared/bank.Dp5YErpd.cjs');
3
+ const database_schema = require('./shared/bank.CWAToo_g.cjs');
4
+ const mockCobs_connector = require('./shared/bank.B8QzFnJl.cjs');
5
5
  const generalCodes = require('@develit-io/general-codes');
6
6
  require('@develit-io/backend-sdk');
7
7
  require('drizzle-orm/sqlite-core');
package/dist/types.d.cts CHANGED
@@ -285,7 +285,7 @@ type FinbricksTransaction = {
285
285
  fbxReference: string | null;
286
286
  entryReference: string;
287
287
  amount: FinbricksAmount;
288
- creditDebitIndicator: string;
288
+ creditDebitIndicator: 'CRDT' | 'DBIT';
289
289
  reversalIndicator: boolean;
290
290
  status: string;
291
291
  bookingDate: {
@@ -347,6 +347,7 @@ type FinbricksTransaction = {
347
347
  };
348
348
  };
349
349
  debtorAccount: {
350
+ name: string;
350
351
  identification: {
351
352
  iban: string;
352
353
  other: {
@@ -364,6 +365,7 @@ type FinbricksTransaction = {
364
365
  };
365
366
  };
366
367
  creditorAccount: {
368
+ name: string;
367
369
  identification: {
368
370
  iban: string;
369
371
  other: {
package/dist/types.d.mts CHANGED
@@ -285,7 +285,7 @@ type FinbricksTransaction = {
285
285
  fbxReference: string | null;
286
286
  entryReference: string;
287
287
  amount: FinbricksAmount;
288
- creditDebitIndicator: string;
288
+ creditDebitIndicator: 'CRDT' | 'DBIT';
289
289
  reversalIndicator: boolean;
290
290
  status: string;
291
291
  bookingDate: {
@@ -347,6 +347,7 @@ type FinbricksTransaction = {
347
347
  };
348
348
  };
349
349
  debtorAccount: {
350
+ name: string;
350
351
  identification: {
351
352
  iban: string;
352
353
  other: {
@@ -364,6 +365,7 @@ type FinbricksTransaction = {
364
365
  };
365
366
  };
366
367
  creditorAccount: {
368
+ name: string;
367
369
  identification: {
368
370
  iban: string;
369
371
  other: {
package/dist/types.d.ts CHANGED
@@ -285,7 +285,7 @@ type FinbricksTransaction = {
285
285
  fbxReference: string | null;
286
286
  entryReference: string;
287
287
  amount: FinbricksAmount;
288
- creditDebitIndicator: string;
288
+ creditDebitIndicator: 'CRDT' | 'DBIT';
289
289
  reversalIndicator: boolean;
290
290
  status: string;
291
291
  bookingDate: {
@@ -347,6 +347,7 @@ type FinbricksTransaction = {
347
347
  };
348
348
  };
349
349
  debtorAccount: {
350
+ name: string;
350
351
  identification: {
351
352
  iban: string;
352
353
  other: {
@@ -364,6 +365,7 @@ type FinbricksTransaction = {
364
365
  };
365
366
  };
366
367
  creditorAccount: {
368
+ name: string;
367
369
  identification: {
368
370
  iban: string;
369
371
  other: {
package/dist/types.mjs CHANGED
@@ -1,5 +1,5 @@
1
- export { A as ACCOUNT_STATUSES, B as BATCH_STATUES, B as BATCH_STATUSES, C as CHARGE_BEARERS, g as CONNECTOR_KEYS, f as COUNTRY_CODES, h as CREDENTIALS_TYPES, E as ErsteConnector, b as FINBRICKS_ENDPOINTS, a as FinbricksClient, F as FinbricksConnector, I as IBankConnector, c as INSTRUCTION_PRIORITIES, M as MockConnector, e as PAYMENT_DIRECTIONS, d as PAYMENT_STATUSES, P as PAYMENT_TYPES, T as TOKEN_TYPES, l as accountCredentialsInsertSchema, n as accountCredentialsSelectSchema, m as accountCredentialsUpdateSchema, i as accountInsertSchema, k as accountSelectSchema, j as accountUpdateSchema, o as ottInsertSchema, r as ottSelectSchema, q as ottUpdateSchema, p as paymentInsertTypeZod, s as signFinbricksJws, u as useFinbricksFetch } from './shared/bank.BTcR2cZW.mjs';
2
- export { M as MockCobsConnector } from './shared/bank.BgD9dJ3A.mjs';
1
+ export { A as ACCOUNT_STATUSES, B as BATCH_STATUES, B as BATCH_STATUSES, C as CHARGE_BEARERS, g as CONNECTOR_KEYS, f as COUNTRY_CODES, h as CREDENTIALS_TYPES, E as ErsteConnector, b as FINBRICKS_ENDPOINTS, a as FinbricksClient, F as FinbricksConnector, I as IBankConnector, c as INSTRUCTION_PRIORITIES, M as MockConnector, e as PAYMENT_DIRECTIONS, d as PAYMENT_STATUSES, P as PAYMENT_TYPES, T as TOKEN_TYPES, l as accountCredentialsInsertSchema, n as accountCredentialsSelectSchema, m as accountCredentialsUpdateSchema, i as accountInsertSchema, k as accountSelectSchema, j as accountUpdateSchema, o as ottInsertSchema, r as ottSelectSchema, q as ottUpdateSchema, p as paymentInsertTypeZod, s as signFinbricksJws, u as useFinbricksFetch } from './shared/bank.B0uSWeRe.mjs';
2
+ export { M as MockCobsConnector } from './shared/bank.CjZRgRoJ.mjs';
3
3
  export { BANK_CODES, CURRENCY_CODES } from '@develit-io/general-codes';
4
4
  import '@develit-io/backend-sdk';
5
5
  import 'drizzle-orm/sqlite-core';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@develit-services/bank",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "author": "Develit.io s.r.o.",
5
5
  "type": "module",
6
6
  "exports": {