-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cc42f47
commit 955e571
Showing
7 changed files
with
151 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,36 @@ | ||
import type { Passkey } from "@exactly/common/validation"; | ||
import { Platform } from "react-native"; | ||
import { Environment, Inquiry } from "react-native-persona"; | ||
|
||
import handleError from "./handleError"; | ||
import queryClient from "./queryClient"; | ||
import { kyc } from "./server"; | ||
|
||
export const templateId = "itmpl_8uim4FvD5P3kFpKHX37CW817"; | ||
export const environment = __DEV__ ? Environment.SANDBOX : Environment.PRODUCTION; | ||
|
||
export async function verifyIdentity(passkey: Passkey) { | ||
if (Platform.OS === "web") { | ||
const otl = await kyc(); | ||
window.open(otl, "_self"); | ||
return; | ||
} | ||
export function createInquiry(passkey: Passkey) { | ||
Inquiry.fromTemplate(templateId) | ||
.environment(environment) | ||
.referenceId(passkey.credentialId) | ||
.onCanceled((inquiryId) => { | ||
if (!inquiryId) throw new Error("no inquiry id"); | ||
kyc(inquiryId).catch(handleError); | ||
.onCanceled(() => { | ||
queryClient.invalidateQueries({ queryKey: ["kyc", "status"] }).catch(handleError); | ||
}) | ||
.onComplete((inquiryId) => { | ||
if (!inquiryId) throw new Error("no inquiry id"); | ||
kyc(inquiryId).catch(handleError); | ||
.onComplete(() => { | ||
queryClient.invalidateQueries({ queryKey: ["kyc", "status"] }).catch(handleError); | ||
}) | ||
.onError(handleError) | ||
.build() | ||
.start(); | ||
} | ||
|
||
export function resumeInquiry(inquiryId: string, sessionToken: string) { | ||
Inquiry.fromInquiry(inquiryId) | ||
.sessionToken(sessionToken) | ||
.onCanceled(() => { | ||
queryClient.invalidateQueries({ queryKey: ["kyc", "status"] }).catch(handleError); | ||
}) | ||
.onComplete(() => { | ||
queryClient.invalidateQueries({ queryKey: ["kyc", "status"] }).catch(handleError); | ||
}) | ||
.build() | ||
.start(); | ||
} |
Oops, something went wrong.