diff options
Diffstat (limited to 'packages/taler-wallet-core/src/operations')
-rw-r--r-- | packages/taler-wallet-core/src/operations/reward.ts | 6 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/operations/transactions.ts | 11 |
2 files changed, 12 insertions, 5 deletions
diff --git a/packages/taler-wallet-core/src/operations/reward.ts b/packages/taler-wallet-core/src/operations/reward.ts index 4e16d977d..ed9927bab 100644 --- a/packages/taler-wallet-core/src/operations/reward.ts +++ b/packages/taler-wallet-core/src/operations/reward.ts @@ -23,7 +23,7 @@ import { Amounts, BlindedDenominationSignature, codecForMerchantTipResponseV2, - codecForTipPickupGetResponse, + codecForRewardPickupGetResponse, CoinStatus, DenomKeyType, encodeCrock, @@ -168,11 +168,11 @@ export async function prepareTip( const merchantResp = await ws.http.fetch(tipStatusUrl.href); const tipPickupStatus = await readSuccessResponseJsonOrThrow( merchantResp, - codecForTipPickupGetResponse(), + codecForRewardPickupGetResponse(), ); logger.trace(`status ${j2s(tipPickupStatus)}`); - const amount = Amounts.parseOrThrow(tipPickupStatus.tip_amount); + const amount = Amounts.parseOrThrow(tipPickupStatus.reward_amount); logger.trace("new tip, creating tip record"); await updateExchangeFromUrl(ws, tipPickupStatus.exchange_url); diff --git a/packages/taler-wallet-core/src/operations/transactions.ts b/packages/taler-wallet-core/src/operations/transactions.ts index 72c67b153..bebb3d60b 100644 --- a/packages/taler-wallet-core/src/operations/transactions.ts +++ b/packages/taler-wallet-core/src/operations/transactions.ts @@ -1290,9 +1290,16 @@ export async function getTransactions( const txPending = transactions.filter((x) => isPending(x)); const txNotPending = transactions.filter((x) => !isPending(x)); + let sortSign: number; + if (transactionsRequest?.sort == "descending") { + sortSign = -1; + } else { + sortSign = 1; + } + const txCmp = (h1: Transaction, h2: Transaction) => { // Order transactions by timestamp. Newest transactions come first. - const tsCmp = -AbsoluteTime.cmp( + const tsCmp = AbsoluteTime.cmp( AbsoluteTime.fromPreciseTimestamp(h1.timestamp), AbsoluteTime.fromPreciseTimestamp(h2.timestamp), ); @@ -1300,7 +1307,7 @@ export async function getTransactions( if (tsCmp === 0) { return Math.sign(txOrder[h1.type] - txOrder[h2.type]); } - return tsCmp; + return sortSign * tsCmp; }; txPending.sort(txCmp); |