summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/transactions.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-core/src/transactions.ts')
-rw-r--r--packages/taler-wallet-core/src/transactions.ts75
1 files changed, 1 insertions, 74 deletions
diff --git a/packages/taler-wallet-core/src/transactions.ts b/packages/taler-wallet-core/src/transactions.ts
index 1660c8d09..7ece43dc5 100644
--- a/packages/taler-wallet-core/src/transactions.ts
+++ b/packages/taler-wallet-core/src/transactions.ts
@@ -322,19 +322,7 @@ export async function getTransactionById(
}
case TransactionType.Reward: {
- const tipId = parsedTx.walletRewardId;
- return await wex.db.runReadWriteTx(
- ["rewards", "operationRetries"],
- async (tx) => {
- const tipRecord = await tx.rewards.get(tipId);
- if (!tipRecord) throw Error("not found");
-
- const retries = await tx.operationRetries.get(
- TaskIdentifiers.forTipPickup(tipRecord),
- );
- return buildTransactionForTip(tipRecord, retries);
- },
- );
+ throw Error("unsupported operation");
}
case TransactionType.Deposit: {
@@ -923,31 +911,6 @@ function buildTransactionForDeposit(
};
}
-function buildTransactionForTip(
- tipRecord: RewardRecord,
- ort?: OperationRetryRecord,
-): Transaction {
- checkLogicInvariant(!!tipRecord.acceptedTimestamp);
-
- const txState = computeRewardTransactionStatus(tipRecord);
- return {
- type: TransactionType.Reward,
- txState,
- txActions: computeTipTransactionActions(tipRecord),
- amountEffective: isUnsuccessfulTransaction(txState)
- ? Amounts.stringify(Amounts.zeroOfAmount(tipRecord.rewardAmountEffective))
- : Amounts.stringify(tipRecord.rewardAmountEffective),
- amountRaw: Amounts.stringify(tipRecord.rewardAmountRaw),
- timestamp: timestampPreciseFromDb(tipRecord.acceptedTimestamp),
- transactionId: constructTransactionIdentifier({
- tag: TransactionType.Reward,
- walletRewardId: tipRecord.walletRewardId,
- }),
- merchantBaseUrl: tipRecord.merchantBaseUrl,
- ...(ort?.lastError ? { error: ort.lastError } : {}),
- };
-}
-
async function lookupMaybeContractData(
tx: WalletDbReadOnlyTransaction<["purchases", "contractTerms"]>,
proposalId: string,
@@ -1444,26 +1407,6 @@ export async function getTransactions(
),
);
});
-
- //FIXME: remove rewards
- await iterRecordsForReward(tx, filter, async (tipRecord) => {
- if (
- shouldSkipCurrency(
- transactionsRequest,
- Amounts.parseOrThrow(tipRecord.rewardAmountRaw).currency,
- [tipRecord.exchangeBaseUrl],
- )
- ) {
- return;
- }
- if (!tipRecord.acceptedTimestamp) {
- return;
- }
- const opId = TaskIdentifiers.forTipPickup(tipRecord);
- const retryRecord = await tx.operationRetries.get(opId);
- transactions.push(buildTransactionForTip(tipRecord, retryRecord));
- });
- //ends REMOVE REWARDS
},
);
@@ -1904,22 +1847,6 @@ async function iterRecordsForDeposit(
}
}
-async function iterRecordsForReward(
- tx: WalletDbReadOnlyTransaction<["rewards"]>,
- filter: TransactionRecordFilter,
- f: (r: RewardRecord) => Promise<void>,
-): Promise<void> {
- if (filter.onlyState === "nonfinal") {
- const keyRange = GlobalIDB.KeyRange.bound(
- OPERATION_STATUS_ACTIVE_FIRST,
- OPERATION_STATUS_ACTIVE_LAST,
- );
- await tx.rewards.indexes.byStatus.iter(keyRange).forEachAsync(f);
- } else {
- await tx.rewards.indexes.byStatus.iter().forEachAsync(f);
- }
-}
-
async function iterRecordsForRefund(
tx: WalletDbReadOnlyTransaction<["refundGroups"]>,
filter: TransactionRecordFilter,