@develit-services/ledger 0.3.6 → 0.4.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/dist/database/schema.cjs +2 -2
- 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 +2 -2
- package/dist/export/worker.cjs +190 -18
- package/dist/export/worker.d.cts +8 -2
- package/dist/export/worker.d.mts +8 -2
- package/dist/export/worker.d.ts +8 -2
- package/dist/export/worker.mjs +190 -18
- package/dist/shared/{ledger.CclKAyrw.d.ts → ledger.BtCTt25C.d.cts} +37 -8
- package/dist/shared/{ledger.CclKAyrw.d.mts → ledger.BtCTt25C.d.mts} +37 -8
- package/dist/shared/{ledger.CclKAyrw.d.cts → ledger.BtCTt25C.d.ts} +37 -8
- package/dist/shared/{ledger.DOcqPJUV.cjs → ledger.C4eXkZIj.cjs} +2 -1
- package/dist/shared/{ledger.qc5F0gBL.cjs → ledger.CAoxOU3F.cjs} +15 -3
- package/dist/shared/{ledger.QqlD3imC.d.mts → ledger.D_QC9ub6.d.mts} +35 -8
- package/dist/shared/{ledger.DvlQNN83.mjs → ledger.De19PrJa.mjs} +15 -4
- package/dist/shared/{ledger.CGMCq9Gr.mjs → ledger.Dpxzz64a.mjs} +2 -1
- package/dist/shared/{ledger.CWua2AX5.d.cts → ledger.WHp2MLCf.d.cts} +35 -8
- package/dist/shared/{ledger.BEmulMH8.d.ts → ledger.ZADe_DAC.d.ts} +35 -8
- package/dist/types.cjs +2 -1
- package/dist/types.d.cts +5 -4
- package/dist/types.d.mts +5 -4
- package/dist/types.d.ts +5 -4
- package/dist/types.mjs +1 -1
- package/package.json +2 -2
package/dist/database/schema.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const database_schema = require('../shared/ledger.
|
|
3
|
+
const database_schema = require('../shared/ledger.C4eXkZIj.cjs');
|
|
4
4
|
require('@develit-io/backend-sdk');
|
|
5
5
|
require('drizzle-orm');
|
|
6
6
|
require('drizzle-orm/sqlite-core');
|
|
7
|
-
require('../shared/ledger.
|
|
7
|
+
require('../shared/ledger.CAoxOU3F.cjs');
|
|
8
8
|
require('zod');
|
|
9
9
|
require('@develit-io/general-codes');
|
|
10
10
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { G as account, H as accountIdentifier, J as accountIdentifierMapping, K as accountIdentifierMappingRelations, L as accountIdentifierRelations, M as accountRelations, N as entry, O as transaction } from '../shared/ledger.
|
|
1
|
+
export { G as account, H as accountIdentifier, J as accountIdentifierMapping, K as accountIdentifierMappingRelations, L as accountIdentifierRelations, M as accountRelations, N as entry, O as transaction } from '../shared/ledger.BtCTt25C.cjs';
|
|
2
2
|
import 'drizzle-orm';
|
|
3
3
|
import 'drizzle-orm/sqlite-core';
|
|
4
4
|
import '@develit-io/backend-sdk';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { G as account, H as accountIdentifier, J as accountIdentifierMapping, K as accountIdentifierMappingRelations, L as accountIdentifierRelations, M as accountRelations, N as entry, O as transaction } from '../shared/ledger.
|
|
1
|
+
export { G as account, H as accountIdentifier, J as accountIdentifierMapping, K as accountIdentifierMappingRelations, L as accountIdentifierRelations, M as accountRelations, N as entry, O as transaction } from '../shared/ledger.BtCTt25C.mjs';
|
|
2
2
|
import 'drizzle-orm';
|
|
3
3
|
import 'drizzle-orm/sqlite-core';
|
|
4
4
|
import '@develit-io/backend-sdk';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { G as account, H as accountIdentifier, J as accountIdentifierMapping, K as accountIdentifierMappingRelations, L as accountIdentifierRelations, M as accountRelations, N as entry, O as transaction } from '../shared/ledger.
|
|
1
|
+
export { G as account, H as accountIdentifier, J as accountIdentifierMapping, K as accountIdentifierMappingRelations, L as accountIdentifierRelations, M as accountRelations, N as entry, O as transaction } from '../shared/ledger.BtCTt25C.js';
|
|
2
2
|
import 'drizzle-orm';
|
|
3
3
|
import 'drizzle-orm/sqlite-core';
|
|
4
4
|
import '@develit-io/backend-sdk';
|
package/dist/database/schema.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { a as account, b as accountIdentifier, c as accountIdentifierMapping, d as accountIdentifierMappingRelations, e as accountIdentifierRelations, f as accountRelations, g as entry, t as transaction } from '../shared/ledger.
|
|
1
|
+
export { a as account, b as accountIdentifier, c as accountIdentifierMapping, d as accountIdentifierMappingRelations, e as accountIdentifierRelations, f as accountRelations, g as entry, t as transaction } from '../shared/ledger.Dpxzz64a.mjs';
|
|
2
2
|
import '@develit-io/backend-sdk';
|
|
3
3
|
import 'drizzle-orm';
|
|
4
4
|
import 'drizzle-orm/sqlite-core';
|
|
5
|
-
import '../shared/ledger.
|
|
5
|
+
import '../shared/ledger.De19PrJa.mjs';
|
|
6
6
|
import 'zod';
|
|
7
7
|
import '@develit-io/general-codes';
|
package/dist/export/worker.cjs
CHANGED
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const backendSdk = require('@develit-io/backend-sdk');
|
|
6
6
|
const cloudflare_workers = require('cloudflare:workers');
|
|
7
7
|
const d1 = require('drizzle-orm/d1');
|
|
8
|
-
const database_schema = require('../shared/ledger.
|
|
8
|
+
const database_schema = require('../shared/ledger.C4eXkZIj.cjs');
|
|
9
9
|
const drizzleOrm = require('drizzle-orm');
|
|
10
|
-
const updateTransactionStatus = require('../shared/ledger.
|
|
10
|
+
const updateTransactionStatus = require('../shared/ledger.CAoxOU3F.cjs');
|
|
11
11
|
require('@develit-io/general-codes');
|
|
12
12
|
require('drizzle-orm/sqlite-core');
|
|
13
13
|
require('zod');
|
|
@@ -30,6 +30,11 @@ const deleteAccountCommand = async (db, id) => {
|
|
|
30
30
|
return { accountIdentifierMappingCommand, accountCommand };
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
+
const deleteTransactionCommand = (db, transactionId) => {
|
|
34
|
+
const command = db.delete(tables.transaction).where(drizzleOrm.eq(tables.transaction.id, transactionId));
|
|
35
|
+
return { command };
|
|
36
|
+
};
|
|
37
|
+
|
|
33
38
|
const linkAccountIdentifierCommand = async (db, accountId, identifierId) => {
|
|
34
39
|
const command = db.insert(tables.accountIdentifierMapping).values({ accountId, identifierId }).returning();
|
|
35
40
|
return { command };
|
|
@@ -41,13 +46,23 @@ const updateAccountCommand = async (db, id, input) => {
|
|
|
41
46
|
};
|
|
42
47
|
|
|
43
48
|
const updateTransactionStatusCommand = (db, data) => {
|
|
44
|
-
const {
|
|
49
|
+
const {
|
|
50
|
+
transactionId,
|
|
51
|
+
status,
|
|
52
|
+
paymentId,
|
|
53
|
+
completedAt,
|
|
54
|
+
statusReason,
|
|
55
|
+
receivedValue,
|
|
56
|
+
metadata
|
|
57
|
+
} = data;
|
|
45
58
|
const command = db.update(tables.transaction).set({
|
|
46
59
|
status,
|
|
47
60
|
statusReason,
|
|
48
61
|
updatedAt: /* @__PURE__ */ new Date(),
|
|
49
62
|
completedAt,
|
|
50
|
-
paymentId
|
|
63
|
+
paymentId,
|
|
64
|
+
...receivedValue !== void 0 && { receivedValue },
|
|
65
|
+
...metadata !== void 0 && { metadata }
|
|
51
66
|
}).where(drizzleOrm.eq(tables.transaction.id, transactionId)).returning();
|
|
52
67
|
return { command };
|
|
53
68
|
};
|
|
@@ -237,6 +252,7 @@ const getTransactionsWithPaginationQuery = async ({
|
|
|
237
252
|
filterTransactionDateTo,
|
|
238
253
|
filterTransactionCompletedAt,
|
|
239
254
|
filterTransactionStatus,
|
|
255
|
+
filterTransactionStatuses,
|
|
240
256
|
search
|
|
241
257
|
}
|
|
242
258
|
}) => {
|
|
@@ -257,7 +273,8 @@ const getTransactionsWithPaginationQuery = async ({
|
|
|
257
273
|
filterTransactionDateFrom ? drizzleOrm.gte(tables.transaction.createdAt, filterTransactionDateFrom) : void 0,
|
|
258
274
|
filterTransactionDateTo ? drizzleOrm.lte(tables.transaction.createdAt, filterTransactionDateTo) : void 0,
|
|
259
275
|
filterTransactionCompletedAt ? drizzleOrm.eq(tables.transaction.completedAt, filterTransactionCompletedAt) : void 0,
|
|
260
|
-
filterTransactionStatus ? drizzleOrm.eq(tables.transaction.status, filterTransactionStatus) : void 0
|
|
276
|
+
filterTransactionStatus ? drizzleOrm.eq(tables.transaction.status, filterTransactionStatus) : void 0,
|
|
277
|
+
filterTransactionStatuses?.length ? drizzleOrm.inArray(tables.transaction.status, filterTransactionStatuses) : void 0
|
|
261
278
|
);
|
|
262
279
|
const sortColumn = resolveColumn(tables.transaction, sort.column);
|
|
263
280
|
const [{ totalCount }] = await db.select({ totalCount: drizzleOrm.sql`count(*)` }).from(tables.transaction).where(whereConditions);
|
|
@@ -395,12 +412,75 @@ let LedgerServiceBase = class extends backendSdk.develitWorker(
|
|
|
395
412
|
}
|
|
396
413
|
);
|
|
397
414
|
}
|
|
415
|
+
/**
|
|
416
|
+
* Internal method that applies match amount logic to a transaction.
|
|
417
|
+
* Shared by matchTransaction and resolveUnmatchedTransaction.
|
|
418
|
+
*/
|
|
419
|
+
async _applyMatchAmount({
|
|
420
|
+
existingTransaction,
|
|
421
|
+
paymentId,
|
|
422
|
+
amount,
|
|
423
|
+
completedAt,
|
|
424
|
+
extraMetadata
|
|
425
|
+
}) {
|
|
426
|
+
const transactionId = existingTransaction.id;
|
|
427
|
+
if (amount !== void 0) {
|
|
428
|
+
const previousReceived = existingTransaction.receivedValue ?? 0;
|
|
429
|
+
const newReceivedValue = previousReceived + amount;
|
|
430
|
+
const expectedValue = existingTransaction.value ?? 0;
|
|
431
|
+
const isFullyMatched = newReceivedValue >= expectedValue;
|
|
432
|
+
const matchEntry = {
|
|
433
|
+
paymentId,
|
|
434
|
+
amount,
|
|
435
|
+
matchedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
436
|
+
};
|
|
437
|
+
const existingMatches = existingTransaction.metadata?.partialMatches ?? [];
|
|
438
|
+
const updatedMetadata = {
|
|
439
|
+
...existingTransaction.metadata,
|
|
440
|
+
...extraMetadata,
|
|
441
|
+
partialMatches: [...existingMatches, matchEntry]
|
|
442
|
+
};
|
|
443
|
+
const transaction2 = await updateTransactionStatusCommand(this.db, {
|
|
444
|
+
transactionId,
|
|
445
|
+
status: isFullyMatched ? "MATCHED" : "PARTIALLY_MATCHED",
|
|
446
|
+
completedAt: isFullyMatched ? completedAt : void 0,
|
|
447
|
+
paymentId,
|
|
448
|
+
receivedValue: newReceivedValue,
|
|
449
|
+
metadata: updatedMetadata
|
|
450
|
+
}).command.execute().then(backendSdk.first);
|
|
451
|
+
if (!transaction2) {
|
|
452
|
+
throw backendSdk.createInternalError(null, {
|
|
453
|
+
message: "Failed to update transaction",
|
|
454
|
+
status: 500,
|
|
455
|
+
code: "INTERNAL_ERROR"
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
return {
|
|
459
|
+
transaction: transaction2,
|
|
460
|
+
signal: isFullyMatched ? "matched" : "partiallyMatched"
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
const transaction = await updateTransactionStatusCommand(this.db, {
|
|
464
|
+
transactionId,
|
|
465
|
+
status: "MATCHED",
|
|
466
|
+
completedAt,
|
|
467
|
+
paymentId
|
|
468
|
+
}).command.execute().then(backendSdk.first);
|
|
469
|
+
if (!transaction) {
|
|
470
|
+
throw backendSdk.createInternalError(null, {
|
|
471
|
+
message: "Failed to update transaction",
|
|
472
|
+
status: 500,
|
|
473
|
+
code: "INTERNAL_ERROR"
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
return { transaction, signal: "matched" };
|
|
477
|
+
}
|
|
398
478
|
async matchTransaction(input) {
|
|
399
479
|
return this.handleAction(
|
|
400
480
|
{ data: input, schema: updateTransactionStatus.matchTransactionInputSchema },
|
|
401
481
|
{ successMessage: "Transaction successfully matched." },
|
|
402
482
|
async (params) => {
|
|
403
|
-
const { transactionId, completedAt, paymentId } = params;
|
|
483
|
+
const { transactionId, completedAt, paymentId, amount } = params;
|
|
404
484
|
const existingTransaction = await getTransactionByIdQuery(
|
|
405
485
|
this.db,
|
|
406
486
|
transactionId
|
|
@@ -412,24 +492,112 @@ let LedgerServiceBase = class extends backendSdk.develitWorker(
|
|
|
412
492
|
code: "NOT_FOUND"
|
|
413
493
|
});
|
|
414
494
|
}
|
|
415
|
-
|
|
416
|
-
transactionId,
|
|
417
|
-
status: "MATCHED",
|
|
418
|
-
completedAt,
|
|
419
|
-
paymentId
|
|
420
|
-
}).command.execute().then(backendSdk.first);
|
|
421
|
-
if (!transaction) {
|
|
495
|
+
if (existingTransaction.status !== "WAITING_FOR_PAYMENT" && existingTransaction.status !== "PARTIALLY_MATCHED") {
|
|
422
496
|
throw backendSdk.createInternalError(null, {
|
|
423
|
-
message:
|
|
424
|
-
status:
|
|
425
|
-
code: "
|
|
497
|
+
message: `Transaction is in status ${existingTransaction.status}, expected WAITING_FOR_PAYMENT or PARTIALLY_MATCHED`,
|
|
498
|
+
status: 400,
|
|
499
|
+
code: "INVALID_STATUS"
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
const { transaction, signal } = await this._applyMatchAmount({
|
|
503
|
+
existingTransaction,
|
|
504
|
+
paymentId,
|
|
505
|
+
amount,
|
|
506
|
+
completedAt
|
|
507
|
+
});
|
|
508
|
+
await this.pushToQueue(
|
|
509
|
+
this.env.QUEUE_BUS_QUEUE,
|
|
510
|
+
{
|
|
511
|
+
eventType: "LEDGER_TRANSACTION",
|
|
512
|
+
eventSignal: signal,
|
|
513
|
+
ledgerTransaction: transaction,
|
|
514
|
+
metadata: {
|
|
515
|
+
correlationId: backendSdk.uuidv4(),
|
|
516
|
+
entityId: transaction.id,
|
|
517
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
);
|
|
521
|
+
return transaction;
|
|
522
|
+
}
|
|
523
|
+
);
|
|
524
|
+
}
|
|
525
|
+
async resolveUnmatchedTransaction(input) {
|
|
526
|
+
return this.handleAction(
|
|
527
|
+
{ data: input, schema: updateTransactionStatus.resolveUnmatchedTransactionInputSchema },
|
|
528
|
+
{ successMessage: "Unmatched transaction successfully resolved." },
|
|
529
|
+
async (params) => {
|
|
530
|
+
const {
|
|
531
|
+
unmatchedTransactionId,
|
|
532
|
+
targetTransactionId,
|
|
533
|
+
note,
|
|
534
|
+
performedBy
|
|
535
|
+
} = params;
|
|
536
|
+
const unmatchedTx = await getTransactionByIdQuery(
|
|
537
|
+
this.db,
|
|
538
|
+
unmatchedTransactionId
|
|
539
|
+
);
|
|
540
|
+
if (!unmatchedTx) {
|
|
541
|
+
throw backendSdk.createInternalError(null, {
|
|
542
|
+
message: "Unmatched transaction not found",
|
|
543
|
+
status: 404,
|
|
544
|
+
code: "NOT_FOUND"
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
if (unmatchedTx.type !== "UNMATCHED") {
|
|
548
|
+
throw backendSdk.createInternalError(null, {
|
|
549
|
+
message: `Transaction type is ${unmatchedTx.type}, expected UNMATCHED`,
|
|
550
|
+
status: 400,
|
|
551
|
+
code: "INVALID_TYPE"
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
if (unmatchedTx.status !== "WAITING_FOR_MANUAL_PROCESSING") {
|
|
555
|
+
throw backendSdk.createInternalError(null, {
|
|
556
|
+
message: `Unmatched transaction is in status ${unmatchedTx.status}, expected WAITING_FOR_MANUAL_PROCESSING`,
|
|
557
|
+
status: 400,
|
|
558
|
+
code: "INVALID_STATUS"
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
const targetTx = await getTransactionByIdQuery(
|
|
562
|
+
this.db,
|
|
563
|
+
targetTransactionId
|
|
564
|
+
);
|
|
565
|
+
if (!targetTx) {
|
|
566
|
+
throw backendSdk.createInternalError(null, {
|
|
567
|
+
message: "Target transaction not found",
|
|
568
|
+
status: 404,
|
|
569
|
+
code: "NOT_FOUND"
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
if (targetTx.status !== "WAITING_FOR_PAYMENT" && targetTx.status !== "PARTIALLY_MATCHED") {
|
|
573
|
+
throw backendSdk.createInternalError(null, {
|
|
574
|
+
message: `Target transaction is in status ${targetTx.status}, expected WAITING_FOR_PAYMENT or PARTIALLY_MATCHED`,
|
|
575
|
+
status: 400,
|
|
576
|
+
code: "INVALID_STATUS"
|
|
426
577
|
});
|
|
427
578
|
}
|
|
579
|
+
const amount = unmatchedTx.value ?? 0;
|
|
580
|
+
const paymentId = unmatchedTx.paymentId ?? unmatchedTx.id;
|
|
581
|
+
const { transaction, signal } = await this._applyMatchAmount({
|
|
582
|
+
existingTransaction: targetTx,
|
|
583
|
+
paymentId,
|
|
584
|
+
amount,
|
|
585
|
+
completedAt: /* @__PURE__ */ new Date(),
|
|
586
|
+
extraMetadata: {
|
|
587
|
+
note,
|
|
588
|
+
performedBy
|
|
589
|
+
}
|
|
590
|
+
});
|
|
591
|
+
const { command } = deleteTransactionCommand(
|
|
592
|
+
this.db,
|
|
593
|
+
unmatchedTransactionId
|
|
594
|
+
);
|
|
595
|
+
await command.execute();
|
|
428
596
|
await this.pushToQueue(
|
|
429
597
|
this.env.QUEUE_BUS_QUEUE,
|
|
430
598
|
{
|
|
431
599
|
eventType: "LEDGER_TRANSACTION",
|
|
432
|
-
eventSignal:
|
|
600
|
+
eventSignal: signal,
|
|
433
601
|
ledgerTransaction: transaction,
|
|
434
602
|
metadata: {
|
|
435
603
|
correlationId: backendSdk.uuidv4(),
|
|
@@ -543,7 +711,7 @@ let LedgerServiceBase = class extends backendSdk.develitWorker(
|
|
|
543
711
|
{ data: input, schema: updateTransactionStatus.refundTransactionInputSchema },
|
|
544
712
|
{ successMessage: "Transaction successfully refunded." },
|
|
545
713
|
async (params) => {
|
|
546
|
-
const { transactionId, amount, reason } = params;
|
|
714
|
+
const { transactionId, amount, reason, performedBy } = params;
|
|
547
715
|
const originalTx = await getTransactionByIdQuery(this.db, transactionId);
|
|
548
716
|
if (!originalTx) {
|
|
549
717
|
throw backendSdk.createInternalError(null, {
|
|
@@ -611,6 +779,7 @@ let LedgerServiceBase = class extends backendSdk.develitWorker(
|
|
|
611
779
|
metadata: {
|
|
612
780
|
tags: ["refund", `refund-${originalTx.type.toLowerCase()}`],
|
|
613
781
|
note: reason,
|
|
782
|
+
performedBy,
|
|
614
783
|
payment: {
|
|
615
784
|
amount: refundAmount,
|
|
616
785
|
currency: originalPayment.currency,
|
|
@@ -994,6 +1163,9 @@ __decorateClass([
|
|
|
994
1163
|
__decorateClass([
|
|
995
1164
|
backendSdk.action("match-transaction")
|
|
996
1165
|
], LedgerServiceBase.prototype, "matchTransaction", 1);
|
|
1166
|
+
__decorateClass([
|
|
1167
|
+
backendSdk.action("resolve-unmatched-transaction")
|
|
1168
|
+
], LedgerServiceBase.prototype, "resolveUnmatchedTransaction", 1);
|
|
997
1169
|
__decorateClass([
|
|
998
1170
|
backendSdk.action("fail-transaction")
|
|
999
1171
|
], LedgerServiceBase.prototype, "failTransaction", 1);
|
package/dist/export/worker.d.cts
CHANGED
|
@@ -2,9 +2,9 @@ import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
|
|
|
2
2
|
import { IRPCResponse } from '@develit-io/backend-sdk';
|
|
3
3
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
4
4
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
5
|
-
import { t as tables, C as CreateTransactionInput, a as CreateTransactionOutput, M as MatchTransactionInput, b as MatchTransactionOutput, F as FailTransactionInput,
|
|
5
|
+
import { t as tables, C as CreateTransactionInput, a as CreateTransactionOutput, M as MatchTransactionInput, b as MatchTransactionOutput, R as ResolveUnmatchedTransactionInput, c as ResolveUnmatchedTransactionOutput, F as FailTransactionInput, d as FailTransactionOutput, e as CancelTransactionInput, f as CancelTransactionOutput, g as RefundTransactionInput, h as RefundTransactionOutput, G as GetTransactionByIdInput, i as GetTransactionByIdOutput, j as GetTransactionsByIdReferenceInput, k as GetTransactionsByReferenceIdOutput, l as GetTransactionsInput, m as GetTransactionsOutput, n as CreateAccountInput, o as CreateAccountOutput, U as UpdateAccountInput, p as UpdateAccountOutput, D as DeleteAccountInput, q as DeleteAccountOutput, r as GetAccountInput, s as GetAccountOutput, u as GetAccountsByOwnerInput, v as GetAccountsByOwnerOutput, L as ListAccountsInput, w as ListAccountsOutput, x as GetAccountIdentifierInput, y as GetAccountIdentifierOutput, z as ListAccountIdentifiersInput, A as ListAccountIdentifiersOutput, B as FindAccountByIdentifierInput, E as FindAccountByIdentifierOutput, H as GetAccountBalanceInput, I as GetAccountBalanceOutput, J as UpdateTransactionConfirmationSentAtInput, K as UpdateTransactionConfirmationSentAtOutput, N as UpdateTransactionStatusInput, O as UpdateTransactionStatusOutput } from '../shared/ledger.WHp2MLCf.cjs';
|
|
6
6
|
import 'zod';
|
|
7
|
-
import '../shared/ledger.
|
|
7
|
+
import '../shared/ledger.BtCTt25C.cjs';
|
|
8
8
|
import 'drizzle-orm';
|
|
9
9
|
import 'drizzle-orm/sqlite-core';
|
|
10
10
|
import '@develit-io/general-codes';
|
|
@@ -14,7 +14,13 @@ declare class LedgerServiceBase extends LedgerServiceBase_base {
|
|
|
14
14
|
readonly db: DrizzleD1Database<typeof tables>;
|
|
15
15
|
constructor(ctx: ExecutionContext, env: LedgerEnv);
|
|
16
16
|
createTransaction(input: CreateTransactionInput): Promise<IRPCResponse<CreateTransactionOutput>>;
|
|
17
|
+
/**
|
|
18
|
+
* Internal method that applies match amount logic to a transaction.
|
|
19
|
+
* Shared by matchTransaction and resolveUnmatchedTransaction.
|
|
20
|
+
*/
|
|
21
|
+
private _applyMatchAmount;
|
|
17
22
|
matchTransaction(input: MatchTransactionInput): Promise<IRPCResponse<MatchTransactionOutput>>;
|
|
23
|
+
resolveUnmatchedTransaction(input: ResolveUnmatchedTransactionInput): Promise<IRPCResponse<ResolveUnmatchedTransactionOutput>>;
|
|
18
24
|
failTransaction(input: FailTransactionInput): Promise<IRPCResponse<FailTransactionOutput>>;
|
|
19
25
|
cancelTransaction(input: CancelTransactionInput): Promise<IRPCResponse<CancelTransactionOutput>>;
|
|
20
26
|
refundTransaction(input: RefundTransactionInput): Promise<IRPCResponse<RefundTransactionOutput>>;
|
package/dist/export/worker.d.mts
CHANGED
|
@@ -2,9 +2,9 @@ import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
|
|
|
2
2
|
import { IRPCResponse } from '@develit-io/backend-sdk';
|
|
3
3
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
4
4
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
5
|
-
import { t as tables, C as CreateTransactionInput, a as CreateTransactionOutput, M as MatchTransactionInput, b as MatchTransactionOutput, F as FailTransactionInput,
|
|
5
|
+
import { t as tables, C as CreateTransactionInput, a as CreateTransactionOutput, M as MatchTransactionInput, b as MatchTransactionOutput, R as ResolveUnmatchedTransactionInput, c as ResolveUnmatchedTransactionOutput, F as FailTransactionInput, d as FailTransactionOutput, e as CancelTransactionInput, f as CancelTransactionOutput, g as RefundTransactionInput, h as RefundTransactionOutput, G as GetTransactionByIdInput, i as GetTransactionByIdOutput, j as GetTransactionsByIdReferenceInput, k as GetTransactionsByReferenceIdOutput, l as GetTransactionsInput, m as GetTransactionsOutput, n as CreateAccountInput, o as CreateAccountOutput, U as UpdateAccountInput, p as UpdateAccountOutput, D as DeleteAccountInput, q as DeleteAccountOutput, r as GetAccountInput, s as GetAccountOutput, u as GetAccountsByOwnerInput, v as GetAccountsByOwnerOutput, L as ListAccountsInput, w as ListAccountsOutput, x as GetAccountIdentifierInput, y as GetAccountIdentifierOutput, z as ListAccountIdentifiersInput, A as ListAccountIdentifiersOutput, B as FindAccountByIdentifierInput, E as FindAccountByIdentifierOutput, H as GetAccountBalanceInput, I as GetAccountBalanceOutput, J as UpdateTransactionConfirmationSentAtInput, K as UpdateTransactionConfirmationSentAtOutput, N as UpdateTransactionStatusInput, O as UpdateTransactionStatusOutput } from '../shared/ledger.D_QC9ub6.mjs';
|
|
6
6
|
import 'zod';
|
|
7
|
-
import '../shared/ledger.
|
|
7
|
+
import '../shared/ledger.BtCTt25C.mjs';
|
|
8
8
|
import 'drizzle-orm';
|
|
9
9
|
import 'drizzle-orm/sqlite-core';
|
|
10
10
|
import '@develit-io/general-codes';
|
|
@@ -14,7 +14,13 @@ declare class LedgerServiceBase extends LedgerServiceBase_base {
|
|
|
14
14
|
readonly db: DrizzleD1Database<typeof tables>;
|
|
15
15
|
constructor(ctx: ExecutionContext, env: LedgerEnv);
|
|
16
16
|
createTransaction(input: CreateTransactionInput): Promise<IRPCResponse<CreateTransactionOutput>>;
|
|
17
|
+
/**
|
|
18
|
+
* Internal method that applies match amount logic to a transaction.
|
|
19
|
+
* Shared by matchTransaction and resolveUnmatchedTransaction.
|
|
20
|
+
*/
|
|
21
|
+
private _applyMatchAmount;
|
|
17
22
|
matchTransaction(input: MatchTransactionInput): Promise<IRPCResponse<MatchTransactionOutput>>;
|
|
23
|
+
resolveUnmatchedTransaction(input: ResolveUnmatchedTransactionInput): Promise<IRPCResponse<ResolveUnmatchedTransactionOutput>>;
|
|
18
24
|
failTransaction(input: FailTransactionInput): Promise<IRPCResponse<FailTransactionOutput>>;
|
|
19
25
|
cancelTransaction(input: CancelTransactionInput): Promise<IRPCResponse<CancelTransactionOutput>>;
|
|
20
26
|
refundTransaction(input: RefundTransactionInput): Promise<IRPCResponse<RefundTransactionOutput>>;
|
package/dist/export/worker.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
|
|
|
2
2
|
import { IRPCResponse } from '@develit-io/backend-sdk';
|
|
3
3
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
4
4
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
5
|
-
import { t as tables, C as CreateTransactionInput, a as CreateTransactionOutput, M as MatchTransactionInput, b as MatchTransactionOutput, F as FailTransactionInput,
|
|
5
|
+
import { t as tables, C as CreateTransactionInput, a as CreateTransactionOutput, M as MatchTransactionInput, b as MatchTransactionOutput, R as ResolveUnmatchedTransactionInput, c as ResolveUnmatchedTransactionOutput, F as FailTransactionInput, d as FailTransactionOutput, e as CancelTransactionInput, f as CancelTransactionOutput, g as RefundTransactionInput, h as RefundTransactionOutput, G as GetTransactionByIdInput, i as GetTransactionByIdOutput, j as GetTransactionsByIdReferenceInput, k as GetTransactionsByReferenceIdOutput, l as GetTransactionsInput, m as GetTransactionsOutput, n as CreateAccountInput, o as CreateAccountOutput, U as UpdateAccountInput, p as UpdateAccountOutput, D as DeleteAccountInput, q as DeleteAccountOutput, r as GetAccountInput, s as GetAccountOutput, u as GetAccountsByOwnerInput, v as GetAccountsByOwnerOutput, L as ListAccountsInput, w as ListAccountsOutput, x as GetAccountIdentifierInput, y as GetAccountIdentifierOutput, z as ListAccountIdentifiersInput, A as ListAccountIdentifiersOutput, B as FindAccountByIdentifierInput, E as FindAccountByIdentifierOutput, H as GetAccountBalanceInput, I as GetAccountBalanceOutput, J as UpdateTransactionConfirmationSentAtInput, K as UpdateTransactionConfirmationSentAtOutput, N as UpdateTransactionStatusInput, O as UpdateTransactionStatusOutput } from '../shared/ledger.ZADe_DAC.js';
|
|
6
6
|
import 'zod';
|
|
7
|
-
import '../shared/ledger.
|
|
7
|
+
import '../shared/ledger.BtCTt25C.js';
|
|
8
8
|
import 'drizzle-orm';
|
|
9
9
|
import 'drizzle-orm/sqlite-core';
|
|
10
10
|
import '@develit-io/general-codes';
|
|
@@ -14,7 +14,13 @@ declare class LedgerServiceBase extends LedgerServiceBase_base {
|
|
|
14
14
|
readonly db: DrizzleD1Database<typeof tables>;
|
|
15
15
|
constructor(ctx: ExecutionContext, env: LedgerEnv);
|
|
16
16
|
createTransaction(input: CreateTransactionInput): Promise<IRPCResponse<CreateTransactionOutput>>;
|
|
17
|
+
/**
|
|
18
|
+
* Internal method that applies match amount logic to a transaction.
|
|
19
|
+
* Shared by matchTransaction and resolveUnmatchedTransaction.
|
|
20
|
+
*/
|
|
21
|
+
private _applyMatchAmount;
|
|
17
22
|
matchTransaction(input: MatchTransactionInput): Promise<IRPCResponse<MatchTransactionOutput>>;
|
|
23
|
+
resolveUnmatchedTransaction(input: ResolveUnmatchedTransactionInput): Promise<IRPCResponse<ResolveUnmatchedTransactionOutput>>;
|
|
18
24
|
failTransaction(input: FailTransactionInput): Promise<IRPCResponse<FailTransactionOutput>>;
|
|
19
25
|
cancelTransaction(input: CancelTransactionInput): Promise<IRPCResponse<CancelTransactionOutput>>;
|
|
20
26
|
refundTransaction(input: RefundTransactionInput): Promise<IRPCResponse<RefundTransactionOutput>>;
|