@develit-services/bank 0.8.6 → 0.8.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.
- package/dist/database/schema.cjs +1 -1
- package/dist/database/schema.d.cts +1 -1
- package/dist/database/schema.d.mts +1 -1
- package/dist/database/schema.d.ts +1 -1
- package/dist/database/schema.mjs +1 -1
- package/dist/export/worker.cjs +550 -153
- package/dist/export/worker.d.cts +259 -47
- package/dist/export/worker.d.mts +259 -47
- package/dist/export/worker.d.ts +259 -47
- package/dist/export/worker.mjs +551 -154
- package/dist/export/workflows.cjs +95 -17
- package/dist/export/workflows.mjs +96 -18
- package/dist/export/wrangler.d.cts +2 -1
- package/dist/export/wrangler.d.mts +2 -1
- package/dist/export/wrangler.d.ts +2 -1
- package/dist/shared/{bank.BliD3oCT.d.ts → bank.B-NJB8GB.d.cts} +34 -10
- package/dist/shared/{bank.BliD3oCT.d.cts → bank.B-NJB8GB.d.mts} +34 -10
- package/dist/shared/{bank.BliD3oCT.d.mts → bank.B-NJB8GB.d.ts} +34 -10
- package/dist/shared/{bank.Cpy9PULF.mjs → bank.B5bZRvgq.mjs} +28 -5
- package/dist/shared/{bank.CQBfbG8u.d.cts → bank.BP_3WMIF.d.cts} +1 -0
- package/dist/shared/{bank.CQBfbG8u.d.mts → bank.BP_3WMIF.d.mts} +1 -0
- package/dist/shared/{bank.CQBfbG8u.d.ts → bank.BP_3WMIF.d.ts} +1 -0
- package/dist/shared/{bank.DDHrdFgy.mjs → bank.BoZtXQpG.mjs} +1 -1
- package/dist/shared/{bank.DRrBrAdI.mjs → bank.BtszLapg.mjs} +211 -43
- package/dist/shared/{bank.BoMDujsl.d.ts → bank.BzobShUU.d.cts} +17 -7
- package/dist/shared/{bank.C4VOdIx1.mjs → bank.C6jjS1Pl.mjs} +32 -4
- package/dist/shared/{bank.lbzMqyr3.d.cts → bank.CAVvvZZO.d.mts} +17 -7
- package/dist/shared/{bank.CQURey1E.cjs → bank.CtnsGHM8.cjs} +210 -43
- package/dist/shared/{bank.C-T1FQxg.cjs → bank.DJnDSYqE.cjs} +1 -1
- package/dist/shared/{bank.B6U8sUZn.d.mts → bank.DRTuKO8S.d.ts} +17 -7
- package/dist/shared/{bank.BOnP9p9Y.cjs → bank.DT6bg8k5.cjs} +28 -5
- package/dist/shared/{bank.SQ4Mmr8u.cjs → bank.JVlyPAAb.cjs} +32 -4
- package/dist/types.cjs +2 -3
- package/dist/types.d.cts +14 -18
- package/dist/types.d.mts +14 -18
- package/dist/types.d.ts +14 -18
- package/dist/types.mjs +2 -2
- package/package.json +2 -2
|
@@ -42,7 +42,7 @@ type CurrencyCode = (typeof CURRENCY_CODES)[number];
|
|
|
42
42
|
/**
|
|
43
43
|
* Batch status constants
|
|
44
44
|
*/
|
|
45
|
-
declare const BATCH_STATUSES: readonly ["OPEN", "PROCESSING", "READY_TO_SIGN", "SIGNED", "SIGNATURE_FAILED", "FAILED"];
|
|
45
|
+
declare const BATCH_STATUSES: readonly ["OPEN", "PROCESSING", "READY_TO_SIGN", "SIGNED", "SIGNATURE_FAILED", "FAILED", "COMPLETED"];
|
|
46
46
|
/**
|
|
47
47
|
* Type definition for batch status
|
|
48
48
|
*/
|
|
@@ -90,6 +90,12 @@ type ConnectedAccount = {
|
|
|
90
90
|
declare abstract class IBankConnector {
|
|
91
91
|
/** Unique identifier for this bank connector (e.g., 'ERSTE', 'FINBRICKS', 'MOCK') */
|
|
92
92
|
abstract connectorKey: ConnectorKey;
|
|
93
|
+
/**
|
|
94
|
+
* Lifecycle mode for payment status resolution:
|
|
95
|
+
* - 'batch': statuses are resolved via updateBatchStatuses (getBatchStatus polling)
|
|
96
|
+
* - 'per-payment': statuses are resolved via updatePaymentStatuses (getPaymentStatus polling per payment)
|
|
97
|
+
*/
|
|
98
|
+
abstract readonly lifecycleMode: 'batch' | 'per-payment';
|
|
93
99
|
/** List of bank accounts connected through this connector instance */
|
|
94
100
|
abstract connectedAccounts: ConnectedAccount[];
|
|
95
101
|
/** Optional resolver for loading credentials on demand */
|
|
@@ -102,6 +108,7 @@ declare abstract class IBankConnector {
|
|
|
102
108
|
* @returns true if native batch API is supported, false if fallback to single payments is needed
|
|
103
109
|
*/
|
|
104
110
|
abstract supportsBatch(paymentType: PaymentType): boolean;
|
|
111
|
+
supportsPaymentType(paymentType: PaymentType): boolean;
|
|
105
112
|
/**
|
|
106
113
|
* Generates authorization URI for connecting a new bank account.
|
|
107
114
|
* @param ott - One-time token used to identify the authorization flow
|
|
@@ -2629,20 +2636,20 @@ declare const batch: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
2629
2636
|
tableName: "batch";
|
|
2630
2637
|
dataType: "string";
|
|
2631
2638
|
columnType: "SQLiteText";
|
|
2632
|
-
data: "
|
|
2639
|
+
data: "OPEN" | "PROCESSING" | "READY_TO_SIGN" | "SIGNED" | "SIGNATURE_FAILED" | "FAILED" | "COMPLETED";
|
|
2633
2640
|
driverParam: string;
|
|
2634
2641
|
notNull: false;
|
|
2635
2642
|
hasDefault: false;
|
|
2636
2643
|
isPrimaryKey: false;
|
|
2637
2644
|
isAutoincrement: false;
|
|
2638
2645
|
hasRuntimeDefault: false;
|
|
2639
|
-
enumValues: ["OPEN", "PROCESSING", "READY_TO_SIGN", "SIGNED", "SIGNATURE_FAILED", "FAILED"];
|
|
2646
|
+
enumValues: ["OPEN", "PROCESSING", "READY_TO_SIGN", "SIGNED", "SIGNATURE_FAILED", "FAILED", "COMPLETED"];
|
|
2640
2647
|
baseColumn: never;
|
|
2641
2648
|
identity: undefined;
|
|
2642
2649
|
generated: undefined;
|
|
2643
2650
|
}, {}, {
|
|
2644
2651
|
length: number | undefined;
|
|
2645
|
-
$type: "
|
|
2652
|
+
$type: "OPEN" | "PROCESSING" | "READY_TO_SIGN" | "SIGNED" | "SIGNATURE_FAILED" | "FAILED" | "COMPLETED";
|
|
2646
2653
|
}>;
|
|
2647
2654
|
statusReason: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
2648
2655
|
name: "status_reason";
|
|
@@ -3053,7 +3060,7 @@ declare const payment: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
3053
3060
|
tableName: "payment";
|
|
3054
3061
|
dataType: "string";
|
|
3055
3062
|
columnType: "SQLiteText";
|
|
3056
|
-
data: "
|
|
3063
|
+
data: "SIGNED" | "FAILED" | "COMPLETED" | "CREATED" | "PREPARED" | "PENDING";
|
|
3057
3064
|
driverParam: string;
|
|
3058
3065
|
notNull: true;
|
|
3059
3066
|
hasDefault: false;
|
|
@@ -3066,7 +3073,7 @@ declare const payment: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
3066
3073
|
generated: undefined;
|
|
3067
3074
|
}, {}, {
|
|
3068
3075
|
length: number | undefined;
|
|
3069
|
-
$type: "
|
|
3076
|
+
$type: "SIGNED" | "FAILED" | "COMPLETED" | "CREATED" | "PREPARED" | "PENDING";
|
|
3070
3077
|
}>;
|
|
3071
3078
|
statusReason: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
3072
3079
|
name: "status_reason";
|
|
@@ -3647,7 +3654,7 @@ declare const paymentRequest: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
3647
3654
|
tableName: "payment_request";
|
|
3648
3655
|
dataType: "string";
|
|
3649
3656
|
columnType: "SQLiteText";
|
|
3650
|
-
data: "
|
|
3657
|
+
data: "SIGNED" | "FAILED" | "COMPLETED" | "CREATED" | "PREPARED" | "PENDING";
|
|
3651
3658
|
driverParam: string;
|
|
3652
3659
|
notNull: true;
|
|
3653
3660
|
hasDefault: false;
|
|
@@ -3660,7 +3667,7 @@ declare const paymentRequest: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
3660
3667
|
generated: undefined;
|
|
3661
3668
|
}, {}, {
|
|
3662
3669
|
length: number | undefined;
|
|
3663
|
-
$type: "
|
|
3670
|
+
$type: "SIGNED" | "FAILED" | "COMPLETED" | "CREATED" | "PREPARED" | "PENDING";
|
|
3664
3671
|
}>;
|
|
3665
3672
|
statusReason: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
3666
3673
|
name: "status_reason";
|
|
@@ -3926,6 +3933,23 @@ declare const paymentRequest: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
3926
3933
|
}, {}, {
|
|
3927
3934
|
length: number | undefined;
|
|
3928
3935
|
}>;
|
|
3936
|
+
sendAsSinglePayment: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
3937
|
+
name: "send_as_single_payment";
|
|
3938
|
+
tableName: "payment_request";
|
|
3939
|
+
dataType: "boolean";
|
|
3940
|
+
columnType: "SQLiteBoolean";
|
|
3941
|
+
data: boolean;
|
|
3942
|
+
driverParam: number;
|
|
3943
|
+
notNull: false;
|
|
3944
|
+
hasDefault: false;
|
|
3945
|
+
isPrimaryKey: false;
|
|
3946
|
+
isAutoincrement: false;
|
|
3947
|
+
hasRuntimeDefault: false;
|
|
3948
|
+
enumValues: undefined;
|
|
3949
|
+
baseColumn: never;
|
|
3950
|
+
identity: undefined;
|
|
3951
|
+
generated: undefined;
|
|
3952
|
+
}, {}, {}>;
|
|
3929
3953
|
id: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
3930
3954
|
name: "id";
|
|
3931
3955
|
tableName: "payment_request";
|
|
@@ -5342,5 +5366,5 @@ declare function isBatchFailed(batch: {
|
|
|
5342
5366
|
status?: string | null;
|
|
5343
5367
|
}): batch is CompletedBatch;
|
|
5344
5368
|
|
|
5345
|
-
export { PAYMENT_STATUSES as $, BATCH_STATUSES as
|
|
5346
|
-
export type { AccountSelectType as A, BatchSelectType as B, ConfigEnvironmentBank as C,
|
|
5369
|
+
export { PAYMENT_STATUSES as $, BATCH_STATUSES as G, IBankConnector as I, CHARGE_BEARERS as O, CONNECTOR_KEYS as Q, COUNTRY_CODES as R, CREDENTIALS_TYPES as S, INSTRUCTION_PRIORITIES as Y, PAYMENT_DIRECTIONS as _, PAYMENT_TYPES as a0, TOKEN_TYPES as aa, accountCredentialsInsertSchema as ac, accountCredentialsSelectSchema as ad, accountCredentialsUpdateSchema as ae, accountInsertSchema as af, accountSelectSchema as ag, accountUpdateSchema as ah, hasPaymentAccountAssigned as ai, isBatchCompleted as aj, isBatchFailed as ak, isBatchInitiated as al, isBatchOpen as am, isBatchProcessing as an, isBatchReadyToSign as ao, isBatchSigned as ap, isPaymentCompleted as aq, isPaymentPrepared as ar, account as as, accountCredentials as at, batch as au, ott as av, payment as aw, paymentRelations as ax, paymentRequest as ay, paymentRequestRelations as az, tables as t, ACCOUNT_STATUSES as w };
|
|
5370
|
+
export type { AccountSelectType as A, BatchSelectType as B, ConfigEnvironmentBank as C, AccountPatchType as D, AccountStatus as E, AccountUpdateType as F, BankAccountWithLastSync as H, BankCode as J, BatchInsertType as K, LastSyncMetadata as L, BatchLifecycle as M, BatchPayment as N, PaymentSelectType as P, ChargeBearer as T, CompletedBatch as U, CountryCode as V, CreatedBatch as W, CredentialsType as X, InstructionPriority as Z, PaymentRequestSelectType as a, PaymentDirection as a1, PaymentFailedInsertType as a2, PaymentInsertType as a3, PaymentLifecycle as a4, PaymentPreparedInsertType as a5, ProcessingBatch as a6, ReadyToSignBatch as a7, ResolvedCredentials as a8, SignedBatch as a9, TokenType as ab, ConnectorKey as b, PaymentType as c, CurrencyCode as d, ConnectedAccount as e, CredentialsResolver as f, AccountCredentialsInsertType as g, AccountInsertType as h, BatchedPayment as i, InitiatedBatch as j, IncomingPayment as k, InitiatedPayment as l, ParsedBankPayment as m, PaymentStatus as n, BatchStatus as o, BatchMetadata as p, Currency as q, AccountAssignedPayment as r, PreparedPayment as s, CompletedPayment as u, PaymentRequestInsertType as v, AccountCredentialsPatchType as x, AccountCredentialsSelectType as y, AccountCredentialsUpdateType as z };
|
|
@@ -42,7 +42,7 @@ type CurrencyCode = (typeof CURRENCY_CODES)[number];
|
|
|
42
42
|
/**
|
|
43
43
|
* Batch status constants
|
|
44
44
|
*/
|
|
45
|
-
declare const BATCH_STATUSES: readonly ["OPEN", "PROCESSING", "READY_TO_SIGN", "SIGNED", "SIGNATURE_FAILED", "FAILED"];
|
|
45
|
+
declare const BATCH_STATUSES: readonly ["OPEN", "PROCESSING", "READY_TO_SIGN", "SIGNED", "SIGNATURE_FAILED", "FAILED", "COMPLETED"];
|
|
46
46
|
/**
|
|
47
47
|
* Type definition for batch status
|
|
48
48
|
*/
|
|
@@ -90,6 +90,12 @@ type ConnectedAccount = {
|
|
|
90
90
|
declare abstract class IBankConnector {
|
|
91
91
|
/** Unique identifier for this bank connector (e.g., 'ERSTE', 'FINBRICKS', 'MOCK') */
|
|
92
92
|
abstract connectorKey: ConnectorKey;
|
|
93
|
+
/**
|
|
94
|
+
* Lifecycle mode for payment status resolution:
|
|
95
|
+
* - 'batch': statuses are resolved via updateBatchStatuses (getBatchStatus polling)
|
|
96
|
+
* - 'per-payment': statuses are resolved via updatePaymentStatuses (getPaymentStatus polling per payment)
|
|
97
|
+
*/
|
|
98
|
+
abstract readonly lifecycleMode: 'batch' | 'per-payment';
|
|
93
99
|
/** List of bank accounts connected through this connector instance */
|
|
94
100
|
abstract connectedAccounts: ConnectedAccount[];
|
|
95
101
|
/** Optional resolver for loading credentials on demand */
|
|
@@ -102,6 +108,7 @@ declare abstract class IBankConnector {
|
|
|
102
108
|
* @returns true if native batch API is supported, false if fallback to single payments is needed
|
|
103
109
|
*/
|
|
104
110
|
abstract supportsBatch(paymentType: PaymentType): boolean;
|
|
111
|
+
supportsPaymentType(paymentType: PaymentType): boolean;
|
|
105
112
|
/**
|
|
106
113
|
* Generates authorization URI for connecting a new bank account.
|
|
107
114
|
* @param ott - One-time token used to identify the authorization flow
|
|
@@ -2629,20 +2636,20 @@ declare const batch: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
2629
2636
|
tableName: "batch";
|
|
2630
2637
|
dataType: "string";
|
|
2631
2638
|
columnType: "SQLiteText";
|
|
2632
|
-
data: "
|
|
2639
|
+
data: "OPEN" | "PROCESSING" | "READY_TO_SIGN" | "SIGNED" | "SIGNATURE_FAILED" | "FAILED" | "COMPLETED";
|
|
2633
2640
|
driverParam: string;
|
|
2634
2641
|
notNull: false;
|
|
2635
2642
|
hasDefault: false;
|
|
2636
2643
|
isPrimaryKey: false;
|
|
2637
2644
|
isAutoincrement: false;
|
|
2638
2645
|
hasRuntimeDefault: false;
|
|
2639
|
-
enumValues: ["OPEN", "PROCESSING", "READY_TO_SIGN", "SIGNED", "SIGNATURE_FAILED", "FAILED"];
|
|
2646
|
+
enumValues: ["OPEN", "PROCESSING", "READY_TO_SIGN", "SIGNED", "SIGNATURE_FAILED", "FAILED", "COMPLETED"];
|
|
2640
2647
|
baseColumn: never;
|
|
2641
2648
|
identity: undefined;
|
|
2642
2649
|
generated: undefined;
|
|
2643
2650
|
}, {}, {
|
|
2644
2651
|
length: number | undefined;
|
|
2645
|
-
$type: "
|
|
2652
|
+
$type: "OPEN" | "PROCESSING" | "READY_TO_SIGN" | "SIGNED" | "SIGNATURE_FAILED" | "FAILED" | "COMPLETED";
|
|
2646
2653
|
}>;
|
|
2647
2654
|
statusReason: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
2648
2655
|
name: "status_reason";
|
|
@@ -3053,7 +3060,7 @@ declare const payment: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
3053
3060
|
tableName: "payment";
|
|
3054
3061
|
dataType: "string";
|
|
3055
3062
|
columnType: "SQLiteText";
|
|
3056
|
-
data: "
|
|
3063
|
+
data: "SIGNED" | "FAILED" | "COMPLETED" | "CREATED" | "PREPARED" | "PENDING";
|
|
3057
3064
|
driverParam: string;
|
|
3058
3065
|
notNull: true;
|
|
3059
3066
|
hasDefault: false;
|
|
@@ -3066,7 +3073,7 @@ declare const payment: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
3066
3073
|
generated: undefined;
|
|
3067
3074
|
}, {}, {
|
|
3068
3075
|
length: number | undefined;
|
|
3069
|
-
$type: "
|
|
3076
|
+
$type: "SIGNED" | "FAILED" | "COMPLETED" | "CREATED" | "PREPARED" | "PENDING";
|
|
3070
3077
|
}>;
|
|
3071
3078
|
statusReason: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
3072
3079
|
name: "status_reason";
|
|
@@ -3647,7 +3654,7 @@ declare const paymentRequest: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
3647
3654
|
tableName: "payment_request";
|
|
3648
3655
|
dataType: "string";
|
|
3649
3656
|
columnType: "SQLiteText";
|
|
3650
|
-
data: "
|
|
3657
|
+
data: "SIGNED" | "FAILED" | "COMPLETED" | "CREATED" | "PREPARED" | "PENDING";
|
|
3651
3658
|
driverParam: string;
|
|
3652
3659
|
notNull: true;
|
|
3653
3660
|
hasDefault: false;
|
|
@@ -3660,7 +3667,7 @@ declare const paymentRequest: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
3660
3667
|
generated: undefined;
|
|
3661
3668
|
}, {}, {
|
|
3662
3669
|
length: number | undefined;
|
|
3663
|
-
$type: "
|
|
3670
|
+
$type: "SIGNED" | "FAILED" | "COMPLETED" | "CREATED" | "PREPARED" | "PENDING";
|
|
3664
3671
|
}>;
|
|
3665
3672
|
statusReason: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
3666
3673
|
name: "status_reason";
|
|
@@ -3926,6 +3933,23 @@ declare const paymentRequest: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
3926
3933
|
}, {}, {
|
|
3927
3934
|
length: number | undefined;
|
|
3928
3935
|
}>;
|
|
3936
|
+
sendAsSinglePayment: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
3937
|
+
name: "send_as_single_payment";
|
|
3938
|
+
tableName: "payment_request";
|
|
3939
|
+
dataType: "boolean";
|
|
3940
|
+
columnType: "SQLiteBoolean";
|
|
3941
|
+
data: boolean;
|
|
3942
|
+
driverParam: number;
|
|
3943
|
+
notNull: false;
|
|
3944
|
+
hasDefault: false;
|
|
3945
|
+
isPrimaryKey: false;
|
|
3946
|
+
isAutoincrement: false;
|
|
3947
|
+
hasRuntimeDefault: false;
|
|
3948
|
+
enumValues: undefined;
|
|
3949
|
+
baseColumn: never;
|
|
3950
|
+
identity: undefined;
|
|
3951
|
+
generated: undefined;
|
|
3952
|
+
}, {}, {}>;
|
|
3929
3953
|
id: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
3930
3954
|
name: "id";
|
|
3931
3955
|
tableName: "payment_request";
|
|
@@ -5342,5 +5366,5 @@ declare function isBatchFailed(batch: {
|
|
|
5342
5366
|
status?: string | null;
|
|
5343
5367
|
}): batch is CompletedBatch;
|
|
5344
5368
|
|
|
5345
|
-
export { PAYMENT_STATUSES as $, BATCH_STATUSES as
|
|
5346
|
-
export type { AccountSelectType as A, BatchSelectType as B, ConfigEnvironmentBank as C,
|
|
5369
|
+
export { PAYMENT_STATUSES as $, BATCH_STATUSES as G, IBankConnector as I, CHARGE_BEARERS as O, CONNECTOR_KEYS as Q, COUNTRY_CODES as R, CREDENTIALS_TYPES as S, INSTRUCTION_PRIORITIES as Y, PAYMENT_DIRECTIONS as _, PAYMENT_TYPES as a0, TOKEN_TYPES as aa, accountCredentialsInsertSchema as ac, accountCredentialsSelectSchema as ad, accountCredentialsUpdateSchema as ae, accountInsertSchema as af, accountSelectSchema as ag, accountUpdateSchema as ah, hasPaymentAccountAssigned as ai, isBatchCompleted as aj, isBatchFailed as ak, isBatchInitiated as al, isBatchOpen as am, isBatchProcessing as an, isBatchReadyToSign as ao, isBatchSigned as ap, isPaymentCompleted as aq, isPaymentPrepared as ar, account as as, accountCredentials as at, batch as au, ott as av, payment as aw, paymentRelations as ax, paymentRequest as ay, paymentRequestRelations as az, tables as t, ACCOUNT_STATUSES as w };
|
|
5370
|
+
export type { AccountSelectType as A, BatchSelectType as B, ConfigEnvironmentBank as C, AccountPatchType as D, AccountStatus as E, AccountUpdateType as F, BankAccountWithLastSync as H, BankCode as J, BatchInsertType as K, LastSyncMetadata as L, BatchLifecycle as M, BatchPayment as N, PaymentSelectType as P, ChargeBearer as T, CompletedBatch as U, CountryCode as V, CreatedBatch as W, CredentialsType as X, InstructionPriority as Z, PaymentRequestSelectType as a, PaymentDirection as a1, PaymentFailedInsertType as a2, PaymentInsertType as a3, PaymentLifecycle as a4, PaymentPreparedInsertType as a5, ProcessingBatch as a6, ReadyToSignBatch as a7, ResolvedCredentials as a8, SignedBatch as a9, TokenType as ab, ConnectorKey as b, PaymentType as c, CurrencyCode as d, ConnectedAccount as e, CredentialsResolver as f, AccountCredentialsInsertType as g, AccountInsertType as h, BatchedPayment as i, InitiatedBatch as j, IncomingPayment as k, InitiatedPayment as l, ParsedBankPayment as m, PaymentStatus as n, BatchStatus as o, BatchMetadata as p, Currency as q, AccountAssignedPayment as r, PreparedPayment as s, CompletedPayment as u, PaymentRequestInsertType as v, AccountCredentialsPatchType as x, AccountCredentialsSelectType as y, AccountCredentialsUpdateType as z };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { sql, and, eq, isNull } from 'drizzle-orm';
|
|
1
2
|
import { uuidv4 } from '@develit-io/backend-sdk';
|
|
2
|
-
import
|
|
3
|
-
import './bank.C4VOdIx1.mjs';
|
|
3
|
+
import './bank.C6jjS1Pl.mjs';
|
|
4
4
|
import 'date-fns';
|
|
5
5
|
import 'jose';
|
|
6
6
|
import '@develit-io/general-codes';
|
|
7
7
|
import { createHash } from 'node:crypto';
|
|
8
|
-
import { s as schema } from './bank.
|
|
8
|
+
import { s as schema } from './bank.BoZtXQpG.mjs';
|
|
9
9
|
|
|
10
10
|
const createPaymentCommand = (db, { payment }) => {
|
|
11
11
|
return {
|
|
@@ -13,6 +13,19 @@ const createPaymentCommand = (db, { payment }) => {
|
|
|
13
13
|
...payment,
|
|
14
14
|
creditorIban: payment.creditor.iban,
|
|
15
15
|
debtorIban: payment.debtor.iban
|
|
16
|
+
}).onConflictDoUpdate({
|
|
17
|
+
// Unique index: (connector_key, bank_ref_id)
|
|
18
|
+
target: [tables.payment.connectorKey, tables.payment.bankRefId],
|
|
19
|
+
set: {
|
|
20
|
+
status: sql`excluded.status`,
|
|
21
|
+
statusReason: sql`excluded.status_reason`,
|
|
22
|
+
processedAt: sql`excluded.processed_at`,
|
|
23
|
+
updatedAt: sql`excluded.updated_at`,
|
|
24
|
+
// Keep existing refId if already set, otherwise use enriched value
|
|
25
|
+
refId: sql`coalesce(payment.ref_id, excluded.ref_id)`,
|
|
26
|
+
// Keep existing batchId if already set, otherwise use enriched value
|
|
27
|
+
batchId: sql`coalesce(payment.bank_execution_batch_id, excluded.bank_execution_batch_id)`
|
|
28
|
+
}
|
|
16
29
|
}).returning()
|
|
17
30
|
};
|
|
18
31
|
};
|
|
@@ -37,7 +50,12 @@ const upsertBatchCommand = (db, { batch }) => {
|
|
|
37
50
|
const updatePaymentRequestStatusCommand = (db, values) => {
|
|
38
51
|
const { id, ...set } = values;
|
|
39
52
|
return {
|
|
40
|
-
command: db.update(tables.paymentRequest).set(set).where(
|
|
53
|
+
command: db.update(tables.paymentRequest).set(set).where(
|
|
54
|
+
and(
|
|
55
|
+
eq(tables.paymentRequest.id, id),
|
|
56
|
+
isNull(tables.paymentRequest.deletedAt)
|
|
57
|
+
)
|
|
58
|
+
).returning()
|
|
41
59
|
};
|
|
42
60
|
};
|
|
43
61
|
|
|
@@ -58,7 +76,12 @@ const getCredentialsByAccountId = async (db, encryptionKey, { accountId }) => {
|
|
|
58
76
|
};
|
|
59
77
|
|
|
60
78
|
const getPaymentRequestsByBatchIdQuery = async (db, { batchId }) => {
|
|
61
|
-
return await db.select().from(tables.paymentRequest).where(
|
|
79
|
+
return await db.select().from(tables.paymentRequest).where(
|
|
80
|
+
and(
|
|
81
|
+
eq(tables.paymentRequest.batchId, batchId),
|
|
82
|
+
isNull(tables.paymentRequest.deletedAt)
|
|
83
|
+
)
|
|
84
|
+
);
|
|
62
85
|
};
|
|
63
86
|
|
|
64
87
|
async function importAesKey(base64Key) {
|
|
@@ -27,6 +27,7 @@ interface BankServiceEnvironmentConfig {
|
|
|
27
27
|
FINBRICKS_BASE_URI: 'https://api.sandbox.finbricks.com';
|
|
28
28
|
FINBRICKS_MERCHANT_ID: string;
|
|
29
29
|
CRON_BATCH_STATUSES: string;
|
|
30
|
+
CRON_PAYMENT_STATUSES: string;
|
|
30
31
|
BANK_AUTH_RECIPIENT: string;
|
|
31
32
|
DBUCS_BASE_URI: string;
|
|
32
33
|
DBUCS_USERNAME: string;
|
|
@@ -27,6 +27,7 @@ interface BankServiceEnvironmentConfig {
|
|
|
27
27
|
FINBRICKS_BASE_URI: 'https://api.sandbox.finbricks.com';
|
|
28
28
|
FINBRICKS_MERCHANT_ID: string;
|
|
29
29
|
CRON_BATCH_STATUSES: string;
|
|
30
|
+
CRON_PAYMENT_STATUSES: string;
|
|
30
31
|
BANK_AUTH_RECIPIENT: string;
|
|
31
32
|
DBUCS_BASE_URI: string;
|
|
32
33
|
DBUCS_USERNAME: string;
|
|
@@ -27,6 +27,7 @@ interface BankServiceEnvironmentConfig {
|
|
|
27
27
|
FINBRICKS_BASE_URI: 'https://api.sandbox.finbricks.com';
|
|
28
28
|
FINBRICKS_MERCHANT_ID: string;
|
|
29
29
|
CRON_BATCH_STATUSES: string;
|
|
30
|
+
CRON_PAYMENT_STATUSES: string;
|
|
30
31
|
BANK_AUTH_RECIPIENT: string;
|
|
31
32
|
DBUCS_BASE_URI: string;
|
|
32
33
|
DBUCS_USERNAME: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as account, p as accountCredentials, q as batch, r as ott, s as payment, t as paymentRelations, u as paymentRequest, v as paymentRequestRelations } from './bank.
|
|
1
|
+
import { n as account, p as accountCredentials, q as batch, r as ott, s as payment, t as paymentRelations, u as paymentRequest, v as paymentRequestRelations } from './bank.C6jjS1Pl.mjs';
|
|
2
2
|
|
|
3
3
|
const schema = {
|
|
4
4
|
__proto__: null,
|