diff options
author | Sebastian <sebasjm@gmail.com> | 2022-08-31 11:46:39 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-08-31 11:46:39 -0300 |
commit | e759684fd0658b4a3ba241744424ceda11bd500b (patch) | |
tree | 31e3e8998aada76bf49df1dd9988021fb67bb856 /packages/taler-wallet-webextension/src/cta/TransferPickup/state.ts | |
parent | d84424202dca22fff22cb1d304286f627642187b (diff) | |
download | wallet-core-e759684fd0658b4a3ba241744424ceda11bd500b.tar.xz |
invoice and transfer details
Diffstat (limited to 'packages/taler-wallet-webextension/src/cta/TransferPickup/state.ts')
-rw-r--r-- | packages/taler-wallet-webextension/src/cta/TransferPickup/state.ts | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/packages/taler-wallet-webextension/src/cta/TransferPickup/state.ts b/packages/taler-wallet-webextension/src/cta/TransferPickup/state.ts index a16389709..ce4c7236d 100644 --- a/packages/taler-wallet-webextension/src/cta/TransferPickup/state.ts +++ b/packages/taler-wallet-webextension/src/cta/TransferPickup/state.ts @@ -14,7 +14,7 @@ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -import { Amounts, TalerErrorDetail } from "@gnu-taler/taler-util"; +import { AbsoluteTime, Amounts, TalerErrorDetail, TalerProtocolTimestamp } from "@gnu-taler/taler-util"; import { TalerError } from "@gnu-taler/taler-wallet-core"; import { useState } from "preact/hooks"; import { useAsyncAsHook } from "../../hooks/useAsyncAsHook.js"; @@ -22,7 +22,7 @@ import * as wxApi from "../../wxApi.js"; import { Props, State } from "./index.js"; export function useComponentState( - { talerPayPushUri }: Props, + { talerPayPushUri, onClose }: Props, api: typeof wxApi, ): State { const hook = useAsyncAsHook(async () => { @@ -45,13 +45,18 @@ export function useComponentState( }; } - const { amount, peerPushPaymentIncomingId } = hook.response + const { amount: purseAmount, contractTerms, peerPushPaymentIncomingId } = hook.response + + const amount: string = contractTerms?.amount + const summary: string | undefined = contractTerms?.summary + const expiration: TalerProtocolTimestamp | undefined = contractTerms?.purse_expiration async function accept(): Promise<void> { try { const resp = await api.acceptPeerPushPayment({ peerPushPaymentIncomingId }) + await onClose() } catch (e) { if (e instanceof TalerError) { setOperationError(e.errorDetail) @@ -67,6 +72,11 @@ export function useComponentState( accept: { onClick: accept }, + summary, + expiration: expiration ? AbsoluteTime.fromTimestamp(expiration) : undefined, + cancel: { + onClick: onClose + }, operationError } } |