From a286649b0a611d87916a178a795c1acd2917741c Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Tue, 25 Oct 2022 12:23:08 -0300
Subject: cherry-pick: using new wallet typed api missing test

---
 .../src/wallet/ProviderDetailPage.tsx              | 24 ++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

(limited to 'packages/taler-wallet-webextension/src/wallet/ProviderDetailPage.tsx')

diff --git a/packages/taler-wallet-webextension/src/wallet/ProviderDetailPage.tsx b/packages/taler-wallet-webextension/src/wallet/ProviderDetailPage.tsx
index 5378f4b93..d9dd1d746 100644
--- a/packages/taler-wallet-webextension/src/wallet/ProviderDetailPage.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/ProviderDetailPage.tsx
@@ -20,6 +20,7 @@ import {
   ProviderInfo,
   ProviderPaymentStatus,
   ProviderPaymentType,
+  WalletApiOperation,
 } from "@gnu-taler/taler-wallet-core";
 import { Fragment, h, VNode } from "preact";
 import { ErrorMessage } from "../components/ErrorMessage.js";
@@ -30,7 +31,7 @@ import { Time } from "../components/Time.js";
 import { useTranslationContext } from "../context/translation.js";
 import { useAsyncAsHook } from "../hooks/useAsyncAsHook.js";
 import { Button } from "../mui/Button.js";
-import * as wxApi from "../wxApi.js";
+import { wxApi } from "../wxApi.js";
 
 interface Props {
   pid: string;
@@ -41,7 +42,10 @@ export function ProviderDetailPage({ pid: providerURL, onBack }: Props): VNode {
   const { i18n } = useTranslationContext();
   async function getProviderInfo(): Promise<ProviderInfo | null> {
     //create a first list of backup info by currency
-    const status = await wxApi.getBackupInfo();
+    const status = await wxApi.wallet.call(
+      WalletApiOperation.GetBackupInfo,
+      {},
+    );
 
     const providers = status.providers.filter(
       (p) => p.syncProviderBaseUrl === providerURL,
@@ -72,8 +76,20 @@ export function ProviderDetailPage({ pid: providerURL, onBack }: Props): VNode {
     <ProviderView
       url={providerURL}
       info={state.response}
-      onSync={() => wxApi.syncOneProvider(providerURL)}
-      onDelete={() => wxApi.removeProvider(providerURL).then(onBack)}
+      onSync={async () =>
+        wxApi.wallet
+          .call(WalletApiOperation.RunBackupCycle, {
+            providers: [providerURL],
+          })
+          .then()
+      }
+      onDelete={() =>
+        wxApi.wallet
+          .call(WalletApiOperation.RemoveBackupProvider, {
+            provider: providerURL,
+          })
+          .then(onBack)
+      }
       onBack={onBack}
       onExtend={async () => {
         null;
-- 
cgit v1.2.3

