@develit-services/bank 0.1.6 → 0.1.8

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.
@@ -0,0 +1,113 @@
1
+ import { t as tables, F as FinbricksConnector, M as MockConnector, E as ErsteConnector } from './bank.DHj3MnQJ.mjs';
2
+ import { eq, inArray } from 'drizzle-orm';
3
+ import { M as MockCobsConnector } from './bank.DulU-rr_.mjs';
4
+ import 'jose';
5
+ import '@develit-io/general-codes';
6
+
7
+ const createPaymentCommand = (db, { payment }) => {
8
+ return {
9
+ command: db.insert(tables.payment).values({
10
+ ...payment,
11
+ creditorIban: payment.creditor.iban,
12
+ debtorIban: payment.debtor.iban
13
+ }).returning()
14
+ };
15
+ };
16
+
17
+ const updatePaymentCommand = (db, { payment }) => {
18
+ return {
19
+ command: db.update(tables.payment).set(payment).where(eq(tables.payment.id, payment.id)).returning()
20
+ };
21
+ };
22
+
23
+ const updateAccountLastSyncCommand = (db, { lastSyncedAt, accountId }) => {
24
+ const command = db.update(tables.account).set({
25
+ lastSyncedAt
26
+ }).where(eq(tables.account.id, accountId)).returning();
27
+ return {
28
+ command
29
+ };
30
+ };
31
+
32
+ const getCredentialsByAccountId = async (db, { accountId }) => {
33
+ const cred = await db.select().from(tables.accountCredentials).where(eq(tables.accountCredentials.accountId, accountId)).get();
34
+ return cred;
35
+ };
36
+
37
+ const getPaymentsByBankRefIdsQuery = async (db, { ids }) => {
38
+ return await db.select().from(tables.payment).where(inArray(tables.payment.bankRefId, ids));
39
+ };
40
+
41
+ class CreditasConnector extends FinbricksConnector {
42
+ constructor(config) {
43
+ super("CREDITAS", config);
44
+ }
45
+ }
46
+
47
+ class FioConnector extends FinbricksConnector {
48
+ constructor(config) {
49
+ super("FIO", config);
50
+ }
51
+ }
52
+
53
+ class MonetaConnector extends FinbricksConnector {
54
+ constructor(config) {
55
+ super("MONETA", config);
56
+ }
57
+ }
58
+
59
+ const initiateConnector = ({
60
+ bank,
61
+ env,
62
+ connectedAccounts
63
+ }) => {
64
+ switch (bank) {
65
+ case "ERSTE":
66
+ return new ErsteConnector({
67
+ API_KEY: env.ERSTE_API_KEY,
68
+ CLIENT_ID: env.ERSTE_CLIENT_ID,
69
+ CLIENT_SECRET: env.ERSTE_CLIENT_SECRET,
70
+ REDIRECT_URI: env.REDIRECT_URI,
71
+ AUTH_URI: env.ERSTE_AUTH_URI,
72
+ PAYMENTS_URI: env.ERSTE_PAYMENTS_URI,
73
+ ACCOUNTS_URI: env.ERSTE_ACCOUNTS_URI,
74
+ connectedAccounts
75
+ });
76
+ case "CREDITAS":
77
+ return new CreditasConnector({
78
+ BASE_URI: env.FINBRICKS_BASE_URI,
79
+ MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
80
+ PRIVATE_KEY_PEM: env.FINBRICKS_PRIVATE_KEY_PEM,
81
+ REDIRECT_URI: env.REDIRECT_URI,
82
+ connectedAccounts
83
+ });
84
+ case "MOCK_COBS":
85
+ return new MockCobsConnector({
86
+ BASE_URI: env.FINBRICKS_BASE_URI,
87
+ MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
88
+ PRIVATE_KEY_PEM: env.FINBRICKS_PRIVATE_KEY_PEM,
89
+ REDIRECT_URI: env.REDIRECT_URI,
90
+ connectedAccounts
91
+ });
92
+ case "FIO":
93
+ return new FioConnector({
94
+ BASE_URI: env.FINBRICKS_BASE_URI,
95
+ MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
96
+ PRIVATE_KEY_PEM: env.FINBRICKS_PRIVATE_KEY_PEM,
97
+ REDIRECT_URI: env.REDIRECT_URI,
98
+ connectedAccounts
99
+ });
100
+ case "MONETA":
101
+ return new MonetaConnector({
102
+ BASE_URI: env.FINBRICKS_BASE_URI,
103
+ MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
104
+ PRIVATE_KEY_PEM: env.FINBRICKS_PRIVATE_KEY_PEM,
105
+ REDIRECT_URI: env.REDIRECT_URI,
106
+ connectedAccounts
107
+ });
108
+ default:
109
+ return new MockConnector();
110
+ }
111
+ };
112
+
113
+ export { getPaymentsByBankRefIdsQuery as a, updateAccountLastSyncCommand as b, createPaymentCommand as c, getCredentialsByAccountId as g, initiateConnector as i, updatePaymentCommand as u };
@@ -130,6 +130,7 @@ const FINBRICKS_ENDPOINTS = {
130
130
  TRANSACTION_INIT: "/transaction/platform/init",
131
131
  TRANSACTION_STATUS: "/transaction/platform/status",
132
132
  TRANSACTION_SEPA_INIT: "/transaction/platform/sepa/init",
133
+ TRANSACTION_FOREIGN_INIT: "/transaction/platform/foreign/init",
133
134
  TRANSACTION_BATCH_INIT: "/transaction/platform/batchPayment/init",
134
135
  BATCH_STATUS: "/transaction/platform/batchPayment/status"
135
136
  };
