@develit-services/bank 0.7.7 → 0.7.9

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/types.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { I as IBankConnector, a as ConnectorKey, b as ConnectedAccount, c as PaymentType, d as AccountCredentialsInsertType, e as AccountInsertType, f as BatchedPayment, g as InitiatedPayment, h as InitiatedBatch, A as AccountSelectType, i as ParsedBankPayment, j as PaymentStatus, k as BatchStatus, l as IncomingPayment, m as BatchMetadata, n as CurrencyCode, o as BankCode, p as CountryCode, q as Currency, P as PaymentSelectType, r as AccountAssignedPayment, s as PreparedPayment, u as CompletedPayment } from './shared/bank.CJAPmWGK.mjs';
2
- export { v as ACCOUNT_STATUSES, w as AccountCredentialsPatchType, x as AccountCredentialsSelectType, y as AccountCredentialsUpdateType, z as AccountPatchType, D as AccountStatus, E as AccountUpdateType, F as BATCH_STATUES, F as BATCH_STATUSES, G as BankAccountWithLastSync, H as BatchInsertType, J as BatchLifecycle, K as BatchPayment, B as BatchSelectType, M as CHARGE_BEARERS, N as CONNECTOR_KEYS, O as COUNTRY_CODES, Q as CREDENTIALS_TYPES, R as ChargeBearer, S as CompletedBatch, C as ConfigEnvironmentBank, T as CreatedBatch, U as CredentialsType, V as INSTRUCTION_PRIORITIES, W as InstructionPriority, L as LastSyncMetadata, X as PAYMENT_DIRECTIONS, Y as PAYMENT_STATUSES, Z as PAYMENT_TYPES, _ as PaymentDirection, $ as PaymentFailedInsertType, a0 as PaymentInsertType, a1 as PaymentLifecycle, a2 as PaymentPreparedInsertType, a3 as ProcessingBatch, a4 as ReadyToSignBatch, a5 as SignedBatch, a6 as TOKEN_TYPES, a7 as TokenType, a8 as accountCredentialsInsertSchema, a9 as accountCredentialsSelectSchema, aa as accountCredentialsUpdateSchema, ab as accountInsertSchema, ac as accountSelectSchema, ad as accountUpdateSchema, ae as hasPaymentAccountAssigned, af as isBatchCompleted, ag as isBatchFailed, ah as isBatchInitiated, ai as isBatchOpen, aj as isBatchProcessing, ak as isBatchReadyToSign, al as isBatchSigned, am as isPaymentCompleted, an as isPaymentPrepared } from './shared/bank.CJAPmWGK.mjs';
1
+ import { b as CurrencyCode, c as BankCode, d as CountryCode, I as IBankConnector, a as ConnectorKey, e as ConnectedAccount, f as CredentialsResolver, g as AccountCredentialsInsertType, h as AccountInsertType, i as BatchedPayment, j as InitiatedBatch, k as IncomingPayment, l as InitiatedPayment, A as AccountSelectType, m as ParsedBankPayment, n as PaymentStatus, o as BatchStatus, p as PaymentType, q as BatchMetadata, r as Currency, P as PaymentSelectType, s as AccountAssignedPayment, u as PreparedPayment, v as CompletedPayment } from './shared/bank.BJ7LqYtJ.mjs';
2
+ export { w as ACCOUNT_STATUSES, x as AccountCredentialsPatchType, y as AccountCredentialsSelectType, z as AccountCredentialsUpdateType, D as AccountPatchType, E as AccountStatus, F as AccountUpdateType, G as BATCH_STATUES, G as BATCH_STATUSES, H as BankAccountWithLastSync, J as BatchInsertType, K as BatchLifecycle, M as BatchPayment, B as BatchSelectType, N as CHARGE_BEARERS, O as CONNECTOR_KEYS, Q as COUNTRY_CODES, R as CREDENTIALS_TYPES, S as ChargeBearer, T as CompletedBatch, C as ConfigEnvironmentBank, U as CreatedBatch, V as CredentialsType, W as INSTRUCTION_PRIORITIES, X as InstructionPriority, L as LastSyncMetadata, Y as PAYMENT_DIRECTIONS, Z as PAYMENT_STATUSES, _ as PAYMENT_TYPES, $ as PaymentDirection, a0 as PaymentFailedInsertType, a1 as PaymentInsertType, a2 as PaymentLifecycle, a3 as PaymentPreparedInsertType, a4 as ProcessingBatch, a5 as ReadyToSignBatch, a6 as ResolvedCredentials, a7 as SignedBatch, a8 as TOKEN_TYPES, a9 as TokenType, aa as accountCredentialsInsertSchema, ab as accountCredentialsSelectSchema, ac as accountCredentialsUpdateSchema, ad as accountInsertSchema, ae as accountSelectSchema, af as accountUpdateSchema, ag as hasPaymentAccountAssigned, ah as isBatchCompleted, ai as isBatchFailed, aj as isBatchInitiated, ak as isBatchOpen, al as isBatchProcessing, am as isBatchReadyToSign, an as isBatchSigned, ao as isPaymentCompleted, ap as isPaymentPrepared } from './shared/bank.BJ7LqYtJ.mjs';
3
3
  export { a as BankServiceEnv, b as BankServiceEnvironmentConfig, B as BankServiceWranglerConfig } from './shared/bank.BC06Rbrx.mjs';
