diff --git a/packages/wallet-webui/src/routes/App.tsx b/packages/wallet-webui/src/routes/App.tsx index e649abaf4..7772198ab 100644 --- a/packages/wallet-webui/src/routes/App.tsx +++ b/packages/wallet-webui/src/routes/App.tsx @@ -2072,7 +2072,7 @@ function PeerCreateRoute(props: { mode: "send" | "request" }) { } function PeerShareRoute() { - const { connection } = useServices(); + const { connection, platform } = useServices(); const callMutation = useWalletMutation(connection); const [, params] = useRoute("/peer/share/:transactionId/:mode"); const [, navigate] = useLocation(); @@ -2132,7 +2132,20 @@ function PeerShareRoute() { /* Translators: Peer payments transfer digital cash between people using links. A shared link can offer money to receive or request money to be paid. */ i18n.str`This peer link is no longer available.`, ) : transactionProblem; - const loading = query.isLoading || (!uri && !error); + // The exchange may require identity verification before the link exists + // (e.g. a request above its limit): say so instead of waiting for it. + const kycUrl = + transaction && + !uri && + transaction.txState.major === TransactionMajorState.Pending && + safeWebUrl(transaction.kycUrl) + ? transaction.kycUrl + : undefined; + const kycInit = + transaction && + !uri && + transaction.txState.minor === TransactionMinorState.KycInit; + const loading = query.isLoading || (!uri && !error && !kycUrl); const [delayed, setDelayed] = useState(false); useEffect(() => { setDelayed(false); @@ -2175,7 +2188,16 @@ function PeerShareRoute() { uri={uri} loading={loading} delayed={delayed} + kycInit={Boolean(kycInit)} error={error} + kyc={ + kycUrl && !error + ? { + reviewing: Boolean(transaction?.kycAmlReview), + onOpen: () => void platform.openExternal(kycUrl), + } + : undefined + } retryable={retryable} retrying={retrying} onCopy={() => { diff --git a/packages/wallet-webui/src/screens/PeerShareScreen.tsx b/packages/wallet-webui/src/screens/PeerShareScreen.tsx index 1b4d2f613..7c5bf7276 100644 --- a/packages/wallet-webui/src/screens/PeerShareScreen.tsx +++ b/packages/wallet-webui/src/screens/PeerShareScreen.tsx @@ -10,6 +10,10 @@ export function PeerShareScreen(props: { uri?: string; loading: boolean; delayed?: boolean; + /** wallet-core is fetching the exchange's identity verification requirements */ + kycInit?: boolean; + /** the exchange requires identity verification before the link is created */ + kyc?: { reviewing: boolean; onOpen: () => void }; error?: ErrorPresentation; retryable?: boolean; retrying?: boolean; @@ -38,12 +42,39 @@ export function PeerShareScreen(props: { {props.loading && (

- {props.delayed - ? /* Translators: An exchange is a GNU Taler service issuing and redeeming digital cash, not an action that converts one currency into another. */ i18n.str`Waiting for a response from the exchange…` - : /* Translators: The exchange is preparing a link for a peer transfer or request that the user can share with the other person. */ i18n.str`Preparing a secure share link…`} + {props.kycInit + ? i18n.str`Loading identity verification requirements` + : props.delayed + ? /* Translators: An exchange is a GNU Taler service issuing and redeeming digital cash, not an action that converts one currency into another. */ i18n.str`Waiting for a response from the exchange…` + : /* Translators: The exchange is preparing a link for a peer transfer or request that the user can share with the other person. */ i18n.str`Preparing a secure share link…`}

)} + {props.kyc && ( + + +

+ {props.kyc.reviewing + ? i18n.str`The exchange is reviewing your account. Please wait.` + : /* Translators: An exchange is a GNU Taler service issuing and redeeming digital cash, not an action that converts one currency into another. */ i18n.str`Complete the required identity verification on the exchange's website.`} +

+
+ + +
+
+ )} {props.error && ( {props.retryable && (