aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/taler-util/src/notifications.ts16
-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
4 files changed, 24 insertions, 116 deletions
diff --git a/packages/taler-util/src/notifications.ts b/packages/taler-util/src/notifications.ts
index a8a8c3299..49952295a 100644
--- a/packages/taler-util/src/notifications.ts
+++ b/packages/taler-util/src/notifications.ts
@@ -24,7 +24,11 @@
*/
import { AbsoluteTime } from "./time.js";
import { TransactionState } from "./transactions-types.js";
-import { ExchangeEntryState, TalerErrorDetail } from "./wallet-types.js";
+import {
+ ExchangeEntryState,
+ TalerErrorDetail,
+ TransactionIdStr,
+} from "./wallet-types.js";
export enum NotificationType {
BalanceChange = "balance-change",
@@ -134,6 +138,12 @@ export enum ObservabilityEventType {
CryptoFinishSuccess = "crypto-finish-success",
CryptoFinishError = "crypto-finish-error",
Message = "message",
+ /**
+ * Declare that an observability event is relevant to a particular transaction.
+ * If emitted from a request/task, all past/future events for that request/task
+ * should be shown for the transaction as well.
+ */
+ DeclareConcernsTransaction = "declare-concerns-transaction",
}
export type ObservabilityEvent =
@@ -217,6 +227,10 @@ export type ObservabilityEvent =
| {
type: ObservabilityEventType.Message;
contents: string;
+ }
+ | {
+ type: ObservabilityEventType.DeclareConcernsTransaction;
+ transactionId: TransactionIdStr;
};
export interface BackupOperationErrorNotification {
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);