@develit-services/bank 0.8.1 → 0.8.3
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 +82 -6
- package/dist/database/schema.cjs +9 -7
- 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 +211 -43
- package/dist/export/worker.d.cts +23 -8
- package/dist/export/worker.d.mts +23 -8
- package/dist/export/worker.d.ts +23 -8
- package/dist/export/worker.mjs +202 -34
- package/dist/export/workflows.cjs +71 -52
- package/dist/export/workflows.mjs +71 -52
- package/dist/export/wrangler.d.cts +1 -2
- package/dist/export/wrangler.d.mts +1 -2
- package/dist/export/wrangler.d.ts +1 -2
- package/dist/shared/{bank.C0p-hLzn.d.mts → bank.BE9bK1n7.d.mts} +213 -3
- package/dist/shared/{bank.Bs7mkXbR.cjs → bank.BOnP9p9Y.cjs} +15 -2
- package/dist/shared/bank.C-T1FQxg.cjs +17 -0
- package/dist/shared/{bank.993UA65l.mjs → bank.C4VOdIx1.mjs} +57 -5
- package/dist/shared/{bank.BC06Rbrx.d.cts → bank.CQBfbG8u.d.cts} +0 -1
- package/dist/shared/{bank.BC06Rbrx.d.mts → bank.CQBfbG8u.d.mts} +0 -1
- package/dist/shared/{bank.BC06Rbrx.d.ts → bank.CQBfbG8u.d.ts} +0 -1
- package/dist/shared/{bank.Ce-NBBw1.cjs → bank.CQURey1E.cjs} +64 -7
- package/dist/shared/{bank.CGIeLo8U.mjs → bank.Cpy9PULF.mjs} +14 -3
- package/dist/shared/bank.DDHrdFgy.mjs +15 -0
- package/dist/shared/{bank.BJ7LqYtJ.d.cts → bank.DDveEfub.d.cts} +707 -126
- package/dist/shared/{bank.BJ7LqYtJ.d.mts → bank.DDveEfub.d.mts} +707 -126
- package/dist/shared/{bank.BJ7LqYtJ.d.ts → bank.DDveEfub.d.ts} +707 -126
- package/dist/shared/{bank.CeRbuycV.mjs → bank.DRrBrAdI.mjs} +62 -8
- package/dist/shared/{bank.IVhZ_RlH.cjs → bank.SQ4Mmr8u.cjs} +57 -3
- package/dist/shared/{bank.C0p-hLzn.d.ts → bank.gl4dlxWy.d.cts} +213 -3
- package/dist/shared/{bank.C0p-hLzn.d.cts → bank.pngKIcOl.d.ts} +213 -3
- package/dist/types.cjs +25 -23
- package/dist/types.d.cts +29 -180
- package/dist/types.d.mts +29 -180
- package/dist/types.d.ts +29 -180
- package/dist/types.mjs +2 -2
- package/package.json +1 -1
- package/dist/shared/bank.Cp0yvOdq.cjs +0 -15
- package/dist/shared/bank.fIGTiPnp.mjs +0 -13
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
const backendSdk = require('@develit-io/backend-sdk');
|
|
4
4
|
const drizzleOrm = require('drizzle-orm');
|
|
5
|
-
require('./bank.
|
|
5
|
+
require('./bank.SQ4Mmr8u.cjs');
|
|
6
6
|
require('date-fns');
|
|
7
7
|
require('jose');
|
|
8
8
|
require('@develit-io/general-codes');
|
|
9
9
|
const node_crypto = require('node:crypto');
|
|
10
|
-
const database_schema = require('./bank.
|
|
10
|
+
const database_schema = require('./bank.C-T1FQxg.cjs');
|
|
11
11
|
|
|
12
12
|
const createPaymentCommand = (db, { payment }) => {
|
|
13
13
|
return {
|
|
@@ -36,6 +36,13 @@ const upsertBatchCommand = (db, { batch }) => {
|
|
|
36
36
|
};
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
+
const updatePaymentRequestStatusCommand = (db, values) => {
|
|
40
|
+
const { id, ...set } = values;
|
|
41
|
+
return {
|
|
42
|
+
command: db.update(tables.paymentRequest).set(set).where(drizzleOrm.eq(tables.paymentRequest.id, id)).returning()
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
|
|
39
46
|
const getAccountByIdQuery = async (db, { accountId }) => {
|
|
40
47
|
return await db.select().from(tables.account).where(drizzleOrm.eq(tables.account.id, accountId)).get();
|
|
41
48
|
};
|
|
@@ -52,6 +59,10 @@ const getCredentialsByAccountId = async (db, encryptionKey, { accountId }) => {
|
|
|
52
59
|
} : void 0;
|
|
53
60
|
};
|
|
54
61
|
|
|
62
|
+
const getPaymentRequestsByBatchIdQuery = async (db, { batchId }) => {
|
|
63
|
+
return await db.select().from(tables.paymentRequest).where(drizzleOrm.eq(tables.paymentRequest.batchId, batchId));
|
|
64
|
+
};
|
|
65
|
+
|
|
55
66
|
async function importAesKey(base64Key) {
|
|
56
67
|
const raw = Uint8Array.from(atob(base64Key), (c) => c.charCodeAt(0));
|
|
57
68
|
return await crypto.subtle.importKey("raw", raw, { name: "AES-GCM" }, false, [
|
|
@@ -118,6 +129,8 @@ exports.createPaymentCommand = createPaymentCommand;
|
|
|
118
129
|
exports.encrypt = encrypt;
|
|
119
130
|
exports.getAccountByIdQuery = getAccountByIdQuery;
|
|
120
131
|
exports.getBatchByIdQuery = getBatchByIdQuery;
|
|
132
|
+
exports.getPaymentRequestsByBatchIdQuery = getPaymentRequestsByBatchIdQuery;
|
|
121
133
|
exports.importAesKey = importAesKey;
|
|
122
134
|
exports.tables = tables;
|
|
135
|
+
exports.updatePaymentRequestStatusCommand = updatePaymentRequestStatusCommand;
|
|
123
136
|
exports.upsertBatchCommand = upsertBatchCommand;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const paymentRequest_schema = require('./bank.SQ4Mmr8u.cjs');
|
|
4
|
+
|
|
5
|
+
const schema = {
|
|
6
|
+
__proto__: null,
|
|
7
|
+
account: paymentRequest_schema.account,
|
|
8
|
+
accountCredentials: paymentRequest_schema.accountCredentials,
|
|
9
|
+
batch: paymentRequest_schema.batch,
|
|
10
|
+
ott: paymentRequest_schema.ott,
|
|
11
|
+
payment: paymentRequest_schema.payment,
|
|
12
|
+
paymentRelations: paymentRequest_schema.paymentRelations,
|
|
13
|
+
paymentRequest: paymentRequest_schema.paymentRequest,
|
|
14
|
+
paymentRequestRelations: paymentRequest_schema.paymentRequestRelations
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.schema = schema;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { bankAccount, base } from '@develit-io/backend-sdk';
|
|
2
2
|
import { relations } from 'drizzle-orm/relations';
|
|
3
|
-
import { sqliteTable, text, integer, unique, real } from 'drizzle-orm/sqlite-core';
|
|
3
|
+
import { sqliteTable, text, integer, unique, real, index } from 'drizzle-orm/sqlite-core';
|
|
4
4
|
import 'date-fns';
|
|
5
5
|
import 'jose';
|
|
6
6
|
import { COUNTRY_CODES_2, BANK_CODES } from '@develit-io/general-codes';
|
|
@@ -12,11 +12,12 @@ const PAYMENT_TYPES = ["SEPA", "SWIFT", "DOMESTIC", "UNKNOWN"];
|
|
|
12
12
|
const CHARGE_BEARERS = ["SHA", "OUR", "BEN"];
|
|
13
13
|
const INSTRUCTION_PRIORITIES = ["NORM", "HIGH", "INST"];
|
|
14
14
|
const PAYMENT_STATUSES = [
|
|
15
|
+
"CREATED",
|
|
15
16
|
"PREPARED",
|
|
16
|
-
"
|
|
17
|
+
"SIGNED",
|
|
17
18
|
"PENDING",
|
|
18
19
|
"COMPLETED",
|
|
19
|
-
"
|
|
20
|
+
"FAILED"
|
|
20
21
|
];
|
|
21
22
|
const PAYMENT_DIRECTIONS = ["INCOMING", "OUTGOING"];
|
|
22
23
|
const BATCH_STATUSES = [
|
|
@@ -124,7 +125,6 @@ const batch = sqliteTable("batch", {
|
|
|
124
125
|
status: text("status", { enum: BATCH_STATUSES }).$type(),
|
|
125
126
|
statusReason: text("status_reason"),
|
|
126
127
|
statusResponse: text("status_response", { mode: "json" }).$type(),
|
|
127
|
-
payments: text("payments", { mode: "json" }).$type().notNull(),
|
|
128
128
|
metadata: text("metadata", { mode: "json" }).$type(),
|
|
129
129
|
paymentType: text("payment_type", {
|
|
130
130
|
enum: PAYMENT_TYPES
|
|
@@ -178,4 +178,56 @@ const paymentRelations = relations(payment, ({ one }) => ({
|
|
|
178
178
|
batch: one(batch, { fields: [payment.batchId], references: [batch.id] })
|
|
179
179
|
}));
|
|
180
180
|
|
|
181
|
-
|
|
181
|
+
const paymentRequest = sqliteTable(
|
|
182
|
+
"payment_request",
|
|
183
|
+
{
|
|
184
|
+
...base,
|
|
185
|
+
batchId: text("batch_id").references(() => batch.id, {
|
|
186
|
+
onDelete: "restrict",
|
|
187
|
+
onUpdate: "cascade"
|
|
188
|
+
}),
|
|
189
|
+
accountId: text("account_id").references(() => account.id, {
|
|
190
|
+
onDelete: "restrict",
|
|
191
|
+
onUpdate: "cascade"
|
|
192
|
+
}).notNull(),
|
|
193
|
+
correlationId: text("correlation_id").notNull(),
|
|
194
|
+
refId: text("ref_id"),
|
|
195
|
+
bankRefId: text("bank_ref_id"),
|
|
196
|
+
connectorKey: text("connector_key", { enum: CONNECTOR_KEYS }).$type().notNull(),
|
|
197
|
+
amount: real("amount").notNull(),
|
|
198
|
+
paymentType: text("payment_type", { enum: PAYMENT_TYPES }).$type().notNull(),
|
|
199
|
+
currency: text("currency").$type().notNull(),
|
|
200
|
+
status: text("status", { enum: PAYMENT_STATUSES }).$type().notNull(),
|
|
201
|
+
statusReason: text("status_reason"),
|
|
202
|
+
authorizationUrl: text("authorization_url"),
|
|
203
|
+
initiatedAt: integer("initiated_at", { mode: "timestamp_ms" }),
|
|
204
|
+
processedAt: integer("processed_at", { mode: "timestamp_ms" }),
|
|
205
|
+
vs: text("vs"),
|
|
206
|
+
ss: text("ss"),
|
|
207
|
+
ks: text("ks"),
|
|
208
|
+
message: text("message"),
|
|
209
|
+
chargeBearer: text("charge_bearer", {
|
|
210
|
+
enum: CHARGE_BEARERS
|
|
211
|
+
}).$type(),
|
|
212
|
+
instructionPriority: text("instruction_priority", {
|
|
213
|
+
enum: INSTRUCTION_PRIORITIES
|
|
214
|
+
}).$type(),
|
|
215
|
+
creditor: text("creditor", { mode: "json" }).$type().notNull(),
|
|
216
|
+
creditorIban: text("creditor_iban"),
|
|
217
|
+
debtor: text("debtor", { mode: "json" }).$type().notNull(),
|
|
218
|
+
debtorIban: text("debtor_iban")
|
|
219
|
+
},
|
|
220
|
+
(t) => [index("payment_request_batch_id_idx").on(t.batchId)]
|
|
221
|
+
);
|
|
222
|
+
const paymentRequestRelations = relations(paymentRequest, ({ one }) => ({
|
|
223
|
+
batch: one(batch, {
|
|
224
|
+
fields: [paymentRequest.batchId],
|
|
225
|
+
references: [batch.id]
|
|
226
|
+
}),
|
|
227
|
+
account: one(account, {
|
|
228
|
+
fields: [paymentRequest.accountId],
|
|
229
|
+
references: [account.id]
|
|
230
|
+
})
|
|
231
|
+
}));
|
|
232
|
+
|
|
233
|
+
export { ACCOUNT_STATUSES as A, BATCH_STATUSES as B, CHARGE_BEARERS as C, INSTRUCTION_PRIORITIES as I, PAYMENT_DIRECTIONS as P, TOKEN_TYPES as T, CONNECTOR_KEYS as a, COUNTRY_CODES as b, CREDENTIALS_TYPES as c, PAYMENT_STATUSES as d, PAYMENT_TYPES as e, accountCredentialsInsertSchema as f, accountCredentialsSelectSchema as g, accountCredentialsUpdateSchema as h, accountInsertSchema as i, accountSelectSchema as j, accountUpdateSchema as k, ottSelectSchema as l, ottUpdateSchema as m, account as n, ottInsertSchema as o, accountCredentials as p, batch as q, ott as r, payment as s, paymentRelations as t, paymentRequest as u, paymentRequestRelations as v };
|
|
@@ -27,7 +27,6 @@ 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_PAYMENTS_PROCESSING: string;
|
|
31
30
|
BANK_AUTH_RECIPIENT: string;
|
|
32
31
|
DBUCS_BASE_URI: string;
|
|
33
32
|
DBUCS_USERNAME: string;
|
|
@@ -27,7 +27,6 @@ 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_PAYMENTS_PROCESSING: string;
|
|
31
30
|
BANK_AUTH_RECIPIENT: string;
|
|
32
31
|
DBUCS_BASE_URI: string;
|
|
33
32
|
DBUCS_USERNAME: string;
|
|
@@ -27,7 +27,6 @@ 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_PAYMENTS_PROCESSING: string;
|
|
31
30
|
BANK_AUTH_RECIPIENT: string;
|
|
32
31
|
DBUCS_BASE_URI: string;
|
|
33
32
|
DBUCS_USERNAME: string;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const backendSdk = require('@develit-io/backend-sdk');
|
|
4
4
|
const dateFns = require('date-fns');
|
|
5
5
|
const generalCodes = require('@develit-io/general-codes');
|
|
6
|
-
require('./bank.
|
|
6
|
+
require('./bank.SQ4Mmr8u.cjs');
|
|
7
7
|
require('drizzle-orm');
|
|
8
8
|
const jose = require('jose');
|
|
9
9
|
require('node:crypto');
|
|
@@ -65,6 +65,58 @@ function toCompletedPayment(payment, status, bankRefId, processedAt) {
|
|
|
65
65
|
function batchTransform(payments, transformer) {
|
|
66
66
|
return payments.map(transformer);
|
|
67
67
|
}
|
|
68
|
+
function toPaymentRequestInsert(payment, batchId) {
|
|
69
|
+
return {
|
|
70
|
+
id: payment.id,
|
|
71
|
+
batchId,
|
|
72
|
+
accountId: payment.accountId,
|
|
73
|
+
correlationId: payment.correlationId,
|
|
74
|
+
refId: payment.refId ?? null,
|
|
75
|
+
connectorKey: payment.connectorKey,
|
|
76
|
+
amount: payment.amount,
|
|
77
|
+
paymentType: payment.paymentType,
|
|
78
|
+
currency: payment.currency,
|
|
79
|
+
status: "CREATED",
|
|
80
|
+
vs: payment.vs ?? null,
|
|
81
|
+
ss: payment.ss ?? null,
|
|
82
|
+
ks: payment.ks ?? null,
|
|
83
|
+
message: payment.message ?? null,
|
|
84
|
+
chargeBearer: payment.chargeBearer,
|
|
85
|
+
instructionPriority: payment.instructionPriority,
|
|
86
|
+
creditor: payment.creditor,
|
|
87
|
+
creditorIban: payment.creditorIban ?? null,
|
|
88
|
+
debtor: payment.debtor,
|
|
89
|
+
debtorIban: payment.debtorIban ?? null
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function toBatchedPaymentFromPaymentRequest(sp) {
|
|
93
|
+
return {
|
|
94
|
+
id: sp.id,
|
|
95
|
+
correlationId: sp.correlationId,
|
|
96
|
+
refId: sp.refId,
|
|
97
|
+
accountId: sp.accountId,
|
|
98
|
+
connectorKey: sp.connectorKey,
|
|
99
|
+
amount: sp.amount,
|
|
100
|
+
direction: "OUTGOING",
|
|
101
|
+
paymentType: sp.paymentType,
|
|
102
|
+
currency: sp.currency,
|
|
103
|
+
status: "CREATED",
|
|
104
|
+
statusReason: sp.statusReason,
|
|
105
|
+
batchId: sp.batchId,
|
|
106
|
+
initiatedAt: sp.initiatedAt,
|
|
107
|
+
processedAt: sp.processedAt,
|
|
108
|
+
vs: sp.vs,
|
|
109
|
+
ss: sp.ss,
|
|
110
|
+
ks: sp.ks,
|
|
111
|
+
message: sp.message,
|
|
112
|
+
chargeBearer: sp.chargeBearer,
|
|
113
|
+
instructionPriority: sp.instructionPriority,
|
|
114
|
+
creditor: sp.creditor,
|
|
115
|
+
creditorIban: sp.creditorIban,
|
|
116
|
+
debtor: sp.debtor,
|
|
117
|
+
debtorIban: sp.debtorIban
|
|
118
|
+
};
|
|
119
|
+
}
|
|
68
120
|
|
|
69
121
|
class IBankConnector {
|
|
70
122
|
// ── Deprecated methods (backward compatibility) ────────────────────
|
|
@@ -79,7 +131,7 @@ class IBankConnector {
|
|
|
79
131
|
* @deprecated Use initiateDomesticPayment instead.
|
|
80
132
|
* Delegates to initiateDomesticPayment for backward compatibility.
|
|
81
133
|
*/
|
|
82
|
-
|
|
134
|
+
initiatePaymentRequest(payment) {
|
|
83
135
|
return this.initiateDomesticPayment(payment);
|
|
84
136
|
}
|
|
85
137
|
// ── Batch methods ─────────────────────────────────────────────────
|
|
@@ -252,7 +304,8 @@ const FINBRICKS_ENDPOINTS = {
|
|
|
252
304
|
TRANSACTION_SEPA_INIT: "/transaction/platform/sepa/init",
|
|
253
305
|
TRANSACTION_FOREIGN_INIT: "/transaction/platform/foreign/init",
|
|
254
306
|
TRANSACTION_BATCH_INIT: "/transaction/platform/batchPayment/init",
|
|
255
|
-
BATCH_STATUS: "/transaction/platform/batchPayment/status"
|
|
307
|
+
BATCH_STATUS: "/transaction/platform/batchPayment/status",
|
|
308
|
+
BANK_INFO: "/status/bankInfo"
|
|
256
309
|
};
|
|
257
310
|
|
|
258
311
|
const mapFinbricksStatus = (status) => {
|
|
@@ -659,7 +712,7 @@ class FinbricksConnector extends IBankConnector {
|
|
|
659
712
|
},
|
|
660
713
|
creditorName: payment.creditor.holderName || ""
|
|
661
714
|
},
|
|
662
|
-
callbackUrl:
|
|
715
|
+
callbackUrl: `${this.finbricks.REDIRECT_URI}?type=payment&paymentId=${payment.id}`
|
|
663
716
|
}
|
|
664
717
|
})
|
|
665
718
|
);
|
|
@@ -700,7 +753,8 @@ class FinbricksConnector extends IBankConnector {
|
|
|
700
753
|
clientId
|
|
701
754
|
},
|
|
702
755
|
paymentIdentification: {
|
|
703
|
-
merchantTransactionId: bankRefId
|
|
756
|
+
merchantTransactionId: bankRefId,
|
|
757
|
+
endToEndIdentification: payment.id
|
|
704
758
|
},
|
|
705
759
|
amount: payment.amount,
|
|
706
760
|
debtor: {
|
|
@@ -712,7 +766,7 @@ class FinbricksConnector extends IBankConnector {
|
|
|
712
766
|
creditorAccountIban: payment.creditor.iban,
|
|
713
767
|
creditorName: payment.creditor.holderName
|
|
714
768
|
},
|
|
715
|
-
callbackUrl:
|
|
769
|
+
callbackUrl: `${this.finbricks.REDIRECT_URI}?type=payment&paymentId=${payment.id}`
|
|
716
770
|
}
|
|
717
771
|
})
|
|
718
772
|
);
|
|
@@ -751,7 +805,7 @@ class FinbricksConnector extends IBankConnector {
|
|
|
751
805
|
creditorName: payment.creditor.holderName,
|
|
752
806
|
description: payment.message,
|
|
753
807
|
variableSymbol: payment.vs,
|
|
754
|
-
callbackUrl:
|
|
808
|
+
callbackUrl: `${this.finbricks.REDIRECT_URI}?type=payment&paymentId=${payment.id}`,
|
|
755
809
|
paymentProvider: this.PROVIDER
|
|
756
810
|
}
|
|
757
811
|
})
|
|
@@ -1988,9 +2042,12 @@ exports.MockConnector = MockConnector;
|
|
|
1988
2042
|
exports.assignAccount = assignAccount;
|
|
1989
2043
|
exports.batchTransform = batchTransform;
|
|
1990
2044
|
exports.initiateConnector = initiateConnector;
|
|
2045
|
+
exports.mapFinbricksTransactionStatus = mapFinbricksTransactionStatus;
|
|
1991
2046
|
exports.signFinbricksJws = signFinbricksJws;
|
|
1992
2047
|
exports.toBatchedPayment = toBatchedPayment;
|
|
2048
|
+
exports.toBatchedPaymentFromPaymentRequest = toBatchedPaymentFromPaymentRequest;
|
|
1993
2049
|
exports.toCompletedPayment = toCompletedPayment;
|
|
1994
2050
|
exports.toIncomingPayment = toIncomingPayment;
|
|
2051
|
+
exports.toPaymentRequestInsert = toPaymentRequestInsert;
|
|
1995
2052
|
exports.toPreparedPayment = toPreparedPayment;
|
|
1996
2053
|
exports.useFinbricksFetch = useFinbricksFetch;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { uuidv4 } from '@develit-io/backend-sdk';
|
|
2
2
|
import { eq } from 'drizzle-orm';
|
|
3
|
-
import './bank.
|
|
3
|
+
import './bank.C4VOdIx1.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.DDHrdFgy.mjs';
|
|
9
9
|
|
|
10
10
|
const createPaymentCommand = (db, { payment }) => {
|
|
11
11
|
return {
|
|
@@ -34,6 +34,13 @@ const upsertBatchCommand = (db, { batch }) => {
|
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
+
const updatePaymentRequestStatusCommand = (db, values) => {
|
|
38
|
+
const { id, ...set } = values;
|
|
39
|
+
return {
|
|
40
|
+
command: db.update(tables.paymentRequest).set(set).where(eq(tables.paymentRequest.id, id)).returning()
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
|
|
37
44
|
const getAccountByIdQuery = async (db, { accountId }) => {
|
|
38
45
|
return await db.select().from(tables.account).where(eq(tables.account.id, accountId)).get();
|
|
39
46
|
};
|
|
@@ -50,6 +57,10 @@ const getCredentialsByAccountId = async (db, encryptionKey, { accountId }) => {
|
|
|
50
57
|
} : void 0;
|
|
51
58
|
};
|
|
52
59
|
|
|
60
|
+
const getPaymentRequestsByBatchIdQuery = async (db, { batchId }) => {
|
|
61
|
+
return await db.select().from(tables.paymentRequest).where(eq(tables.paymentRequest.batchId, batchId));
|
|
62
|
+
};
|
|
63
|
+
|
|
53
64
|
async function importAesKey(base64Key) {
|
|
54
65
|
const raw = Uint8Array.from(atob(base64Key), (c) => c.charCodeAt(0));
|
|
55
66
|
return await crypto.subtle.importKey("raw", raw, { name: "AES-GCM" }, false, [
|
|
@@ -110,4 +121,4 @@ const createCredentialsResolver = async (db, env) => {
|
|
|
110
121
|
|
|
111
122
|
const tables = schema;
|
|
112
123
|
|
|
113
|
-
export {
|
|
124
|
+
export { getPaymentRequestsByBatchIdQuery as a, getAccountByIdQuery as b, checksum as c, createCredentialsResolver as d, updatePaymentRequestStatusCommand as e, createPaymentCommand as f, getBatchByIdQuery as g, encrypt as h, importAesKey as i, tables as t, upsertBatchCommand as u };
|
|
@@ -0,0 +1,15 @@
|
|
|
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.C4VOdIx1.mjs';
|
|
2
|
+
|
|
3
|
+
const schema = {
|
|
4
|
+
__proto__: null,
|
|
5
|
+
account: account,
|
|
6
|
+
accountCredentials: accountCredentials,
|
|
7
|
+
batch: batch,
|
|
8
|
+
ott: ott,
|
|
9
|
+
payment: payment,
|
|
10
|
+
paymentRelations: paymentRelations,
|
|
11
|
+
paymentRequest: paymentRequest,
|
|
12
|
+
paymentRequestRelations: paymentRequestRelations
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { schema as s };
|