summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-04-15 18:58:53 +0200
committerFlorian Dold <florian@dold.me>2024-04-15 18:59:04 +0200
commitfc77825639c5da6d4c9a209ad8cf6df77c96fbae (patch)
tree765a6f4f6cf52d62f7cbb3daed23b858df23f9dc
parentffd2e70fec069441d56db73da9fa9c8e0633e0dc (diff)
downloadwallet-core-fc77825639c5da6d4c9a209ad8cf6df77c96fbae.tar.gz
wallet-core-fc77825639c5da6d4c9a209ad8cf6df77c96fbae.tar.bz2
wallet-core-fc77825639c5da6d4c9a209ad8cf6df77c96fbae.zip
wallet-core: remove more remains of rewards
-rw-r--r--packages/taler-util/src/transactions-types.ts19
-rw-r--r--packages/taler-wallet-core/src/reward.ts165
-rw-r--r--packages/taler-wallet-core/src/shepherd.ts15
-rw-r--r--packages/taler-wallet-core/src/transactions.ts21
-rw-r--r--packages/taler-wallet-webextension/src/components/HistoryItem.tsx2
-rw-r--r--packages/taler-wallet-webextension/src/wallet/Transaction.tsx3
6 files changed, 0 insertions, 225 deletions
diff --git a/packages/taler-util/src/transactions-types.ts b/packages/taler-util/src/transactions-types.ts
index bddc03c25..ac4c3d717 100644
--- a/packages/taler-util/src/transactions-types.ts
+++ b/packages/taler-util/src/transactions-types.ts
@@ -214,7 +214,6 @@ export type Transaction =
| TransactionWithdrawal
| TransactionPayment
| TransactionRefund
- | TransactionReward
| TransactionRefresh
| TransactionDeposit
| TransactionPeerPullCredit
@@ -231,7 +230,6 @@ export enum TransactionType {
Payment = "payment",
Refund = "refund",
Refresh = "refresh",
- Reward = "reward",
Deposit = "deposit",
PeerPushDebit = "peer-push-debit",
PeerPushCredit = "peer-push-credit",
@@ -641,23 +639,6 @@ export interface TransactionRefund extends TransactionCommon {
paymentInfo: RefundPaymentInfo | undefined;
}
-export interface TransactionReward extends TransactionCommon {
- type: TransactionType.Reward;
-
- // Raw amount of the tip, without extra fees that apply
- amountRaw: AmountString;
-
- /**
- * More information about the merchant
- */
- // merchant: MerchantInfo;
-
- // Amount will be (or was) added to the wallet's balance after fees and refreshing
- amountEffective: AmountString;
-
- merchantBaseUrl: string;
-}
-
/**
* A transaction shown for refreshes.
* Only shown for (1) refreshes not associated with other transactions
diff --git a/packages/taler-wallet-core/src/reward.ts b/packages/taler-wallet-core/src/reward.ts
deleted file mode 100644
index 85e8c6606..000000000
--- a/packages/taler-wallet-core/src/reward.ts
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2019 Taler Systems S.A.
-
- GNU Taler is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-
-/**
- * Imports.
- */
-import {
- AcceptTipResponse,
- Logger,
- PrepareTipResult,
- TransactionAction,
- TransactionIdStr,
- TransactionMajorState,
- TransactionMinorState,
- TransactionState,
- TransactionType,
- assertUnreachable,
-} from "@gnu-taler/taler-util";
-import {
- PendingTaskType,
- TaskIdStr,
- TaskRunResult,
- TombstoneTag,
- TransactionContext,
- constructTaskIdentifier,
-} from "./common.js";
-import { RewardRecord, RewardRecordStatus } from "./db.js";
-import {
- constructTransactionIdentifier,
-} from "./transactions.js";
-import { InternalWalletState, WalletExecutionContext } from "./wallet.js";
-
-export class RewardTransactionContext implements TransactionContext {
- public transactionId: TransactionIdStr;
- public taskId: TaskIdStr;
-
- constructor(
- public wex: WalletExecutionContext,
- public walletRewardId: string,
- ) {
- this.transactionId = constructTransactionIdentifier({
- tag: TransactionType.Reward,
- walletRewardId,
- });
- this.taskId = constructTaskIdentifier({
- tag: PendingTaskType.RewardPickup,
- walletRewardId,
- });
- }
-
- async deleteTransaction(): Promise<void> {
- throw Error("unsupported operation");
- }
-
- async suspendTransaction(): Promise<void> {
- throw Error("unsupported operation");
- }
-
- async abortTransaction(): Promise<void> {
- throw Error("unsupported operation");
- }
-
- async resumeTransaction(): Promise<void> {
- throw Error("unsupported operation");
- }
-
- async failTransaction(): Promise<void> {
- throw Error("unsupported operation");
- }
-}
-
-/**
- * Get the (DD37-style) transaction status based on the
- * database record of a reward.
- */
-export function computeRewardTransactionStatus(
- tipRecord: RewardRecord,
-): TransactionState {
- switch (tipRecord.status) {
- case RewardRecordStatus.Done:
- return {
- major: TransactionMajorState.Done,
- };
- case RewardRecordStatus.Aborted:
- return {
- major: TransactionMajorState.Aborted,
- };
- case RewardRecordStatus.PendingPickup:
- return {
- major: TransactionMajorState.Pending,
- minor: TransactionMinorState.Pickup,
- };
- case RewardRecordStatus.DialogAccept:
- return {
- major: TransactionMajorState.Dialog,
- minor: TransactionMinorState.Proposed,
- };
- case RewardRecordStatus.SuspendedPickup:
- return {
- major: TransactionMajorState.Pending,
- minor: TransactionMinorState.Pickup,
- };
- case RewardRecordStatus.Failed:
- return {
- major: TransactionMajorState.Failed,
- };
- default:
- assertUnreachable(tipRecord.status);
- }
-}
-
-export function computeTipTransactionActions(
- tipRecord: RewardRecord,
-): TransactionAction[] {
- switch (tipRecord.status) {
- case RewardRecordStatus.Done:
- return [TransactionAction.Delete];
- case RewardRecordStatus.Failed:
- return [TransactionAction.Delete];
- case RewardRecordStatus.Aborted:
- return [TransactionAction.Delete];
- case RewardRecordStatus.PendingPickup:
- return [TransactionAction.Suspend, TransactionAction.Fail];
- case RewardRecordStatus.SuspendedPickup:
- return [TransactionAction.Resume, TransactionAction.Fail];
- case RewardRecordStatus.DialogAccept:
- return [TransactionAction.Abort];
- default:
- assertUnreachable(tipRecord.status);
- }
-}
-
-export async function prepareReward(
- ws: InternalWalletState,
- talerTipUri: string,
-): Promise<PrepareTipResult> {
- throw Error("the rewards feature is not supported anymore");
-}
-
-export async function processTip(
- ws: InternalWalletState,
- walletTipId: string,
-): Promise<TaskRunResult> {
- return TaskRunResult.finished();
-}
-
-export async function acceptTip(
- ws: InternalWalletState,
- transactionId: TransactionIdStr,
-): Promise<AcceptTipResponse> {
- throw Error("the rewards feature is not supported anymore");
-}
diff --git a/packages/taler-wallet-core/src/shepherd.ts b/packages/taler-wallet-core/src/shepherd.ts
index 4ca472e7b..b2722ce1d 100644
--- a/packages/taler-wallet-core/src/shepherd.ts
+++ b/packages/taler-wallet-core/src/shepherd.ts
@@ -91,7 +91,6 @@ import {
computeRefreshTransactionState,
processRefreshGroup,
} from "./refresh.js";
-import { computeRewardTransactionStatus } from "./reward.js";
import {
constructTransactionIdentifier,
parseTransactionIdentifier,
@@ -713,13 +712,6 @@ async function getTransactionState(
}
return computeRefreshTransactionState(rec);
}
- case TransactionType.Reward: {
- const rec = await tx.rewards.get(parsedTxId.walletRewardId);
- if (!rec) {
- return undefined;
- }
- return computeRewardTransactionStatus(rec);
- }
case TransactionType.Recoup:
throw Error("not yet supported");
case TransactionType.DenomLoss: {
@@ -867,8 +859,6 @@ export function listTaskForTransactionId(transactionId: string): TaskIdStr[] {
];
case TransactionType.Refund:
return [];
- case TransactionType.Reward:
- return [];
case TransactionType.Withdrawal:
return [
constructTaskIdentifier({
@@ -925,11 +915,6 @@ export function convertTaskToTransactionId(
tag: TransactionType.Refresh,
refreshGroupId: parsedTaskId.refreshGroupId,
});
- case PendingTaskType.RewardPickup:
- return constructTransactionIdentifier({
- tag: TransactionType.Reward,
- walletRewardId: parsedTaskId.walletRewardId,
- });
case PendingTaskType.PeerPushDebit:
return constructTransactionIdentifier({
tag: TransactionType.PeerPushDebit,
diff --git a/packages/taler-wallet-core/src/transactions.ts b/packages/taler-wallet-core/src/transactions.ts
index 536f0de4b..43ef09220 100644
--- a/packages/taler-wallet-core/src/transactions.ts
+++ b/packages/taler-wallet-core/src/transactions.ts
@@ -129,7 +129,6 @@ import {
computeRefreshTransactionState,
RefreshTransactionContext,
} from "./refresh.js";
-import { RewardTransactionContext } from "./reward.js";
import type { WalletExecutionContext } from "./wallet.js";
import {
augmentPaytoUrisForWithdrawal,
@@ -199,7 +198,6 @@ function shouldSkipSearch(
*/
const txOrder: { [t in TransactionType]: number } = {
[TransactionType.Withdrawal]: 1,
- [TransactionType.Reward]: 2,
[TransactionType.Payment]: 3,
[TransactionType.PeerPullCredit]: 4,
[TransactionType.PeerPullDebit]: 5,
@@ -333,10 +331,6 @@ export async function getTransactionById(
);
}
- case TransactionType.Reward: {
- throw Error("unsupported operation");
- }
-
case TransactionType.Deposit: {
const depositGroupId = parsedTx.depositGroupId;
return await wex.db.runReadWriteTx(
@@ -1531,7 +1525,6 @@ export type ParsedTransactionIdentifier =
| { tag: TransactionType.PeerPushDebit; pursePub: string }
| { tag: TransactionType.Refresh; refreshGroupId: string }
| { tag: TransactionType.Refund; refundGroupId: string }
- | { tag: TransactionType.Reward; walletRewardId: string }
| { tag: TransactionType.Withdrawal; withdrawalGroupId: string }
| { tag: TransactionType.InternalWithdrawal; withdrawalGroupId: string }
| { tag: TransactionType.Recoup; recoupGroupId: string }
@@ -1557,8 +1550,6 @@ export function constructTransactionIdentifier(
return `txn:${pTxId.tag}:${pTxId.refreshGroupId}` as TransactionIdStr;
case TransactionType.Refund:
return `txn:${pTxId.tag}:${pTxId.refundGroupId}` as TransactionIdStr;
- case TransactionType.Reward:
- return `txn:${pTxId.tag}:${pTxId.walletRewardId}` as TransactionIdStr;
case TransactionType.Withdrawal:
return `txn:${pTxId.tag}:${pTxId.withdrawalGroupId}` as TransactionIdStr;
case TransactionType.InternalWithdrawal:
@@ -1616,11 +1607,6 @@ export function parseTransactionIdentifier(
tag: TransactionType.Refund,
refundGroupId: rest[0],
};
- case TransactionType.Reward:
- return {
- tag: TransactionType.Reward,
- walletRewardId: rest[0],
- };
case TransactionType.Withdrawal:
return {
tag: TransactionType.Withdrawal,
@@ -1669,11 +1655,6 @@ function maybeTaskFromTransaction(
tag: PendingTaskType.Purchase,
proposalId: parsedTx.proposalId,
});
- case TransactionType.Reward:
- return constructTaskIdentifier({
- tag: PendingTaskType.RewardPickup,
- walletRewardId: parsedTx.walletRewardId,
- });
case TransactionType.Refresh:
return constructTaskIdentifier({
tag: PendingTaskType.Refresh,
@@ -1753,8 +1734,6 @@ async function getContextForTransaction(
return new PeerPushCreditTransactionContext(wex, tx.peerPushCreditId);
case TransactionType.Refund:
return new RefundTransactionContext(wex, tx.refundGroupId);
- case TransactionType.Reward:
- return new RewardTransactionContext(wex, tx.walletRewardId);
case TransactionType.Recoup:
//return new RecoupTransactionContext(ws, tx.recoupGroupId);
throw new Error("not yet supported");
diff --git a/packages/taler-wallet-webextension/src/components/HistoryItem.tsx b/packages/taler-wallet-webextension/src/components/HistoryItem.tsx
index 833448e67..9be9326b2 100644
--- a/packages/taler-wallet-webextension/src/components/HistoryItem.tsx
+++ b/packages/taler-wallet-webextension/src/components/HistoryItem.tsx
@@ -136,8 +136,6 @@ export function HistoryItem(props: { tx: Transaction }): VNode {
}
/>
);
- case TransactionType.Reward:
- return <div>not supported</div>;
case TransactionType.Refresh:
return (
<Layout
diff --git a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx
index 27c9b5d77..af6868434 100644
--- a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx
@@ -1139,9 +1139,6 @@ export function TransactionView({
if (transaction.type === TransactionType.Recoup) {
throw Error("recoup transaction not implemented");
}
- if (transaction.type === TransactionType.Reward) {
- throw Error("recoup transaction not implemented");
- }
assertUnreachable(transaction);
}