@develit-services/bank 0.3.60 → 0.4.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/database/schema.cjs +9 -9
- package/dist/database/schema.d.cts +4 -5
- package/dist/database/schema.d.mts +4 -5
- package/dist/database/schema.d.ts +4 -5
- package/dist/database/schema.mjs +3 -3
- package/dist/export/worker.cjs +91 -85
- package/dist/export/worker.d.cts +23 -766
- package/dist/export/worker.d.mts +23 -766
- package/dist/export/worker.d.ts +23 -766
- package/dist/export/worker.mjs +72 -66
- package/dist/export/workflows.cjs +215 -211
- package/dist/export/workflows.d.cts +4 -4
- package/dist/export/workflows.d.mts +4 -4
- package/dist/export/workflows.d.ts +4 -4
- package/dist/export/workflows.mjs +210 -206
- package/dist/export/wrangler.d.cts +3 -1
- package/dist/export/wrangler.d.mts +3 -1
- package/dist/export/wrangler.d.ts +3 -1
- package/dist/shared/bank.B51e8oDT.mjs +104 -0
- package/dist/shared/{bank.Dh_H_5rC.d.cts → bank.BJvgLwyZ.d.cts} +2 -0
- package/dist/shared/{bank.Dh_H_5rC.d.mts → bank.BJvgLwyZ.d.mts} +2 -0
- package/dist/shared/{bank.Dh_H_5rC.d.ts → bank.BJvgLwyZ.d.ts} +2 -0
- package/dist/shared/bank.BUSlmr6r.mjs +13 -0
- package/dist/shared/{bank.CMbfx0u7.cjs → bank.BeIpkWR-.cjs} +3 -14
- package/dist/shared/bank.Bg3Pdwm4.cjs +44 -0
- package/dist/shared/bank.CDoYUKBx.d.cts +748 -0
- package/dist/shared/bank.CDoYUKBx.d.mts +748 -0
- package/dist/shared/bank.CDoYUKBx.d.ts +748 -0
- package/dist/shared/{bank.CNEv3Rac.cjs → bank.CfSZTfWS.cjs} +634 -179
- package/dist/shared/{bank.XJJV8p4b.d.cts → bank.CsJuzqZH.d.cts} +2401 -2117
- package/dist/shared/{bank.XJJV8p4b.d.mts → bank.CsJuzqZH.d.mts} +2401 -2117
- package/dist/shared/{bank.XJJV8p4b.d.ts → bank.CsJuzqZH.d.ts} +2401 -2117
- package/dist/shared/bank.DEvSNsEs.cjs +114 -0
- package/dist/shared/{bank.DgGcjhmM.mjs → bank.DinCwx0P.mjs} +627 -179
- package/dist/shared/bank.Dpx6PvkA.mjs +33 -0
- package/dist/shared/bank.c38V_FCq.cjs +15 -0
- package/dist/shared/{bank.BqGzJNC6.mjs → bank.qc8ALZwm.mjs} +4 -14
- package/dist/types.cjs +51 -33
- package/dist/types.d.cts +164 -39
- package/dist/types.d.mts +164 -39
- package/dist/types.d.ts +164 -39
- package/dist/types.mjs +4 -3
- package/package.json +7 -10
- package/dist/shared/bank.CXpc8168.cjs +0 -212
- package/dist/shared/bank.DSsVeR3F.mjs +0 -202
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
function hasPaymentAccountAssigned(payment) {
|
|
2
|
+
return "accountId" in payment && "connectorKey" in payment && payment.accountId !== void 0 && payment.connectorKey !== void 0;
|
|
3
|
+
}
|
|
4
|
+
function isPaymentPrepared(payment) {
|
|
5
|
+
return payment.status === "PREPARED";
|
|
6
|
+
}
|
|
7
|
+
function isPaymentCompleted(payment) {
|
|
8
|
+
return (payment.status === "COMPLETED" || payment.status === "PENDING" || payment.status === "FAILED") && "bankRefId" in payment && typeof payment.bankRefId === "string";
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function isBatchInitiated(batch) {
|
|
12
|
+
return "authorizationUrls" in batch && batch.authorizationUrls !== null && batch.authorizationUrls !== void 0 && batch.authorizationUrls.length > 0;
|
|
13
|
+
}
|
|
14
|
+
function isBatchReadyToSign(batch) {
|
|
15
|
+
return "status" in batch && batch.status === "READY_TO_SIGN";
|
|
16
|
+
}
|
|
17
|
+
function isBatchSigned(batch) {
|
|
18
|
+
return "status" in batch && batch.status === "SIGNED";
|
|
19
|
+
}
|
|
20
|
+
function isBatchProcessing(batch) {
|
|
21
|
+
return "status" in batch && batch.status === "PROCESSING";
|
|
22
|
+
}
|
|
23
|
+
function isBatchCompleted(batch) {
|
|
24
|
+
return "status" in batch && (batch.status === "COMPLETED" || batch.status === "FAILED" || batch.status === "SIGNATURE_FAILED");
|
|
25
|
+
}
|
|
26
|
+
function isBatchOpen(batch) {
|
|
27
|
+
return "status" in batch && batch.status === "OPEN";
|
|
28
|
+
}
|
|
29
|
+
function isBatchFailed(batch) {
|
|
30
|
+
return "status" in batch && batch.status === "FAILED";
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { isPaymentCompleted as a, isBatchInitiated as b, isBatchReadyToSign as c, isBatchSigned as d, isBatchProcessing as e, isBatchCompleted as f, isBatchOpen as g, hasPaymentAccountAssigned as h, isPaymentPrepared as i, isBatchFailed as j };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const payment_schema = require('./bank.BeIpkWR-.cjs');
|
|
4
|
+
|
|
5
|
+
const schema = {
|
|
6
|
+
__proto__: null,
|
|
7
|
+
account: payment_schema.account,
|
|
8
|
+
accountCredentials: payment_schema.accountCredentials,
|
|
9
|
+
batch: payment_schema.batch,
|
|
10
|
+
ott: payment_schema.ott,
|
|
11
|
+
payment: payment_schema.payment,
|
|
12
|
+
paymentRelations: payment_schema.paymentRelations
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
exports.schema = schema;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { bankAccount, base } from '@develit-io/backend-sdk';
|
|
2
|
+
import { relations } from 'drizzle-orm/relations';
|
|
2
3
|
import { sqliteTable, text, integer, unique, real } from 'drizzle-orm/sqlite-core';
|
|
3
4
|
import 'date-fns';
|
|
4
|
-
import { relations } from 'drizzle-orm/relations';
|
|
5
5
|
import { COUNTRY_CODES_2, BANK_CODES } from '@develit-io/general-codes';
|
|
6
|
-
import 'drizzle-orm';
|
|
7
6
|
import 'jose';
|
|
7
|
+
import 'drizzle-orm';
|
|
8
8
|
import 'node:crypto';
|
|
9
9
|
import { createInsertSchema, createUpdateSchema, createSelectSchema } from 'drizzle-zod';
|
|
10
10
|
|
|
@@ -13,7 +13,6 @@ const CHARGE_BEARERS = ["SHA", "OUR", "BEN"];
|
|
|
13
13
|
const INSTRUCTION_PRIORITIES = ["NORM", "HIGH", "INST"];
|
|
14
14
|
const PAYMENT_STATUSES = [
|
|
15
15
|
"PREPARED",
|
|
16
|
-
"INITIALIZED",
|
|
17
16
|
"FAILED",
|
|
18
17
|
"PENDING",
|
|
19
18
|
"COMPLETED",
|
|
@@ -39,6 +38,7 @@ const CONNECTOR_KEYS = [
|
|
|
39
38
|
"MOCK_COBS",
|
|
40
39
|
"FIO",
|
|
41
40
|
"MONETA",
|
|
41
|
+
"DBU",
|
|
42
42
|
"CSAS",
|
|
43
43
|
"AIRBANK"
|
|
44
44
|
];
|
|
@@ -165,14 +165,4 @@ const paymentRelations = relations(payment, ({ one }) => ({
|
|
|
165
165
|
batch: one(batch, { fields: [payment.batchId], references: [batch.id] })
|
|
166
166
|
}));
|
|
167
167
|
|
|
168
|
-
|
|
169
|
-
__proto__: null,
|
|
170
|
-
account: account,
|
|
171
|
-
accountCredentials: accountCredentials,
|
|
172
|
-
batch: batch,
|
|
173
|
-
ott: ott,
|
|
174
|
-
payment: payment,
|
|
175
|
-
paymentRelations: paymentRelations
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
export { ACCOUNT_STATUSES as A, BATCH_STATUSES as B, CHARGE_BEARERS as C, INSTRUCTION_PRIORITIES as I, PAYMENT_TYPES as P, TOKEN_TYPES as T, PAYMENT_STATUSES as a, PAYMENT_DIRECTIONS as b, COUNTRY_CODES as c, CONNECTOR_KEYS as d, CREDENTIALS_TYPES as e, accountInsertSchema as f, accountUpdateSchema as g, accountSelectSchema as h, accountCredentialsInsertSchema as i, accountCredentialsUpdateSchema as j, accountCredentialsSelectSchema as k, ottUpdateSchema as l, ottSelectSchema as m, batch as n, ottInsertSchema as o, payment as p, paymentRelations as q, ott as r, schema as s, account as t, accountCredentials as u };
|
|
168
|
+
export { ACCOUNT_STATUSES as A, BATCH_STATUSES as B, CHARGE_BEARERS as C, INSTRUCTION_PRIORITIES as I, PAYMENT_TYPES as P, TOKEN_TYPES as T, PAYMENT_STATUSES as a, PAYMENT_DIRECTIONS as b, COUNTRY_CODES as c, CONNECTOR_KEYS as d, CREDENTIALS_TYPES as e, accountInsertSchema as f, accountUpdateSchema as g, accountSelectSchema as h, accountCredentialsInsertSchema as i, accountCredentialsUpdateSchema as j, accountCredentialsSelectSchema as k, ottUpdateSchema as l, ottSelectSchema as m, account as n, ottInsertSchema as o, accountCredentials as p, batch as q, ott as r, payment as s, paymentRelations as t };
|
package/dist/types.cjs
CHANGED
|
@@ -1,48 +1,66 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const
|
|
3
|
+
const mock_connector = require('./shared/bank.CfSZTfWS.cjs');
|
|
4
|
+
const payment_schema = require('./shared/bank.BeIpkWR-.cjs');
|
|
5
|
+
const batchLifecycle = require('./shared/bank.Bg3Pdwm4.cjs');
|
|
5
6
|
const generalCodes = require('@develit-io/general-codes');
|
|
6
7
|
require('@develit-io/backend-sdk');
|
|
7
8
|
require('date-fns');
|
|
8
9
|
require('drizzle-orm');
|
|
9
10
|
require('jose');
|
|
10
11
|
require('node:crypto');
|
|
11
|
-
require('drizzle-orm/sqlite-core');
|
|
12
12
|
require('drizzle-orm/relations');
|
|
13
|
+
require('drizzle-orm/sqlite-core');
|
|
13
14
|
require('drizzle-zod');
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
|
|
17
|
-
exports.
|
|
18
|
-
exports.
|
|
19
|
-
exports.
|
|
20
|
-
exports.
|
|
21
|
-
exports.
|
|
22
|
-
exports.
|
|
23
|
-
exports.
|
|
24
|
-
exports.
|
|
25
|
-
exports.
|
|
26
|
-
exports.
|
|
27
|
-
exports.
|
|
28
|
-
exports.
|
|
29
|
-
exports.
|
|
30
|
-
exports.
|
|
31
|
-
exports.
|
|
32
|
-
exports.
|
|
33
|
-
exports.
|
|
34
|
-
exports.
|
|
35
|
-
exports.
|
|
36
|
-
exports.
|
|
37
|
-
exports.
|
|
38
|
-
exports.
|
|
39
|
-
exports.
|
|
40
|
-
exports.
|
|
41
|
-
exports.
|
|
42
|
-
exports.
|
|
43
|
-
exports.
|
|
44
|
-
exports.
|
|
45
|
-
exports.
|
|
46
|
-
exports.
|
|
18
|
+
exports.DbuConnector = mock_connector.DbuConnector;
|
|
19
|
+
exports.ErsteConnector = mock_connector.ErsteConnector;
|
|
20
|
+
exports.FINBRICKS_ENDPOINTS = mock_connector.FINBRICKS_ENDPOINTS;
|
|
21
|
+
exports.FinbricksClient = mock_connector.FinbricksClient;
|
|
22
|
+
exports.FinbricksConnector = mock_connector.FinbricksConnector;
|
|
23
|
+
exports.IBankConnector = mock_connector.IBankConnector;
|
|
24
|
+
exports.MockCobsConnector = mock_connector.MockCobsConnector;
|
|
25
|
+
exports.MockConnector = mock_connector.MockConnector;
|
|
26
|
+
exports.assignAccount = mock_connector.assignAccount;
|
|
27
|
+
exports.batchTransform = mock_connector.batchTransform;
|
|
28
|
+
exports.signFinbricksJws = mock_connector.signFinbricksJws;
|
|
29
|
+
exports.toBatchedPayment = mock_connector.toBatchedPayment;
|
|
30
|
+
exports.toCompletedPayment = mock_connector.toCompletedPayment;
|
|
31
|
+
exports.toIncomingPayment = mock_connector.toIncomingPayment;
|
|
32
|
+
exports.toPreparedPayment = mock_connector.toPreparedPayment;
|
|
33
|
+
exports.useFinbricksFetch = mock_connector.useFinbricksFetch;
|
|
34
|
+
exports.ACCOUNT_STATUSES = payment_schema.ACCOUNT_STATUSES;
|
|
35
|
+
exports.BATCH_STATUES = payment_schema.BATCH_STATUSES;
|
|
36
|
+
exports.BATCH_STATUSES = payment_schema.BATCH_STATUSES;
|
|
37
|
+
exports.CHARGE_BEARERS = payment_schema.CHARGE_BEARERS;
|
|
38
|
+
exports.CONNECTOR_KEYS = payment_schema.CONNECTOR_KEYS;
|
|
39
|
+
exports.COUNTRY_CODES = payment_schema.COUNTRY_CODES;
|
|
40
|
+
exports.CREDENTIALS_TYPES = payment_schema.CREDENTIALS_TYPES;
|
|
41
|
+
exports.INSTRUCTION_PRIORITIES = payment_schema.INSTRUCTION_PRIORITIES;
|
|
42
|
+
exports.PAYMENT_DIRECTIONS = payment_schema.PAYMENT_DIRECTIONS;
|
|
43
|
+
exports.PAYMENT_STATUSES = payment_schema.PAYMENT_STATUSES;
|
|
44
|
+
exports.PAYMENT_TYPES = payment_schema.PAYMENT_TYPES;
|
|
45
|
+
exports.TOKEN_TYPES = payment_schema.TOKEN_TYPES;
|
|
46
|
+
exports.accountCredentialsInsertSchema = payment_schema.accountCredentialsInsertSchema;
|
|
47
|
+
exports.accountCredentialsSelectSchema = payment_schema.accountCredentialsSelectSchema;
|
|
48
|
+
exports.accountCredentialsUpdateSchema = payment_schema.accountCredentialsUpdateSchema;
|
|
49
|
+
exports.accountInsertSchema = payment_schema.accountInsertSchema;
|
|
50
|
+
exports.accountSelectSchema = payment_schema.accountSelectSchema;
|
|
51
|
+
exports.accountUpdateSchema = payment_schema.accountUpdateSchema;
|
|
52
|
+
exports.ottInsertSchema = payment_schema.ottInsertSchema;
|
|
53
|
+
exports.ottSelectSchema = payment_schema.ottSelectSchema;
|
|
54
|
+
exports.ottUpdateSchema = payment_schema.ottUpdateSchema;
|
|
55
|
+
exports.hasPaymentAccountAssigned = batchLifecycle.hasPaymentAccountAssigned;
|
|
56
|
+
exports.isBatchCompleted = batchLifecycle.isBatchCompleted;
|
|
57
|
+
exports.isBatchFailed = batchLifecycle.isBatchFailed;
|
|
58
|
+
exports.isBatchInitiated = batchLifecycle.isBatchInitiated;
|
|
59
|
+
exports.isBatchOpen = batchLifecycle.isBatchOpen;
|
|
60
|
+
exports.isBatchProcessing = batchLifecycle.isBatchProcessing;
|
|
61
|
+
exports.isBatchReadyToSign = batchLifecycle.isBatchReadyToSign;
|
|
62
|
+
exports.isBatchSigned = batchLifecycle.isBatchSigned;
|
|
63
|
+
exports.isPaymentCompleted = batchLifecycle.isPaymentCompleted;
|
|
64
|
+
exports.isPaymentPrepared = batchLifecycle.isPaymentPrepared;
|
|
47
65
|
exports.BANK_CODES = generalCodes.BANK_CODES;
|
|
48
66
|
exports.CURRENCY_CODES = generalCodes.CURRENCY_CODES;
|
package/dist/types.d.cts
CHANGED
|
@@ -1,14 +1,66 @@
|
|
|
1
|
-
import { I as IBankConnector, d as
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
export { b as BankServiceEnv, a as BankServiceEnvironmentConfig, B as BankServiceWranglerConfig } from './shared/bank.Dh_H_5rC.cjs';
|
|
1
|
+
import { I as IBankConnector, a as ConnectorKey, d as ConnectedAccount, e as AccountCredentialsInsertType, f as AccountInsertType, b as BatchedPayment, g as InitiatedBatch, h as IncomingPayment, i as InitiatedPayment, A as AccountSelectType, j as ParsedBankPayment, k as PaymentStatus, l as BatchStatus, c as BatchMetadata, m as CurrencyCode, n as BankCode, o as CountryCode, p as Currency, P as PaymentSelectType, q as AccountAssignedPayment, r as PreparedPayment, s as CompletedPayment } from './shared/bank.CsJuzqZH.cjs';
|
|
2
|
+
export { O as ACCOUNT_STATUSES, a5 as AccountCredentialsPatchType, a6 as AccountCredentialsSelectType, a4 as AccountCredentialsUpdateType, a0 as AccountPatchType, Q as AccountStatus, $ as AccountUpdateType, z as BATCH_STATUES, z as BATCH_STATUSES, S as BankAccountWithLastSync, x as BatchInsertType, ag as BatchLifecycle, y as BatchPayment, B as BatchSelectType, F as CHARGE_BEARERS, T as CONNECTOR_KEYS, R as COUNTRY_CODES, U as CREDENTIALS_TYPES, G as ChargeBearer, af as CompletedBatch, C as ConfigEnvironmentBank, ab as CreatedBatch, V as CredentialsType, H as INSTRUCTION_PRIORITIES, J as InstructionPriority, L as LastSyncMetadata, M as PAYMENT_DIRECTIONS, K as PAYMENT_STATUSES, D as PAYMENT_TYPES, N as PaymentDirection, u as PaymentFailedInsertType, w as PaymentInsertType, a7 as PaymentLifecycle, v as PaymentPreparedInsertType, E as PaymentType, ae as ProcessingBatch, ac as ReadyToSignBatch, ad as SignedBatch, W as TOKEN_TYPES, X as TokenType, a1 as accountCredentialsInsertSchema, a3 as accountCredentialsSelectSchema, a2 as accountCredentialsUpdateSchema, Y as accountInsertSchema, _ as accountSelectSchema, Z as accountUpdateSchema, a8 as hasPaymentAccountAssigned, al as isBatchCompleted, an as isBatchFailed, ah as isBatchInitiated, am as isBatchOpen, ak as isBatchProcessing, ai as isBatchReadyToSign, aj as isBatchSigned, aa as isPaymentCompleted, a9 as isPaymentPrepared } from './shared/bank.CsJuzqZH.cjs';
|
|
3
|
+
export { b as BankServiceEnv, a as BankServiceEnvironmentConfig, B as BankServiceWranglerConfig } from './shared/bank.BJvgLwyZ.cjs';
|
|
4
|
+
import { BaseEvent } from '@develit-io/backend-sdk';
|
|
6
5
|
import * as drizzle_zod from 'drizzle-zod';
|
|
7
6
|
import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
|
|
8
7
|
import { z } from 'zod';
|
|
8
|
+
import { S as SendPaymentInput } from './shared/bank.CDoYUKBx.cjs';
|
|
9
9
|
export { BANK_CODES, CURRENCY_CODES } from '@develit-io/general-codes';
|
|
10
10
|
import 'drizzle-orm';
|
|
11
11
|
|
|
12
|
+
interface DbuConnectorConfig {
|
|
13
|
+
BASE_URL: string;
|
|
14
|
+
USERNAME: string;
|
|
15
|
+
KV: KVNamespace;
|
|
16
|
+
}
|
|
17
|
+
declare class DbuConnector extends IBankConnector {
|
|
18
|
+
connectorKey: ConnectorKey;
|
|
19
|
+
connectedAccounts: ConnectedAccount[];
|
|
20
|
+
readonly kv: KVNamespace;
|
|
21
|
+
private readonly baseUrl;
|
|
22
|
+
private readonly username;
|
|
23
|
+
private readonly sessionId;
|
|
24
|
+
private readonly allowedPostEndpoints;
|
|
25
|
+
constructor({ BASE_URL, USERNAME, KV }: DbuConnectorConfig);
|
|
26
|
+
private makeRequest;
|
|
27
|
+
private mapDbuCurrencyCode;
|
|
28
|
+
private mapDbuTransactionToPayment;
|
|
29
|
+
private mapDbuStatusToPaymentStatus;
|
|
30
|
+
getAuthUri({ ott }: {
|
|
31
|
+
ott: string;
|
|
32
|
+
}): Promise<string>;
|
|
33
|
+
authorizeAccount({ urlParams }: {
|
|
34
|
+
urlParams: string;
|
|
35
|
+
}): Promise<{
|
|
36
|
+
credentials: AccountCredentialsInsertType[];
|
|
37
|
+
accounts: AccountInsertType[];
|
|
38
|
+
}>;
|
|
39
|
+
listAccounts(): Promise<AccountInsertType[]>;
|
|
40
|
+
initiateBatch({ batchId, payments, }: {
|
|
41
|
+
batchId: string;
|
|
42
|
+
payments: BatchedPayment[];
|
|
43
|
+
}): Promise<InitiatedBatch>;
|
|
44
|
+
initiateSEPAPayment(payment: IncomingPayment): Promise<InitiatedPayment>;
|
|
45
|
+
initiateSinglePayment(payment: IncomingPayment): Promise<InitiatedPayment>;
|
|
46
|
+
getAllAccountPayments({ account, filter, }: {
|
|
47
|
+
account: AccountSelectType;
|
|
48
|
+
filter: {
|
|
49
|
+
dateFrom: Date;
|
|
50
|
+
dateTo?: Date;
|
|
51
|
+
};
|
|
52
|
+
}): Promise<ParsedBankPayment[]>;
|
|
53
|
+
getPaymentStatus({ paymentId, }: {
|
|
54
|
+
paymentId: string;
|
|
55
|
+
}): Promise<PaymentStatus>;
|
|
56
|
+
getBatchStatus({ batchId, }: {
|
|
57
|
+
batchId: string;
|
|
58
|
+
}): Promise<{
|
|
59
|
+
status: BatchStatus;
|
|
60
|
+
apiResponse: object;
|
|
61
|
+
}>;
|
|
62
|
+
}
|
|
63
|
+
|
|
12
64
|
interface ErsteConnectorConfig {
|
|
13
65
|
API_KEY: string;
|
|
14
66
|
CLIENT_ID: string;
|
|
@@ -20,7 +72,7 @@ interface ErsteConnectorConfig {
|
|
|
20
72
|
connectedAccounts: ConnectedAccount[];
|
|
21
73
|
}
|
|
22
74
|
declare class ErsteConnector extends IBankConnector {
|
|
23
|
-
initiateSEPAPayment(payment:
|
|
75
|
+
initiateSEPAPayment(payment: IncomingPayment): Promise<InitiatedPayment>;
|
|
24
76
|
private readonly API_KEY;
|
|
25
77
|
private readonly CLIENT_ID;
|
|
26
78
|
private readonly CLIENT_SECRET;
|
|
@@ -41,17 +93,16 @@ declare class ErsteConnector extends IBankConnector {
|
|
|
41
93
|
credentials: AccountCredentialsInsertType[];
|
|
42
94
|
accounts: AccountInsertType[];
|
|
43
95
|
}>;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
initiateBatchFromPayments({ batchId, payments, }: {
|
|
96
|
+
/**
|
|
97
|
+
* Erste-specific: Prepare individual payment
|
|
98
|
+
* This is an internal method used by initiateBatch
|
|
99
|
+
*/
|
|
100
|
+
private prepareErstePayment;
|
|
101
|
+
initiateBatch({ batchId, payments, }: {
|
|
51
102
|
batchId: string;
|
|
52
|
-
payments:
|
|
103
|
+
payments: IncomingPayment[];
|
|
53
104
|
}): Promise<InitiatedBatch>;
|
|
54
|
-
initiateSinglePayment(): Promise<InitiatedPayment>;
|
|
105
|
+
initiateSinglePayment(payment: IncomingPayment): Promise<InitiatedPayment>;
|
|
55
106
|
sendBatchPaymentForAuthorization(paymentIds: string[]): Promise<BatchMetadata>;
|
|
56
107
|
getBatchAuthorizationURI({ signId, signHash, }: {
|
|
57
108
|
signId: string;
|
|
@@ -469,7 +520,6 @@ declare abstract class FinbricksConnector extends IBankConnector {
|
|
|
469
520
|
credentials: AccountCredentialsInsertType[];
|
|
470
521
|
accounts: AccountInsertType[];
|
|
471
522
|
}>;
|
|
472
|
-
authenticate(code: AuthInput): Promise<string>;
|
|
473
523
|
revokeAuthentication(clientId: string): Promise<void>;
|
|
474
524
|
isClientIdExpired({ clientId, }: {
|
|
475
525
|
clientId: string;
|
|
@@ -477,18 +527,15 @@ declare abstract class FinbricksConnector extends IBankConnector {
|
|
|
477
527
|
getAccountsForClient({ clientId, }: {
|
|
478
528
|
clientId: string;
|
|
479
529
|
}): Promise<FinbricksAccount[]>;
|
|
480
|
-
|
|
481
|
-
preparePayment(payment: IncomingPaymentMessage): Promise<PaymentPreparedInsertType>;
|
|
482
|
-
initiateBatchFromPayments({ batchId, payments, }: {
|
|
530
|
+
initiateBatch({ batchId, payments, }: {
|
|
483
531
|
batchId: string;
|
|
484
|
-
payments:
|
|
532
|
+
payments: BatchedPayment[];
|
|
485
533
|
}): Promise<InitiatedBatch>;
|
|
486
|
-
initiateForeignPayment(payment:
|
|
487
|
-
initiateSEPAPayment(payment:
|
|
488
|
-
initiateSinglePayment(payment:
|
|
534
|
+
initiateForeignPayment(payment: IncomingPayment): Promise<InitiatedPayment>;
|
|
535
|
+
initiateSEPAPayment(payment: IncomingPayment): Promise<InitiatedPayment>;
|
|
536
|
+
initiateSinglePayment(payment: BatchedPayment): Promise<InitiatedPayment>;
|
|
489
537
|
getAllAccountPayments({ account, filter, }: {
|
|
490
538
|
account: AccountSelectType;
|
|
491
|
-
environment: Environment;
|
|
492
539
|
filter: {
|
|
493
540
|
dateFrom: Date;
|
|
494
541
|
dateTo?: Date;
|
|
@@ -506,13 +553,14 @@ declare abstract class FinbricksConnector extends IBankConnector {
|
|
|
506
553
|
}>;
|
|
507
554
|
}
|
|
508
555
|
|
|
556
|
+
declare class MockCobsConnector extends FinbricksConnector {
|
|
557
|
+
constructor(config: FinbricksConnectorConfig);
|
|
558
|
+
}
|
|
559
|
+
|
|
509
560
|
declare class MockConnector extends IBankConnector {
|
|
510
|
-
initiateSEPAPayment(payment: IncomingPaymentMessage): Promise<InitiatedPayment>;
|
|
511
561
|
connectedAccounts: ConnectedAccount[];
|
|
512
562
|
connectorKey: ConnectorKey;
|
|
513
563
|
constructor();
|
|
514
|
-
authenticate(): Promise<string>;
|
|
515
|
-
listAccounts(): Promise<[]>;
|
|
516
564
|
getAuthUri({ accountId, }: {
|
|
517
565
|
accountId: string;
|
|
518
566
|
ott: string;
|
|
@@ -523,14 +571,18 @@ declare class MockConnector extends IBankConnector {
|
|
|
523
571
|
credentials: AccountCredentialsInsertType[];
|
|
524
572
|
accounts: AccountInsertType[];
|
|
525
573
|
}>;
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
574
|
+
initiateSinglePayment(payment: BatchedPayment): Promise<InitiatedPayment>;
|
|
575
|
+
initiateSEPAPayment(payment: BatchedPayment): Promise<InitiatedPayment>;
|
|
576
|
+
initiateBatch({ batchId, payments, }: {
|
|
529
577
|
batchId: string;
|
|
530
|
-
payments:
|
|
578
|
+
payments: BatchedPayment[];
|
|
531
579
|
}): Promise<InitiatedBatch>;
|
|
532
|
-
getAllAccountPayments({
|
|
533
|
-
|
|
580
|
+
getAllAccountPayments({ account, filter, }: {
|
|
581
|
+
account: AccountSelectType;
|
|
582
|
+
filter: {
|
|
583
|
+
dateFrom: Date;
|
|
584
|
+
dateTo?: Date;
|
|
585
|
+
};
|
|
534
586
|
}): Promise<ParsedBankPayment[]>;
|
|
535
587
|
getPaymentStatus(_: {
|
|
536
588
|
paymentId: string;
|
|
@@ -543,10 +595,6 @@ declare class MockConnector extends IBankConnector {
|
|
|
543
595
|
}>;
|
|
544
596
|
}
|
|
545
597
|
|
|
546
|
-
declare class MockCobsConnector extends FinbricksConnector {
|
|
547
|
-
constructor(config: FinbricksConnectorConfig);
|
|
548
|
-
}
|
|
549
|
-
|
|
550
598
|
interface ErsteAuthenticationResponse {
|
|
551
599
|
access_token: string;
|
|
552
600
|
token_type: string;
|
|
@@ -1135,5 +1183,82 @@ type OneTimeTokenUpdateType = z.infer<typeof ottInsertSchema>;
|
|
|
1135
1183
|
type OneTimeTokenPatchType = z.infer<typeof ottUpdateSchema>;
|
|
1136
1184
|
type OneTimeTokenSelectType = z.infer<typeof ottSelectSchema>;
|
|
1137
1185
|
|
|
1138
|
-
|
|
1139
|
-
|
|
1186
|
+
/**
|
|
1187
|
+
* Payment transformer utilities
|
|
1188
|
+
*
|
|
1189
|
+
* Helper functions to transform payments between different lifecycle stages.
|
|
1190
|
+
* These functions provide type-safe transformations and encapsulate the mapping logic.
|
|
1191
|
+
*/
|
|
1192
|
+
|
|
1193
|
+
/**
|
|
1194
|
+
* Transform API input (SendPaymentInput) to incoming payment
|
|
1195
|
+
*
|
|
1196
|
+
* This is the first transformation in the payment lifecycle.
|
|
1197
|
+
* Creates a new payment with generated ID and CREATED status.
|
|
1198
|
+
*
|
|
1199
|
+
* @param input - Payment data from API
|
|
1200
|
+
* @returns IncomingPayment ready for account assignment
|
|
1201
|
+
*/
|
|
1202
|
+
declare function toIncomingPayment(input: SendPaymentInput): IncomingPayment;
|
|
1203
|
+
/**
|
|
1204
|
+
* Assign account to incoming payment
|
|
1205
|
+
*
|
|
1206
|
+
* Transforms IncomingPayment to AccountAssignedPayment by adding
|
|
1207
|
+
* account ID and connector key.
|
|
1208
|
+
*
|
|
1209
|
+
* @param payment - Incoming payment without account
|
|
1210
|
+
* @param account - Account data to assign
|
|
1211
|
+
* @returns AccountAssignedPayment ready for batching
|
|
1212
|
+
*/
|
|
1213
|
+
declare function assignAccount(payment: IncomingPayment, account: {
|
|
1214
|
+
id: string;
|
|
1215
|
+
connectorKey: ConnectorKey;
|
|
1216
|
+
}): AccountAssignedPayment;
|
|
1217
|
+
/**
|
|
1218
|
+
* Convert AccountAssignedPayment to BatchedPayment
|
|
1219
|
+
*
|
|
1220
|
+
* Semantically marks payment as part of a batch.
|
|
1221
|
+
* Type structure is identical but semantic meaning differs.
|
|
1222
|
+
*
|
|
1223
|
+
* @param payment - Account assigned payment
|
|
1224
|
+
* @returns BatchedPayment for batch storage
|
|
1225
|
+
*/
|
|
1226
|
+
declare function toBatchedPayment(payment: AccountAssignedPayment): BatchedPayment;
|
|
1227
|
+
/**
|
|
1228
|
+
* Transform batched payment to prepared payment
|
|
1229
|
+
*
|
|
1230
|
+
* Updates payment status to PREPARED after connector.initiateBatch()
|
|
1231
|
+
* May include bankRefId if connector assigns it during batch initiation.
|
|
1232
|
+
*
|
|
1233
|
+
* @param payment - Batched payment
|
|
1234
|
+
* @param bankRefId - Optional bank reference ID from connector
|
|
1235
|
+
* @param initiatedAt - Timestamp when batch was initiated
|
|
1236
|
+
* @returns PreparedPayment ready for authorization
|
|
1237
|
+
*/
|
|
1238
|
+
declare function toPreparedPayment(payment: BatchedPayment, bankRefId?: string, initiatedAt?: Date): PreparedPayment;
|
|
1239
|
+
/**
|
|
1240
|
+
* Transform prepared payment to completed payment
|
|
1241
|
+
*
|
|
1242
|
+
* Updates payment status to final state (COMPLETED/PENDING/FAILED) after bank processing
|
|
1243
|
+
* Requires bankRefId to be present.
|
|
1244
|
+
*
|
|
1245
|
+
* @param payment - Prepared payment
|
|
1246
|
+
* @param status - Final payment status
|
|
1247
|
+
* @param bankRefId - Bank reference ID (required for completed payment)
|
|
1248
|
+
* @param processedAt - Timestamp when payment was processed by bank
|
|
1249
|
+
* @returns CompletedPayment with final status
|
|
1250
|
+
*/
|
|
1251
|
+
declare function toCompletedPayment(payment: PreparedPayment, status: 'COMPLETED' | 'FAILED', bankRefId: string, processedAt?: Date): CompletedPayment;
|
|
1252
|
+
/**
|
|
1253
|
+
* Batch transform multiple payments
|
|
1254
|
+
*
|
|
1255
|
+
* Helper to transform array of payments using a transformer function.
|
|
1256
|
+
*
|
|
1257
|
+
* @param payments - Array of payments to transform
|
|
1258
|
+
* @param transformer - Transformer function
|
|
1259
|
+
* @returns Array of transformed payments
|
|
1260
|
+
*/
|
|
1261
|
+
declare function batchTransform<TInput, TOutput>(payments: TInput[], transformer: (payment: TInput) => TOutput): TOutput[];
|
|
1262
|
+
|
|
1263
|
+
export { AccountAssignedPayment, AccountCredentialsInsertType, AccountInsertType, AccountSelectType, BankCode, BatchMetadata, BatchStatus, BatchedPayment, CompletedPayment, ConnectedAccount, ConnectorKey, CountryCode, Currency, CurrencyCode, DbuConnector, ErsteConnector, FINBRICKS_ENDPOINTS, FinbricksClient, FinbricksConnector, IBankConnector, IncomingPayment, IncomingPayment as IncomingPaymentMessage, InitiatedBatch, InitiatedPayment, MockCobsConnector, MockConnector, ParsedBankPayment, PaymentSelectType, PaymentStatus, PreparedPayment, assignAccount, batchTransform, ottInsertSchema, ottSelectSchema, ottUpdateSchema, signFinbricksJws, toBatchedPayment, toCompletedPayment, toIncomingPayment, toPreparedPayment, useFinbricksFetch };
|
|
1264
|
+
export type { BankPaymentEvent, DbuConnectorConfig, ErsteAuthenticationResponse, ErsteBatchPaymentInitiationResponse, ErsteIncomingPaymentResponse, ErsteObtainAuthorizationURLResponse, ErstePaymentInitiationResponse, FinbricksAccount, FinbricksAccountTransactionsResponse, FinbricksAccountsListResponse, FinbricksAuthTokenResponse, FinbricksBatchBody, FinbricksBatchResponse, FinbricksBatchStatus, FinbricksConnectAccountBody, FinbricksConnectAccountResponse, FinbricksConnectorConfig, FinbricksEndpoint, FinbricksEndpointPath, FinbricksFetchConfig, FinbricksForeignPaymentBody, FinbricksGetBatchStatusBody, FinbricksGetBatchStatusResponse, FinbricksGetTransactionStatusResponse, FinbricksJWSData, FinbricksPaymentBody, FinbricksPaymentResponse, FinbricksProvider, FinbricksRequestInit, FinbricksTransactionStatus, OneTimeTokenInsertType, OneTimeTokenPatchType, OneTimeTokenSelectType, OneTimeTokenUpdateType };
|