/*
This file is part of TALER
(C) 2015-2016 GNUnet e.V.
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation; either version 3, or (at your option) any later version.
TALER is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
TALER; see the file COPYING. If not, see
*/
/**
* Page that shows refund status for purchases.
*
* @author sebasjm
*/
import {
AmountJson,
Amounts,
NotificationType,
Product,
} from "@gnu-taler/taler-util";
import { h, VNode } from "preact";
import { useEffect, useState } from "preact/hooks";
import { Amount } from "../components/Amount.js";
import { Loading } from "../components/Loading.js";
import { LoadingError } from "../components/LoadingError.js";
import { LogoHeader } from "../components/LogoHeader.js";
import { Part } from "../components/Part.js";
import {
ButtonSuccess,
SubTitle,
WalletAction,
} from "../components/styled/index.js";
import { useTranslationContext } from "../context/translation.js";
import { HookError, useAsyncAsHook } from "../hooks/useAsyncAsHook.js";
import { ButtonHandler } from "../mui/handlers.js";
import * as wxApi from "../wxApi.js";
import { ProductList } from "./Pay.js";
interface Props {
talerRefundUri?: string;
}
export interface ViewProps {
state: State;
}
export function View({ state }: ViewProps): VNode {
const { i18n } = useTranslationContext();
if (state.status === "loading") {
if (!state.hook) {
return ;
}
return (
Could not load refund status}
error={state.hook}
/>
);
}
if (state.status === "ignored") {
return (
Digital cash refund
You've ignored the tip.
);
}
if (state.status === "in-progress") {
return (
Digital cash refund
The refund is in progress.
Total to refund}
text={}
kind="negative"
/>
Refunded}
text={}
kind="negative"
/>
{state.products && state.products.length ? (
) : undefined}
{/* */}
);
}
if (state.status === "completed") {
return (
Digital cash refund
this refund is already accepted.
Total to refunded}
text={}
kind="negative"
/>
);
}
return (
Digital cash refund
The merchant "{state.merchantName}" is offering you
a refund.