summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations/backup
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-core/src/operations/backup')
-rw-r--r--packages/taler-wallet-core/src/operations/backup/export.ts18
-rw-r--r--packages/taler-wallet-core/src/operations/backup/import.ts32
2 files changed, 25 insertions, 25 deletions
diff --git a/packages/taler-wallet-core/src/operations/backup/export.ts b/packages/taler-wallet-core/src/operations/backup/export.ts
index 21ba5dc37..c9446a05f 100644
--- a/packages/taler-wallet-core/src/operations/backup/export.ts
+++ b/packages/taler-wallet-core/src/operations/backup/export.ts
@@ -96,7 +96,7 @@ export async function exportBackup(
x.purchases,
x.refreshGroups,
x.backupProviders,
- x.tips,
+ x.rewards,
x.recoupGroups,
x.withdrawalGroups,
])
@@ -184,12 +184,12 @@ export async function exportBackup(
});
});
- await tx.tips.iter().forEach((tip) => {
+ await tx.rewards.iter().forEach((tip) => {
backupTips.push({
exchange_base_url: tip.exchangeBaseUrl,
merchant_base_url: tip.merchantBaseUrl,
- merchant_tip_id: tip.merchantTipId,
- wallet_tip_id: tip.walletTipId,
+ merchant_tip_id: tip.merchantRewardId,
+ wallet_tip_id: tip.walletRewardId,
next_url: tip.next_url,
secret_seed: tip.secretSeed,
selected_denoms: tip.denomsSel.selectedDenoms.map((x) => ({
@@ -199,8 +199,8 @@ export async function exportBackup(
timestamp_finished: tip.pickedUpTimestamp,
timestamp_accepted: tip.acceptedTimestamp,
timestamp_created: tip.createdTimestamp,
- timestamp_expiration: tip.tipExpiration,
- tip_amount_raw: Amounts.stringify(tip.tipAmountRaw),
+ timestamp_expiration: tip.rewardExpiration,
+ tip_amount_raw: Amounts.stringify(tip.rewardAmountRaw),
selected_denoms_uid: tip.denomSelUid,
});
});
@@ -244,11 +244,11 @@ export async function exportBackup(
refresh_group_id: coin.coinSource.refreshGroupId,
};
break;
- case CoinSourceType.Tip:
+ case CoinSourceType.Reward:
bcs = {
- type: BackupCoinSourceType.Tip,
+ type: BackupCoinSourceType.Reward,
coin_index: coin.coinSource.coinIndex,
- wallet_tip_id: coin.coinSource.walletTipId,
+ wallet_tip_id: coin.coinSource.walletRewardId,
};
break;
case CoinSourceType.Withdraw:
diff --git a/packages/taler-wallet-core/src/operations/backup/import.ts b/packages/taler-wallet-core/src/operations/backup/import.ts
index b161aa8f2..a53b624e8 100644
--- a/packages/taler-wallet-core/src/operations/backup/import.ts
+++ b/packages/taler-wallet-core/src/operations/backup/import.ts
@@ -56,7 +56,7 @@ import {
WithdrawalGroupStatus,
WithdrawalRecordType,
RefreshOperationStatus,
- TipRecordStatus,
+ RewardRecordStatus,
} from "../../db.js";
import { InternalWalletState } from "../../internal-wallet-state.js";
import { assertUnreachable } from "../../util/assertUnreachable.js";
@@ -250,11 +250,11 @@ export async function importCoin(
refreshGroupId: backupCoin.coin_source.refresh_group_id,
};
break;
- case BackupCoinSourceType.Tip:
+ case BackupCoinSourceType.Reward:
coinSource = {
- type: CoinSourceType.Tip,
+ type: CoinSourceType.Reward,
coinIndex: backupCoin.coin_source.coin_index,
- walletTipId: backupCoin.coin_source.wallet_tip_id,
+ walletRewardId: backupCoin.coin_source.wallet_tip_id,
};
break;
case BackupCoinSourceType.Withdraw:
@@ -311,7 +311,7 @@ export async function importBackup(
x.purchases,
x.refreshGroups,
x.backupProviders,
- x.tips,
+ x.rewards,
x.recoupGroups,
x.withdrawalGroups,
x.tombstones,
@@ -812,13 +812,13 @@ export async function importBackup(
for (const backupTip of backupBlob.tips) {
const ts = constructTombstone({
- tag: TombstoneTag.DeleteTip,
+ tag: TombstoneTag.DeleteReward,
walletTipId: backupTip.wallet_tip_id,
});
if (tombstoneSet.has(ts)) {
continue;
}
- const existingTip = await tx.tips.get(backupTip.wallet_tip_id);
+ const existingTip = await tx.rewards.get(backupTip.wallet_tip_id);
if (!existingTip) {
const tipAmountRaw = Amounts.parseOrThrow(backupTip.tip_amount_raw);
const denomsSel = await getDenomSelStateFromBackup(
@@ -827,22 +827,22 @@ export async function importBackup(
backupTip.exchange_base_url,
backupTip.selected_denoms,
);
- await tx.tips.put({
+ await tx.rewards.put({
acceptedTimestamp: backupTip.timestamp_accepted,
createdTimestamp: backupTip.timestamp_created,
denomsSel,
next_url: backupTip.next_url,
exchangeBaseUrl: backupTip.exchange_base_url,
merchantBaseUrl: backupTip.exchange_base_url,
- merchantTipId: backupTip.merchant_tip_id,
+ merchantRewardId: backupTip.merchant_tip_id,
pickedUpTimestamp: backupTip.timestamp_finished,
secretSeed: backupTip.secret_seed,
- tipAmountEffective: Amounts.stringify(denomsSel.totalCoinValue),
- tipAmountRaw: Amounts.stringify(tipAmountRaw),
- tipExpiration: backupTip.timestamp_expiration,
- walletTipId: backupTip.wallet_tip_id,
+ rewardAmountEffective: Amounts.stringify(denomsSel.totalCoinValue),
+ rewardAmountRaw: Amounts.stringify(tipAmountRaw),
+ rewardExpiration: backupTip.timestamp_expiration,
+ walletRewardId: backupTip.wallet_tip_id,
denomSelUid: backupTip.selected_denoms_uid,
- status: TipRecordStatus.Done, // FIXME!
+ status: RewardRecordStatus.Done, // FIXME!
});
}
}
@@ -863,8 +863,8 @@ export async function importBackup(
} else if (type === TombstoneTag.DeleteRefund) {
// Nothing required, will just prevent display
// in the transactions list
- } else if (type === TombstoneTag.DeleteTip) {
- await tx.tips.delete(rest[0]);
+ } else if (type === TombstoneTag.DeleteReward) {
+ await tx.rewards.delete(rest[0]);
} else if (type === TombstoneTag.DeleteWithdrawalGroup) {
await tx.withdrawalGroups.delete(rest[0]);
} else {