Skip to content

Commit

Permalink
feat: Added KYC expiration support (#980)
Browse files Browse the repository at this point in the history
* feat: Added KYC expiration support (backend has been migrated to the new Shuttle infrastructure / URL)

* Fixed the typo in 'Not verified' text label

* set verification status to "Invalid recipient wallet address" if not meeting the address criteria

---------

Co-authored-by: Peter Salomonsen <[email protected]>
  • Loading branch information
frol and petersalomonsen authored Nov 5, 2024
1 parent acd48c1 commit 214a52c
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,22 @@ useEffect(() => {
(receiverAccount ?? "").includes(".tg")
) {
asyncFetch(
`https://neardevhub-kyc-proxy.shuttleapp.rs/kyc/${receiverAccount}`
`https://neardevhub-kyc-proxy-gvbr.shuttle.app/kyc/${receiverAccount}`
).then((res) => {
let displayableText = "";
switch (res.body.kyc_status) {
case "Approved":
case "APPROVED":
displayableText = "Verified";
break;
case "Pending":
case "PENDING":
displayableText = "Pending";
break;
case "NotSubmitted":
case "Rejected":
displayableText = "Not Verfied";
case "EXPIRED":
displayableText = "Expired";
break;
case "NOT_SUBMITTED":
case "REJECTED":
displayableText = "Not Verified";
break;
default:
displayableText = "Failed to get status";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,32 @@ useEffect(() => {
(receiverAccount ?? "").includes(".near") ||
(receiverAccount ?? "").includes(".tg")
) {
useCache(
() =>
asyncFetch(
`https://neardevhub-kyc-proxy.shuttleapp.rs/kyc/${receiverAccount}`
).then((res) => {
let displayableText = "";
switch (res.body.kyc_status) {
case "Approved":
displayableText = "Verified";
break;
case "Pending":
displayableText = "Pending";
break;
default:
displayableText = "Not Verfied";
break;
}
setVerificationStatus(displayableText);
}),
"ky-check-proposal" + receiverAccount,
{ subscribe: false }
);
asyncFetch(
`https://neardevhub-kyc-proxy-gvbr.shuttle.app/kyc/${receiverAccount}`
).then((res) => {
let displayableText = "";
switch (res.body.kyc_status) {
case "APPROVED":
displayableText = "Verified";
break;
case "PENDING":
displayableText = "Pending";
break;
case "EXPIRED":
displayableText = "Expired";
break;
case "NOT_SUBMITTED":
case "REJECTED":
displayableText = "Not Verified";
break;
default:
displayableText = "Failed to get status";
break;
}
setVerificationStatus(displayableText);
});
} else {
setVerificationStatus("Invalid receipient wallet address");
}
}, [receiverAccount]);

Expand Down Expand Up @@ -233,21 +237,29 @@ const VerificationBtn = () => {

return (
<div>
<div className="d-flex text-black justify-content-between align-items-center">
<div className="d-flex" style={{ gap: "12px" }}>
<img
className="align-self-center object-fit-cover"
src={verificationStatus === "Verified" ? SuccessImg : WarningImg}
height={imageSize}
/>
<div className="d-flex flex-column justify-content-center">
<div className="h6 mb-0">Fractal</div>
<div className="text-sm text-muted">{verificationStatus}</div>
{!verificationStatus ? (
<span
className="spinner-grow spinner-grow-sm me-1"
role="status"
aria-hidden="true"
/>
) : (
<div className="d-flex text-black justify-content-between align-items-center">
<div className="d-flex" style={{ gap: "12px" }}>
<img
className="align-self-center object-fit-cover"
src={verificationStatus === "Verified" ? SuccessImg : WarningImg}
height={imageSize}
/>
<div className="d-flex flex-column justify-content-center">
<div className="h6 mb-0">Fractal</div>
<div className="text-sm text-muted">{verificationStatus}</div>
</div>
</div>
{verificationStatus !== "Verified" && showGetVerifiedBtn && (
<VerificationBtn />
)}
</div>
{verificationStatus !== "Verified" && showGetVerifiedBtn && (
<VerificationBtn />
)}
</div>
)}
</div>
);

0 comments on commit 214a52c

Please sign in to comment.