@develit-services/bank 2.0.0 → 2.2.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/README.md +6 -0
- 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/export/worker.cjs +38 -1
- package/dist/export/worker.d.cts +24 -8
- package/dist/export/worker.d.mts +24 -8
- package/dist/export/worker.d.ts +24 -8
- package/dist/export/worker.mjs +38 -1
- package/dist/export/workflows.cjs +1 -1
- package/dist/export/workflows.mjs +1 -1
- package/dist/export/wrangler.cjs +2 -0
- package/dist/export/wrangler.d.cts +1 -1
- package/dist/export/wrangler.d.mts +1 -1
- package/dist/export/wrangler.d.ts +1 -1
- package/dist/export/wrangler.mjs +2 -0
- package/dist/shared/{bank.BsKwYyaC.mjs → bank.Bo4HtOgs.mjs} +97 -15
- package/dist/shared/{bank.BYUn0j0r.d.mts → bank.BpTNVqyL.d.mts} +1 -1
- package/dist/shared/{bank.Bl1DnY7_.d.cts → bank.Bu5RkozT.d.cts} +1 -1
- package/dist/shared/{bank.NqesB7DM.d.cts → bank.BvQ2SE8p.d.cts} +37 -6
- package/dist/shared/{bank.NqesB7DM.d.mts → bank.BvQ2SE8p.d.mts} +37 -6
- package/dist/shared/{bank.NqesB7DM.d.ts → bank.BvQ2SE8p.d.ts} +37 -6
- package/dist/shared/{bank.CVJosema.d.mts → bank.Bz4DIxJL.d.cts} +1 -0
- package/dist/shared/{bank.CVJosema.d.ts → bank.Bz4DIxJL.d.mts} +1 -0
- package/dist/shared/{bank.CVJosema.d.cts → bank.Bz4DIxJL.d.ts} +1 -0
- package/dist/shared/{bank.CpEGzmAr.cjs → bank.Dk3nEc0x.cjs} +97 -15
- package/dist/shared/{bank.Dg_QI-D5.d.ts → bank.FUi1SRkA.d.ts} +1 -1
- package/dist/types.cjs +1 -1
- package/dist/types.d.cts +17 -5
- package/dist/types.d.mts +17 -5
- package/dist/types.d.ts +17 -5
- package/dist/types.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -396,4 +396,10 @@ Format: `{CATEGORY}-B-{NUMBER}`
|
|
|
396
396
|
| `VALID-B-011` | 422 | Batch: debtor IBAN/currency mismatch |
|
|
397
397
|
| `VALID-B-012` | 422 | Batch: payment type mismatch |
|
|
398
398
|
| `VALID-B-013` | 422 | Batch: size limit exceeded |
|
|
399
|
+
| `VALID-B-014` | 404 | Account not found (balance) |
|
|
400
|
+
| `VALID-B-016` | 400 | Account configuration incomplete |
|
|
399
401
|
| `SYS-B-001` | 501 | Not implemented |
|
|
402
|
+
| `SYS-B-002` | 400 | Account has no bankRefId |
|
|
403
|
+
| `SYS-B-003` | 503 | Balance data unavailable |
|
|
404
|
+
| `SYS-B-004` | 501 | Balance not supported by connector |
|
|
405
|
+
| `SYS-B-005` | 500 | Backoffice API request failed |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { az as account, aA as accountCredentials, aB as batch, aC as ott, aD as payment, aE as paymentRelations, aF as paymentRequest, aG as paymentRequestRelations } from '../shared/bank.
|
|
1
|
+
export { az as account, aA as accountCredentials, aB as batch, aC as ott, aD as payment, aE as paymentRelations, aF as paymentRequest, aG as paymentRequestRelations } from '../shared/bank.BvQ2SE8p.cjs';
|
|
2
2
|
import 'drizzle-orm/sqlite-core';
|
|
3
3
|
import 'drizzle-orm';
|
|
4
4
|
import '@develit-io/backend-sdk';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { az as account, aA as accountCredentials, aB as batch, aC as ott, aD as payment, aE as paymentRelations, aF as paymentRequest, aG as paymentRequestRelations } from '../shared/bank.
|
|
1
|
+
export { az as account, aA as accountCredentials, aB as batch, aC as ott, aD as payment, aE as paymentRelations, aF as paymentRequest, aG as paymentRequestRelations } from '../shared/bank.BvQ2SE8p.mjs';
|
|
2
2
|
import 'drizzle-orm/sqlite-core';
|
|
3
3
|
import 'drizzle-orm';
|
|
4
4
|
import '@develit-io/backend-sdk';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { az as account, aA as accountCredentials, aB as batch, aC as ott, aD as payment, aE as paymentRelations, aF as paymentRequest, aG as paymentRequestRelations } from '../shared/bank.
|
|
1
|
+
export { az as account, aA as accountCredentials, aB as batch, aC as ott, aD as payment, aE as paymentRelations, aF as paymentRequest, aG as paymentRequestRelations } from '../shared/bank.BvQ2SE8p.js';
|
|
2
2
|
import 'drizzle-orm/sqlite-core';
|
|
3
3
|
import 'drizzle-orm';
|
|
4
4
|
import '@develit-io/backend-sdk';
|
package/dist/export/worker.cjs
CHANGED
|
@@ -5,7 +5,7 @@ const database_schema = require('../shared/bank.CIWYI18z.cjs');
|
|
|
5
5
|
const drizzleOrm = require('drizzle-orm');
|
|
6
6
|
const cloudflare_workers = require('cloudflare:workers');
|
|
7
7
|
const d1 = require('drizzle-orm/d1');
|
|
8
|
-
const mock_connector = require('../shared/bank.
|
|
8
|
+
const mock_connector = require('../shared/bank.Dk3nEc0x.cjs');
|
|
9
9
|
require('jose');
|
|
10
10
|
const zod = require('zod');
|
|
11
11
|
const generalCodes = require('@develit-io/general-codes');
|
|
@@ -576,6 +576,10 @@ const getPaymentRequestsInputSchema = zod.z.object({
|
|
|
576
576
|
// filterDirection: removed — payment_request is always OUTGOING
|
|
577
577
|
});
|
|
578
578
|
|
|
579
|
+
const getAccountBalanceInputSchema = zod.z.object({
|
|
580
|
+
accountId: zod.z.string().uuid()
|
|
581
|
+
});
|
|
582
|
+
|
|
579
583
|
var __defProp = Object.defineProperty;
|
|
580
584
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
581
585
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -1564,6 +1568,36 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
|
|
|
1564
1568
|
}
|
|
1565
1569
|
);
|
|
1566
1570
|
}
|
|
1571
|
+
async getAccountBalance(input) {
|
|
1572
|
+
return this.handleAction(
|
|
1573
|
+
{ data: input, schema: getAccountBalanceInputSchema },
|
|
1574
|
+
{ successMessage: "Account balance retrieved successfully" },
|
|
1575
|
+
async (data) => {
|
|
1576
|
+
const account = await credentialsResolver.getAccountByIdQuery(this.db, {
|
|
1577
|
+
accountId: data.accountId
|
|
1578
|
+
});
|
|
1579
|
+
if (!account) {
|
|
1580
|
+
throw backendSdk.createInternalError(null, {
|
|
1581
|
+
message: "Account not found",
|
|
1582
|
+
code: "VALID-B-014",
|
|
1583
|
+
status: 404
|
|
1584
|
+
});
|
|
1585
|
+
}
|
|
1586
|
+
if (!account.bankRefId) {
|
|
1587
|
+
throw backendSdk.createInternalError(null, {
|
|
1588
|
+
message: "Account configuration incomplete",
|
|
1589
|
+
code: "VALID-B-016",
|
|
1590
|
+
status: 400
|
|
1591
|
+
});
|
|
1592
|
+
}
|
|
1593
|
+
const connector = await this._initiateBankConnector({
|
|
1594
|
+
connectorKey: account.connectorKey,
|
|
1595
|
+
skipAccounts: false
|
|
1596
|
+
});
|
|
1597
|
+
return await connector.getAccountBalance({ account });
|
|
1598
|
+
}
|
|
1599
|
+
);
|
|
1600
|
+
}
|
|
1567
1601
|
async updateAccount(input) {
|
|
1568
1602
|
return this.handleAction(
|
|
1569
1603
|
{
|
|
@@ -1767,6 +1801,9 @@ __decorateClass([
|
|
|
1767
1801
|
__decorateClass([
|
|
1768
1802
|
backendSdk.action("get-bank-accounts")
|
|
1769
1803
|
], BankServiceBase.prototype, "getBankAccounts", 1);
|
|
1804
|
+
__decorateClass([
|
|
1805
|
+
backendSdk.action("get-account-balance")
|
|
1806
|
+
], BankServiceBase.prototype, "getAccountBalance", 1);
|
|
1770
1807
|
__decorateClass([
|
|
1771
1808
|
backendSdk.action("update-account")
|
|
1772
1809
|
], BankServiceBase.prototype, "updateAccount", 1);
|
package/dist/export/worker.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BatchSelectType, P as PaymentRequestSelectType, A as AccountSelectType, a as PaymentSelectType, L as LastSyncMetadata, C as ConfigEnvironmentBank, t as tables, b as ConnectorKey, I as IBankConnector, c as PaymentType, d as CurrencyCode, H as HandleAuthorizationCallbackInput, e as HandleAuthorizationCallbackOutput } from '../shared/bank.
|
|
2
|
-
import { S as SendPaymentInput, a as SendPaymentOutput, b as SendPaymentSyncInput, c as SendPaymentSyncOutput, F as FinbricksSupportedBanksResponse } from '../shared/bank.
|
|
1
|
+
import { B as BatchSelectType, P as PaymentRequestSelectType, A as AccountSelectType, a as PaymentSelectType, L as LastSyncMetadata, C as ConfigEnvironmentBank, t as tables, b as ConnectorKey, I as IBankConnector, c as PaymentType, d as CurrencyCode, H as HandleAuthorizationCallbackInput, e as HandleAuthorizationCallbackOutput } from '../shared/bank.BvQ2SE8p.cjs';
|
|
2
|
+
import { S as SendPaymentInput, a as SendPaymentOutput, b as SendPaymentSyncInput, c as SendPaymentSyncOutput, F as FinbricksSupportedBanksResponse } from '../shared/bank.Bu5RkozT.cjs';
|
|
3
3
|
import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
|
|
4
4
|
import { WorkflowInstanceStatus, IRPCResponse } from '@develit-io/backend-sdk';
|
|
5
5
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
@@ -2703,15 +2703,15 @@ declare const getBatchesInputSchema: z.ZodObject<{
|
|
|
2703
2703
|
filterBatchAccountId: z.ZodOptional<z.ZodUnion<readonly [z.ZodUUID, z.ZodArray<z.ZodUUID>]>>;
|
|
2704
2704
|
filterBatchStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
2705
2705
|
AUTHORIZED: "AUTHORIZED";
|
|
2706
|
-
COMPLETED: "COMPLETED";
|
|
2707
2706
|
PROCESSING: "PROCESSING";
|
|
2708
2707
|
READY_TO_SIGN: "READY_TO_SIGN";
|
|
2708
|
+
COMPLETED: "COMPLETED";
|
|
2709
2709
|
FAILED: "FAILED";
|
|
2710
2710
|
}>, z.ZodArray<z.ZodEnum<{
|
|
2711
2711
|
AUTHORIZED: "AUTHORIZED";
|
|
2712
|
-
COMPLETED: "COMPLETED";
|
|
2713
2712
|
PROCESSING: "PROCESSING";
|
|
2714
2713
|
READY_TO_SIGN: "READY_TO_SIGN";
|
|
2714
|
+
COMPLETED: "COMPLETED";
|
|
2715
2715
|
FAILED: "FAILED";
|
|
2716
2716
|
}>>]>>;
|
|
2717
2717
|
}, z.core.$strip>;
|
|
@@ -2948,19 +2948,19 @@ declare const getPaymentsInputSchema: z.ZodObject<{
|
|
|
2948
2948
|
filterPaymentDateFrom: z.ZodOptional<z.ZodDate>;
|
|
2949
2949
|
filterPaymentDateTo: z.ZodOptional<z.ZodDate>;
|
|
2950
2950
|
filterPaymentStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
2951
|
+
PROCESSING: "PROCESSING";
|
|
2951
2952
|
BOOKED: "BOOKED";
|
|
2952
2953
|
REJECTED: "REJECTED";
|
|
2953
2954
|
PENDING: "PENDING";
|
|
2954
|
-
PROCESSING: "PROCESSING";
|
|
2955
2955
|
CANCELLED: "CANCELLED";
|
|
2956
2956
|
SCHEDULED: "SCHEDULED";
|
|
2957
2957
|
HOLD: "HOLD";
|
|
2958
2958
|
INFO: "INFO";
|
|
2959
2959
|
}>, z.ZodArray<z.ZodEnum<{
|
|
2960
|
+
PROCESSING: "PROCESSING";
|
|
2960
2961
|
BOOKED: "BOOKED";
|
|
2961
2962
|
REJECTED: "REJECTED";
|
|
2962
2963
|
PENDING: "PENDING";
|
|
2963
|
-
PROCESSING: "PROCESSING";
|
|
2964
2964
|
CANCELLED: "CANCELLED";
|
|
2965
2965
|
SCHEDULED: "SCHEDULED";
|
|
2966
2966
|
HOLD: "HOLD";
|
|
@@ -3914,16 +3914,16 @@ declare const getPaymentRequestsInputSchema: z.ZodObject<{
|
|
|
3914
3914
|
filterAccountId: z.ZodOptional<z.ZodUnion<readonly [z.ZodUUID, z.ZodArray<z.ZodUUID>]>>;
|
|
3915
3915
|
filterStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
3916
3916
|
AUTHORIZED: "AUTHORIZED";
|
|
3917
|
-
OPENED: "OPENED";
|
|
3918
3917
|
COMPLETED: "COMPLETED";
|
|
3918
|
+
OPENED: "OPENED";
|
|
3919
3919
|
BOOKED: "BOOKED";
|
|
3920
3920
|
SETTLED: "SETTLED";
|
|
3921
3921
|
REJECTED: "REJECTED";
|
|
3922
3922
|
CLOSED: "CLOSED";
|
|
3923
3923
|
}>, z.ZodArray<z.ZodEnum<{
|
|
3924
3924
|
AUTHORIZED: "AUTHORIZED";
|
|
3925
|
-
OPENED: "OPENED";
|
|
3926
3925
|
COMPLETED: "COMPLETED";
|
|
3926
|
+
OPENED: "OPENED";
|
|
3927
3927
|
BOOKED: "BOOKED";
|
|
3928
3928
|
SETTLED: "SETTLED";
|
|
3929
3929
|
REJECTED: "REJECTED";
|
|
@@ -4072,6 +4072,21 @@ type GetPaymentRequestOutput = {
|
|
|
4072
4072
|
paymentRequest: PaymentRequestSelectType;
|
|
4073
4073
|
};
|
|
4074
4074
|
|
|
4075
|
+
declare const getAccountBalanceInputSchema: z.ZodObject<{
|
|
4076
|
+
accountId: z.ZodString;
|
|
4077
|
+
}, z.core.$strip>;
|
|
4078
|
+
type GetAccountBalanceInput = z.input<typeof getAccountBalanceInputSchema>;
|
|
4079
|
+
type GetAccountBalanceOutput = {
|
|
4080
|
+
balances: Array<{
|
|
4081
|
+
amount: {
|
|
4082
|
+
value: number;
|
|
4083
|
+
currency: string;
|
|
4084
|
+
};
|
|
4085
|
+
balanceType: 'AVAILABLE' | 'VALUTA' | 'GPE_AVAILABLE' | 'MULTI_AVAILABLE';
|
|
4086
|
+
balanceDate: Date;
|
|
4087
|
+
}>;
|
|
4088
|
+
};
|
|
4089
|
+
|
|
4075
4090
|
declare const BankServiceBase_base: (abstract new (ctx: ExecutionContext, env: BankEnv) => WorkerEntrypoint<BankEnv, {}>) & (abstract new (...args: any[]) => _develit_io_backend_sdk.DevelitWorkerMethods);
|
|
4076
4091
|
declare class BankServiceBase extends BankServiceBase_base {
|
|
4077
4092
|
readonly db: DrizzleD1Database<typeof tables>;
|
|
@@ -4228,6 +4243,7 @@ declare class BankServiceBase extends BankServiceBase_base {
|
|
|
4228
4243
|
*/
|
|
4229
4244
|
sendBatch(input: SendBatchInput): Promise<IRPCResponse<SendBatchOutput>>;
|
|
4230
4245
|
getBankAccounts(input: GetBankAccountsInput): Promise<IRPCResponse<GetBankAccountsOutput>>;
|
|
4246
|
+
getAccountBalance(input: GetAccountBalanceInput): Promise<IRPCResponse<GetAccountBalanceOutput>>;
|
|
4231
4247
|
updateAccount(input: UpdateAccountInput): Promise<IRPCResponse<UpdateAccountOutput>>;
|
|
4232
4248
|
disconnectAccount(input: DisconnectAccountInput): Promise<IRPCResponse<DisconnectAccountOutput>>;
|
|
4233
4249
|
getBatches(input: GetBatchesInput): Promise<IRPCResponse<GetBatchesOutput>>;
|
package/dist/export/worker.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BatchSelectType, P as PaymentRequestSelectType, A as AccountSelectType, a as PaymentSelectType, L as LastSyncMetadata, C as ConfigEnvironmentBank, t as tables, b as ConnectorKey, I as IBankConnector, c as PaymentType, d as CurrencyCode, H as HandleAuthorizationCallbackInput, e as HandleAuthorizationCallbackOutput } from '../shared/bank.
|
|
2
|
-
import { S as SendPaymentInput, a as SendPaymentOutput, b as SendPaymentSyncInput, c as SendPaymentSyncOutput, F as FinbricksSupportedBanksResponse } from '../shared/bank.
|
|
1
|
+
import { B as BatchSelectType, P as PaymentRequestSelectType, A as AccountSelectType, a as PaymentSelectType, L as LastSyncMetadata, C as ConfigEnvironmentBank, t as tables, b as ConnectorKey, I as IBankConnector, c as PaymentType, d as CurrencyCode, H as HandleAuthorizationCallbackInput, e as HandleAuthorizationCallbackOutput } from '../shared/bank.BvQ2SE8p.mjs';
|
|
2
|
+
import { S as SendPaymentInput, a as SendPaymentOutput, b as SendPaymentSyncInput, c as SendPaymentSyncOutput, F as FinbricksSupportedBanksResponse } from '../shared/bank.BpTNVqyL.mjs';
|
|
3
3
|
import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
|
|
4
4
|
import { WorkflowInstanceStatus, IRPCResponse } from '@develit-io/backend-sdk';
|
|
5
5
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
@@ -2703,15 +2703,15 @@ declare const getBatchesInputSchema: z.ZodObject<{
|
|
|
2703
2703
|
filterBatchAccountId: z.ZodOptional<z.ZodUnion<readonly [z.ZodUUID, z.ZodArray<z.ZodUUID>]>>;
|
|
2704
2704
|
filterBatchStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
2705
2705
|
AUTHORIZED: "AUTHORIZED";
|
|
2706
|
-
COMPLETED: "COMPLETED";
|
|
2707
2706
|
PROCESSING: "PROCESSING";
|
|
2708
2707
|
READY_TO_SIGN: "READY_TO_SIGN";
|
|
2708
|
+
COMPLETED: "COMPLETED";
|
|
2709
2709
|
FAILED: "FAILED";
|
|
2710
2710
|
}>, z.ZodArray<z.ZodEnum<{
|
|
2711
2711
|
AUTHORIZED: "AUTHORIZED";
|
|
2712
|
-
COMPLETED: "COMPLETED";
|
|
2713
2712
|
PROCESSING: "PROCESSING";
|
|
2714
2713
|
READY_TO_SIGN: "READY_TO_SIGN";
|
|
2714
|
+
COMPLETED: "COMPLETED";
|
|
2715
2715
|
FAILED: "FAILED";
|
|
2716
2716
|
}>>]>>;
|
|
2717
2717
|
}, z.core.$strip>;
|
|
@@ -2948,19 +2948,19 @@ declare const getPaymentsInputSchema: z.ZodObject<{
|
|
|
2948
2948
|
filterPaymentDateFrom: z.ZodOptional<z.ZodDate>;
|
|
2949
2949
|
filterPaymentDateTo: z.ZodOptional<z.ZodDate>;
|
|
2950
2950
|
filterPaymentStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
2951
|
+
PROCESSING: "PROCESSING";
|
|
2951
2952
|
BOOKED: "BOOKED";
|
|
2952
2953
|
REJECTED: "REJECTED";
|
|
2953
2954
|
PENDING: "PENDING";
|
|
2954
|
-
PROCESSING: "PROCESSING";
|
|
2955
2955
|
CANCELLED: "CANCELLED";
|
|
2956
2956
|
SCHEDULED: "SCHEDULED";
|
|
2957
2957
|
HOLD: "HOLD";
|
|
2958
2958
|
INFO: "INFO";
|
|
2959
2959
|
}>, z.ZodArray<z.ZodEnum<{
|
|
2960
|
+
PROCESSING: "PROCESSING";
|
|
2960
2961
|
BOOKED: "BOOKED";
|
|
2961
2962
|
REJECTED: "REJECTED";
|
|
2962
2963
|
PENDING: "PENDING";
|
|
2963
|
-
PROCESSING: "PROCESSING";
|
|
2964
2964
|
CANCELLED: "CANCELLED";
|
|
2965
2965
|
SCHEDULED: "SCHEDULED";
|
|
2966
2966
|
HOLD: "HOLD";
|
|
@@ -3914,16 +3914,16 @@ declare const getPaymentRequestsInputSchema: z.ZodObject<{
|
|
|
3914
3914
|
filterAccountId: z.ZodOptional<z.ZodUnion<readonly [z.ZodUUID, z.ZodArray<z.ZodUUID>]>>;
|
|
3915
3915
|
filterStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
3916
3916
|
AUTHORIZED: "AUTHORIZED";
|
|
3917
|
-
OPENED: "OPENED";
|
|
3918
3917
|
COMPLETED: "COMPLETED";
|
|
3918
|
+
OPENED: "OPENED";
|
|
3919
3919
|
BOOKED: "BOOKED";
|
|
3920
3920
|
SETTLED: "SETTLED";
|
|
3921
3921
|
REJECTED: "REJECTED";
|
|
3922
3922
|
CLOSED: "CLOSED";
|
|
3923
3923
|
}>, z.ZodArray<z.ZodEnum<{
|
|
3924
3924
|
AUTHORIZED: "AUTHORIZED";
|
|
3925
|
-
OPENED: "OPENED";
|
|
3926
3925
|
COMPLETED: "COMPLETED";
|
|
3926
|
+
OPENED: "OPENED";
|
|
3927
3927
|
BOOKED: "BOOKED";
|
|
3928
3928
|
SETTLED: "SETTLED";
|
|
3929
3929
|
REJECTED: "REJECTED";
|
|
@@ -4072,6 +4072,21 @@ type GetPaymentRequestOutput = {
|
|
|
4072
4072
|
paymentRequest: PaymentRequestSelectType;
|
|
4073
4073
|
};
|
|
4074
4074
|
|
|
4075
|
+
declare const getAccountBalanceInputSchema: z.ZodObject<{
|
|
4076
|
+
accountId: z.ZodString;
|
|
4077
|
+
}, z.core.$strip>;
|
|
4078
|
+
type GetAccountBalanceInput = z.input<typeof getAccountBalanceInputSchema>;
|
|
4079
|
+
type GetAccountBalanceOutput = {
|
|
4080
|
+
balances: Array<{
|
|
4081
|
+
amount: {
|
|
4082
|
+
value: number;
|
|
4083
|
+
currency: string;
|
|
4084
|
+
};
|
|
4085
|
+
balanceType: 'AVAILABLE' | 'VALUTA' | 'GPE_AVAILABLE' | 'MULTI_AVAILABLE';
|
|
4086
|
+
balanceDate: Date;
|
|
4087
|
+
}>;
|
|
4088
|
+
};
|
|
4089
|
+
|
|
4075
4090
|
declare const BankServiceBase_base: (abstract new (ctx: ExecutionContext, env: BankEnv) => WorkerEntrypoint<BankEnv, {}>) & (abstract new (...args: any[]) => _develit_io_backend_sdk.DevelitWorkerMethods);
|
|
4076
4091
|
declare class BankServiceBase extends BankServiceBase_base {
|
|
4077
4092
|
readonly db: DrizzleD1Database<typeof tables>;
|
|
@@ -4228,6 +4243,7 @@ declare class BankServiceBase extends BankServiceBase_base {
|
|
|
4228
4243
|
*/
|
|
4229
4244
|
sendBatch(input: SendBatchInput): Promise<IRPCResponse<SendBatchOutput>>;
|
|
4230
4245
|
getBankAccounts(input: GetBankAccountsInput): Promise<IRPCResponse<GetBankAccountsOutput>>;
|
|
4246
|
+
getAccountBalance(input: GetAccountBalanceInput): Promise<IRPCResponse<GetAccountBalanceOutput>>;
|
|
4231
4247
|
updateAccount(input: UpdateAccountInput): Promise<IRPCResponse<UpdateAccountOutput>>;
|
|
4232
4248
|
disconnectAccount(input: DisconnectAccountInput): Promise<IRPCResponse<DisconnectAccountOutput>>;
|
|
4233
4249
|
getBatches(input: GetBatchesInput): Promise<IRPCResponse<GetBatchesOutput>>;
|
package/dist/export/worker.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BatchSelectType, P as PaymentRequestSelectType, A as AccountSelectType, a as PaymentSelectType, L as LastSyncMetadata, C as ConfigEnvironmentBank, t as tables, b as ConnectorKey, I as IBankConnector, c as PaymentType, d as CurrencyCode, H as HandleAuthorizationCallbackInput, e as HandleAuthorizationCallbackOutput } from '../shared/bank.
|
|
2
|
-
import { S as SendPaymentInput, a as SendPaymentOutput, b as SendPaymentSyncInput, c as SendPaymentSyncOutput, F as FinbricksSupportedBanksResponse } from '../shared/bank.
|
|
1
|
+
import { B as BatchSelectType, P as PaymentRequestSelectType, A as AccountSelectType, a as PaymentSelectType, L as LastSyncMetadata, C as ConfigEnvironmentBank, t as tables, b as ConnectorKey, I as IBankConnector, c as PaymentType, d as CurrencyCode, H as HandleAuthorizationCallbackInput, e as HandleAuthorizationCallbackOutput } from '../shared/bank.BvQ2SE8p.js';
|
|
2
|
+
import { S as SendPaymentInput, a as SendPaymentOutput, b as SendPaymentSyncInput, c as SendPaymentSyncOutput, F as FinbricksSupportedBanksResponse } from '../shared/bank.FUi1SRkA.js';
|
|
3
3
|
import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
|
|
4
4
|
import { WorkflowInstanceStatus, IRPCResponse } from '@develit-io/backend-sdk';
|
|
5
5
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
@@ -2703,15 +2703,15 @@ declare const getBatchesInputSchema: z.ZodObject<{
|
|
|
2703
2703
|
filterBatchAccountId: z.ZodOptional<z.ZodUnion<readonly [z.ZodUUID, z.ZodArray<z.ZodUUID>]>>;
|
|
2704
2704
|
filterBatchStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
2705
2705
|
AUTHORIZED: "AUTHORIZED";
|
|
2706
|
-
COMPLETED: "COMPLETED";
|
|
2707
2706
|
PROCESSING: "PROCESSING";
|
|
2708
2707
|
READY_TO_SIGN: "READY_TO_SIGN";
|
|
2708
|
+
COMPLETED: "COMPLETED";
|
|
2709
2709
|
FAILED: "FAILED";
|
|
2710
2710
|
}>, z.ZodArray<z.ZodEnum<{
|
|
2711
2711
|
AUTHORIZED: "AUTHORIZED";
|
|
2712
|
-
COMPLETED: "COMPLETED";
|
|
2713
2712
|
PROCESSING: "PROCESSING";
|
|
2714
2713
|
READY_TO_SIGN: "READY_TO_SIGN";
|
|
2714
|
+
COMPLETED: "COMPLETED";
|
|
2715
2715
|
FAILED: "FAILED";
|
|
2716
2716
|
}>>]>>;
|
|
2717
2717
|
}, z.core.$strip>;
|
|
@@ -2948,19 +2948,19 @@ declare const getPaymentsInputSchema: z.ZodObject<{
|
|
|
2948
2948
|
filterPaymentDateFrom: z.ZodOptional<z.ZodDate>;
|
|
2949
2949
|
filterPaymentDateTo: z.ZodOptional<z.ZodDate>;
|
|
2950
2950
|
filterPaymentStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
2951
|
+
PROCESSING: "PROCESSING";
|
|
2951
2952
|
BOOKED: "BOOKED";
|
|
2952
2953
|
REJECTED: "REJECTED";
|
|
2953
2954
|
PENDING: "PENDING";
|
|
2954
|
-
PROCESSING: "PROCESSING";
|
|
2955
2955
|
CANCELLED: "CANCELLED";
|
|
2956
2956
|
SCHEDULED: "SCHEDULED";
|
|
2957
2957
|
HOLD: "HOLD";
|
|
2958
2958
|
INFO: "INFO";
|
|
2959
2959
|
}>, z.ZodArray<z.ZodEnum<{
|
|
2960
|
+
PROCESSING: "PROCESSING";
|
|
2960
2961
|
BOOKED: "BOOKED";
|
|
2961
2962
|
REJECTED: "REJECTED";
|
|
2962
2963
|
PENDING: "PENDING";
|
|
2963
|
-
PROCESSING: "PROCESSING";
|
|
2964
2964
|
CANCELLED: "CANCELLED";
|
|
2965
2965
|
SCHEDULED: "SCHEDULED";
|
|
2966
2966
|
HOLD: "HOLD";
|
|
@@ -3914,16 +3914,16 @@ declare const getPaymentRequestsInputSchema: z.ZodObject<{
|
|
|
3914
3914
|
filterAccountId: z.ZodOptional<z.ZodUnion<readonly [z.ZodUUID, z.ZodArray<z.ZodUUID>]>>;
|
|
3915
3915
|
filterStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
3916
3916
|
AUTHORIZED: "AUTHORIZED";
|
|
3917
|
-
OPENED: "OPENED";
|
|
3918
3917
|
COMPLETED: "COMPLETED";
|
|
3918
|
+
OPENED: "OPENED";
|
|
3919
3919
|
BOOKED: "BOOKED";
|
|
3920
3920
|
SETTLED: "SETTLED";
|
|
3921
3921
|
REJECTED: "REJECTED";
|
|
3922
3922
|
CLOSED: "CLOSED";
|
|
3923
3923
|
}>, z.ZodArray<z.ZodEnum<{
|
|
3924
3924
|
AUTHORIZED: "AUTHORIZED";
|
|
3925
|
-
OPENED: "OPENED";
|
|
3926
3925
|
COMPLETED: "COMPLETED";
|
|
3926
|
+
OPENED: "OPENED";
|
|
3927
3927
|
BOOKED: "BOOKED";
|
|
3928
3928
|
SETTLED: "SETTLED";
|
|
3929
3929
|
REJECTED: "REJECTED";
|
|
@@ -4072,6 +4072,21 @@ type GetPaymentRequestOutput = {
|
|
|
4072
4072
|
paymentRequest: PaymentRequestSelectType;
|
|
4073
4073
|
};
|
|
4074
4074
|
|
|
4075
|
+
declare const getAccountBalanceInputSchema: z.ZodObject<{
|
|
4076
|
+
accountId: z.ZodString;
|
|
4077
|
+
}, z.core.$strip>;
|
|
4078
|
+
type GetAccountBalanceInput = z.input<typeof getAccountBalanceInputSchema>;
|
|
4079
|
+
type GetAccountBalanceOutput = {
|
|
4080
|
+
balances: Array<{
|
|
4081
|
+
amount: {
|
|
4082
|
+
value: number;
|
|
4083
|
+
currency: string;
|
|
4084
|
+
};
|
|
4085
|
+
balanceType: 'AVAILABLE' | 'VALUTA' | 'GPE_AVAILABLE' | 'MULTI_AVAILABLE';
|
|
4086
|
+
balanceDate: Date;
|
|
4087
|
+
}>;
|
|
4088
|
+
};
|
|
4089
|
+
|
|
4075
4090
|
declare const BankServiceBase_base: (abstract new (ctx: ExecutionContext, env: BankEnv) => WorkerEntrypoint<BankEnv, {}>) & (abstract new (...args: any[]) => _develit_io_backend_sdk.DevelitWorkerMethods);
|
|
4076
4091
|
declare class BankServiceBase extends BankServiceBase_base {
|
|
4077
4092
|
readonly db: DrizzleD1Database<typeof tables>;
|
|
@@ -4228,6 +4243,7 @@ declare class BankServiceBase extends BankServiceBase_base {
|
|
|
4228
4243
|
*/
|
|
4229
4244
|
sendBatch(input: SendBatchInput): Promise<IRPCResponse<SendBatchOutput>>;
|
|
4230
4245
|
getBankAccounts(input: GetBankAccountsInput): Promise<IRPCResponse<GetBankAccountsOutput>>;
|
|
4246
|
+
getAccountBalance(input: GetAccountBalanceInput): Promise<IRPCResponse<GetAccountBalanceOutput>>;
|
|
4231
4247
|
updateAccount(input: UpdateAccountInput): Promise<IRPCResponse<UpdateAccountOutput>>;
|
|
4232
4248
|
disconnectAccount(input: DisconnectAccountInput): Promise<IRPCResponse<DisconnectAccountOutput>>;
|
|
4233
4249
|
getBatches(input: GetBatchesInput): Promise<IRPCResponse<GetBatchesOutput>>;
|
package/dist/export/worker.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { v as tables, I as INSTRUCTION_PRIORITIES, C as CHARGE_BEARERS, g as PAY
|
|
|
3
3
|
import { eq, sql, and, like, asc, desc, inArray, gte, lte, isNull, count } from 'drizzle-orm';
|
|
4
4
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
5
5
|
import { drizzle } from 'drizzle-orm/d1';
|
|
6
|
-
import { j as initiateConnector, g as toIncomingPayment, d as assignAccount, t as toBatchedPayment, h as toPaymentRequestInsert, a as FinbricksClient, F as FINBRICKS_ENDPOINTS } from '../shared/bank.
|
|
6
|
+
import { j as initiateConnector, g as toIncomingPayment, d as assignAccount, t as toBatchedPayment, h as toPaymentRequestInsert, a as FinbricksClient, F as FINBRICKS_ENDPOINTS } from '../shared/bank.Bo4HtOgs.mjs';
|
|
7
7
|
import 'jose';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import { CURRENCY_CODES } from '@develit-io/general-codes';
|
|
@@ -574,6 +574,10 @@ const getPaymentRequestsInputSchema = z.object({
|
|
|
574
574
|
// filterDirection: removed — payment_request is always OUTGOING
|
|
575
575
|
});
|
|
576
576
|
|
|
577
|
+
const getAccountBalanceInputSchema = z.object({
|
|
578
|
+
accountId: z.string().uuid()
|
|
579
|
+
});
|
|
580
|
+
|
|
577
581
|
var __defProp = Object.defineProperty;
|
|
578
582
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
579
583
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -1562,6 +1566,36 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
|
|
|
1562
1566
|
}
|
|
1563
1567
|
);
|
|
1564
1568
|
}
|
|
1569
|
+
async getAccountBalance(input) {
|
|
1570
|
+
return this.handleAction(
|
|
1571
|
+
{ data: input, schema: getAccountBalanceInputSchema },
|
|
1572
|
+
{ successMessage: "Account balance retrieved successfully" },
|
|
1573
|
+
async (data) => {
|
|
1574
|
+
const account = await getAccountByIdQuery(this.db, {
|
|
1575
|
+
accountId: data.accountId
|
|
1576
|
+
});
|
|
1577
|
+
if (!account) {
|
|
1578
|
+
throw createInternalError(null, {
|
|
1579
|
+
message: "Account not found",
|
|
1580
|
+
code: "VALID-B-014",
|
|
1581
|
+
status: 404
|
|
1582
|
+
});
|
|
1583
|
+
}
|
|
1584
|
+
if (!account.bankRefId) {
|
|
1585
|
+
throw createInternalError(null, {
|
|
1586
|
+
message: "Account configuration incomplete",
|
|
1587
|
+
code: "VALID-B-016",
|
|
1588
|
+
status: 400
|
|
1589
|
+
});
|
|
1590
|
+
}
|
|
1591
|
+
const connector = await this._initiateBankConnector({
|
|
1592
|
+
connectorKey: account.connectorKey,
|
|
1593
|
+
skipAccounts: false
|
|
1594
|
+
});
|
|
1595
|
+
return await connector.getAccountBalance({ account });
|
|
1596
|
+
}
|
|
1597
|
+
);
|
|
1598
|
+
}
|
|
1565
1599
|
async updateAccount(input) {
|
|
1566
1600
|
return this.handleAction(
|
|
1567
1601
|
{
|
|
@@ -1765,6 +1799,9 @@ __decorateClass([
|
|
|
1765
1799
|
__decorateClass([
|
|
1766
1800
|
action("get-bank-accounts")
|
|
1767
1801
|
], BankServiceBase.prototype, "getBankAccounts", 1);
|
|
1802
|
+
__decorateClass([
|
|
1803
|
+
action("get-account-balance")
|
|
1804
|
+
], BankServiceBase.prototype, "getAccountBalance", 1);
|
|
1768
1805
|
__decorateClass([
|
|
1769
1806
|
action("update-account")
|
|
1770
1807
|
], BankServiceBase.prototype, "updateAccount", 1);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const backendSdk = require('@develit-io/backend-sdk');
|
|
4
4
|
const database_schema = require('../shared/bank.CIWYI18z.cjs');
|
|
5
5
|
const batchLifecycle = require('../shared/bank.NF8bZBy0.cjs');
|
|
6
|
-
const mock_connector = require('../shared/bank.
|
|
6
|
+
const mock_connector = require('../shared/bank.Dk3nEc0x.cjs');
|
|
7
7
|
const drizzleOrm = require('drizzle-orm');
|
|
8
8
|
const credentialsResolver = require('../shared/bank.B0EWZbAs.cjs');
|
|
9
9
|
const cloudflare_workers = require('cloudflare:workers');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { first, uuidv4, asNonEmpty } from '@develit-io/backend-sdk';
|
|
2
2
|
import { v as tables, o as isPaymentCompleted } from '../shared/bank.C7MA33AX.mjs';
|
|
3
3
|
import { i as isBatchAuthorized, b as isBatchFailed, d as isBatchProcessing } from '../shared/bank.XqSw509X.mjs';
|
|
4
|
-
import { e as toBatchedPaymentFromPaymentRequest, i as toPreparedPayment, j as initiateConnector } from '../shared/bank.
|
|
4
|
+
import { e as toBatchedPaymentFromPaymentRequest, i as toPreparedPayment, j as initiateConnector } from '../shared/bank.Bo4HtOgs.mjs';
|
|
5
5
|
import { eq, and, inArray } from 'drizzle-orm';
|
|
6
6
|
import { g as getBatchByIdQuery, a as getPaymentRequestsByBatchIdQuery, c as checksum, u as upsertBatchCommand, b as getAccountByIdQuery, d as createCredentialsResolver, e as updatePaymentRequestStatusCommand, f as createPaymentCommand } from '../shared/bank.UBWdag5k.mjs';
|
|
7
7
|
import { WorkflowEntrypoint } from 'cloudflare:workers';
|
package/dist/export/wrangler.cjs
CHANGED
|
@@ -10,6 +10,7 @@ function defineBankServiceWrangler(config) {
|
|
|
10
10
|
name
|
|
11
11
|
}),
|
|
12
12
|
vars: {
|
|
13
|
+
...envs.local.customVars,
|
|
13
14
|
...envs.local.vars,
|
|
14
15
|
ENVIRONMENT: "localhost"
|
|
15
16
|
},
|
|
@@ -72,6 +73,7 @@ function defineBankServiceWrangler(config) {
|
|
|
72
73
|
)) {
|
|
73
74
|
base.env[envName] = {
|
|
74
75
|
vars: {
|
|
76
|
+
...envCfg.customVars,
|
|
75
77
|
...envCfg.vars,
|
|
76
78
|
ENVIRONMENT: envName
|
|
77
79
|
},
|
package/dist/export/wrangler.mjs
CHANGED
|
@@ -8,6 +8,7 @@ function defineBankServiceWrangler(config) {
|
|
|
8
8
|
name
|
|
9
9
|
}),
|
|
10
10
|
vars: {
|
|
11
|
+
...envs.local.customVars,
|
|
11
12
|
...envs.local.vars,
|
|
12
13
|
ENVIRONMENT: "localhost"
|
|
13
14
|
},
|
|
@@ -70,6 +71,7 @@ function defineBankServiceWrangler(config) {
|
|
|
70
71
|
)) {
|
|
71
72
|
base.env[envName] = {
|
|
72
73
|
vars: {
|
|
74
|
+
...envCfg.customVars,
|
|
73
75
|
...envCfg.vars,
|
|
74
76
|
ENVIRONMENT: envName
|
|
75
77
|
},
|