4
4
  import { BaseEvent } from '@develit-io/backend-sdk';
5
5
  import * as drizzle_zod from 'drizzle-zod';
@@ -9,152 +9,6 @@ import { S as SendPaymentInput } from './shared/bank.COC0tqmL.mjs';
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
- API: Fetcher;
17
- REDIRECT_URI: string;
18
- TX_AUTH_URI: string;
19
- connectedAccounts: ConnectedAccount[];
20
- }
21
- declare class DbuConnector extends IBankConnector {
22
- connectorKey: ConnectorKey;
23
- connectedAccounts: ConnectedAccount[];
24
- readonly kv: KVNamespace;
25
- readonly api: Fetcher;
26
- private readonly baseUrl;
27
- private readonly username;
28
- private readonly sessionId;
29
- private readonly redirectUri;
30
- private readonly txAuthUri;
31
- private readonly allowedPostEndpoints;
32
- constructor({ BASE_URL, USERNAME, KV, API, REDIRECT_URI, TX_AUTH_URI, connectedAccounts, }: DbuConnectorConfig);
33
- supportsBatch(_paymentType: PaymentType): boolean;
34
- private makeRequest;
35
- private mapDbuCurrencyCode;
36
- private mapDbuTransactionToPayment;
37
- private mapDbuStatusToPaymentStatus;
38
- getAuthUri({ ott }: {
39
- ott: string;
40
- }): Promise<string>;
41
- authorizeAccount({ urlParams }: {
42
- urlParams: string;
43
- }): Promise<{
44
- credentials: AccountCredentialsInsertType[];
45
- accounts: AccountInsertType[];
46
- }>;
47
- listAccounts(): Promise<AccountInsertType[]>;
48
- private resolveIdAccountDebit;
49
- private initiateInstantPayment;
50
- initiateDomesticPayment(payment: BatchedPayment): Promise<InitiatedPayment>;
51
- initiateSEPAPayment(_payment: BatchedPayment): Promise<InitiatedPayment>;
52
- initiateForeignPayment(_payment: BatchedPayment): Promise<InitiatedPayment>;
53
- protected initiateDomesticBatchImpl(_args: {
54
- batchId: string;
55
- payments: BatchedPayment[];
56
- }): Promise<InitiatedBatch>;
57
- protected initiateSEPABatchImpl(_args: {
58
- batchId: string;
59
- payments: BatchedPayment[];
60
- }): Promise<InitiatedBatch>;
61
- protected initiateForeignBatchImpl(_args: {
62
- batchId: string;
63
- payments: BatchedPayment[];
64
- }): Promise<InitiatedBatch>;
65
- getAllAccountPayments({ account, filter, }: {
66
- account: AccountSelectType;
67
- filter: {
68
- dateFrom: Date;
69
- dateTo?: Date;
70
- };
71
- }): Promise<ParsedBankPayment[]>;
72
- getPaymentStatus({ paymentId, }: {
73
- paymentId: string;
74
- }): Promise<PaymentStatus>;
75
- getBatchStatus({ batchId, }: {
76
- batchId: string;
77
- }): Promise<{
78
- status: BatchStatus;
79
- apiResponse: object;
80
- }>;
81
- }
82
-
83
- interface ErsteConnectorConfig {
84
- API_KEY: string;
85
- CLIENT_ID: string;
86
- CLIENT_SECRET: string;
87
- REDIRECT_URI: string;
88
- AUTH_URI: string;
89
- PAYMENTS_URI: string;
90
- ACCOUNTS_URI: string;
91
- connectedAccounts: ConnectedAccount[];
92
- }
93
- declare class ErsteConnector extends IBankConnector {
94
- initiateDomesticPayment(_payment: IncomingPayment): Promise<InitiatedPayment>;
95
- initiateSEPAPayment(_payment: IncomingPayment): Promise<InitiatedPayment>;
96
- initiateForeignPayment(_payment: IncomingPayment): Promise<InitiatedPayment>;
97
- private readonly API_KEY;
98
- private readonly CLIENT_ID;
99
- private readonly CLIENT_SECRET;
100
- private readonly AUTH_URI;
101
- private readonly PAYMENTS_URI;
102
- private readonly REDIRECT_URI;
103
- private readonly ACCOUNTS_URI;
104
- connectorKey: ConnectorKey;
105
- connectedAccounts: ConnectedAccount[];
106
- private accessToken;
107
- constructor(config: ErsteConnectorConfig);
108
- supportsBatch(paymentType: PaymentType): boolean;
109
- getAuthUri({ ott }: {
110
- ott: string;
111
- }): Promise<string>;
112
- authorizeAccount({ urlParams }: {
113
- urlParams: string;
114
- }): Promise<{
115
- credentials: AccountCredentialsInsertType[];
116
- accounts: AccountInsertType[];
117
- }>;
118
- /**
119
- * Erste-specific: Prepare individual payment
120
- * This is an internal method used by initiateBatch
121
- */
122
- private prepareErstePayment;
123
- protected initiateDomesticBatchImpl({ batchId, payments, }: {
124
- batchId: string;
125
- payments: IncomingPayment[];
126
- }): Promise<InitiatedBatch>;
127
- protected initiateSEPABatchImpl(_args: {
128
- batchId: string;
129
- payments: IncomingPayment[];
130
- }): Promise<InitiatedBatch>;
131
- protected initiateForeignBatchImpl(_args: {
132
- batchId: string;
133
- payments: IncomingPayment[];
134
- }): Promise<InitiatedBatch>;
135
- sendBatchPaymentForAuthorization(paymentIds: string[]): Promise<BatchMetadata>;
136
- getBatchAuthorizationURI({ signId, signHash, }: {
137
- signId: string;
138
- signHash: string;
139
- }): Promise<string>;
140
- getAllAccountPayments({ account, filter, }: {
141
- account: AccountSelectType;
142
- filter: {
143
- dateFrom: Date;
144
- dateTo?: Date;
145
- };
146
- }): Promise<ParsedBankPayment[]>;
147
- getPaymentStatus(_: {
148
- paymentId: string;
149
- }): Promise<PaymentStatus>;
150
- getBatchStatus(_: {
151
- batchId: string;
152
- }): Promise<{
153
- status: BatchStatus;
154
- apiResponse: object;
155
- }>;
156
- }
157
-
158
12
  type FinbricksProvider = 'KB' | 'ERSTE' | 'CSOB' | 'MOCK_COBS' | 'CREDITAS' | 'FIO' | 'MONETA' | 'AIRBANK' | 'CSAS';
