public class PCKYCManager
extends java.lang.Object
Works this PC KYC-Connector to perform the remote identification of the client before creating the key. The basic process of key acquisition includes the following steps:
startSession(String, String, PCPushServiceType, SessionCallback)
or
startSession(String, String, String, String, PCPushServiceType, SessionCallback)
.PCKYCSession.getSourceSet()
.uploadMedia(PCKYCSession, byte[], String, PCKYCSession.MediaSourceType, UploadMediaCallback)
(uploads file as byte array),
uploadMedia(PCKYCSession, InputStream, String, PCKYCSession.MediaSourceType, UploadMediaCallback)
(uploads file as input stream),
uploadMedia(PCKYCSession, File, PCKYCSession.MediaSourceType, UploadMediaCallback)
(uploads file as java.io.File) or upload all the sources together with
uploadAllMedia(PCKYCSession, HashMap, UploadMediaCallback)
.PCKYCSession.SessionStatus.OCR_SUCCESS
. You can check
current session status with help of getSessionStatus(PCKYCSession, SessionStatusCallback)
.getOCRResults(PCKYCSession, OCRResultsCallback)
and show the parsed results to user so that they
can verify that their documents have been scanned correctly.approveOCRResults(PCKYCSession, HandleOCRResultsCallback)
to send the documents for further
verification by authorities. If the user finds a mistake, call
declineOCRResults(PCKYCSession, HandleOCRResultsCallback)
to invalidate the results of analysis.
Call getRequiredSources(PCKYCSession, RequiredSourcesCallback)
to find out which sources must be
uploaded again to restart the analysis.PCKYCSession.SessionStatus.PCKEY_READY
. As soon as this happens, call
getPCUser(PCKYCSession, GetPCUserCallback)
to obtain the actual PC key which is represented by
PCUser
object.Constructor and Description |
---|
PCKYCManager() |
Modifier and Type | Method and Description |
---|---|
static void |
approveOCRResults(PCKYCSession session,
PCKYCManager.HandleOCRResultsCallback callback)
Approves results of OCR.
|
static void |
closeSession(PCKYCSession session)
This function must be called after the
PCUser acquired or after work with session is finished by another
reason in order to delete session data from storage |
static void |
declineOCRResults(PCKYCSession session,
PCKYCManager.HandleOCRResultsCallback callback)
Declined results of OCR.
|
static void |
deleteAllRestoredSessions()
Delete any existing sessions in storage
|
static void |
getOCRResults(PCKYCSession session,
PCKYCManager.OCRResultsCallback callback)
Gets results of OCR procedure.
|
static void |
getPCUser(PCKYCSession session,
PCKYCManager.GetPCUserCallback callback)
Retrieves a PC key from server and returns
PCUser object ready to be used in the app. |
static void |
getRequiredSources(PCKYCSession session,
PCKYCManager.RequiredSourcesCallback callback)
Gets required sources from server which must be uploaded again to succeed OCR
|
static void |
getSessionStatus(PCKYCSession session,
PCKYCManager.SessionStatusCallback callback)
Retrieves the current status of the session
|
static void |
getStatusHistory(PCKYCSession session,
PCKYCManager.StatusHistoryCallback callback)
Retrieves the history of statuses for a particular session
|
static java.util.List<PCKYCSession> |
listSessions()
Restores all previously stored sessions and returns the list of
PCKYCSession objects |
static void |
startSession(java.lang.String sessionData,
java.lang.String pushId,
PCPushServiceType pushServiceType,
PCKYCManager.SessionCallback callback)
Starts session to interact with KYC-Connector.
|
static void |
startSession(java.lang.String KYCConnectorUrl,
java.lang.String systemId,
java.lang.String appExtra,
java.lang.String pushId,
PCPushServiceType pushServiceType,
PCKYCManager.SessionCallback callback)
Starts session to interact with KYC-Connector.
|
static boolean |
storeSession(PCKYCSession session)
Stores session data in order to use later.
|
static void |
uploadAllMedia(PCKYCSession session,
java.util.HashMap<PCKYCSession.MediaSourceType,java.io.File> data,
PCKYCManager.UploadMediaCallback callback)
Uploads all required media to the server in order to perform an analysis
|
static void |
uploadMedia(PCKYCSession session,
byte[] data,
java.lang.String fileExtension,
PCKYCSession.MediaSourceType type,
PCKYCManager.UploadMediaCallback callback)
Uploads the media of specified type to the server in order to perform an analysis
|
static void |
uploadMedia(PCKYCSession session,
java.io.File data,
PCKYCSession.MediaSourceType type,
PCKYCManager.UploadMediaCallback callback)
Uploads the media of specified type to the server in order to perform an analysis
|
static void |
uploadMedia(PCKYCSession session,
java.io.InputStream data,
java.lang.String fileExtension,
PCKYCSession.MediaSourceType type,
PCKYCManager.UploadMediaCallback callback)
Uploads the media of specified type to the server in order to perform an analysis
|
public static void startSession(java.lang.String sessionData, java.lang.String pushId, PCPushServiceType pushServiceType, PCKYCManager.SessionCallback callback)
PCKYCSession
object is returned through callback in case
of successsessionData
- Initial data required to initialize session. This data is JSON-body of decoded QR-codepushId
- Firebase Push token to receive notifications, may be nullpushServiceType
- Type of service to work with pushes. One of values from PCPushServiceType
. May
be null if pushId is null. If pushId is not null, passing null value for this param
has the same impact as if PCPushServiceType.Firebase
is passedcallback
- PCKYCManager.SessionCallback
to handle resultspublic static void startSession(java.lang.String KYCConnectorUrl, java.lang.String systemId, java.lang.String appExtra, java.lang.String pushId, PCPushServiceType pushServiceType, PCKYCManager.SessionCallback callback)
PCKYCSession
object is returned through callback in case
of successKYCConnectorUrl
- The URL of KYC connector serviceappExtra
- A valid JSON-string containing any required additional datasystemId
- The identifier of the system or nullpushId
- Firebase Push token to receive notifications, may be nullpushServiceType
- Type of service to work with pushes. One of values from PCPushServiceType
. May
be null if pushId is null. If pushId is not null, passing null value for this param
has the same impact as if PCPushServiceType.Firebase
is passedcallback
- PCKYCManager.SessionCallback
to handle resultspublic static void getSessionStatus(PCKYCSession session, PCKYCManager.SessionStatusCallback callback)
callback
- Callback for handling resultspublic static void getStatusHistory(PCKYCSession session, PCKYCManager.StatusHistoryCallback callback)
callback
- Callback for handling resultspublic static void uploadMedia(PCKYCSession session, byte[] data, java.lang.String fileExtension, PCKYCSession.MediaSourceType type, PCKYCManager.UploadMediaCallback callback)
session
- Target PCKYCSession
data
- Photo or video as array of bytesfileExtension
- File extension which is necessary for proper request. You may put null instead, then it is
supposed that photos are in JPG format while the video are encoded in MP4. If you mention
the actual format, please note that a dot (.) must be put first.type
- Type of data to be uploaded, must be one of PCKYCSession.MediaSourceType
callback
- Callback for handling resultspublic static void uploadMedia(PCKYCSession session, java.io.InputStream data, java.lang.String fileExtension, PCKYCSession.MediaSourceType type, PCKYCManager.UploadMediaCallback callback)
session
- Target PCKYCSession
data
- Photo or video as InputStreamfileExtension
- File extension which is necessary for proper request. You may put null instead, then it is
supposed that photos are in JPG format while the video are encoded in MP4. If you mention
the actual format, please note that a dot (.) must be put first.type
- Type of data to be uploaded, must be one of PCKYCSession.MediaSourceType
callback
- Callback for handling resultspublic static void uploadMedia(PCKYCSession session, java.io.File data, PCKYCSession.MediaSourceType type, PCKYCManager.UploadMediaCallback callback)
session
- Target PCKYCSession
data
- Photo or video as File objecttype
- Type of data to be uploaded, must be one of PCKYCSession.MediaSourceType
callback
- Callback for handling resultspublic static void uploadAllMedia(PCKYCSession session, java.util.HashMap<PCKYCSession.MediaSourceType,java.io.File> data, PCKYCManager.UploadMediaCallback callback)
session
- Target PCKYCSession
data
- HashMap with required data, where each key stands for one type among
PCKYCSession.MediaSourceType
and each value is File object representing data of
corresponding type. This method just triggers series of calls of
uploadMedia(PCKYCSession, File, PCKYCSession.MediaSourceType, PCKYCManager.UploadMediaCallback)
.callback
- Callback for handling resultspublic static void getOCRResults(PCKYCSession session, PCKYCManager.OCRResultsCallback callback)
PCKYCSession.getAnalyserType()
.session
- Target PCKYCSession
callback
- Callback to handle resultspublic static void getRequiredSources(PCKYCSession session, PCKYCManager.RequiredSourcesCallback callback)
session
- Target PCKYCSession
callback
- Callback to handle resultspublic static void approveOCRResults(PCKYCSession session, PCKYCManager.HandleOCRResultsCallback callback)
getOCRResults(PCKYCSession, OCRResultsCallback)
).session
- Target PCKYCSession
callback
- Callback to handle resultspublic static void declineOCRResults(PCKYCSession session, PCKYCManager.HandleOCRResultsCallback callback)
getOCRResults(PCKYCSession, OCRResultsCallback)
).session
- Target PCKYCSession
callback
- Callback to handle resultspublic static void getPCUser(PCKYCSession session, PCKYCManager.GetPCUserCallback callback)
PCUser
object ready to be used in the app.PCKYCSession.SessionStatus.ANALYSED_SUCCESSFULLY
session
- Target PCKYCSession
callback
- Callback for handling resultspublic static boolean storeSession(PCKYCSession session)
startSession(String, String, PCPushServiceType, SessionCallback)
getSessionStatus(PCKYCSession, SessionStatusCallback)
uploadMedia(PCKYCSession, File, PCKYCSession.MediaSourceType, UploadMediaCallback)
uploadMedia(PCKYCSession, InputStream, String, PCKYCSession.MediaSourceType, UploadMediaCallback)
uploadMedia(PCKYCSession, byte[], String, PCKYCSession.MediaSourceType, UploadMediaCallback)
uploadAllMedia(PCKYCSession, HashMap, UploadMediaCallback)
getOCRResults(PCKYCSession, OCRResultsCallback)
approveOCRResults(PCKYCSession, HandleOCRResultsCallback)
declineOCRResults(PCKYCSession, HandleOCRResultsCallback)
getPCUser(PCKYCSession, GetPCUserCallback)
public static void closeSession(PCKYCSession session)
PCUser
acquired or after work with session is finished by another
reason in order to delete session data from storagesession
- Target PCKYCSession
public static java.util.List<PCKYCSession> listSessions()
PCKYCSession
objectsPCKYCSession
objects which might be empty if no sessions are storedpublic static void deleteAllRestoredSessions()