);
}
function ShowImportantMessage({ state }: { state: Ready | Confirmed }): VNode {
const { i18n } = useTranslationContext();
const { payStatus } = state;
if (payStatus.status === PreparePayResultType.AlreadyConfirmed) {
if (payStatus.paid) {
if (payStatus.contractTerms.fulfillment_url) {
return (
Already paid, you are going to be redirected to{" "}
{payStatus.contractTerms.fulfillment_url}
);
}
return (
Already paid
);
}
return (
Already claimed
);
}
if (state.status == "confirmed") {
const { payResult, payHandler } = state;
if (payHandler.error) {
return ;
}
if (payResult.type === ConfirmPayResultType.Done) {
return (
Payment complete
{!payResult.contractTerms.fulfillment_message ? (
payResult.contractTerms.fulfillment_url ? (
You are going to be redirected to $
{payResult.contractTerms.fulfillment_url}
) : (
You can close this page.
)
) : (
payResult.contractTerms.fulfillment_message
)}
);
}
}
return ;
}
function PayWithMobile({ state }: { state: Ready }): VNode {
const { i18n } = useTranslationContext();
const [showQR, setShowQR] = useState(false);
const privateUri =
state.payStatus.status !== PreparePayResultType.AlreadyConfirmed
? `${state.uri}&n=${state.payStatus.noncePriv}`
: state.uri;
return (
setShowQR((qr) => !qr)}>
{!showQR ? (
Pay with a mobile phone
) : (
Hide QR
)}
{showQR && (