159
13
  declare const FINBRICKS_TRANSACTION_STATUSES: readonly ["OPENED", "AUTHORIZED", "COMPLETED", "BOOKED", "SETTLED", "REJECTED", "CLOSED"];
160
14
  type FinbricksTransactionStatus = (typeof FINBRICKS_TRANSACTION_STATUSES)[number];
@@ -533,13 +387,15 @@ interface FinbricksConnectorConfig {
533
387
  BASE_URI: string;
534
388
  REDIRECT_URI: string;
535
389
  connectedAccounts: ConnectedAccount[];
390
+ resolveCredentials?: CredentialsResolver;
536
391
  }
537
392
  declare abstract class FinbricksConnector extends IBankConnector {
538
393
  connectorKey: ConnectorKey;
539
394
  connectedAccounts: ConnectedAccount[];
540
395
  protected readonly finbricks: FinbricksClient;
541
396
  protected readonly PROVIDER: FinbricksProvider;
542
- constructor(provider: FinbricksProvider, { BASE_URI, MERCHANT_ID, PRIVATE_KEY_PEM, REDIRECT_URI, connectedAccounts, }: FinbricksConnectorConfig);
397
+ constructor(provider: FinbricksProvider, { BASE_URI, MERCHANT_ID, PRIVATE_KEY_PEM, REDIRECT_URI, connectedAccounts, resolveCredentials, }: FinbricksConnectorConfig);
398
+ private getClientId;
543
399
  getAuthUri({ ott }: {
544
400
  ott: string;
545
401
  }): Promise<string>;
@@ -594,6 +450,163 @@ declare abstract class FinbricksConnector extends IBankConnector {
594
450
  }>;
595
451
  }
