@develit-services/ledger 0.0.14 → 0.0.16
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 +16 -17
- package/dist/export/worker.d.cts +2 -2
- package/dist/export/worker.d.mts +2 -2
- package/dist/export/worker.d.ts +2 -2
- package/dist/export/worker.mjs +16 -17
- package/dist/shared/{ledger.bWo3rI1l.d.cts → ledger.BvbOZ0WG.d.cts} +78 -9
- package/dist/shared/{ledger.D8XNEnr1.mjs → ledger.CYkZYSMS.mjs} +13 -6
- package/dist/shared/{ledger.CDuhIB9s.cjs → ledger.CcYWtEGS.cjs} +1 -1
- package/dist/shared/{ledger.DLQ2e8kE.d.mts → ledger.Cd1qa4GB.d.ts} +78 -9
- package/dist/shared/{ledger.DXlB4bbD.cjs → ledger.CwcPuqoq.cjs} +12 -5
- package/dist/shared/{ledger.CrqaHbwM.d.ts → ledger.DRm7L41a.d.mts} +78 -9
- package/dist/shared/{ledger.C9ZgmZrv.d.cts → ledger.N4btQFi1.d.cts} +10 -11
- package/dist/shared/{ledger.C9ZgmZrv.d.mts → ledger.N4btQFi1.d.mts} +10 -11
- package/dist/shared/{ledger.C9ZgmZrv.d.ts → ledger.N4btQFi1.d.ts} +10 -11
- package/dist/shared/{ledger.qEafj0Ix.mjs → ledger.al23fGGy.mjs} +1 -1
- package/dist/types.cjs +1 -1
- package/dist/types.d.cts +3 -3
- package/dist/types.d.mts +3 -3
- package/dist/types.d.ts +3 -3
- 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.CcYWtEGS.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.CwcPuqoq.cjs');
|
|
8
8
|
require('@develit-io/general-codes');
|
|
9
9
|
require('zod');
|
|
10
10
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { F as account, G as accountIdentifier, H as accountIdentifierMapping, L as accountIdentifierMappingRelations, K as accountIdentifierRelations, J as accountRelations, M as entry, N as transaction } from '../shared/ledger.
|
|
1
|
+
export { F as account, G as accountIdentifier, H as accountIdentifierMapping, L as accountIdentifierMappingRelations, K as accountIdentifierRelations, J as accountRelations, M as entry, N as transaction } from '../shared/ledger.N4btQFi1.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 { F as account, G as accountIdentifier, H as accountIdentifierMapping, L as accountIdentifierMappingRelations, K as accountIdentifierRelations, J as accountRelations, M as entry, N as transaction } from '../shared/ledger.
|
|
1
|
+
export { F as account, G as accountIdentifier, H as accountIdentifierMapping, L as accountIdentifierMappingRelations, K as accountIdentifierRelations, J as accountRelations, M as entry, N as transaction } from '../shared/ledger.N4btQFi1.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 { F as account, G as accountIdentifier, H as accountIdentifierMapping, L as accountIdentifierMappingRelations, K as accountIdentifierRelations, J as accountRelations, M as entry, N as transaction } from '../shared/ledger.
|
|
1
|
+
export { F as account, G as accountIdentifier, H as accountIdentifierMapping, L as accountIdentifierMappingRelations, K as accountIdentifierRelations, J as accountRelations, M as entry, N as transaction } from '../shared/ledger.N4btQFi1.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, f as accountIdentifierMappingRelations, e as accountIdentifierRelations, d as accountRelations, g as entry, t as transaction } from '../shared/ledger.
|
|
1
|
+
export { a as account, b as accountIdentifier, c as accountIdentifierMapping, f as accountIdentifierMappingRelations, e as accountIdentifierRelations, d as accountRelations, g as entry, t as transaction } from '../shared/ledger.al23fGGy.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.CYkZYSMS.mjs';
|
|
6
6
|
import '@develit-io/general-codes';
|
|
7
7
|
import 'zod';
|
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.CcYWtEGS.cjs');
|
|
9
9
|
const drizzleOrm = require('drizzle-orm');
|
|
10
|
-
const updateTransactionConfirmationSentAt = require('../shared/ledger.
|
|
10
|
+
const updateTransactionConfirmationSentAt = require('../shared/ledger.CwcPuqoq.cjs');
|
|
11
11
|
require('@develit-io/general-codes');
|
|
12
12
|
require('drizzle-orm/sqlite-core');
|
|
13
13
|
require('zod');
|
|
@@ -40,11 +40,13 @@ const updateAccountCommand = async (db, id, input) => {
|
|
|
40
40
|
return { command };
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
const updateTransactionStatusCommand =
|
|
43
|
+
const updateTransactionStatusCommand = (db, data) => {
|
|
44
|
+
const { transactionId, status, paymentId, completedAt } = data;
|
|
44
45
|
const updateData = {
|
|
45
46
|
status,
|
|
46
47
|
updatedAt: /* @__PURE__ */ new Date(),
|
|
47
|
-
|
|
48
|
+
completedAt,
|
|
49
|
+
paymentId
|
|
48
50
|
};
|
|
49
51
|
const command = db.update(tables.transaction).set(updateData).where(drizzleOrm.eq(tables.transaction.id, transactionId)).returning();
|
|
50
52
|
return { command };
|
|
@@ -394,7 +396,7 @@ let LedgerServiceBase = class extends backendSdk.develitWorker(
|
|
|
394
396
|
{ data: input, schema: updateTransactionConfirmationSentAt.matchTransactionInputSchema },
|
|
395
397
|
{ successMessage: "Transaction successfully matched." },
|
|
396
398
|
async (params) => {
|
|
397
|
-
const { transactionId, completedAt } = params;
|
|
399
|
+
const { transactionId, completedAt, paymentId } = params;
|
|
398
400
|
const existingTransaction = await getTransactionByIdQuery(
|
|
399
401
|
this.db,
|
|
400
402
|
transactionId
|
|
@@ -406,21 +408,19 @@ let LedgerServiceBase = class extends backendSdk.develitWorker(
|
|
|
406
408
|
code: "NOT_FOUND"
|
|
407
409
|
});
|
|
408
410
|
}
|
|
409
|
-
const
|
|
410
|
-
this.db,
|
|
411
|
+
const transaction = await updateTransactionStatusCommand(this.db, {
|
|
411
412
|
transactionId,
|
|
412
|
-
"MATCHED",
|
|
413
|
-
completedAt
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
if (!
|
|
413
|
+
status: "MATCHED",
|
|
414
|
+
completedAt,
|
|
415
|
+
paymentId
|
|
416
|
+
}).command.execute().then(backendSdk.first);
|
|
417
|
+
if (!transaction) {
|
|
417
418
|
throw backendSdk.createInternalError(null, {
|
|
418
419
|
message: "Failed to update transaction",
|
|
419
420
|
status: 500,
|
|
420
421
|
code: "INTERNAL_ERROR"
|
|
421
422
|
});
|
|
422
423
|
}
|
|
423
|
-
const transaction = backendSdk.first(updatedTransaction);
|
|
424
424
|
await this.pushToQueue(
|
|
425
425
|
this.env.QUEUE_BUS_QUEUE,
|
|
426
426
|
{
|
|
@@ -455,12 +455,11 @@ let LedgerServiceBase = class extends backendSdk.develitWorker(
|
|
|
455
455
|
code: "NOT_FOUND"
|
|
456
456
|
});
|
|
457
457
|
}
|
|
458
|
-
const { command } =
|
|
459
|
-
this.db,
|
|
458
|
+
const { command } = updateTransactionStatusCommand(this.db, {
|
|
460
459
|
transactionId,
|
|
461
|
-
"FAILED",
|
|
460
|
+
status: "FAILED",
|
|
462
461
|
completedAt
|
|
463
|
-
);
|
|
462
|
+
});
|
|
464
463
|
const [updatedTransaction] = await this.db.batch([command]);
|
|
465
464
|
if (!updatedTransaction) {
|
|
466
465
|
throw backendSdk.createInternalError(null, {
|
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, G as GetTransactionByIdInput, d as GetTransactionByIdOutput, e as GetTransactionsByIdReferenceInput, f as GetTransactionsByReferenceIdOutput, g as GetTransactionsInput, h as GetTransactionsOutput, i as CreateAccountInput, j as CreateAccountOutput, U as UpdateAccountInput, k as UpdateAccountOutput, D as DeleteAccountInput, l as DeleteAccountOutput, m as GetAccountInput, n as GetAccountOutput, o as GetAccountsByOwnerInput, p as GetAccountsByOwnerOutput, L as ListAccountsInput, q as ListAccountsOutput, r as GetAccountIdentifierInput, s as GetAccountIdentifierOutput, u as ListAccountIdentifiersInput, v as ListAccountIdentifiersOutput, w as FindAccountByIdentifierInput, x as FindAccountByIdentifierOutput, y as GetAccountBalanceInput, z as GetAccountBalanceOutput, A as UpdateTransactionConfirmationSentAtInput, B as UpdateTransactionConfirmationSentAtOutput } from '../shared/ledger.
|
|
5
|
+
import { t as tables, C as CreateTransactionInput, a as CreateTransactionOutput, M as MatchTransactionInput, b as MatchTransactionOutput, F as FailTransactionInput, c as FailTransactionOutput, G as GetTransactionByIdInput, d as GetTransactionByIdOutput, e as GetTransactionsByIdReferenceInput, f as GetTransactionsByReferenceIdOutput, g as GetTransactionsInput, h as GetTransactionsOutput, i as CreateAccountInput, j as CreateAccountOutput, U as UpdateAccountInput, k as UpdateAccountOutput, D as DeleteAccountInput, l as DeleteAccountOutput, m as GetAccountInput, n as GetAccountOutput, o as GetAccountsByOwnerInput, p as GetAccountsByOwnerOutput, L as ListAccountsInput, q as ListAccountsOutput, r as GetAccountIdentifierInput, s as GetAccountIdentifierOutput, u as ListAccountIdentifiersInput, v as ListAccountIdentifiersOutput, w as FindAccountByIdentifierInput, x as FindAccountByIdentifierOutput, y as GetAccountBalanceInput, z as GetAccountBalanceOutput, A as UpdateTransactionConfirmationSentAtInput, B as UpdateTransactionConfirmationSentAtOutput } from '../shared/ledger.BvbOZ0WG.cjs';
|
|
6
6
|
import 'zod';
|
|
7
|
-
import '../shared/ledger.
|
|
7
|
+
import '../shared/ledger.N4btQFi1.cjs';
|
|
8
8
|
import 'drizzle-orm';
|
|
9
9
|
import 'drizzle-orm/sqlite-core';
|
|
10
10
|
import '@develit-io/general-codes';
|
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, G as GetTransactionByIdInput, d as GetTransactionByIdOutput, e as GetTransactionsByIdReferenceInput, f as GetTransactionsByReferenceIdOutput, g as GetTransactionsInput, h as GetTransactionsOutput, i as CreateAccountInput, j as CreateAccountOutput, U as UpdateAccountInput, k as UpdateAccountOutput, D as DeleteAccountInput, l as DeleteAccountOutput, m as GetAccountInput, n as GetAccountOutput, o as GetAccountsByOwnerInput, p as GetAccountsByOwnerOutput, L as ListAccountsInput, q as ListAccountsOutput, r as GetAccountIdentifierInput, s as GetAccountIdentifierOutput, u as ListAccountIdentifiersInput, v as ListAccountIdentifiersOutput, w as FindAccountByIdentifierInput, x as FindAccountByIdentifierOutput, y as GetAccountBalanceInput, z as GetAccountBalanceOutput, A as UpdateTransactionConfirmationSentAtInput, B as UpdateTransactionConfirmationSentAtOutput } from '../shared/ledger.
|
|
5
|
+
import { t as tables, C as CreateTransactionInput, a as CreateTransactionOutput, M as MatchTransactionInput, b as MatchTransactionOutput, F as FailTransactionInput, c as FailTransactionOutput, G as GetTransactionByIdInput, d as GetTransactionByIdOutput, e as GetTransactionsByIdReferenceInput, f as GetTransactionsByReferenceIdOutput, g as GetTransactionsInput, h as GetTransactionsOutput, i as CreateAccountInput, j as CreateAccountOutput, U as UpdateAccountInput, k as UpdateAccountOutput, D as DeleteAccountInput, l as DeleteAccountOutput, m as GetAccountInput, n as GetAccountOutput, o as GetAccountsByOwnerInput, p as GetAccountsByOwnerOutput, L as ListAccountsInput, q as ListAccountsOutput, r as GetAccountIdentifierInput, s as GetAccountIdentifierOutput, u as ListAccountIdentifiersInput, v as ListAccountIdentifiersOutput, w as FindAccountByIdentifierInput, x as FindAccountByIdentifierOutput, y as GetAccountBalanceInput, z as GetAccountBalanceOutput, A as UpdateTransactionConfirmationSentAtInput, B as UpdateTransactionConfirmationSentAtOutput } from '../shared/ledger.DRm7L41a.mjs';
|
|
6
6
|
import 'zod';
|
|
7
|
-
import '../shared/ledger.
|
|
7
|
+
import '../shared/ledger.N4btQFi1.mjs';
|
|
8
8
|
import 'drizzle-orm';
|
|
9
9
|
import 'drizzle-orm/sqlite-core';
|
|
10
10
|
import '@develit-io/general-codes';
|
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, G as GetTransactionByIdInput, d as GetTransactionByIdOutput, e as GetTransactionsByIdReferenceInput, f as GetTransactionsByReferenceIdOutput, g as GetTransactionsInput, h as GetTransactionsOutput, i as CreateAccountInput, j as CreateAccountOutput, U as UpdateAccountInput, k as UpdateAccountOutput, D as DeleteAccountInput, l as DeleteAccountOutput, m as GetAccountInput, n as GetAccountOutput, o as GetAccountsByOwnerInput, p as GetAccountsByOwnerOutput, L as ListAccountsInput, q as ListAccountsOutput, r as GetAccountIdentifierInput, s as GetAccountIdentifierOutput, u as ListAccountIdentifiersInput, v as ListAccountIdentifiersOutput, w as FindAccountByIdentifierInput, x as FindAccountByIdentifierOutput, y as GetAccountBalanceInput, z as GetAccountBalanceOutput, A as UpdateTransactionConfirmationSentAtInput, B as UpdateTransactionConfirmationSentAtOutput } from '../shared/ledger.
|
|
5
|
+
import { t as tables, C as CreateTransactionInput, a as CreateTransactionOutput, M as MatchTransactionInput, b as MatchTransactionOutput, F as FailTransactionInput, c as FailTransactionOutput, G as GetTransactionByIdInput, d as GetTransactionByIdOutput, e as GetTransactionsByIdReferenceInput, f as GetTransactionsByReferenceIdOutput, g as GetTransactionsInput, h as GetTransactionsOutput, i as CreateAccountInput, j as CreateAccountOutput, U as UpdateAccountInput, k as UpdateAccountOutput, D as DeleteAccountInput, l as DeleteAccountOutput, m as GetAccountInput, n as GetAccountOutput, o as GetAccountsByOwnerInput, p as GetAccountsByOwnerOutput, L as ListAccountsInput, q as ListAccountsOutput, r as GetAccountIdentifierInput, s as GetAccountIdentifierOutput, u as ListAccountIdentifiersInput, v as ListAccountIdentifiersOutput, w as FindAccountByIdentifierInput, x as FindAccountByIdentifierOutput, y as GetAccountBalanceInput, z as GetAccountBalanceOutput, A as UpdateTransactionConfirmationSentAtInput, B as UpdateTransactionConfirmationSentAtOutput } from '../shared/ledger.Cd1qa4GB.js';
|
|
6
6
|
import 'zod';
|
|
7
|
-
import '../shared/ledger.
|
|
7
|
+
import '../shared/ledger.N4btQFi1.js';
|
|
8
8
|
import 'drizzle-orm';
|
|
9
9
|
import 'drizzle-orm/sqlite-core';
|
|
10
10
|
import '@develit-io/general-codes';
|
package/dist/export/worker.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { first, develitWorker, uuidv4, useResult, createInternalError, action, service } from '@develit-io/backend-sdk';
|
|
2
2
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
3
3
|
import { drizzle } from 'drizzle-orm/d1';
|
|
4
|
-
import { s as schema } from '../shared/ledger.
|
|
4
|
+
import { s as schema } from '../shared/ledger.al23fGGy.mjs';
|
|
5
5
|
import { eq, and, inArray, or, count, gte, lte, sql, asc, desc } from 'drizzle-orm';
|
|
6
|
-
import {
|
|
6
|
+
import { f as createTransactionInputSchema, s as matchTransactionInputSchema, h as failTransactionInputSchema, n as getTransactionByIdInputSchema, p as getTransactionsByReferenceIdInputSchema, o as getTransactionsInputSchema, e as createAccountInputSchema, u as updateAccountInputSchema, g as deleteAccountInputSchema, j as getAccountInputSchema, m as getAccountsByOwnerInputSchema, r as listAccountsInputSchema, l as getAccountIdentifierInputSchema, q as listAccountIdentifiersInputSchema, i as findAccountByIdentifierInputSchema, k as getAccountBalanceInputSchema, t as updateTransactionConfirmationSentAtInputSchema } from '../shared/ledger.CYkZYSMS.mjs';
|
|
7
7
|
import '@develit-io/general-codes';
|
|
8
8
|
import 'drizzle-orm/sqlite-core';
|
|
9
9
|
import 'zod';
|
|
@@ -36,11 +36,13 @@ const updateAccountCommand = async (db, id, input) => {
|
|
|
36
36
|
return { command };
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
const updateTransactionStatusCommand =
|
|
39
|
+
const updateTransactionStatusCommand = (db, data) => {
|
|
40
|
+
const { transactionId, status, paymentId, completedAt } = data;
|
|
40
41
|
const updateData = {
|
|
41
42
|
status,
|
|
42
43
|
updatedAt: /* @__PURE__ */ new Date(),
|
|
43
|
-
|
|
44
|
+
completedAt,
|
|
45
|
+
paymentId
|
|
44
46
|
};
|
|
45
47
|
const command = db.update(tables.transaction).set(updateData).where(eq(tables.transaction.id, transactionId)).returning();
|
|
46
48
|
return { command };
|
|
@@ -390,7 +392,7 @@ let LedgerServiceBase = class extends develitWorker(
|
|
|
390
392
|
{ data: input, schema: matchTransactionInputSchema },
|
|
391
393
|
{ successMessage: "Transaction successfully matched." },
|
|
392
394
|
async (params) => {
|
|
393
|
-
const { transactionId, completedAt } = params;
|
|
395
|
+
const { transactionId, completedAt, paymentId } = params;
|
|
394
396
|
const existingTransaction = await getTransactionByIdQuery(
|
|
395
397
|
this.db,
|
|
396
398
|
transactionId
|
|
@@ -402,21 +404,19 @@ let LedgerServiceBase = class extends develitWorker(
|
|
|
402
404
|
code: "NOT_FOUND"
|
|
403
405
|
});
|
|
404
406
|
}
|
|
405
|
-
const
|
|
406
|
-
this.db,
|
|
407
|
+
const transaction = await updateTransactionStatusCommand(this.db, {
|
|
407
408
|
transactionId,
|
|
408
|
-
"MATCHED",
|
|
409
|
-
completedAt
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
if (!
|
|
409
|
+
status: "MATCHED",
|
|
410
|
+
completedAt,
|
|
411
|
+
paymentId
|
|
412
|
+
}).command.execute().then(first);
|
|
413
|
+
if (!transaction) {
|
|
413
414
|
throw createInternalError(null, {
|
|
414
415
|
message: "Failed to update transaction",
|
|
415
416
|
status: 500,
|
|
416
417
|
code: "INTERNAL_ERROR"
|
|
417
418
|
});
|
|
418
419
|
}
|
|
419
|
-
const transaction = first(updatedTransaction);
|
|
420
420
|
await this.pushToQueue(
|
|
421
421
|
this.env.QUEUE_BUS_QUEUE,
|
|
422
422
|
{
|
|
@@ -451,12 +451,11 @@ let LedgerServiceBase = class extends develitWorker(
|
|
|
451
451
|
code: "NOT_FOUND"
|
|
452
452
|
});
|
|
453
453
|
}
|
|
454
|
-
const { command } =
|
|
455
|
-
this.db,
|
|
454
|
+
const { command } = updateTransactionStatusCommand(this.db, {
|
|
456
455
|
transactionId,
|
|
457
|
-
"FAILED",
|
|
456
|
+
status: "FAILED",
|
|
458
457
|
completedAt
|
|
459
|
-
);
|
|
458
|
+
});
|
|
460
459
|
const [updatedTransaction] = await this.db.batch([command]);
|
|
461
460
|
if (!updatedTransaction) {
|
|
462
461
|
throw createInternalError(null, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { D as schema } from './ledger.
|
|
2
|
+
import { D as schema } from './ledger.N4btQFi1.cjs';
|
|
3
3
|
import { InferSelectModel, ExtractTablesWithRelations, DBQueryConfig, BuildQueryResult, InferInsertModel } from 'drizzle-orm';
|
|
4
4
|
|
|
5
5
|
interface TSchema extends ExtractTablesWithRelations<typeof tables> {
|
|
@@ -329,9 +329,9 @@ declare const createAccountInputSchema: z.ZodObject<{
|
|
|
329
329
|
}>>;
|
|
330
330
|
identifier: z.ZodOptional<z.ZodObject<{
|
|
331
331
|
kind: z.ZodEnum<{
|
|
332
|
-
SWIFT: "SWIFT";
|
|
333
332
|
IBAN: "IBAN";
|
|
334
333
|
LOCAL_CZ: "LOCAL_CZ";
|
|
334
|
+
SWIFT: "SWIFT";
|
|
335
335
|
CRYPTO_ADDRESS: "CRYPTO_ADDRESS";
|
|
336
336
|
}>;
|
|
337
337
|
iban: z.ZodOptional<z.ZodString>;
|
|
@@ -401,17 +401,17 @@ interface CreateAccountOutput {
|
|
|
401
401
|
declare const createTransactionInputSchema: z.ZodObject<{
|
|
402
402
|
correlationId: z.ZodString;
|
|
403
403
|
referenceType: z.ZodEnum<{
|
|
404
|
-
EXCHANGE: "EXCHANGE";
|
|
405
404
|
PAYMENT: "PAYMENT";
|
|
405
|
+
EXCHANGE: "EXCHANGE";
|
|
406
406
|
ORDER: "ORDER";
|
|
407
407
|
}>;
|
|
408
408
|
referenceId: z.ZodOptional<z.ZodString>;
|
|
409
409
|
type: z.ZodEnum<{
|
|
410
|
+
EXCHANGE: "EXCHANGE";
|
|
410
411
|
CLIENT_FUND_IN: "CLIENT_FUND_IN";
|
|
411
412
|
CLIENT_FUND_OUT: "CLIENT_FUND_OUT";
|
|
412
413
|
PROVIDER_FUND_IN: "PROVIDER_FUND_IN";
|
|
413
414
|
PROVIDER_FUND_OUT: "PROVIDER_FUND_OUT";
|
|
414
|
-
EXCHANGE: "EXCHANGE";
|
|
415
415
|
UNMATCHED: "UNMATCHED";
|
|
416
416
|
ADJUSTMENT: "ADJUSTMENT";
|
|
417
417
|
TRANSFER: "TRANSFER";
|
|
@@ -428,6 +428,18 @@ declare const createTransactionInputSchema: z.ZodObject<{
|
|
|
428
428
|
ss: z.ZodOptional<z.ZodString>;
|
|
429
429
|
ks: z.ZodOptional<z.ZodString>;
|
|
430
430
|
message: z.ZodOptional<z.ZodString>;
|
|
431
|
+
type: z.ZodEnum<{
|
|
432
|
+
SWIFT: "SWIFT";
|
|
433
|
+
DOMESTIC: "DOMESTIC";
|
|
434
|
+
SEPA: "SEPA";
|
|
435
|
+
UNKNOWN: "UNKNOWN";
|
|
436
|
+
}>;
|
|
437
|
+
paymentChargeType: z.ZodOptional<z.ZodEnum<{
|
|
438
|
+
SHA: "SHA";
|
|
439
|
+
OUR: "OUR";
|
|
440
|
+
BEN: "BEN";
|
|
441
|
+
}>>;
|
|
442
|
+
expressPayment: z.ZodOptional<z.ZodBoolean>;
|
|
431
443
|
reference: z.ZodOptional<z.ZodString>;
|
|
432
444
|
creditor: z.ZodOptional<z.ZodObject<{
|
|
433
445
|
id: z.ZodOptional<z.ZodString>;
|
|
@@ -1144,9 +1156,9 @@ declare const createTransactionInputSchema: z.ZodObject<{
|
|
|
1144
1156
|
AVAX: "AVAX";
|
|
1145
1157
|
}>>;
|
|
1146
1158
|
amount: z.ZodOptional<z.ZodNumber>;
|
|
1147
|
-
|
|
1159
|
+
purpose: z.ZodOptional<z.ZodString>;
|
|
1148
1160
|
}, z.core.$strip>>;
|
|
1149
|
-
}, z.core.$
|
|
1161
|
+
}, z.core.$strip>>>;
|
|
1150
1162
|
status: z.ZodEnum<{
|
|
1151
1163
|
FAILED: "FAILED";
|
|
1152
1164
|
COMPLETED: "COMPLETED";
|
|
@@ -1158,6 +1170,62 @@ declare const createTransactionInputSchema: z.ZodObject<{
|
|
|
1158
1170
|
RETURNED: "RETURNED";
|
|
1159
1171
|
CANCELLED: "CANCELLED";
|
|
1160
1172
|
}>;
|
|
1173
|
+
currency: z.ZodOptional<z.ZodEnum<{
|
|
1174
|
+
CZK: "CZK";
|
|
1175
|
+
EUR: "EUR";
|
|
1176
|
+
USD: "USD";
|
|
1177
|
+
PLN: "PLN";
|
|
1178
|
+
RON: "RON";
|
|
1179
|
+
GBP: "GBP";
|
|
1180
|
+
RUB: "RUB";
|
|
1181
|
+
HUF: "HUF";
|
|
1182
|
+
CHF: "CHF";
|
|
1183
|
+
DKK: "DKK";
|
|
1184
|
+
SEK: "SEK";
|
|
1185
|
+
HRK: "HRK";
|
|
1186
|
+
NOK: "NOK";
|
|
1187
|
+
BGN: "BGN";
|
|
1188
|
+
TRY: "TRY";
|
|
1189
|
+
AUD: "AUD";
|
|
1190
|
+
CAD: "CAD";
|
|
1191
|
+
JPY: "JPY";
|
|
1192
|
+
CNY: "CNY";
|
|
1193
|
+
INR: "INR";
|
|
1194
|
+
BRL: "BRL";
|
|
1195
|
+
MXN: "MXN";
|
|
1196
|
+
ZAR: "ZAR";
|
|
1197
|
+
SGD: "SGD";
|
|
1198
|
+
HKD: "HKD";
|
|
1199
|
+
KRW: "KRW";
|
|
1200
|
+
MYR: "MYR";
|
|
1201
|
+
THB: "THB";
|
|
1202
|
+
IDR: "IDR";
|
|
1203
|
+
PHP: "PHP";
|
|
1204
|
+
AED: "AED";
|
|
1205
|
+
SAR: "SAR";
|
|
1206
|
+
ILS: "ILS";
|
|
1207
|
+
EGP: "EGP";
|
|
1208
|
+
NGN: "NGN";
|
|
1209
|
+
PKR: "PKR";
|
|
1210
|
+
COP: "COP";
|
|
1211
|
+
CLP: "CLP";
|
|
1212
|
+
PEN: "PEN";
|
|
1213
|
+
VND: "VND";
|
|
1214
|
+
KZT: "KZT";
|
|
1215
|
+
UAH: "UAH";
|
|
1216
|
+
BTC: "BTC";
|
|
1217
|
+
ETH: "ETH";
|
|
1218
|
+
ADA: "ADA";
|
|
1219
|
+
DOT: "DOT";
|
|
1220
|
+
ATOM: "ATOM";
|
|
1221
|
+
XRP: "XRP";
|
|
1222
|
+
LTC: "LTC";
|
|
1223
|
+
SOL: "SOL";
|
|
1224
|
+
DOGE: "DOGE";
|
|
1225
|
+
MATIC: "MATIC";
|
|
1226
|
+
AVAX: "AVAX";
|
|
1227
|
+
}>>;
|
|
1228
|
+
amount: z.ZodOptional<z.ZodNumber>;
|
|
1161
1229
|
}, z.core.$strip>;
|
|
1162
1230
|
interface CreateTransactionInput extends z.infer<typeof createTransactionInputSchema> {
|
|
1163
1231
|
}
|
|
@@ -1294,17 +1362,17 @@ declare const getTransactionsInputSchema: z.ZodObject<{
|
|
|
1294
1362
|
}, z.core.$strip>;
|
|
1295
1363
|
filterTransactionCorrelationId: z.ZodOptional<z.ZodUUID>;
|
|
1296
1364
|
filterTransactionReferenceType: z.ZodOptional<z.ZodEnum<{
|
|
1297
|
-
EXCHANGE: "EXCHANGE";
|
|
1298
1365
|
PAYMENT: "PAYMENT";
|
|
1366
|
+
EXCHANGE: "EXCHANGE";
|
|
1299
1367
|
ORDER: "ORDER";
|
|
1300
1368
|
}>>;
|
|
1301
1369
|
filterTransactionReferenceId: z.ZodOptional<z.ZodUUID>;
|
|
1302
1370
|
filterTransactionType: z.ZodOptional<z.ZodEnum<{
|
|
1371
|
+
EXCHANGE: "EXCHANGE";
|
|
1303
1372
|
CLIENT_FUND_IN: "CLIENT_FUND_IN";
|
|
1304
1373
|
CLIENT_FUND_OUT: "CLIENT_FUND_OUT";
|
|
1305
1374
|
PROVIDER_FUND_IN: "PROVIDER_FUND_IN";
|
|
1306
1375
|
PROVIDER_FUND_OUT: "PROVIDER_FUND_OUT";
|
|
1307
|
-
EXCHANGE: "EXCHANGE";
|
|
1308
1376
|
UNMATCHED: "UNMATCHED";
|
|
1309
1377
|
ADJUSTMENT: "ADJUSTMENT";
|
|
1310
1378
|
TRANSFER: "TRANSFER";
|
|
@@ -1335,8 +1403,8 @@ interface GetTransactionsOutput {
|
|
|
1335
1403
|
|
|
1336
1404
|
declare const getTransactionsByReferenceIdInputSchema: z.ZodObject<{
|
|
1337
1405
|
referenceType: z.ZodEnum<{
|
|
1338
|
-
EXCHANGE: "EXCHANGE";
|
|
1339
1406
|
PAYMENT: "PAYMENT";
|
|
1407
|
+
EXCHANGE: "EXCHANGE";
|
|
1340
1408
|
ORDER: "ORDER";
|
|
1341
1409
|
}>;
|
|
1342
1410
|
referenceId: z.ZodUUID;
|
|
@@ -1449,6 +1517,7 @@ interface ListAccountsOutput {
|
|
|
1449
1517
|
|
|
1450
1518
|
declare const matchTransactionInputSchema: z.ZodObject<{
|
|
1451
1519
|
transactionId: z.ZodUUID;
|
|
1520
|
+
paymentId: z.ZodString;
|
|
1452
1521
|
completedAt: z.ZodOptional<z.ZodDate>;
|
|
1453
1522
|
}, z.core.$strip>;
|
|
1454
1523
|
interface MatchTransactionInput extends z.infer<typeof matchTransactionInputSchema> {
|
|
@@ -83,6 +83,7 @@ const TRANSACTION_TYPES = [
|
|
|
83
83
|
];
|
|
84
84
|
const REFERENCE_TYPES = ["PAYMENT", "EXCHANGE", "ORDER"];
|
|
85
85
|
const PAYMENT_CHARGE_TYPES = ["SHA", "OUR", "BEN"];
|
|
86
|
+
const PAYMENT_TYPES = ["DOMESTIC", "SEPA", "SWIFT", "UNKNOWN"];
|
|
86
87
|
|
|
87
88
|
const ALLOWED_TRANSACTION_FILTERS = {
|
|
88
89
|
CORRELATION_ID: "filterTransactionCorrelationId",
|
|
@@ -96,7 +97,6 @@ const ALLOWED_TRANSACTION_FILTERS = {
|
|
|
96
97
|
STATUS: "filterTransactionStatus"
|
|
97
98
|
};
|
|
98
99
|
|
|
99
|
-
const PAYMENT_TYPES = ["SEPA", "SWIFT", "IFSC", "DOMESTIC"];
|
|
100
100
|
const PAYMENT_STATUSES = [
|
|
101
101
|
"PREPARED",
|
|
102
102
|
"INITIALIZED",
|
|
@@ -153,6 +153,10 @@ const transactionMetadataSchema = z.object({
|
|
|
153
153
|
// konstantní symbol
|
|
154
154
|
message: z.string().optional(),
|
|
155
155
|
// zpráva pro příjemce
|
|
156
|
+
type: z.enum(PAYMENT_TYPES),
|
|
157
|
+
// typ platby
|
|
158
|
+
paymentChargeType: z.enum(PAYMENT_CHARGE_TYPES).optional(),
|
|
159
|
+
expressPayment: z.boolean().optional(),
|
|
156
160
|
reference: z.string().optional(),
|
|
157
161
|
// další reference
|
|
158
162
|
creditor: bankAccountMetadataSchema.optional(),
|
|
@@ -163,10 +167,10 @@ const transactionMetadataSchema = z.object({
|
|
|
163
167
|
// ISO 8601
|
|
164
168
|
currency: z.enum(CURRENCY_CODES).optional(),
|
|
165
169
|
amount: z.number().optional(),
|
|
166
|
-
|
|
167
|
-
//
|
|
170
|
+
purpose: z.string().optional()
|
|
171
|
+
// účel platby
|
|
168
172
|
}).optional()
|
|
169
|
-
})
|
|
173
|
+
});
|
|
170
174
|
const createTransactionInputSchema = z.object({
|
|
171
175
|
correlationId: z.string().min(1),
|
|
172
176
|
referenceType: z.enum(REFERENCE_TYPES),
|
|
@@ -175,7 +179,9 @@ const createTransactionInputSchema = z.object({
|
|
|
175
179
|
description: z.string().optional(),
|
|
176
180
|
paymentId: z.string().optional(),
|
|
177
181
|
metadata: transactionMetadataSchema.optional().default({}),
|
|
178
|
-
status: z.enum(TRANSACTION_STATUSES)
|
|
182
|
+
status: z.enum(TRANSACTION_STATUSES),
|
|
183
|
+
currency: z.enum(CURRENCY_CODES).optional(),
|
|
184
|
+
amount: z.number().optional()
|
|
179
185
|
// entries: z.array(entryInputSchema).min(1),
|
|
180
186
|
});
|
|
181
187
|
|
|
@@ -267,6 +273,7 @@ const listAccountsInputSchema = z.object({
|
|
|
267
273
|
|
|
268
274
|
const matchTransactionInputSchema = z.object({
|
|
269
275
|
transactionId: z.uuid(),
|
|
276
|
+
paymentId: z.string(),
|
|
270
277
|
completedAt: z.date().optional()
|
|
271
278
|
});
|
|
272
279
|
|
|
@@ -286,4 +293,4 @@ const updateTransactionConfirmationSentAtInputSchema = z.object({
|
|
|
286
293
|
transactionId: z.uuid()
|
|
287
294
|
});
|
|
288
295
|
|
|
289
|
-
export { ACCOUNT_TYPES as A, BALANCE_STRATEGIES as B, COUNTRY_CODES as C, ENTRY_STATUSES as E, IDENTIFIER_KINDS as I, PAYMENT_CHARGE_TYPES as P, REFERENCE_TYPES as R, TRANSACTION_STATUSES as T, ASSET_TYPES as a, TRANSACTION_TYPES as b,
|
|
296
|
+
export { ACCOUNT_TYPES as A, BALANCE_STRATEGIES as B, COUNTRY_CODES as C, ENTRY_STATUSES as E, IDENTIFIER_KINDS as I, PAYMENT_CHARGE_TYPES as P, REFERENCE_TYPES as R, TRANSACTION_STATUSES as T, ASSET_TYPES as a, TRANSACTION_TYPES as b, PAYMENT_TYPES as c, ALLOWED_TRANSACTION_FILTERS as d, createAccountInputSchema as e, createTransactionInputSchema as f, deleteAccountInputSchema as g, failTransactionInputSchema as h, findAccountByIdentifierInputSchema as i, getAccountInputSchema as j, getAccountBalanceInputSchema as k, getAccountIdentifierInputSchema as l, getAccountsByOwnerInputSchema as m, getTransactionByIdInputSchema as n, getTransactionsInputSchema as o, getTransactionsByReferenceIdInputSchema as p, listAccountIdentifiersInputSchema as q, listAccountsInputSchema as r, matchTransactionInputSchema as s, updateTransactionConfirmationSentAtInputSchema as t, updateAccountInputSchema as u, PAYMENT_STATUSES as v, PAYMENT_DIRECTIONS as w, BATCH_STATUSES as x };
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const backendSdk = require('@develit-io/backend-sdk');
|
|
4
4
|
const drizzleOrm = require('drizzle-orm');
|
|
5
5
|
const sqliteCore = require('drizzle-orm/sqlite-core');
|
|
6
|
-
const updateTransactionConfirmationSentAt = require('./ledger.
|
|
6
|
+
const updateTransactionConfirmationSentAt = require('./ledger.CwcPuqoq.cjs');
|
|
7
7
|
require('@develit-io/general-codes');
|
|
8
8
|
|
|
9
9
|
const account = sqliteCore.sqliteTable("account", {
|