@develit-services/ledger 0.3.1 → 0.3.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 +318 -0
- 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 +212 -20
- package/dist/export/worker.d.cts +4 -2
- package/dist/export/worker.d.mts +4 -2
- package/dist/export/worker.d.ts +4 -2
- package/dist/export/worker.mjs +194 -2
- package/dist/shared/{ledger.149a0ags.mjs → ledger.B-gGCFFu.mjs} +1 -1
- package/dist/shared/{ledger.CeePJr7h.d.cts → ledger.BeDlCGN3.d.ts} +45 -11
- package/dist/shared/{ledger.DkcYdsVZ.mjs → ledger.DWO4eS7Q.mjs} +26 -8
- package/dist/shared/{ledger.Bombc2Sm.d.ts → ledger.OvxTlwqn.d.cts} +45 -11
- package/dist/shared/{ledger.C6xAPWKq.cjs → ledger.QNHpaH-m.cjs} +28 -7
- package/dist/shared/{ledger.B2SLAQpo.cjs → ledger._WA8Ag9K.cjs} +4 -4
- package/dist/shared/{ledger.Ci2NnLFo.d.mts → ledger.aRF1eJOD.d.cts} +23 -16
- package/dist/shared/{ledger.Ci2NnLFo.d.cts → ledger.aRF1eJOD.d.mts} +23 -16
- package/dist/shared/{ledger.Ci2NnLFo.d.ts → ledger.aRF1eJOD.d.ts} +23 -16
- package/dist/shared/{ledger.C63GL8Bq.d.mts → ledger.rYDhcjdG.d.mts} +45 -11
- package/dist/types.cjs +37 -34
- package/dist/types.d.cts +4 -4
- package/dist/types.d.mts +4 -4
- package/dist/types.d.ts +4 -4
- package/dist/types.mjs +1 -1
- package/package.json +1 -1
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._WA8Ag9K.cjs');
|
|
9
9
|
const drizzleOrm = require('drizzle-orm');
|
|
10
|
-
const
|
|
10
|
+
const updateTransactionStatus = require('../shared/ledger.QNHpaH-m.cjs');
|
|
11
11
|
require('@develit-io/general-codes');
|
|
12
12
|
require('drizzle-orm/sqlite-core');
|
|
13
13
|
require('zod');
|
|
@@ -315,7 +315,7 @@ let LedgerServiceBase = class extends backendSdk.develitWorker(
|
|
|
315
315
|
return this.handleAction(
|
|
316
316
|
{
|
|
317
317
|
data: input,
|
|
318
|
-
schema:
|
|
318
|
+
schema: updateTransactionStatus.createTransactionInputSchema
|
|
319
319
|
},
|
|
320
320
|
{ successMessage: "Transaction successfully created." },
|
|
321
321
|
async (params) => {
|
|
@@ -397,7 +397,7 @@ let LedgerServiceBase = class extends backendSdk.develitWorker(
|
|
|
397
397
|
}
|
|
398
398
|
async matchTransaction(input) {
|
|
399
399
|
return this.handleAction(
|
|
400
|
-
{ data: input, schema:
|
|
400
|
+
{ data: input, schema: updateTransactionStatus.matchTransactionInputSchema },
|
|
401
401
|
{ successMessage: "Transaction successfully matched." },
|
|
402
402
|
async (params) => {
|
|
403
403
|
const { transactionId, completedAt, paymentId } = params;
|
|
@@ -444,7 +444,7 @@ let LedgerServiceBase = class extends backendSdk.develitWorker(
|
|
|
444
444
|
}
|
|
445
445
|
async failTransaction(input) {
|
|
446
446
|
return this.handleAction(
|
|
447
|
-
{ data: input, schema:
|
|
447
|
+
{ data: input, schema: updateTransactionStatus.failTransactionInputSchema },
|
|
448
448
|
{ successMessage: "Transaction successfully failed." },
|
|
449
449
|
async (params) => {
|
|
450
450
|
const { transactionId, completedAt, statusReason } = params;
|
|
@@ -493,7 +493,7 @@ let LedgerServiceBase = class extends backendSdk.develitWorker(
|
|
|
493
493
|
}
|
|
494
494
|
async cancelTransaction(input) {
|
|
495
495
|
return this.handleAction(
|
|
496
|
-
{ data: input, schema:
|
|
496
|
+
{ data: input, schema: updateTransactionStatus.cancelTransactionInputSchema },
|
|
497
497
|
{ successMessage: "Transaction successfully cancelled." },
|
|
498
498
|
async ({ transactionId, statusReason }) => {
|
|
499
499
|
const existingTransaction = await getTransactionByIdQuery(
|
|
@@ -538,9 +538,145 @@ let LedgerServiceBase = class extends backendSdk.develitWorker(
|
|
|
538
538
|
}
|
|
539
539
|
);
|
|
540
540
|
}
|
|
541
|
+
async refundTransaction(input) {
|
|
542
|
+
return this.handleAction(
|
|
543
|
+
{ data: input, schema: updateTransactionStatus.refundTransactionInputSchema },
|
|
544
|
+
{ successMessage: "Transaction successfully refunded." },
|
|
545
|
+
async (params) => {
|
|
546
|
+
const { transactionId, amount, reason } = params;
|
|
547
|
+
const originalTx = await getTransactionByIdQuery(this.db, transactionId);
|
|
548
|
+
if (!originalTx) {
|
|
549
|
+
throw backendSdk.createInternalError(null, {
|
|
550
|
+
message: "Transaction not found",
|
|
551
|
+
status: 404,
|
|
552
|
+
code: "DB-L-03"
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
if (!updateTransactionStatus.REFUNDABLE_TRANSACTION_STATUSES.some(
|
|
556
|
+
(status) => status === originalTx.status
|
|
557
|
+
)) {
|
|
558
|
+
throw backendSdk.createInternalError(null, {
|
|
559
|
+
message: `Transaction with status ${originalTx.status} cannot be refunded`,
|
|
560
|
+
status: 400,
|
|
561
|
+
code: "VALID-L-01"
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
const refundAmount = amount || originalTx.value || 0;
|
|
565
|
+
if (refundAmount <= 0) {
|
|
566
|
+
throw backendSdk.createInternalError(null, {
|
|
567
|
+
message: "Invalid refund amount",
|
|
568
|
+
status: 400,
|
|
569
|
+
code: "VALID-L-02"
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
if (originalTx.value && refundAmount > originalTx.value) {
|
|
573
|
+
throw backendSdk.createInternalError(null, {
|
|
574
|
+
message: "Refund amount exceeds transaction value",
|
|
575
|
+
status: 400,
|
|
576
|
+
code: "VALID-L-03"
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
const originalPayment = originalTx.metadata?.payment;
|
|
580
|
+
if (!originalPayment?.debtor || !originalPayment?.creditor) {
|
|
581
|
+
throw backendSdk.createInternalError(null, {
|
|
582
|
+
message: "Transaction missing payment information for refund",
|
|
583
|
+
status: 400,
|
|
584
|
+
code: "VALID-L-04"
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
if (!originalTx.currency) {
|
|
588
|
+
throw backendSdk.createInternalError(null, {
|
|
589
|
+
message: "Transaction missing currency information",
|
|
590
|
+
status: 400,
|
|
591
|
+
code: "VALID-L-05"
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
const refundTxId = backendSdk.uuidv4();
|
|
595
|
+
const correlationId = backendSdk.uuidv4();
|
|
596
|
+
const timestamp = /* @__PURE__ */ new Date();
|
|
597
|
+
const isPartialRefund = amount !== void 0 && originalTx.value != null && amount < originalTx.value;
|
|
598
|
+
const refundTransaction = {
|
|
599
|
+
id: refundTxId,
|
|
600
|
+
correlationId,
|
|
601
|
+
referenceType: "TRANSACTION",
|
|
602
|
+
referenceId: transactionId,
|
|
603
|
+
type: "REFUND",
|
|
604
|
+
description: `Refund: ${reason}`,
|
|
605
|
+
status: "WAITING_FOR_PAYMENT",
|
|
606
|
+
value: refundAmount,
|
|
607
|
+
currency: originalTx.currency,
|
|
608
|
+
createdAt: timestamp,
|
|
609
|
+
updatedAt: timestamp,
|
|
610
|
+
completedAt: null,
|
|
611
|
+
metadata: {
|
|
612
|
+
tags: ["refund", `refund-${originalTx.type.toLowerCase()}`],
|
|
613
|
+
note: reason,
|
|
614
|
+
payment: {
|
|
615
|
+
amount: refundAmount,
|
|
616
|
+
currency: originalPayment.currency,
|
|
617
|
+
type: originalPayment.type || "DOMESTIC",
|
|
618
|
+
vs: originalPayment.vs,
|
|
619
|
+
ss: originalPayment.ss,
|
|
620
|
+
ks: originalPayment.ks,
|
|
621
|
+
debtor: originalPayment.creditor,
|
|
622
|
+
creditor: originalPayment.debtor
|
|
623
|
+
},
|
|
624
|
+
refund: {
|
|
625
|
+
isPartialRefund
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
};
|
|
629
|
+
const insertRefundCommand = this.db.insert(tables.transaction).values(refundTransaction).returning();
|
|
630
|
+
const { command: updateOriginalCommand } = updateTransactionStatusCommand(this.db, {
|
|
631
|
+
transactionId,
|
|
632
|
+
status: "RETURNING",
|
|
633
|
+
statusReason: `Refund in progress via transaction ${refundTxId}`
|
|
634
|
+
});
|
|
635
|
+
const [refundResult, originalResult] = await this.db.batch([
|
|
636
|
+
insertRefundCommand,
|
|
637
|
+
updateOriginalCommand
|
|
638
|
+
]);
|
|
639
|
+
const createdRefundTx = backendSdk.first(refundResult);
|
|
640
|
+
const updatedOriginalTx = backendSdk.first(originalResult);
|
|
641
|
+
if (!createdRefundTx || !updatedOriginalTx) {
|
|
642
|
+
throw backendSdk.createInternalError(null, {
|
|
643
|
+
message: "Failed to process refund transaction",
|
|
644
|
+
status: 500,
|
|
645
|
+
code: "DB-L-02"
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
await Promise.all([
|
|
649
|
+
this.pushToQueue(this.env.QUEUE_BUS_QUEUE, {
|
|
650
|
+
eventType: "LEDGER_TRANSACTION",
|
|
651
|
+
eventSignal: "created",
|
|
652
|
+
ledgerTransaction: createdRefundTx,
|
|
653
|
+
metadata: {
|
|
654
|
+
correlationId: backendSdk.uuidv4(),
|
|
655
|
+
entityId: createdRefundTx.id,
|
|
656
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
657
|
+
}
|
|
658
|
+
}),
|
|
659
|
+
this.pushToQueue(this.env.QUEUE_BUS_QUEUE, {
|
|
660
|
+
eventType: "LEDGER_TRANSACTION",
|
|
661
|
+
eventSignal: "refunding",
|
|
662
|
+
ledgerTransaction: updatedOriginalTx,
|
|
663
|
+
metadata: {
|
|
664
|
+
correlationId: backendSdk.uuidv4(),
|
|
665
|
+
entityId: updatedOriginalTx.id,
|
|
666
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
667
|
+
}
|
|
668
|
+
})
|
|
669
|
+
]);
|
|
670
|
+
return {
|
|
671
|
+
refundTransaction: createdRefundTx,
|
|
672
|
+
originalTransaction: updatedOriginalTx
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
);
|
|
676
|
+
}
|
|
541
677
|
async getTransactionById(input) {
|
|
542
678
|
return this.handleAction(
|
|
543
|
-
{ data: input, schema:
|
|
679
|
+
{ data: input, schema: updateTransactionStatus.getTransactionByIdInputSchema },
|
|
544
680
|
{ successMessage: "Transaction successfully obtained." },
|
|
545
681
|
async (params) => {
|
|
546
682
|
const { id } = params;
|
|
@@ -551,7 +687,7 @@ let LedgerServiceBase = class extends backendSdk.develitWorker(
|
|
|
551
687
|
}
|
|
552
688
|
async getTransactionsByReferenceId(input) {
|
|
553
689
|
return this.handleAction(
|
|
554
|
-
{ data: input, schema:
|
|
690
|
+
{ data: input, schema: updateTransactionStatus.getTransactionsByReferenceIdInputSchema },
|
|
555
691
|
{ successMessage: "Transaction successfully obtained." },
|
|
556
692
|
async (params) => {
|
|
557
693
|
const { referenceType, referenceId } = params;
|
|
@@ -566,7 +702,7 @@ let LedgerServiceBase = class extends backendSdk.develitWorker(
|
|
|
566
702
|
}
|
|
567
703
|
async getTransactions(input) {
|
|
568
704
|
return this.handleAction(
|
|
569
|
-
{ data: input, schema:
|
|
705
|
+
{ data: input, schema: updateTransactionStatus.getTransactionsInputSchema },
|
|
570
706
|
{ successMessage: "Transactions fetched successfully" },
|
|
571
707
|
async (pagination) => {
|
|
572
708
|
const { transactions, totalCount } = await getTransactionsWithPaginationQuery({
|
|
@@ -579,7 +715,7 @@ let LedgerServiceBase = class extends backendSdk.develitWorker(
|
|
|
579
715
|
}
|
|
580
716
|
async createAccount(input) {
|
|
581
717
|
return this.handleAction(
|
|
582
|
-
{ data: input, schema:
|
|
718
|
+
{ data: input, schema: updateTransactionStatus.createAccountInputSchema },
|
|
583
719
|
{ successMessage: "Account successfully created." },
|
|
584
720
|
async (params) => {
|
|
585
721
|
const { identifier, ...accountData } = params;
|
|
@@ -619,7 +755,7 @@ let LedgerServiceBase = class extends backendSdk.develitWorker(
|
|
|
619
755
|
}
|
|
620
756
|
async updateAccount(input) {
|
|
621
757
|
return this.handleAction(
|
|
622
|
-
{ data: input, schema:
|
|
758
|
+
{ data: input, schema: updateTransactionStatus.updateAccountInputSchema },
|
|
623
759
|
{ successMessage: "Account successfully updated." },
|
|
624
760
|
async (params) => {
|
|
625
761
|
const { accountId, ...updateData } = params;
|
|
@@ -653,7 +789,7 @@ let LedgerServiceBase = class extends backendSdk.develitWorker(
|
|
|
653
789
|
}
|
|
654
790
|
async deleteAccount(input) {
|
|
655
791
|
return this.handleAction(
|
|
656
|
-
{ data: input, schema:
|
|
792
|
+
{ data: input, schema: updateTransactionStatus.deleteAccountInputSchema },
|
|
657
793
|
{ successMessage: "Account successfully deleted." },
|
|
658
794
|
async (params) => {
|
|
659
795
|
const { accountId } = params;
|
|
@@ -668,7 +804,7 @@ let LedgerServiceBase = class extends backendSdk.develitWorker(
|
|
|
668
804
|
}
|
|
669
805
|
async getAccount(input) {
|
|
670
806
|
return this.handleAction(
|
|
671
|
-
{ data: input, schema:
|
|
807
|
+
{ data: input, schema: updateTransactionStatus.getAccountInputSchema },
|
|
672
808
|
{ successMessage: "Account successfully retrieved." },
|
|
673
809
|
async (params) => {
|
|
674
810
|
const { accountId } = params;
|
|
@@ -686,7 +822,7 @@ let LedgerServiceBase = class extends backendSdk.develitWorker(
|
|
|
686
822
|
}
|
|
687
823
|
async getAccountsByOwner(input) {
|
|
688
824
|
return this.handleAction(
|
|
689
|
-
{ data: input, schema:
|
|
825
|
+
{ data: input, schema: updateTransactionStatus.getAccountsByOwnerInputSchema },
|
|
690
826
|
{ successMessage: "Accounts successfully retrieved." },
|
|
691
827
|
async (params) => {
|
|
692
828
|
const { ownerId } = params;
|
|
@@ -697,7 +833,7 @@ let LedgerServiceBase = class extends backendSdk.develitWorker(
|
|
|
697
833
|
}
|
|
698
834
|
async listAccounts(input) {
|
|
699
835
|
return this.handleAction(
|
|
700
|
-
{ data: input, schema:
|
|
836
|
+
{ data: input, schema: updateTransactionStatus.listAccountsInputSchema },
|
|
701
837
|
{ successMessage: "Accounts successfully listed." },
|
|
702
838
|
async (params) => {
|
|
703
839
|
const {
|
|
@@ -725,7 +861,7 @@ let LedgerServiceBase = class extends backendSdk.develitWorker(
|
|
|
725
861
|
}
|
|
726
862
|
async getAccountIdentifierById(input) {
|
|
727
863
|
return this.handleAction(
|
|
728
|
-
{ data: input, schema:
|
|
864
|
+
{ data: input, schema: updateTransactionStatus.getAccountIdentifierInputSchema },
|
|
729
865
|
{ successMessage: "Account identifier successfully retrieved." },
|
|
730
866
|
async (params) => {
|
|
731
867
|
const { identifierId } = params;
|
|
@@ -746,7 +882,7 @@ let LedgerServiceBase = class extends backendSdk.develitWorker(
|
|
|
746
882
|
}
|
|
747
883
|
async listAccountIdentifiers(input) {
|
|
748
884
|
return this.handleAction(
|
|
749
|
-
{ data: input, schema:
|
|
885
|
+
{ data: input, schema: updateTransactionStatus.listAccountIdentifiersInputSchema },
|
|
750
886
|
{ successMessage: "Account identifiers successfully listed." },
|
|
751
887
|
async (params) => {
|
|
752
888
|
const { accountId } = params;
|
|
@@ -760,7 +896,7 @@ let LedgerServiceBase = class extends backendSdk.develitWorker(
|
|
|
760
896
|
}
|
|
761
897
|
async findAccountByIdentifier(input) {
|
|
762
898
|
return this.handleAction(
|
|
763
|
-
{ data: input, schema:
|
|
899
|
+
{ data: input, schema: updateTransactionStatus.findAccountByIdentifierInputSchema },
|
|
764
900
|
{ successMessage: "Account search completed." },
|
|
765
901
|
async (params) => {
|
|
766
902
|
const searchParams = params;
|
|
@@ -774,7 +910,7 @@ let LedgerServiceBase = class extends backendSdk.develitWorker(
|
|
|
774
910
|
}
|
|
775
911
|
async getAccountBalance(input) {
|
|
776
912
|
return this.handleAction(
|
|
777
|
-
{ data: input, schema:
|
|
913
|
+
{ data: input, schema: updateTransactionStatus.getAccountBalanceInputSchema },
|
|
778
914
|
{ successMessage: "Balance successfully obtained." },
|
|
779
915
|
async (params) => {
|
|
780
916
|
const { accountId } = params;
|
|
@@ -789,7 +925,7 @@ let LedgerServiceBase = class extends backendSdk.develitWorker(
|
|
|
789
925
|
}
|
|
790
926
|
async updateTransactionConfirmationSentAt(input) {
|
|
791
927
|
return this.handleAction(
|
|
792
|
-
{ data: input, schema:
|
|
928
|
+
{ data: input, schema: updateTransactionStatus.updateTransactionConfirmationSentAtInputSchema },
|
|
793
929
|
{ successMessage: "Confirmation email sent successfully" },
|
|
794
930
|
async ({ transactionId }) => {
|
|
795
931
|
const { command: transactionCommand } = updateTransactionConfirmationSentAtCommand({
|
|
@@ -801,6 +937,56 @@ let LedgerServiceBase = class extends backendSdk.develitWorker(
|
|
|
801
937
|
}
|
|
802
938
|
);
|
|
803
939
|
}
|
|
940
|
+
async updateTransactionStatus(input) {
|
|
941
|
+
return this.handleAction(
|
|
942
|
+
{ data: input, schema: updateTransactionStatus.updateTransactionStatusInputSchema },
|
|
943
|
+
{ successMessage: "Transaction status successfully updated." },
|
|
944
|
+
async (params) => {
|
|
945
|
+
const { transactionId, status, statusReason, paymentId, completedAt } = params;
|
|
946
|
+
const existingTransaction = await getTransactionByIdQuery(
|
|
947
|
+
this.db,
|
|
948
|
+
transactionId
|
|
949
|
+
);
|
|
950
|
+
if (!existingTransaction) {
|
|
951
|
+
throw backendSdk.createInternalError(null, {
|
|
952
|
+
message: "Transaction not found",
|
|
953
|
+
status: 404,
|
|
954
|
+
code: "NOT_FOUND"
|
|
955
|
+
});
|
|
956
|
+
}
|
|
957
|
+
const { command } = updateTransactionStatusCommand(this.db, {
|
|
958
|
+
transactionId,
|
|
959
|
+
status,
|
|
960
|
+
statusReason,
|
|
961
|
+
paymentId,
|
|
962
|
+
completedAt
|
|
963
|
+
});
|
|
964
|
+
const [updatedTransaction] = await this.db.batch([command]);
|
|
965
|
+
if (!updatedTransaction) {
|
|
966
|
+
throw backendSdk.createInternalError(null, {
|
|
967
|
+
message: "Failed to update transaction",
|
|
968
|
+
status: 500,
|
|
969
|
+
code: "INTERNAL_ERROR"
|
|
970
|
+
});
|
|
971
|
+
}
|
|
972
|
+
const transaction = backendSdk.first(updatedTransaction);
|
|
973
|
+
await this.pushToQueue(
|
|
974
|
+
this.env.QUEUE_BUS_QUEUE,
|
|
975
|
+
{
|
|
976
|
+
eventType: "LEDGER_TRANSACTION",
|
|
977
|
+
eventSignal: "updated",
|
|
978
|
+
ledgerTransaction: transaction,
|
|
979
|
+
metadata: {
|
|
980
|
+
correlationId: backendSdk.uuidv4(),
|
|
981
|
+
entityId: transaction.id,
|
|
982
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
);
|
|
986
|
+
return transaction;
|
|
987
|
+
}
|
|
988
|
+
);
|
|
989
|
+
}
|
|
804
990
|
};
|
|
805
991
|
__decorateClass([
|
|
806
992
|
backendSdk.action("create-transaction")
|
|
@@ -814,6 +1000,9 @@ __decorateClass([
|
|
|
814
1000
|
__decorateClass([
|
|
815
1001
|
backendSdk.action("cancel-transaction")
|
|
816
1002
|
], LedgerServiceBase.prototype, "cancelTransaction", 1);
|
|
1003
|
+
__decorateClass([
|
|
1004
|
+
backendSdk.action("refund-transaction")
|
|
1005
|
+
], LedgerServiceBase.prototype, "refundTransaction", 1);
|
|
817
1006
|
__decorateClass([
|
|
818
1007
|
backendSdk.action("get-transaction-by-id")
|
|
819
1008
|
], LedgerServiceBase.prototype, "getTransactionById", 1);
|
|
@@ -856,6 +1045,9 @@ __decorateClass([
|
|
|
856
1045
|
__decorateClass([
|
|
857
1046
|
backendSdk.action("update-transaction-confirmation-sent-at")
|
|
858
1047
|
], LedgerServiceBase.prototype, "updateTransactionConfirmationSentAt", 1);
|
|
1048
|
+
__decorateClass([
|
|
1049
|
+
backendSdk.action("update-transaction-status")
|
|
1050
|
+
], LedgerServiceBase.prototype, "updateTransactionStatus", 1);
|
|
859
1051
|
LedgerServiceBase = __decorateClass([
|
|
860
1052
|
backendSdk.service("ledger")
|
|
861
1053
|
], LedgerServiceBase);
|
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, c as FailTransactionOutput, d as CancelTransactionInput, e as CancelTransactionOutput, G as GetTransactionByIdInput,
|
|
5
|
+
import { t as tables, C as CreateTransactionInput, a as CreateTransactionOutput, M as MatchTransactionInput, b as MatchTransactionOutput, F as FailTransactionInput, c as FailTransactionOutput, d as CancelTransactionInput, e as CancelTransactionOutput, R as RefundTransactionInput, f as RefundTransactionOutput, G as GetTransactionByIdInput, g as GetTransactionByIdOutput, h as GetTransactionsByIdReferenceInput, i as GetTransactionsByReferenceIdOutput, j as GetTransactionsInput, k as GetTransactionsOutput, l as CreateAccountInput, m as CreateAccountOutput, U as UpdateAccountInput, n as UpdateAccountOutput, D as DeleteAccountInput, o as DeleteAccountOutput, p as GetAccountInput, q as GetAccountOutput, r as GetAccountsByOwnerInput, s as GetAccountsByOwnerOutput, L as ListAccountsInput, u as ListAccountsOutput, v as GetAccountIdentifierInput, w as GetAccountIdentifierOutput, x as ListAccountIdentifiersInput, y as ListAccountIdentifiersOutput, z as FindAccountByIdentifierInput, A as FindAccountByIdentifierOutput, B as GetAccountBalanceInput, E as GetAccountBalanceOutput, H as UpdateTransactionConfirmationSentAtInput, I as UpdateTransactionConfirmationSentAtOutput, J as UpdateTransactionStatusInput, K as UpdateTransactionStatusOutput } from '../shared/ledger.OvxTlwqn.cjs';
|
|
6
6
|
import 'zod';
|
|
7
|
-
import '../shared/ledger.
|
|
7
|
+
import '../shared/ledger.aRF1eJOD.cjs';
|
|
8
8
|
import 'drizzle-orm';
|
|
9
9
|
import 'drizzle-orm/sqlite-core';
|
|
10
10
|
import '@develit-io/general-codes';
|
|
@@ -17,6 +17,7 @@ declare class LedgerServiceBase extends LedgerServiceBase_base {
|
|
|
17
17
|
matchTransaction(input: MatchTransactionInput): Promise<IRPCResponse<MatchTransactionOutput>>;
|
|
18
18
|
failTransaction(input: FailTransactionInput): Promise<IRPCResponse<FailTransactionOutput>>;
|
|
19
19
|
cancelTransaction(input: CancelTransactionInput): Promise<IRPCResponse<CancelTransactionOutput>>;
|
|
20
|
+
refundTransaction(input: RefundTransactionInput): Promise<IRPCResponse<RefundTransactionOutput>>;
|
|
20
21
|
getTransactionById(input: GetTransactionByIdInput): Promise<IRPCResponse<GetTransactionByIdOutput | undefined>>;
|
|
21
22
|
getTransactionsByReferenceId(input: GetTransactionsByIdReferenceInput): Promise<IRPCResponse<GetTransactionsByReferenceIdOutput | undefined>>;
|
|
22
23
|
getTransactions(input: GetTransactionsInput): Promise<IRPCResponse<GetTransactionsOutput>>;
|
|
@@ -31,6 +32,7 @@ declare class LedgerServiceBase extends LedgerServiceBase_base {
|
|
|
31
32
|
findAccountByIdentifier(input: FindAccountByIdentifierInput): Promise<IRPCResponse<FindAccountByIdentifierOutput>>;
|
|
32
33
|
getAccountBalance(input: GetAccountBalanceInput): Promise<IRPCResponse<GetAccountBalanceOutput>>;
|
|
33
34
|
updateTransactionConfirmationSentAt(input: UpdateTransactionConfirmationSentAtInput): Promise<IRPCResponse<UpdateTransactionConfirmationSentAtOutput>>;
|
|
35
|
+
updateTransactionStatus(input: UpdateTransactionStatusInput): Promise<IRPCResponse<UpdateTransactionStatusOutput>>;
|
|
34
36
|
}
|
|
35
37
|
declare function defineLedgerService(): new (ctx: ExecutionContext, env: LedgerEnv) => LedgerServiceBase;
|
|
36
38
|
|
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, c as FailTransactionOutput, d as CancelTransactionInput, e as CancelTransactionOutput, G as GetTransactionByIdInput,
|
|
5
|
+
import { t as tables, C as CreateTransactionInput, a as CreateTransactionOutput, M as MatchTransactionInput, b as MatchTransactionOutput, F as FailTransactionInput, c as FailTransactionOutput, d as CancelTransactionInput, e as CancelTransactionOutput, R as RefundTransactionInput, f as RefundTransactionOutput, G as GetTransactionByIdInput, g as GetTransactionByIdOutput, h as GetTransactionsByIdReferenceInput, i as GetTransactionsByReferenceIdOutput, j as GetTransactionsInput, k as GetTransactionsOutput, l as CreateAccountInput, m as CreateAccountOutput, U as UpdateAccountInput, n as UpdateAccountOutput, D as DeleteAccountInput, o as DeleteAccountOutput, p as GetAccountInput, q as GetAccountOutput, r as GetAccountsByOwnerInput, s as GetAccountsByOwnerOutput, L as ListAccountsInput, u as ListAccountsOutput, v as GetAccountIdentifierInput, w as GetAccountIdentifierOutput, x as ListAccountIdentifiersInput, y as ListAccountIdentifiersOutput, z as FindAccountByIdentifierInput, A as FindAccountByIdentifierOutput, B as GetAccountBalanceInput, E as GetAccountBalanceOutput, H as UpdateTransactionConfirmationSentAtInput, I as UpdateTransactionConfirmationSentAtOutput, J as UpdateTransactionStatusInput, K as UpdateTransactionStatusOutput } from '../shared/ledger.rYDhcjdG.mjs';
|
|
6
6
|
import 'zod';
|
|
7
|
-
import '../shared/ledger.
|
|
7
|
+
import '../shared/ledger.aRF1eJOD.mjs';
|
|
8
8
|
import 'drizzle-orm';
|
|
9
9
|
import 'drizzle-orm/sqlite-core';
|
|
10
10
|
import '@develit-io/general-codes';
|
|
@@ -17,6 +17,7 @@ declare class LedgerServiceBase extends LedgerServiceBase_base {
|
|
|
17
17
|
matchTransaction(input: MatchTransactionInput): Promise<IRPCResponse<MatchTransactionOutput>>;
|
|
18
18
|
failTransaction(input: FailTransactionInput): Promise<IRPCResponse<FailTransactionOutput>>;
|
|
19
19
|
cancelTransaction(input: CancelTransactionInput): Promise<IRPCResponse<CancelTransactionOutput>>;
|
|
20
|
+
refundTransaction(input: RefundTransactionInput): Promise<IRPCResponse<RefundTransactionOutput>>;
|
|
20
21
|
getTransactionById(input: GetTransactionByIdInput): Promise<IRPCResponse<GetTransactionByIdOutput | undefined>>;
|
|
21
22
|
getTransactionsByReferenceId(input: GetTransactionsByIdReferenceInput): Promise<IRPCResponse<GetTransactionsByReferenceIdOutput | undefined>>;
|
|
22
23
|
getTransactions(input: GetTransactionsInput): Promise<IRPCResponse<GetTransactionsOutput>>;
|
|
@@ -31,6 +32,7 @@ declare class LedgerServiceBase extends LedgerServiceBase_base {
|
|
|
31
32
|
findAccountByIdentifier(input: FindAccountByIdentifierInput): Promise<IRPCResponse<FindAccountByIdentifierOutput>>;
|
|
32
33
|
getAccountBalance(input: GetAccountBalanceInput): Promise<IRPCResponse<GetAccountBalanceOutput>>;
|
|
33
34
|
updateTransactionConfirmationSentAt(input: UpdateTransactionConfirmationSentAtInput): Promise<IRPCResponse<UpdateTransactionConfirmationSentAtOutput>>;
|
|
35
|
+
updateTransactionStatus(input: UpdateTransactionStatusInput): Promise<IRPCResponse<UpdateTransactionStatusOutput>>;
|
|
34
36
|
}
|
|
35
37
|
declare function defineLedgerService(): new (ctx: ExecutionContext, env: LedgerEnv) => LedgerServiceBase;
|
|
36
38
|
|
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, c as FailTransactionOutput, d as CancelTransactionInput, e as CancelTransactionOutput, G as GetTransactionByIdInput,
|
|
5
|
+
import { t as tables, C as CreateTransactionInput, a as CreateTransactionOutput, M as MatchTransactionInput, b as MatchTransactionOutput, F as FailTransactionInput, c as FailTransactionOutput, d as CancelTransactionInput, e as CancelTransactionOutput, R as RefundTransactionInput, f as RefundTransactionOutput, G as GetTransactionByIdInput, g as GetTransactionByIdOutput, h as GetTransactionsByIdReferenceInput, i as GetTransactionsByReferenceIdOutput, j as GetTransactionsInput, k as GetTransactionsOutput, l as CreateAccountInput, m as CreateAccountOutput, U as UpdateAccountInput, n as UpdateAccountOutput, D as DeleteAccountInput, o as DeleteAccountOutput, p as GetAccountInput, q as GetAccountOutput, r as GetAccountsByOwnerInput, s as GetAccountsByOwnerOutput, L as ListAccountsInput, u as ListAccountsOutput, v as GetAccountIdentifierInput, w as GetAccountIdentifierOutput, x as ListAccountIdentifiersInput, y as ListAccountIdentifiersOutput, z as FindAccountByIdentifierInput, A as FindAccountByIdentifierOutput, B as GetAccountBalanceInput, E as GetAccountBalanceOutput, H as UpdateTransactionConfirmationSentAtInput, I as UpdateTransactionConfirmationSentAtOutput, J as UpdateTransactionStatusInput, K as UpdateTransactionStatusOutput } from '../shared/ledger.BeDlCGN3.js';
|
|
6
6
|
import 'zod';
|
|
7
|
-
import '../shared/ledger.
|
|
7
|
+
import '../shared/ledger.aRF1eJOD.js';
|
|
8
8
|
import 'drizzle-orm';
|
|
9
9
|
import 'drizzle-orm/sqlite-core';
|
|
10
10
|
import '@develit-io/general-codes';
|
|
@@ -17,6 +17,7 @@ declare class LedgerServiceBase extends LedgerServiceBase_base {
|
|
|
17
17
|
matchTransaction(input: MatchTransactionInput): Promise<IRPCResponse<MatchTransactionOutput>>;
|
|
18
18
|
failTransaction(input: FailTransactionInput): Promise<IRPCResponse<FailTransactionOutput>>;
|
|
19
19
|
cancelTransaction(input: CancelTransactionInput): Promise<IRPCResponse<CancelTransactionOutput>>;
|
|
20
|
+
refundTransaction(input: RefundTransactionInput): Promise<IRPCResponse<RefundTransactionOutput>>;
|
|
20
21
|
getTransactionById(input: GetTransactionByIdInput): Promise<IRPCResponse<GetTransactionByIdOutput | undefined>>;
|
|
21
22
|
getTransactionsByReferenceId(input: GetTransactionsByIdReferenceInput): Promise<IRPCResponse<GetTransactionsByReferenceIdOutput | undefined>>;
|
|
22
23
|
getTransactions(input: GetTransactionsInput): Promise<IRPCResponse<GetTransactionsOutput>>;
|
|
@@ -31,6 +32,7 @@ declare class LedgerServiceBase extends LedgerServiceBase_base {
|
|
|
31
32
|
findAccountByIdentifier(input: FindAccountByIdentifierInput): Promise<IRPCResponse<FindAccountByIdentifierOutput>>;
|
|
32
33
|
getAccountBalance(input: GetAccountBalanceInput): Promise<IRPCResponse<GetAccountBalanceOutput>>;
|
|
33
34
|
updateTransactionConfirmationSentAt(input: UpdateTransactionConfirmationSentAtInput): Promise<IRPCResponse<UpdateTransactionConfirmationSentAtOutput>>;
|
|
35
|
+
updateTransactionStatus(input: UpdateTransactionStatusInput): Promise<IRPCResponse<UpdateTransactionStatusOutput>>;
|
|
34
36
|
}
|
|
35
37
|
declare function defineLedgerService(): new (ctx: ExecutionContext, env: LedgerEnv) => LedgerServiceBase;
|
|
36
38
|
|