diff options
author | Sebastian <sebasjm@gmail.com> | 2022-09-16 11:06:55 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-09-16 11:13:09 -0300 |
commit | 5d0837913901a2947c66209d64855b324824757d (patch) | |
tree | bff68e1fff6f5833948505849d58f4be4a5e62d1 /packages/taler-wallet-webextension | |
parent | a66b636dee2ed531bb5119feced80d6569d99176 (diff) |
working on #7357
getTransactionById is introduced:
with that we move all transaction information building into a function
transactionId was added in every response that creates a tx
Diffstat (limited to 'packages/taler-wallet-webextension')
5 files changed, 27 insertions, 27 deletions
diff --git a/packages/taler-wallet-webextension/src/components/BankDetailsByPaytoType.tsx b/packages/taler-wallet-webextension/src/components/BankDetailsByPaytoType.tsx index 3a15cf1fb..9ab5212f2 100644 --- a/packages/taler-wallet-webextension/src/components/BankDetailsByPaytoType.tsx +++ b/packages/taler-wallet-webextension/src/components/BankDetailsByPaytoType.tsx @@ -73,10 +73,17 @@ export function BankDetailsByPaytoType({ </p> <table> <tr> - <td>{payto.targetPath}</td> <td> - <Amount value={amount} hideCurrency /> BTC + <div> + {payto.targetPath} <Amount value={amount} hideCurrency /> BTC + </div> + {payto.segwitAddrs.map((addr, i) => ( + <div key={i}> + {addr} <Amount value={min} hideCurrency /> BTC + </div> + ))} </td> + <td></td> <td> <CopyButton getContent={() => @@ -85,21 +92,6 @@ export function BankDetailsByPaytoType({ /> </td> </tr> - {payto.segwitAddrs.map((addr, i) => ( - <tr key={i}> - <td>{addr}</td> - <td> - <Amount value={min} hideCurrency /> BTC - </td> - <td> - <CopyButton - getContent={() => - `${addr} ${Amounts.stringifyValue(min)} BTC` - } - /> - </td> - </tr> - ))} </table> <p> <i18n.Translate> diff --git a/packages/taler-wallet-webextension/src/cta/Payment/stories.tsx b/packages/taler-wallet-webextension/src/cta/Payment/stories.tsx index 877c1996a..559e5c5d4 100644 --- a/packages/taler-wallet-webextension/src/cta/Payment/stories.tsx +++ b/packages/taler-wallet-webextension/src/cta/Payment/stories.tsx @@ -348,6 +348,7 @@ export const AlreadyPaidWithoutFulfillment = createExample(BaseView, { payResult: { type: ConfirmPayResultType.Done, contractTerms: {} as any, + transactionId: "", }, payStatus: { status: PreparePayResultType.AlreadyConfirmed, @@ -386,6 +387,7 @@ export const AlreadyPaidWithFulfillment = createExample(BaseView, { fulfillment_message: "thanks for buying!", fulfillment_url: "https://demo.taler.net", } as Partial<ContractTerms> as any, + transactionId: "", }, payStatus: { status: PreparePayResultType.AlreadyConfirmed, diff --git a/packages/taler-wallet-webextension/src/wallet/DeveloperPage.stories.tsx b/packages/taler-wallet-webextension/src/wallet/DeveloperPage.stories.tsx index 1a5d72337..ae1581009 100644 --- a/packages/taler-wallet-webextension/src/wallet/DeveloperPage.stories.tsx +++ b/packages/taler-wallet-webextension/src/wallet/DeveloperPage.stories.tsx @@ -35,6 +35,7 @@ export const AllOff = createExample(TestedComponent, { onDownloadDatabase: async () => "this is the content of the database", operations: [ { + id: "", type: PendingTaskType.ExchangeUpdate, exchangeBaseUrl: "http://exchange.url.", givesLifeness: false, diff --git a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx index 3d2a16e8f..21cee8789 100644 --- a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx +++ b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx @@ -70,13 +70,8 @@ interface Props { } async function getTransaction(tid: string): Promise<Transaction> { - const res = await wxApi.getTransactions(); - const ts = res.transactions.filter((t) => t.transactionId === tid); - if (ts.length > 1) throw Error("more than one transaction with this id"); - if (ts.length === 1) { - return ts[0]; - } - throw Error("no transaction found"); + const res = await wxApi.getTransactionById(tid); + return res; } export function TransactionPage({ tid, goToWalletHistory }: Props): VNode { diff --git a/packages/taler-wallet-webextension/src/wxApi.ts b/packages/taler-wallet-webextension/src/wxApi.ts index b797179c3..e9d26853d 100644 --- a/packages/taler-wallet-webextension/src/wxApi.ts +++ b/packages/taler-wallet-webextension/src/wxApi.ts @@ -68,6 +68,10 @@ import { WalletCoreVersion, WithdrawUriInfoResponse, ExchangeFullDetails, + Transaction, + AcceptTipResponse, + AcceptPeerPullPaymentResponse, + AcceptPeerPushPaymentResponse, } from "@gnu-taler/taler-util"; import { AddBackupProviderRequest, @@ -476,7 +480,7 @@ export function prepareTip(req: PrepareTipRequest): Promise<PrepareTipResult> { return callBackend("prepareTip", req); } -export function acceptTip(req: AcceptTipRequest): Promise<void> { +export function acceptTip(req: AcceptTipRequest): Promise<AcceptTipResponse> { return callBackend("acceptTip", req); } @@ -513,7 +517,7 @@ export function checkPeerPushPayment( } export function acceptPeerPushPayment( req: AcceptPeerPushPaymentRequest, -): Promise<void> { +): Promise<AcceptPeerPushPaymentResponse> { return callBackend("acceptPeerPushPayment", req); } export function initiatePeerPullPayment( @@ -528,6 +532,12 @@ export function checkPeerPullPayment( } export function acceptPeerPullPayment( req: AcceptPeerPullPaymentRequest, -): Promise<void> { +): Promise<AcceptPeerPullPaymentResponse> { return callBackend("acceptPeerPullPayment", req); } + +export function getTransactionById(tid: string): Promise<Transaction> { + return callBackend("getTransactionById", { + transactionId: tid + }) +}
\ No newline at end of file |