diff options
-rw-r--r-- | packages/kyc-ui/src/pages/FillForm.tsx | 13 | ||||
-rw-r--r-- | packages/kyc-ui/src/pages/Start.tsx | 21 |
2 files changed, 31 insertions, 3 deletions
diff --git a/packages/kyc-ui/src/pages/FillForm.tsx b/packages/kyc-ui/src/pages/FillForm.tsx index d5294f0f3..518a89fd4 100644 --- a/packages/kyc-ui/src/pages/FillForm.tsx +++ b/packages/kyc-ui/src/pages/FillForm.tsx @@ -16,6 +16,7 @@ import { AbsoluteTime, AccessToken, + Amounts, HttpStatusCode, KycRequirementInformation, assertUnreachable, @@ -131,7 +132,17 @@ export function FillForm({ payload: validatedForm, }; - return lib.exchange.uploadKycForm(reqId, information); + const fh = new FormData() + // fh.set("header", JSON.stringify(information.header)) + // fh.set("payload", JSON.stringify(information.payload)) + Object.entries(validatedForm as Record<string,string>).forEach(([key, value]) => { + if (key === "money") { + fh.set(key,Amounts.stringify(value)) + } else { + fh.set(key,(value)) + } + }) + return lib.exchange.uploadKycForm(reqId, fh); }, (res) => { onComplete(); diff --git a/packages/kyc-ui/src/pages/Start.tsx b/packages/kyc-ui/src/pages/Start.tsx index c4716f993..e6e7ad1d4 100644 --- a/packages/kyc-ui/src/pages/Start.tsx +++ b/packages/kyc-ui/src/pages/Start.tsx @@ -22,8 +22,10 @@ import { } from "@gnu-taler/taler-util"; import { Attention, + Button, Loading, LocalNotificationBanner, + useExchangeApiContext, useLocalNotificationHandler, useTranslationContext, } from "@gnu-taler/web-util/browser"; @@ -211,6 +213,18 @@ function RequirementRow({ onFormSelected: () => void; }): VNode { const { i18n } = useTranslationContext(); + const { lib } = useExchangeApiContext(); + const [notification, withErrorHandler] = useLocalNotificationHandler(); + const reqId = req.id; + const startHandler = + !reqId ? undefined : + withErrorHandler( + async () => { + return lib.exchange.startKycProcess(reqId) + }, (res) => { + window.open(res.body.redirect_url, "_blank") + }); + switch (req.form) { case "INFO": { return ( @@ -267,10 +281,13 @@ function RequirementRow({ </div> <div class="min-w-0 flex-auto"> <p class="text-sm font-semibold leading-6 text-gray-900"> - <a href="#"> + <Button + type="submit" + handler={startHandler} + > <span class="absolute inset-x-0 -top-px bottom-0"></span> <i18n.Translate>Begin KYC process</i18n.Translate> - </a> + </Button> </p> <p class="mt-1 flex text-xs leading-5 text-gray-500"> {req.description} |