@develit-services/bank 0.0.2 → 0.0.4
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.cjs +29 -0
- package/dist/{@types/index.d.ts → @types.d.cts} +6 -5
- package/dist/@types.d.mts +445 -0
- package/dist/{@types/index.d.mts → @types.d.ts} +6 -5
- package/dist/@types.mjs +10 -0
- package/dist/database/schema.cjs +12 -0
- package/dist/database/{schema/index.d.ts → schema.d.cts} +1 -1
- package/dist/database/{schema/index.d.mts → schema.d.mts} +1 -1
- package/dist/database/schema.d.ts +4 -0
- package/dist/database/{schema/index.mjs → schema.mjs} +1 -1
- package/dist/export/worker.cjs +1224 -0
- package/dist/export/worker.d.cts +243 -0
- package/dist/export/worker.d.mts +2 -1
- package/dist/export/worker.d.ts +5 -2
- package/dist/export/worker.mjs +2 -1
- package/dist/export/wrangler.cjs +131 -0
- package/dist/export/wrangler.d.cts +59 -0
- package/dist/shared/bank.BU2_AKRG.cjs +724 -0
- package/dist/shared/bank.C28GtA5s.d.cts +98 -0
- package/dist/shared/bank.CBNQZ5Pd.d.cts +785 -0
- package/dist/shared/bank.CrAQe4PH.cjs +72 -0
- package/dist/shared/bank.DxGqqFhD.d.cts +36 -0
- package/dist/shared/bank.LCrZu9Ic.d.mts +98 -0
- package/dist/shared/bank.TOYdvcg7.mjs +710 -0
- package/dist/shared/bank.atHmEWmc.d.ts +98 -0
- package/package.json +12 -7
- package/dist/@types/index.mjs +0 -9
- package/dist/shared/bank.D-DeJSGN.d.ts +0 -3127
- package/dist/shared/bank.DdbWdNgy.d.mts +0 -3127
- package/dist/shared/bank._EHVypLw.mjs +0 -3751
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Environment } from '@develit-io/backend-sdk';
|
|
2
|
+
import { BANK_CODES, CURRENCY_CODES, CODES } from '@develit-io/general-codes';
|
|
3
|
+
import { a as PaymentInsertType, t as tables } from './bank.CBNQZ5Pd.cjs';
|
|
4
|
+
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
5
|
+
|
|
6
|
+
declare const PAYMENT_TYPES: readonly ["SEPA", "SWIFT", "IFSC", "DOMESTIC"];
|
|
7
|
+
type PaymentType = (typeof PAYMENT_TYPES)[number];
|
|
8
|
+
declare const PAYMENT_STATUSES: readonly ["PREPARED", "INITIALIZED", "FAILED", "PENDING", "COMPLETED", "CREATED"];
|
|
9
|
+
type PaymentStatus = (typeof PAYMENT_STATUSES)[number];
|
|
10
|
+
declare const PAYMENT_DIRECTIONS: readonly ["INCOMING", "OUTGOING"];
|
|
11
|
+
type PaymentDirection = (typeof PAYMENT_DIRECTIONS)[number];
|
|
12
|
+
|
|
13
|
+
type CurrencyCode = (typeof CURRENCY_CODES)[number];
|
|
14
|
+
/**
|
|
15
|
+
* Batch status constants
|
|
16
|
+
*/
|
|
17
|
+
declare const BATCH_STATUSES: readonly ["OPEN", "WAITING_FOR_PROCESSING", "PROCESSING", "READY_TO_SIGN", "PREPARED", "COMPLETED", "FAILED"];
|
|
18
|
+
/**
|
|
19
|
+
* Type definition for batch status
|
|
20
|
+
*/
|
|
21
|
+
type BatchStatus = (typeof BATCH_STATUSES)[number];
|
|
22
|
+
type Currency = CODES.Currency;
|
|
23
|
+
|
|
24
|
+
type BankCode = (typeof BANK_CODES)[number];
|
|
25
|
+
declare const COUNTRY_CODES: ["AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BO" | "BQ" | "BA" | "BW" | "BR" | "IO" | "VG" | "BG" | "BF" | "BI" | "KH" | "CM" | "CA" | "CV" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CK" | "CR" | "HR" | "CW" | "CY" | "CZ" | "CD" | "DK" | "DJ" | "DM" | "DO" | "TL" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GR" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "GY" | "HT" | "HN" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IM" | "IL" | "IT" | "CI" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "XK" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LI" | "LT" | "LU" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MR" | "MU" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "NA" | "NP" | "NL" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "KP" | "NO" | "OM" | "PK" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "CG" | "RE" | "RO" | "RU" | "RW" | "BL" | "KN" | "LC" | "MF" | "VC" | "WS" | "SM" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SX" | "SK" | "SI" | "SO" | "ZA" | "KR" | "SS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SZ" | "SE" | "CH" | "TW" | "TJ" | "TZ" | "TH" | "TG" | "TO" | "TT" | "TN" | "TR" | "TM" | "UM" | "VI" | "UG" | "UA" | "AE" | "GB" | "UZ" | "VU" | "VE" | "VN" | "WF" | "EH" | "YE" | "ZM" | "ZW", ...("AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BO" | "BQ" | "BA" | "BW" | "BR" | "IO" | "VG" | "BG" | "BF" | "BI" | "KH" | "CM" | "CA" | "CV" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CK" | "CR" | "HR" | "CW" | "CY" | "CZ" | "CD" | "DK" | "DJ" | "DM" | "DO" | "TL" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GR" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "GY" | "HT" | "HN" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IM" | "IL" | "IT" | "CI" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "XK" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LI" | "LT" | "LU" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MR" | "MU" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "NA" | "NP" | "NL" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "KP" | "NO" | "OM" | "PK" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "CG" | "RE" | "RO" | "RU" | "RW" | "BL" | "KN" | "LC" | "MF" | "VC" | "WS" | "SM" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SX" | "SK" | "SI" | "SO" | "ZA" | "KR" | "SS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SZ" | "SE" | "CH" | "TW" | "TJ" | "TZ" | "TH" | "TG" | "TO" | "TT" | "TN" | "TR" | "TM" | "UM" | "VI" | "UG" | "UA" | "AE" | "GB" | "UZ" | "VU" | "VE" | "VN" | "WF" | "EH" | "YE" | "ZM" | "ZW")[]];
|
|
26
|
+
type CountryCode = (typeof COUNTRY_CODES)[number];
|
|
27
|
+
|
|
28
|
+
interface SyncLog {
|
|
29
|
+
lastSyncedAt: Date;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
type ConnectorKey = 'ERSTE' | 'FINBRICKS' | 'MOCK' | 'CREDITAS' | 'MOCK_COBS' | 'FIO';
|
|
33
|
+
interface ConfigBankAccount {
|
|
34
|
+
connectorKey: ConnectorKey;
|
|
35
|
+
id: string;
|
|
36
|
+
identification: {
|
|
37
|
+
number: string;
|
|
38
|
+
bankCode: BankCode;
|
|
39
|
+
iban: string;
|
|
40
|
+
holderName: string;
|
|
41
|
+
};
|
|
42
|
+
fallbackLastSync: Date;
|
|
43
|
+
currency: CurrencyCode;
|
|
44
|
+
production: boolean;
|
|
45
|
+
}
|
|
46
|
+
interface BankAccountWithLastSync extends ConfigBankAccount {
|
|
47
|
+
lastSyncAt: SyncLog;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
type WithStatus<T extends {
|
|
51
|
+
status: PaymentStatus;
|
|
52
|
+
}, S extends PaymentStatus> = Omit<T, 'status'> & {
|
|
53
|
+
status: S;
|
|
54
|
+
};
|
|
55
|
+
type PaymentFailedInsertType = WithStatus<PaymentInsertType, 'FAILED'>;
|
|
56
|
+
type PaymentPreparedInsertType = WithStatus<PaymentInsertType, 'PREPARED'>;
|
|
57
|
+
type paymentInitializedInsertType = WithStatus<PaymentInsertType, 'INITIALIZED'>;
|
|
58
|
+
type BatchMetadata = {
|
|
59
|
+
signHash: string;
|
|
60
|
+
signId: string;
|
|
61
|
+
};
|
|
62
|
+
type InitiatedPayment = {
|
|
63
|
+
authorizationUrl: string;
|
|
64
|
+
payment: paymentInitializedInsertType;
|
|
65
|
+
};
|
|
66
|
+
type InitiatedBatch = {
|
|
67
|
+
id: string;
|
|
68
|
+
authorizationUrls: string[];
|
|
69
|
+
payments: paymentInitializedInsertType[];
|
|
70
|
+
metadata?: BatchMetadata | null;
|
|
71
|
+
};
|
|
72
|
+
type AuthInput = {
|
|
73
|
+
token: string;
|
|
74
|
+
refreshToken?: string;
|
|
75
|
+
};
|
|
76
|
+
declare abstract class IBankConnector {
|
|
77
|
+
abstract connectorKey: ConnectorKey;
|
|
78
|
+
abstract authenticate(code: AuthInput): Promise<string>;
|
|
79
|
+
abstract preparePayment(payment: IncomingPaymentMessage): Promise<PaymentPreparedInsertType>;
|
|
80
|
+
abstract initiateBatchFromPayments({ payments, }: {
|
|
81
|
+
payments: PaymentPreparedInsertType[];
|
|
82
|
+
}): Promise<InitiatedBatch>;
|
|
83
|
+
abstract initiateSinglePayment(payment: PaymentPreparedInsertType): Promise<InitiatedPayment>;
|
|
84
|
+
abstract getAllAccountPayments({ account, lastSync, db, env, }: {
|
|
85
|
+
account: ConfigBankAccount;
|
|
86
|
+
lastSync: SyncLog;
|
|
87
|
+
db: DrizzleD1Database<typeof tables>;
|
|
88
|
+
env: Environment;
|
|
89
|
+
}): Promise<PaymentInsertType[]>;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
interface IncomingPaymentMessage extends PaymentInsertType {
|
|
93
|
+
}
|
|
94
|
+
interface OutgoingPaymentMessage extends PaymentInsertType {
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export { IBankConnector as I, BATCH_STATUSES as k, PAYMENT_TYPES as m, PAYMENT_STATUSES as o, PAYMENT_DIRECTIONS as r, COUNTRY_CODES as t };
|
|
98
|
+
export type { AuthInput as A, BankAccountWithLastSync as B, ConfigBankAccount as C, OutgoingPaymentMessage as O, PaymentPreparedInsertType as P, SyncLog as S, ConnectorKey as a, CurrencyCode as b, BankCode as c, CountryCode as d, IncomingPaymentMessage as e, InitiatedBatch as f, InitiatedPayment as g, BatchMetadata as h, Currency as i, PaymentFailedInsertType as j, BatchStatus as l, PaymentType as n, paymentInitializedInsertType as p, PaymentStatus as q, PaymentDirection as s };
|