aboutsummaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2022-01-30 23:32:56 -0300
committerSebastian <sebasjm@gmail.com>2022-01-30 23:32:56 -0300
commitc47311b4a70d384d08389959c50faa2a6e7d0e91 (patch)
tree00b5d88c6634184e7f42d0d3597cbac6f1939b57 /packages
parentddd4e8f033c92b7d5ff3828e4becb75bf4a14d55 (diff)
if order has been paid, redirect to the fulfillment_url
Diffstat (limited to 'packages')
-rw-r--r--packages/taler-wallet-webextension/src/cta/Pay.tsx27
1 files changed, 25 insertions, 2 deletions
diff --git a/packages/taler-wallet-webextension/src/cta/Pay.tsx b/packages/taler-wallet-webextension/src/cta/Pay.tsx
index c0fcca169..427a3a715 100644
--- a/packages/taler-wallet-webextension/src/cta/Pay.tsx
+++ b/packages/taler-wallet-webextension/src/cta/Pay.tsx
@@ -40,7 +40,7 @@ import {
} from "@gnu-taler/taler-util";
import { OperationFailedError } from "@gnu-taler/taler-wallet-core";
import { Fragment, h, VNode } from "preact";
-import { useState } from "preact/hooks";
+import { useEffect, useState } from "preact/hooks";
import { Loading } from "../components/Loading";
import { LoadingError } from "../components/LoadingError";
import { LogoHeader } from "../components/LogoHeader";
@@ -161,6 +161,20 @@ export function PaymentRequestView({
let totalFees: AmountJson = Amounts.getZero(payStatus.amountRaw);
const contractTerms: ContractTerms = payStatus.contractTerms;
+ useEffect(() => {
+ if (
+ payStatus.status === PreparePayResultType.AlreadyConfirmed &&
+ payStatus.paid
+ ) {
+ const fu = payStatus.contractTerms.fulfillment_url;
+ if (fu) {
+ setTimeout(() => {
+ document.location.href = fu;
+ }, 3000);
+ }
+ }
+ });
+
if (!contractTerms) {
return (
<span>
@@ -281,7 +295,16 @@ export function PaymentRequestView({
<h2>{i18n.str`Digital cash payment`}</h2>
{payStatus.status === PreparePayResultType.AlreadyConfirmed &&
(payStatus.paid ? (
- <SuccessBox> Already paid </SuccessBox>
+ payStatus.contractTerms.fulfillment_url ? (
+ <SuccessBox>
+ Already paid, you are going to be redirected to{" "}
+ <a href={payStatus.contractTerms.fulfillment_url}>
+ {payStatus.contractTerms.fulfillment_url}
+ </a>
+ </SuccessBox>
+ ) : (
+ <SuccessBox> Already paid </SuccessBox>
+ )
) : (
<WarningBox> Already claimed </WarningBox>
))}