aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/cta/Refund/state.ts
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2022-10-25 12:23:08 -0300
committerSebastian <sebasjm@gmail.com>2022-10-25 19:19:09 -0300
commita286649b0a611d87916a178a795c1acd2917741c (patch)
tree86d0a8eefb791ffebc877a88d6876d1ff764cf2b /packages/taler-wallet-webextension/src/cta/Refund/state.ts
parent5fcd434f662bcef7e9e043763766c8b104ad6b97 (diff)
downloadwallet-core-a286649b0a611d87916a178a795c1acd2917741c.tar.gz
wallet-core-a286649b0a611d87916a178a795c1acd2917741c.tar.bz2
wallet-core-a286649b0a611d87916a178a795c1acd2917741c.zip
cherry-pick: using new wallet typed api missing test
Diffstat (limited to 'packages/taler-wallet-webextension/src/cta/Refund/state.ts')
-rw-r--r--packages/taler-wallet-webextension/src/cta/Refund/state.ts18
1 files changed, 10 insertions, 8 deletions
diff --git a/packages/taler-wallet-webextension/src/cta/Refund/state.ts b/packages/taler-wallet-webextension/src/cta/Refund/state.ts
index 16dbbf70d..65a895fc3 100644
--- a/packages/taler-wallet-webextension/src/cta/Refund/state.ts
+++ b/packages/taler-wallet-webextension/src/cta/Refund/state.ts
@@ -15,9 +15,10 @@
*/
import { Amounts, NotificationType } from "@gnu-taler/taler-util";
+import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { useEffect, useState } from "preact/hooks";
import { useAsyncAsHook } from "../../hooks/useAsyncAsHook.js";
-import * as wxApi from "../../wxApi.js";
+import { wxApi } from "../../wxApi.js";
import { Props, State } from "./index.js";
export function useComponentState(
@@ -28,15 +29,14 @@ export function useComponentState(
const info = useAsyncAsHook(async () => {
if (!talerRefundUri) throw Error("ERROR_NO-URI-FOR-REFUND");
- const refund = await api.prepareRefund({ talerRefundUri });
+ const refund = await api.wallet.call(WalletApiOperation.PrepareRefund, { talerRefundUri });
return { refund, uri: talerRefundUri };
});
- useEffect(() => {
- api.onUpdateNotification([NotificationType.RefreshMelted], () => {
- info?.retry();
- });
- });
+ useEffect(() => api.listener.onUpdateNotification(
+ [NotificationType.RefreshMelted],
+ info?.retry)
+ );
if (!info) {
return { status: "loading", error: undefined };
@@ -51,7 +51,9 @@ export function useComponentState(
const { refund, uri } = info.response;
const doAccept = async (): Promise<void> => {
- const res = await api.applyRefund(uri);
+ const res = await api.wallet.call(WalletApiOperation.ApplyRefund, {
+ talerRefundUri: uri
+ });
onSuccess(res.transactionId);
};