aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2020-05-15 12:53:35 +0530
committerFlorian Dold <florian.dold@gmail.com>2020-05-15 12:53:35 +0530
commit35c83414f9e0af11012c1a2e00672d2a7c1856ae (patch)
treebe7d1ad1787706400aaac931c00778b7699a1d1b /src/wallet.ts
parentcda75feb5bf7623439f3f5f8da0c6da0c164b3fb (diff)
downloadwallet-core-35c83414f9e0af11012c1a2e00672d2a7c1856ae.tar.xz
fix issues in the webextension refund UI
Diffstat (limited to 'src/wallet.ts')
-rw-r--r--src/wallet.ts33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/wallet.ts b/src/wallet.ts
index 2d63e2298..31f9af8c2 100644
--- a/src/wallet.ts
+++ b/src/wallet.ts
@@ -112,7 +112,10 @@ import {
import { durationMin, Duration } from "./util/time";
import { processRecoupGroup } from "./operations/recoup";
import { OperationFailedAndReportedError } from "./operations/errors";
-import { TransactionsRequest, TransactionsResponse } from "./types/transactions";
+import {
+ TransactionsRequest,
+ TransactionsResponse,
+} from "./types/transactions";
import { getTransactions } from "./operations/transactions";
const builtinCurrencies: CurrencyRecord[] = [
@@ -631,7 +634,7 @@ export class Wallet {
*/
async applyRefund(
talerRefundUri: string,
- ): Promise<{ contractTermsHash: string }> {
+ ): Promise<{ contractTermsHash: string; proposalId: string }> {
return applyRefund(this.ws, talerRefundUri);
}
@@ -719,14 +722,14 @@ export class Wallet {
return refuseProposal(this.ws, proposalId);
}
- async getPurchaseDetails(hc: string): Promise<PurchaseDetails> {
- const purchase = await this.db.get(Stores.purchases, hc);
+ async getPurchaseDetails(proposalId: string): Promise<PurchaseDetails> {
+ const purchase = await this.db.get(Stores.purchases, proposalId);
if (!purchase) {
throw Error("unknown purchase");
}
- const refundsDoneAmounts = Object.values(
- purchase.refundsDone,
- ).map((x) => Amounts.parseOrThrow(x.perm.refund_amount));
+ const refundsDoneAmounts = Object.values(purchase.refundsDone).map((x) =>
+ Amounts.parseOrThrow(x.perm.refund_amount),
+ );
const refundsPendingAmounts = Object.values(
purchase.refundsPending,
).map((x) => Amounts.parseOrThrow(x.perm.refund_amount));
@@ -734,12 +737,12 @@ export class Wallet {
...refundsDoneAmounts,
...refundsPendingAmounts,
]).amount;
- const refundsDoneFees = Object.values(
- purchase.refundsDone,
- ).map((x) => Amounts.parseOrThrow(x.perm.refund_amount));
- const refundsPendingFees = Object.values(
- purchase.refundsPending,
- ).map((x) => Amounts.parseOrThrow(x.perm.refund_amount));
+ const refundsDoneFees = Object.values(purchase.refundsDone).map((x) =>
+ Amounts.parseOrThrow(x.perm.refund_amount),
+ );
+ const refundsPendingFees = Object.values(purchase.refundsPending).map((x) =>
+ Amounts.parseOrThrow(x.perm.refund_amount),
+ );
const totalRefundFees = Amounts.sum([
...refundsDoneFees,
...refundsPendingFees,
@@ -818,7 +821,9 @@ export class Wallet {
return coinsJson;
}
- async getTransactions(request: TransactionsRequest): Promise<TransactionsResponse> {
+ async getTransactions(
+ request: TransactionsRequest,
+ ): Promise<TransactionsResponse> {
return getTransactions(this.ws, request);
}
}