596
452
 
453
+ declare class CsobConnector extends FinbricksConnector {
454
+ constructor(config: FinbricksConnectorConfig);
455
+ supportsBatch(paymentType: PaymentType): boolean;
456
+ }
457
+
458
+ interface DbuConnectorConfig {
459
+ BASE_URL: string;
460
+ USERNAME: string;
461
+ KV: KVNamespace;
462
+ API: Fetcher;
463
+ REDIRECT_URI: string;
464
+ TX_AUTH_URI: string;
465
+ connectedAccounts: ConnectedAccount[];
466
+ }
467
+ declare class DbuConnector extends IBankConnector {
468
+ connectorKey: ConnectorKey;
469
+ connectedAccounts: ConnectedAccount[];
470
+ readonly kv: KVNamespace;
471
+ readonly api: Fetcher;
472
+ private readonly baseUrl;
473
+ private readonly username;
474
+ private readonly sessionId;
475
+ private readonly redirectUri;
476
+ private readonly txAuthUri;
477
+ private readonly allowedPostEndpoints;
478
+ constructor({ BASE_URL, USERNAME, KV, API, REDIRECT_URI, TX_AUTH_URI, connectedAccounts, }: DbuConnectorConfig);
479
+ supportsBatch(_paymentType: PaymentType): boolean;
480
+ private makeRequest;
481
+ private mapDbuCurrencyCode;
482
+ private mapDbuTransactionToPayment;
483
+ private mapDbuStatusToPaymentStatus;
484
+ getAuthUri({ ott }: {
485
+ ott: string;
486
+ }): Promise<string>;
487
+ authorizeAccount({ urlParams }: {
488
+ urlParams: string;
489
+ }): Promise<{
490
+ credentials: AccountCredentialsInsertType[];
491
+ accounts: AccountInsertType[];
492
+ }>;
493
+ listAccounts(): Promise<AccountInsertType[]>;
494
+ private resolveIdAccountDebit;
495
+ private initiateInstantPayment;
496
+ initiateDomesticPayment(payment: BatchedPayment): Promise<InitiatedPayment>;
497
+ initiateSEPAPayment(_payment: BatchedPayment): Promise<InitiatedPayment>;
498
+ initiateForeignPayment(_payment: BatchedPayment): Promise<InitiatedPayment>;
499
+ protected initiateDomesticBatchImpl(_args: {
500
+ batchId: string;
501
+ payments: BatchedPayment[];
502
+ }): Promise<InitiatedBatch>;
503
+ protected initiateSEPABatchImpl(_args: {
504
+ batchId: string;
505
+ payments: BatchedPayment[];
506
+ }): Promise<InitiatedBatch>;
507
+ protected initiateForeignBatchImpl(_args: {
508
+ batchId: string;
509
+ payments: BatchedPayment[];
510
+ }): Promise<InitiatedBatch>;
511
+ getAllAccountPayments({ account, filter, }: {
512
+ account: AccountSelectType;
513
+ filter: {
514
+ dateFrom: Date;
515
+ dateTo?: Date;
516
+ };
517
+ }): Promise<ParsedBankPayment[]>;
518
+ getPaymentStatus({ paymentId, }: {
519
+ paymentId: string;
520
+ }): Promise<PaymentStatus>;
521
+ getBatchStatus({ batchId, }: {
522
+ batchId: string;
523
+ }): Promise<{
524
+ status: BatchStatus;
525
+ apiResponse: object;
526
+ }>;
527
+ }
528
+
529
+ interface ErsteConnectorConfig {
530
+ API_KEY: string;
531
+ CLIENT_ID: string;
532
+ CLIENT_SECRET: string;
533
+ REDIRECT_URI: string;
534
+ AUTH_URI: string;
535
+ PAYMENTS_URI: string;
536
+ ACCOUNTS_URI: string;
537
+ connectedAccounts: ConnectedAccount[];
538
+ resolveCredentials?: CredentialsResolver;
539
+ }
540
+ declare class ErsteConnector extends IBankConnector {
541
+ initiateDomesticPayment(_payment: IncomingPayment): Promise<InitiatedPayment>;
542
+ initiateSEPAPayment(_payment: IncomingPayment): Promise<InitiatedPayment>;
543
+ initiateForeignPayment(_payment: IncomingPayment): Promise<InitiatedPayment>;
544
+ private readonly API_KEY;
545
+ private readonly CLIENT_ID;
546
+ private readonly CLIENT_SECRET;
547
+ private readonly AUTH_URI;
548
+ private readonly PAYMENTS_URI;
549
+ private readonly REDIRECT_URI;
550
+ private readonly ACCOUNTS_URI;
551
+ connectorKey: ConnectorKey;
552
+ connectedAccounts: ConnectedAccount[];
553
+ private accessToken;
554
+ constructor(config: ErsteConnectorConfig);
555
+ supportsBatch(paymentType: PaymentType): boolean;
556
+ getAuthUri({ ott }: {
557
+ ott: string;
558
+ }): Promise<string>;
559
+ authorizeAccount({ urlParams }: {
560
+ urlParams: string;
561
+ }): Promise<{
562
+ credentials: AccountCredentialsInsertType[];
563
+ accounts: AccountInsertType[];
564
+ }>;
565
+ /**
566
+ * Erste-specific: Prepare individual payment
567
+ * This is an internal method used by initiateBatch
568
+ */
569
+ private prepareErstePayment;
570
+ protected initiateDomesticBatchImpl({ batchId, payments, }: {
571
+ batchId: string;
572
+ payments: IncomingPayment[];
573
+ }): Promise<InitiatedBatch>;
574
+ protected initiateSEPABatchImpl(_args: {
575
+ batchId: string;
576
+ payments: IncomingPayment[];
577
+ }): Promise<InitiatedBatch>;
578
+ protected initiateForeignBatchImpl(_args: {
579
+ batchId: string;
580
+ payments: IncomingPayment[];
581
+ }): Promise<InitiatedBatch>;
582
+ sendBatchPaymentForAuthorization(paymentIds: string[]): Promise<BatchMetadata>;
583
+ getBatchAuthorizationURI({ signId, signHash, }: {
584
+ signId: string;
585
+ signHash: string;
586
+ }): Promise<string>;
587
+ getAllAccountPayments({ account, filter, }: {
588
+ account: AccountSelectType;
589
+ filter: {
590
+ dateFrom: Date;
591
+ dateTo?: Date;
592
+ };
593
+ }): Promise<ParsedBankPayment[]>;
594
+ getPaymentStatus(_: {
595
+ paymentId: string;
596
+ }): Promise<PaymentStatus>;
597
+ getBatchStatus(_: {
598
+ batchId: string;
599
+ }): Promise<{
600
+ status: BatchStatus;
601
+ apiResponse: object;
602
+ }>;
603
+ }
604
+
605
+ declare class KBConnector extends FinbricksConnector {
606
+ constructor(config: FinbricksConnectorConfig);
607
+ supportsBatch(paymentType: PaymentType): boolean;
608
+ }
609
+
597
610
  declare class MockCobsConnector extends FinbricksConnector {
598
611
  constructor(config: FinbricksConnectorConfig);
599
612
  supportsBatch(_paymentType: PaymentType): boolean;
@@ -1483,5 +1496,5 @@ declare function toCompletedPayment(payment: PreparedPayment, status: 'COMPLETED
1483
1496
  */
1484
1497
  declare function batchTransform<TInput, TOutput>(payments: TInput[], transformer: (payment: TInput) => TOutput): TOutput[];
1485
1498
 
1486
- 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, PaymentType, PreparedPayment, SendPaymentInput, assignAccount, batchTransform, ottInsertSchema, ottSelectSchema, ottUpdateSchema, signFinbricksJws, toBatchedPayment, toCompletedPayment, toIncomingPayment, toPreparedPayment, useFinbricksFetch };
1499
+ export { AccountAssignedPayment, AccountCredentialsInsertType, AccountInsertType, AccountSelectType, BankCode, BatchMetadata, BatchStatus, BatchedPayment, CompletedPayment, ConnectedAccount, ConnectorKey, CountryCode, CredentialsResolver, CsobConnector, Currency, CurrencyCode, DbuConnector, ErsteConnector, FINBRICKS_ENDPOINTS, FinbricksClient, FinbricksConnector, IBankConnector, IncomingPayment, IncomingPayment as IncomingPaymentMessage, InitiatedBatch, InitiatedPayment, KBConnector, MockCobsConnector, MockConnector, ParsedBankPayment, PaymentSelectType, PaymentStatus, PaymentType, PreparedPayment, SendPaymentInput, assignAccount, batchTransform, ottInsertSchema, ottSelectSchema, ottUpdateSchema, signFinbricksJws, toBatchedPayment, toCompletedPayment, toIncomingPayment, toPreparedPayment, useFinbricksFetch };
1487
1500
  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 };