@@ -483,6 +484,65 @@ class FinbricksConnector extends IBankConnector {
483
484
  payments: payments.map((p) => ({ ...p, status: "INITIALIZED" }))
484
485
  };
485
486
  }
487
+ async initiateForeignPayment(payment) {
488
+ const [response, error] = await useResult(
489
+ this.finbricks.request({
490
+ endpoint: FINBRICKS_ENDPOINTS.TRANSACTION_FOREIGN_INIT,
491
+ method: "POST",
492
+ body: {
493
+ merchantIdentification: {
494
+ merchantId: this.finbricks.MERCHANT_ID,
495
+ clientId: this.connectedAccounts.find(
496
+ (acc) => acc.iban === payment.debtorIban
497
+ ).token
498
+ },
499
+ paymentIdentification: {
500
+ merchantTransactionId: payment.bankRefId
501
+ },
502
+ amount: {
503
+ value: payment.amount,
504
+ currency: payment.currency
505
+ },
506
+ //TODO(danielklein-arch): add bearer to payment from payouts and replace static value here
507
+ chargeBearer: "SHA",
508
+ debtor: {
509
+ accountIdentification: {
510
+ type: "IBAN",
511
+ value: payment.debtor.iban
512
+ },
513
+ debtorName: payment.debtor.holderName,
514
+ paymentProvider: this.PROVIDER
515
+ },
516
+ creditor: {
517
+ accountIdentification: {
518
+ type: "IBAN",
519
+ value: payment.creditor.iban
520
+ },
521
+ creditorName: payment.creditor.holderName || ""
522
+ },
523
+ callbackUrl: "https://www.example.com"
524
+ }
525
+ })
526
+ );
527
+ if (error || !response) {
528
+ console.log(error, "err");
529
+ console.log(response, "res");
530
+ throw createInternalError(error, {
531
+ message: "Finbricks: failed to initiate FOREIGN payment"
532
+ });
533
+ }
534
+ return {
535
+ authorizationUrl: response.redirectUrl,
536
+ payment: {
537
+ ...payment,
538
+ status: "INITIALIZED",
539
+ accountId: this.connectedAccounts.find(
540
+ (acc) => acc.iban === payment.debtorIban
541
+ ).id,
542
+ connectorKey: this.PROVIDER
543
+ }
544
+ };
545
+ }
486
546
  async initiateSEPAPayment(payment) {
487
547
  const [response, error] = await useResult(
488
548
  this.finbricks.request({
@@ -132,6 +132,7 @@ const FINBRICKS_ENDPOINTS = {
132
132
  TRANSACTION_INIT: "/transaction/platform/init",
133
133
  TRANSACTION_STATUS: "/transaction/platform/status",
134
134
  TRANSACTION_SEPA_INIT: "/transaction/platform/sepa/init",
135
+ TRANSACTION_FOREIGN_INIT: "/transaction/platform/foreign/init",
135
136
  TRANSACTION_BATCH_INIT: "/transaction/platform/batchPayment/init",
136
137
  BATCH_STATUS: "/transaction/platform/batchPayment/status"
137
138
  };
@@ -485,6 +486,65 @@ class FinbricksConnector extends IBankConnector {
485
486
  payments: payments.map((p) => ({ ...p, status: "INITIALIZED" }))
486
487
  };
487
488
  }
489
+ async initiateForeignPayment(payment) {
490
+ const [response, error] = await backendSdk.useResult(
491
+ this.finbricks.request({
492
+ endpoint: FINBRICKS_ENDPOINTS.TRANSACTION_FOREIGN_INIT,
493
+ method: "POST",
494
+ body: {
495
+ merchantIdentification: {
496
+ merchantId: this.finbricks.MERCHANT_ID,
497
+ clientId: this.connectedAccounts.find(
498
+ (acc) => acc.iban === payment.debtorIban
499
+ ).token
500
+ },
501
+ paymentIdentification: {
502
+ merchantTransactionId: payment.bankRefId
503
+ },
504
+ amount: {
505
+ value: payment.amount,
506
+ currency: payment.currency
507
+ },
508
+ //TODO(danielklein-arch): add bearer to payment from payouts and replace static value here
509
+ chargeBearer: "SHA",
510
+ debtor: {
511
+ accountIdentification: {
512
+ type: "IBAN",
513
+ value: payment.debtor.iban
514
+ },
515
+ debtorName: payment.debtor.holderName,
516
+ paymentProvider: this.PROVIDER
517
+ },
518
+ creditor: {
519
+ accountIdentification: {
520
+ type: "IBAN",
521
+ value: payment.creditor.iban
522
+ },
523
+ creditorName: payment.creditor.holderName || ""
524
+ },
525
+ callbackUrl: "https://www.example.com"
526
+ }
527
+ })
528
+ );
529
+ if (error || !response) {
530
+ console.log(error, "err");
531
+ console.log(response, "res");
532
+ throw backendSdk.createInternalError(error, {
533
+ message: "Finbricks: failed to initiate FOREIGN payment"
534
+ });
535
+ }
536
+ return {
537
+ authorizationUrl: response.redirectUrl,
538
+ payment: {
539
+ ...payment,
540
+ status: "INITIALIZED",
541
+ accountId: this.connectedAccounts.find(
542
+ (acc) => acc.iban === payment.debtorIban
543
+ ).id,
544
+ connectorKey: this.PROVIDER
545
+ }
546
+ };
547
+ }
488
548
  async initiateSEPAPayment(payment) {
489
549
  const [response, error] = await backendSdk.useResult(
490
550
  this.finbricks.request({
@@ -1,4 +1,4 @@
1
- import { F as FinbricksConnector } from './bank.xIMAnZ4v.mjs';
1
+ import { F as FinbricksConnector } from './bank.DHj3MnQJ.mjs';
2
2
 
3
3
  class MockCobsConnector extends FinbricksConnector {
4
4
  constructor(config) {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const database_schema = require('./bank.PDmcU0T-.cjs');
3
+ const database_schema = require('./bank.DrMnskU2.cjs');
4
4
 
5
5
  class MockCobsConnector extends database_schema.FinbricksConnector {
6
6
  constructor(config) {
@@ -0,0 +1,120 @@
1
+ 'use strict';
2
+
3
+ const database_schema = require('./bank.DrMnskU2.cjs');
4
+ const drizzleOrm = require('drizzle-orm');
5
+ const mockCobs_connector = require('./bank.YNS7gdPU.cjs');
6
+ require('jose');
7
+ require('@develit-io/general-codes');
8
+
9
+ const createPaymentCommand = (db, { payment }) => {
10
+ return {
11
+ command: db.insert(database_schema.tables.payment).values({
12
+ ...payment,
13
+ creditorIban: payment.creditor.iban,
14
+ debtorIban: payment.debtor.iban
15
+ }).returning()
16
+ };
17
+ };
18
+
19
+ const updatePaymentCommand = (db, { payment }) => {
20
+ return {
21
+ command: db.update(database_schema.tables.payment).set(payment).where(drizzleOrm.eq(database_schema.tables.payment.id, payment.id)).returning()
22
+ };
23
+ };
24
+
25
+ const updateAccountLastSyncCommand = (db, { lastSyncedAt, accountId }) => {
26
+ const command = db.update(database_schema.tables.account).set({
27
+ lastSyncedAt
28
+ }).where(drizzleOrm.eq(database_schema.tables.account.id, accountId)).returning();
29
+ return {
30
+ command
31
+ };
32
+ };
33
+
34
+ const getCredentialsByAccountId = async (db, { accountId }) => {
35
+ const cred = await db.select().from(database_schema.tables.accountCredentials).where(drizzleOrm.eq(database_schema.tables.accountCredentials.accountId, accountId)).get();
36
+ return cred;
37
+ };
38
+
39
+ const getPaymentsByBankRefIdsQuery = async (db, { ids }) => {
40
+ return await db.select().from(database_schema.tables.payment).where(drizzleOrm.inArray(database_schema.tables.payment.bankRefId, ids));
41
+ };
42
+
43
+ class CreditasConnector extends database_schema.FinbricksConnector {
44
+ constructor(config) {
45
+ super("CREDITAS", config);
46
+ }
47
+ }
48
+
49
+ class FioConnector extends database_schema.FinbricksConnector {
50
+ constructor(config) {
51
+ super("FIO", config);
52
+ }
53
+ }
54
+
55
+ class MonetaConnector extends database_schema.FinbricksConnector {
56
+ constructor(config) {
57
+ super("MONETA", config);
58
+ }
59
+ }
60
+
61
+ const initiateConnector = ({
62
+ bank,
63
+ env,
64
+ connectedAccounts
65
+ }) => {
66
+ switch (bank) {
67
+ case "ERSTE":
68
+ return new database_schema.ErsteConnector({
69
+ API_KEY: env.ERSTE_API_KEY,
70
+ CLIENT_ID: env.ERSTE_CLIENT_ID,
71
+ CLIENT_SECRET: env.ERSTE_CLIENT_SECRET,
72
+ REDIRECT_URI: env.REDIRECT_URI,
73
+ AUTH_URI: env.ERSTE_AUTH_URI,
74
+ PAYMENTS_URI: env.ERSTE_PAYMENTS_URI,
75
+ ACCOUNTS_URI: env.ERSTE_ACCOUNTS_URI,
76
+ connectedAccounts
77
+ });
78
+ case "CREDITAS":
79
+ return new CreditasConnector({
80
+ BASE_URI: env.FINBRICKS_BASE_URI,
81
+ MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
82
+ PRIVATE_KEY_PEM: env.FINBRICKS_PRIVATE_KEY_PEM,
83
+ REDIRECT_URI: env.REDIRECT_URI,
84
+ connectedAccounts
85
+ });
86
+ case "MOCK_COBS":
87
+ return new mockCobs_connector.MockCobsConnector({
88
+ BASE_URI: env.FINBRICKS_BASE_URI,
89
+ MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
90
+ PRIVATE_KEY_PEM: env.FINBRICKS_PRIVATE_KEY_PEM,
91
+ REDIRECT_URI: env.REDIRECT_URI,
92
+ connectedAccounts
93
+ });
94
+ case "FIO":
95
+ return new FioConnector({
96
+ BASE_URI: env.FINBRICKS_BASE_URI,
97
+ MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
98
+ PRIVATE_KEY_PEM: env.FINBRICKS_PRIVATE_KEY_PEM,
99
+ REDIRECT_URI: env.REDIRECT_URI,
100
+ connectedAccounts
101
+ });
102
+ case "MONETA":
103
+ return new MonetaConnector({
104
+ BASE_URI: env.FINBRICKS_BASE_URI,
105
+ MERCHANT_ID: env.FINBRICKS_MERCHANT_ID,
106
+ PRIVATE_KEY_PEM: env.FINBRICKS_PRIVATE_KEY_PEM,
107
+ REDIRECT_URI: env.REDIRECT_URI,
108
+ connectedAccounts
109
+ });
110
+ default:
111
+ return new database_schema.MockConnector();
112
+ }
113
+ };
114
+
115
+ exports.createPaymentCommand = createPaymentCommand;
116
+ exports.getCredentialsByAccountId = getCredentialsByAccountId;
117
+ exports.getPaymentsByBankRefIdsQuery = getPaymentsByBankRefIdsQuery;
118
+ exports.initiateConnector = initiateConnector;
119
+ exports.updateAccountLastSyncCommand = updateAccountLastSyncCommand;
120
+ exports.updatePaymentCommand = updatePaymentCommand;
package/dist/types.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const database_schema = require('./shared/bank.PDmcU0T-.cjs');
4
- const mockCobs_connector = require('./shared/bank.BcCfzRPi.cjs');
3
+ const database_schema = require('./shared/bank.DrMnskU2.cjs');
4
+ const mockCobs_connector = require('./shared/bank.YNS7gdPU.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
@@ -157,6 +157,68 @@ type FinbricksGetBatchStatusBody = {
157
157
  merchantTransactionId?: string;
158
158
  finalBankStatus?: boolean;
159
159
  };
160
+ type FinbricksForeignPaymentBody = {
161
+ merchantIdentification: {
162
+ merchantId: string;
163
+ clientId: string;
164
+ initiatorName?: string;
165
+ };
166
+ paymentIdentification: {
167
+ merchantTransactionId: string;
168
+ };
169
+ amount: {
170
+ value: number;
171
+ currency: string;
172
+ };
173
+ chargeBearer: 'SHA' | 'OUR' | 'BEN';
174
+ debtor: {
175
+ accountIdentification: {
176
+ value: string;
177
+ type: 'BBAN' | 'IBAN' | 'PHONE' | 'EMAIL' | 'TAXID';
178
+ currency?: string;
179
+ };
180
+ debtorName?: string;
181
+ psuId?: string;
182
+ segmentContextType?: 'RETAIL' | 'CORPORATE';
183
+ paymentProvider: string;
184
+ };
185
+ creditor: {
186
+ accountIdentification: {
187
+ value: string;
188
+ type: 'BBAN' | 'IBAN' | 'PHONE' | 'EMAIL' | 'TAXID';
189
+ currency?: string;
190
+ };
191
+ creditorName: string;
192
+ postalAddress?: {
193
+ addressLine?: string;
194
+ town?: string;
195
+ country?: string;
196
+ };
197
+ };
198
+ creditorAgent?: {
199
+ financialInstitutionIdentification: {
200
+ bic?: string;
201
+ name?: string;
202
+ postalAddress?: {
203
+ addressLine?: string;
204
+ town?: string;
205
+ country?: string;
206
+ };
207
+ };
208
+ };
209
+ remittanceInformation?: {
210
+ unstructured?: string;
211
+ structured?: {
212
+ reference?: string;
213
+ };
214
+ };
215
+ instructionPriority?: 'NORM';
216
+ callbackUrl?: string;
217
+ confirmationPageUrl?: string;
218
+ transactionConfirmation?: {
219
+ email: string;
220
+ };
221
+ };
160
222
 
161
223
  type ReferenceType = `${'VS' | 'SS' | 'KS'}:${number}`;
162
224
 
@@ -365,6 +427,7 @@ declare const FINBRICKS_ENDPOINTS: {
365
427
  readonly TRANSACTION_INIT: "/transaction/platform/init";
366
428
  readonly TRANSACTION_STATUS: "/transaction/platform/status";
367
429
  readonly TRANSACTION_SEPA_INIT: "/transaction/platform/sepa/init";
430
+ readonly TRANSACTION_FOREIGN_INIT: "/transaction/platform/foreign/init";
368
431
  readonly TRANSACTION_BATCH_INIT: "/transaction/platform/batchPayment/init";
369
432
  readonly BATCH_STATUS: "/transaction/platform/batchPayment/status";
370
433
  };
@@ -417,6 +480,7 @@ declare abstract class FinbricksConnector extends IBankConnector {
417
480
  initiateBatchFromPayments({ payments, }: {
418
481
  payments: PaymentPreparedInsertType[];
419
482
  }): Promise<InitiatedBatch>;
483
+ initiateForeignPayment(payment: IncomingPaymentMessage): Promise<InitiatedPayment>;
420
484
  initiateSEPAPayment(payment: IncomingPaymentMessage): Promise<InitiatedPayment>;
421
485
  initiateSinglePayment(payment: PaymentPreparedInsertType): Promise<InitiatedPayment>;
422
486
  getAllAccountPayments({ account, filter, }: {
@@ -1062,4 +1126,4 @@ type OneTimeTokenPatchType = z.infer<typeof ottUpdateSchema>;
1062
1126
  type OneTimeTokenSelectType = z.infer<typeof ottSelectSchema>;
1063
1127
 
1064
1128
  export { AccountCredentialsInsertType, AccountInsertType, AccountSelectType, AuthInput, BankCode, BatchMetadata, BatchStatus, ConnectedAccount, ConnectorKey, CountryCode, Currency, CurrencyCode, ErsteConnector, FINBRICKS_ENDPOINTS, FinbricksClient, FinbricksConnector, IBankConnector, IncomingPaymentMessage, InitiatedBatch, InitiatedPayment, MockCobsConnector, MockConnector, PaymentInsertType, PaymentPreparedInsertType, PaymentSelectType, PaymentStatus, ottInsertSchema, ottSelectSchema, ottUpdateSchema, signFinbricksJws, useFinbricksFetch };
1065
- export type { BankPaymentEvent, ErsteAuthenticationResponse, ErsteBatchPaymentInitiationResponse, ErsteIncomingPaymentResponse, ErsteObtainAuthorizationURLResponse, ErstePaymentInitiationResponse, FinbricksAccount, FinbricksAccountTransactionsResponse, FinbricksAccountsListResponse, FinbricksAuthTokenResponse, FinbricksBatchBody, FinbricksBatchResponse, FinbricksBatchStatus, FinbricksConnectAccountBody, FinbricksConnectAccountResponse, FinbricksConnectorConfig, FinbricksEndpoint, FinbricksEndpointPath, FinbricksFetchConfig, FinbricksGetBatchStatusBody, FinbricksGetBatchStatusResponse, FinbricksGetTransactionStatusResponse, FinbricksJWSData, FinbricksPaymentBody, FinbricksPaymentResponse, FinbricksProvider, FinbricksRequestInit, FinbricksTransactionStatus, OneTimeTokenInsertType, OneTimeTokenPatchType, OneTimeTokenSelectType, OneTimeTokenUpdateType };
1129
+ export type { BankPaymentEvent, 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 };
package/dist/types.d.mts CHANGED
@@ -157,6 +157,68 @@ type FinbricksGetBatchStatusBody = {
157
157
  merchantTransactionId?: string;
158
158
  finalBankStatus?: boolean;
159
159
  };
160
+ type FinbricksForeignPaymentBody = {
161
+ merchantIdentification: {
162
+ merchantId: string;
163
+ clientId: string;
164
+ initiatorName?: string;
165
+ };
166
+ paymentIdentification: {
167
+ merchantTransactionId: string;
168
+ };
169
+ amount: {
170
+ value: number;
171
+ currency: string;
172
+ };
173
+ chargeBearer: 'SHA' | 'OUR' | 'BEN';
174
+ debtor: {
175
+ accountIdentification: {
176
+ value: string;
177
+ type: 'BBAN' | 'IBAN' | 'PHONE' | 'EMAIL' | 'TAXID';
178
+ currency?: string;
179
+ };
180
+ debtorName?: string;
181
+ psuId?: string;
182
+ segmentContextType?: 'RETAIL' | 'CORPORATE';
183
+ paymentProvider: string;
184
+ };
185
+ creditor: {
186
+ accountIdentification: {
187
+ value: string;
188
+ type: 'BBAN' | 'IBAN' | 'PHONE' | 'EMAIL' | 'TAXID';
189
+ currency?: string;
190
+ };
191
+ creditorName: string;
192
+ postalAddress?: {
193
+ addressLine?: string;
194
+ town?: string;
195
+ country?: string;
196
+ };
197
+ };
198
+ creditorAgent?: {
199
+ financialInstitutionIdentification: {
200
+ bic?: string;
201
+ name?: string;
202
+ postalAddress?: {
203
+ addressLine?: string;
204
+ town?: string;
205
+ country?: string;
206
+ };
207
+ };
208
+ };
209
+ remittanceInformation?: {
210
+ unstructured?: string;
211
+ structured?: {
212
+ reference?: string;
213
+ };
214
+ };
215
+ instructionPriority?: 'NORM';
216
+ callbackUrl?: string;
217
+ confirmationPageUrl?: string;
218
+ transactionConfirmation?: {
219
+ email: string;
220
+ };
221
+ };
160
222
 
161
223
  type ReferenceType = `${'VS' | 'SS' | 'KS'}:${number}`;
162
224
 
@@ -365,6 +427,7 @@ declare const FINBRICKS_ENDPOINTS: {
365
427
  readonly TRANSACTION_INIT: "/transaction/platform/init";
366
428
  readonly TRANSACTION_STATUS: "/transaction/platform/status";
367
429
  readonly TRANSACTION_SEPA_INIT: "/transaction/platform/sepa/init";
430
+ readonly TRANSACTION_FOREIGN_INIT: "/transaction/platform/foreign/init";
368
431
  readonly TRANSACTION_BATCH_INIT: "/transaction/platform/batchPayment/init";
369
432
  readonly BATCH_STATUS: "/transaction/platform/batchPayment/status";
370
433
  };
@@ -417,6 +480,7 @@ declare abstract class FinbricksConnector extends IBankConnector {
417
480
  initiateBatchFromPayments({ payments, }: {
418
481
  payments: PaymentPreparedInsertType[];
419
482
  }): Promise<InitiatedBatch>;
483
+ initiateForeignPayment(payment: IncomingPaymentMessage): Promise<InitiatedPayment>;
420
484
  initiateSEPAPayment(payment: IncomingPaymentMessage): Promise<InitiatedPayment>;
421
485
  initiateSinglePayment(payment: PaymentPreparedInsertType): Promise<InitiatedPayment>;
422
486
  getAllAccountPayments({ account, filter, }: {
@@ -1062,4 +1126,4 @@ type OneTimeTokenPatchType = z.infer<typeof ottUpdateSchema>;
1062
1126
  type OneTimeTokenSelectType = z.infer<typeof ottSelectSchema>;
1063
1127
 
1064
1128
  export { AccountCredentialsInsertType, AccountInsertType, AccountSelectType, AuthInput, BankCode, BatchMetadata, BatchStatus, ConnectedAccount, ConnectorKey, CountryCode, Currency, CurrencyCode, ErsteConnector, FINBRICKS_ENDPOINTS, FinbricksClient, FinbricksConnector, IBankConnector, IncomingPaymentMessage, InitiatedBatch, InitiatedPayment, MockCobsConnector, MockConnector, PaymentInsertType, PaymentPreparedInsertType, PaymentSelectType, PaymentStatus, ottInsertSchema, ottSelectSchema, ottUpdateSchema, signFinbricksJws, useFinbricksFetch };
1065
- export type { BankPaymentEvent, ErsteAuthenticationResponse, ErsteBatchPaymentInitiationResponse, ErsteIncomingPaymentResponse, ErsteObtainAuthorizationURLResponse, ErstePaymentInitiationResponse, FinbricksAccount, FinbricksAccountTransactionsResponse, FinbricksAccountsListResponse, FinbricksAuthTokenResponse, FinbricksBatchBody, FinbricksBatchResponse, FinbricksBatchStatus, FinbricksConnectAccountBody, FinbricksConnectAccountResponse, FinbricksConnectorConfig, FinbricksEndpoint, FinbricksEndpointPath, FinbricksFetchConfig, FinbricksGetBatchStatusBody, FinbricksGetBatchStatusResponse, FinbricksGetTransactionStatusResponse, FinbricksJWSData, FinbricksPaymentBody, FinbricksPaymentResponse, FinbricksProvider, FinbricksRequestInit, FinbricksTransactionStatus, OneTimeTokenInsertType, OneTimeTokenPatchType, OneTimeTokenSelectType, OneTimeTokenUpdateType };
1129
+ export type { BankPaymentEvent, 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 };
package/dist/types.d.ts CHANGED
@@ -157,6 +157,68 @@ type FinbricksGetBatchStatusBody = {
157
157
  merchantTransactionId?: string;
158
158
  finalBankStatus?: boolean;
159
159
  };
160
+ type FinbricksForeignPaymentBody = {
161
+ merchantIdentification: {
162
+ merchantId: string;
163
+ clientId: string;
164
+ initiatorName?: string;
165
+ };
166
+ paymentIdentification: {
167
+ merchantTransactionId: string;
168
+ };
169
+ amount: {
170
+ value: number;
171
+ currency: string;
172
+ };
173
+ chargeBearer: 'SHA' | 'OUR' | 'BEN';
174
+ debtor: {
175
+ accountIdentification: {
176
+ value: string;
177
+ type: 'BBAN' | 'IBAN' | 'PHONE' | 'EMAIL' | 'TAXID';
178
+ currency?: string;
179
+ };
180
+ debtorName?: string;
181
+ psuId?: string;
182
+ segmentContextType?: 'RETAIL' | 'CORPORATE';
183
+ paymentProvider: string;
184
+ };
185
+ creditor: {
186
+ accountIdentification: {
187
+ value: string;
188
+ type: 'BBAN' | 'IBAN' | 'PHONE' | 'EMAIL' | 'TAXID';
189
+ currency?: string;
190
+ };
191
+ creditorName: string;
192
+ postalAddress?: {
193
+ addressLine?: string;
194
+ town?: string;
195
+ country?: string;
196
+ };
197
+ };
198
+ creditorAgent?: {
199
+ financialInstitutionIdentification: {
200
+ bic?: string;
201
+ name?: string;
202
+ postalAddress?: {
203
+ addressLine?: string;
204
+ town?: string;
205
+ country?: string;
206
+ };
207
+ };
208
+ };
209
+ remittanceInformation?: {
210
+ unstructured?: string;
211
+ structured?: {
212
+ reference?: string;
213
+ };
214
+ };
215
+ instructionPriority?: 'NORM';
216
+ callbackUrl?: string;
217
+ confirmationPageUrl?: string;
218
+ transactionConfirmation?: {
219
+ email: string;
220
+ };
221
+ };
160
222
 
161
223
  type ReferenceType = `${'VS' | 'SS' | 'KS'}:${number}`;
162
224
 
@@ -365,6 +427,7 @@ declare const FINBRICKS_ENDPOINTS: {
365
427
  readonly TRANSACTION_INIT: "/transaction/platform/init";
366
428
  readonly TRANSACTION_STATUS: "/transaction/platform/status";
367
429
  readonly TRANSACTION_SEPA_INIT: "/transaction/platform/sepa/init";
430
+ readonly TRANSACTION_FOREIGN_INIT: "/transaction/platform/foreign/init";
368
431
  readonly TRANSACTION_BATCH_INIT: "/transaction/platform/batchPayment/init";
369
432
  readonly BATCH_STATUS: "/transaction/platform/batchPayment/status";
370
433
  };
@@ -417,6 +480,7 @@ declare abstract class FinbricksConnector extends IBankConnector {
417
480
  initiateBatchFromPayments({ payments, }: {
418
481
  payments: PaymentPreparedInsertType[];
419
482
  }): Promise<InitiatedBatch>;
483
+ initiateForeignPayment(payment: IncomingPaymentMessage): Promise<InitiatedPayment>;
420
484
  initiateSEPAPayment(payment: IncomingPaymentMessage): Promise<InitiatedPayment>;
421
485
  initiateSinglePayment(payment: PaymentPreparedInsertType): Promise<InitiatedPayment>;
422
486
  getAllAccountPayments({ account, filter, }: {
@@ -1062,4 +1126,4 @@ type OneTimeTokenPatchType = z.infer<typeof ottUpdateSchema>;
1062
1126
  type OneTimeTokenSelectType = z.infer<typeof ottSelectSchema>;
1063
1127
 
1064
1128
  export { AccountCredentialsInsertType, AccountInsertType, AccountSelectType, AuthInput, BankCode, BatchMetadata, BatchStatus, ConnectedAccount, ConnectorKey, CountryCode, Currency, CurrencyCode, ErsteConnector, FINBRICKS_ENDPOINTS, FinbricksClient, FinbricksConnector, IBankConnector, IncomingPaymentMessage, InitiatedBatch, InitiatedPayment, MockCobsConnector, MockConnector, PaymentInsertType, PaymentPreparedInsertType, PaymentSelectType, PaymentStatus, ottInsertSchema, ottSelectSchema, ottUpdateSchema, signFinbricksJws, useFinbricksFetch };
1065
- export type { BankPaymentEvent, ErsteAuthenticationResponse, ErsteBatchPaymentInitiationResponse, ErsteIncomingPaymentResponse, ErsteObtainAuthorizationURLResponse, ErstePaymentInitiationResponse, FinbricksAccount, FinbricksAccountTransactionsResponse, FinbricksAccountsListResponse, FinbricksAuthTokenResponse, FinbricksBatchBody, FinbricksBatchResponse, FinbricksBatchStatus, FinbricksConnectAccountBody, FinbricksConnectAccountResponse, FinbricksConnectorConfig, FinbricksEndpoint, FinbricksEndpointPath, FinbricksFetchConfig, FinbricksGetBatchStatusBody, FinbricksGetBatchStatusResponse, FinbricksGetTransactionStatusResponse, FinbricksJWSData, FinbricksPaymentBody, FinbricksPaymentResponse, FinbricksProvider, FinbricksRequestInit, FinbricksTransactionStatus, OneTimeTokenInsertType, OneTimeTokenPatchType, OneTimeTokenSelectType, OneTimeTokenUpdateType };
1129
+ export type { BankPaymentEvent, 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 };