aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2024-08-20 12:20:42 -0300
committerSebastian <sebasjm@gmail.com>2024-08-21 10:25:25 -0300
commit2aaa2e999a034f5020eb8ef4a21a8fe71d92ff74 (patch)
treea3281f8d4947e42389f8249424f2a0a7c97088a6
parentc63b6481d62278488dac3870c88917f39c4d2b13 (diff)
open kyc link
-rw-r--r--packages/kyc-ui/src/pages/FillForm.tsx13
-rw-r--r--packages/kyc-ui/src/pages/Start.tsx21
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}