aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-06-30 20:37:03 +0200
committerFlorian Dold <florian@dold.me>2024-06-30 20:37:03 +0200
commitc297b5130cb7e9ceba4602548d9ccb68735d55e5 (patch)
treeba879a090f0a2d604a13ed977b374ae9000aa1e7 /packages/taler-wallet-core/src
parent93283808cfef9a947e62cf136f8b204816248d53 (diff)
downloadwallet-core-c297b5130cb7e9ceba4602548d9ccb68735d55e5.tar.xz
wallet-core: introduce declare-concerns-transaction obs event
Diffstat (limited to 'packages/taler-wallet-core/src')
-rw-r--r--packages/taler-wallet-core/src/shepherd.ts94
-rw-r--r--packages/taler-wallet-core/src/wallet-api-types.ts13
-rw-r--r--packages/taler-wallet-core/src/wallet.ts17
3 files changed, 9 insertions, 115 deletions
diff --git a/packages/taler-wallet-core/src/shepherd.ts b/packages/taler-wallet-core/src/shepherd.ts
index 738a3a9e3..434ee8635 100644
--- a/packages/taler-wallet-core/src/shepherd.ts
+++ b/packages/taler-wallet-core/src/shepherd.ts
@@ -633,6 +633,15 @@ async function callOperationHandlerForTaskId(
taskId: TaskIdStr,
): Promise<TaskRunResult> {
const pending = parseTaskIdentifier(taskId);
+
+ const txId = convertTaskToTransactionId(taskId);
+ if (txId) {
+ wex.oc.observe({
+ type: ObservabilityEventType.DeclareConcernsTransaction,
+ transactionId: txId,
+ });
+ }
+
switch (pending.tag) {
case PendingTaskType.ExchangeUpdate:
return await updateExchangeFromUrlHandler(wex, pending.exchangeBaseUrl);
@@ -863,91 +872,6 @@ async function makeExchangeRetryNotification(
return notif;
}
-export function listTaskForTransactionId(transactionId: string): TaskIdStr[] {
- const tid = parseTransactionIdentifier(transactionId);
- if (!tid) {
- throw Error("invalid task ID");
- }
- switch (tid.tag) {
- case TransactionType.Deposit:
- return [
- constructTaskIdentifier({
- tag: PendingTaskType.Deposit,
- depositGroupId: tid.depositGroupId,
- }),
- ];
- case TransactionType.InternalWithdrawal:
- return [
- constructTaskIdentifier({
- tag: PendingTaskType.Withdraw,
- withdrawalGroupId: tid.withdrawalGroupId,
- }),
- ];
- case TransactionType.Payment:
- return [
- constructTaskIdentifier({
- tag: PendingTaskType.Purchase,
- proposalId: tid.proposalId,
- }),
- ];
- case TransactionType.PeerPullCredit:
- return [
- constructTaskIdentifier({
- tag: PendingTaskType.PeerPullCredit,
- pursePub: tid.pursePub,
- }),
- ];
- case TransactionType.PeerPullDebit:
- return [
- constructTaskIdentifier({
- tag: PendingTaskType.PeerPullDebit,
- peerPullDebitId: tid.peerPullDebitId,
- }),
- ];
- case TransactionType.PeerPushCredit:
- return [
- constructTaskIdentifier({
- tag: PendingTaskType.PeerPullCredit,
- pursePub: tid.peerPushCreditId,
- }),
- ];
- case TransactionType.PeerPushDebit:
- return [
- constructTaskIdentifier({
- tag: PendingTaskType.PeerPullCredit,
- pursePub: tid.pursePub,
- }),
- ];
- case TransactionType.Recoup:
- return [
- constructTaskIdentifier({
- tag: PendingTaskType.Recoup,
- recoupGroupId: tid.recoupGroupId,
- }),
- ];
- case TransactionType.Refresh:
- return [
- constructTaskIdentifier({
- tag: PendingTaskType.Refresh,
- refreshGroupId: tid.refreshGroupId,
- }),
- ];
- case TransactionType.Refund:
- return [];
- case TransactionType.Withdrawal:
- return [
- constructTaskIdentifier({
- tag: PendingTaskType.Withdraw,
- withdrawalGroupId: tid.withdrawalGroupId,
- }),
- ];
- case TransactionType.DenomLoss:
- return [];
- default:
- assertUnreachable(tid);
- }
-}
-
/**
* Convert the task ID for a task that processes a transaction int
* the ID for the transaction.
diff --git a/packages/taler-wallet-core/src/wallet-api-types.ts b/packages/taler-wallet-core/src/wallet-api-types.ts
index cd17bc8cd..c1943daa1 100644
--- a/packages/taler-wallet-core/src/wallet-api-types.ts
+++ b/packages/taler-wallet-core/src/wallet-api-types.ts
@@ -132,8 +132,6 @@ import {
TestPayResult,
TestingGetDenomStatsRequest,
TestingGetDenomStatsResponse,
- TestingListTasksForTransactionRequest,
- TestingListTasksForTransactionsResponse,
TestingSetTimetravelRequest,
TestingWaitTransactionRequest,
Transaction,
@@ -278,7 +276,6 @@ export enum WalletApiOperation {
TestingWaitTasksDone = "testingWaitTasksDone",
TestingSetTimetravel = "testingSetTimetravel",
TestingInfiniteTransactionLoop = "testingInfiniteTransactionLoop",
- TestingListTaskForTransaction = "testingListTasksForTransaction",
TestingGetDenomStats = "testingGetDenomStats",
TestingPing = "testingPing",
TestingGetReserveHistory = "testingGetReserveHistory",
@@ -1165,15 +1162,6 @@ export type TestingSetTimetravelOp = {
};
/**
- * Add an offset to the wallet's internal time.
- */
-export type TestingListTasksForTransactionOp = {
- op: WalletApiOperation.TestingListTaskForTransaction;
- request: TestingListTasksForTransactionRequest;
- response: TestingListTasksForTransactionsResponse;
-};
-
-/**
* Wait until all transactions are in a final state.
*/
export type TestingWaitTransactionsFinalOp = {
@@ -1366,7 +1354,6 @@ export type WalletOperations = {
[WalletApiOperation.AddGlobalCurrencyExchange]: AddGlobalCurrencyExchangeOp;
[WalletApiOperation.RemoveGlobalCurrencyExchange]: RemoveGlobalCurrencyExchangeOp;
[WalletApiOperation.ListAssociatedRefreshes]: ListAssociatedRefreshesOp;
- [WalletApiOperation.TestingListTaskForTransaction]: TestingListTasksForTransactionOp;
[WalletApiOperation.TestingGetDenomStats]: TestingGetDenomStatsOp;
[WalletApiOperation.TestingPing]: TestingPingOp;
[WalletApiOperation.Shutdown]: ShutdownOp;
diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts
index 536f559d4..9e3aea137 100644
--- a/packages/taler-wallet-core/src/wallet.ts
+++ b/packages/taler-wallet-core/src/wallet.ts
@@ -91,8 +91,6 @@ import {
TestingGetDenomStatsRequest,
TestingGetDenomStatsResponse,
TestingGetReserveHistoryRequest,
- TestingListTasksForTransactionRequest,
- TestingListTasksForTransactionsResponse,
TestingWaitTransactionRequest,
TimerAPI,
TimerGroup,
@@ -309,7 +307,6 @@ import {
TaskSchedulerImpl,
convertTaskToTransactionId,
getActiveTaskIds,
- listTaskForTransactionId,
} from "./shepherd.js";
import {
runIntegrationTest,
@@ -816,15 +813,6 @@ async function handleWithdrawTestBalance(
return {};
}
-async function handleTestingListTasksForTransaction(
- wex: WalletExecutionContext,
- req: TestingListTasksForTransactionRequest,
-): Promise<TestingListTasksForTransactionsResponse> {
- return {
- taskIdList: listTaskForTransactionId(req.transactionId),
- };
-}
-
async function handleRunIntegrationTest(
wex: WalletExecutionContext,
req: IntegrationTestArgs,
@@ -1248,11 +1236,6 @@ async function dispatchRequestInternal(
const req = codecForWithdrawTestBalance().decode(payload);
return await handleWithdrawTestBalance(wex, req);
}
- case WalletApiOperation.TestingListTaskForTransaction: {
- const req =
- codecForTestingListTasksForTransactionRequest().decode(payload);
- return await handleTestingListTasksForTransaction(wex, req);
- }
case WalletApiOperation.RunIntegrationTest: {
const req = codecForIntegrationTestArgs().decode(payload);
return await handleRunIntegrationTest(wex, req);