@@ -21,17 +21,17 @@ public class VerifyClient extends RestClient {
2121 private static final String VERIFY_SMART_RESOURCE = "/v1/verify/smart" ;
2222 private static final String VERIFY_STATUS_RESOURCE = "/v1/verify/%s" ;
2323 private static final String VERIFY_COMPLETION_RESOURCE = "/v1/verify/completion/%s" ;
24+ private static final String sdkVersion = VerifyClient .class .getPackage ().getImplementationVersion ();
25+ private static final String sdkSource = "java_telesign_enterprise" ;
26+ private static final String sdkVersionDependency = com .telesign .RestClient .class .getPackage ().getImplementationVersion ();
2427
25- private static final String BASE_URL_VERIFICATION_PROCESS = "https://verify.telesign.com" ;
26- private static final String DEFAULT_FS_BASE_URL = "https://rest-ww.telesign.com" ;
27- private static final String PATH_VERIFICATION = "/verification" ;
2828
2929 public VerifyClient (String customerId , String apiKey ) {
30- super (customerId , apiKey , DEFAULT_FS_BASE_URL );
30+ super (customerId , apiKey , "https://rest-ww.telesign.com" , sdkSource , sdkVersion , sdkVersionDependency );
3131 }
3232
3333 public VerifyClient (String customerId , String apiKey , String restEndpoint ) {
34- super (customerId , apiKey , restEndpoint );
34+ super (customerId , apiKey , restEndpoint , sdkSource , sdkVersion , sdkVersionDependency );
3535 }
3636
3737 public VerifyClient (String customerId ,
@@ -43,7 +43,7 @@ public VerifyClient(String customerId,
4343 Proxy proxy ,
4444 final String proxyUsername ,
4545 final String proxyPassword ) {
46- super (customerId , apiKey , restEndpoint , connectTimeout , readTimeout , writeTimeout , proxy , proxyUsername , proxyPassword );
46+ super (customerId , apiKey , restEndpoint , connectTimeout , readTimeout , writeTimeout , proxy , proxyUsername , proxyPassword , sdkSource , sdkVersion , sdkVersionDependency );
4747 }
4848
4949 /**
@@ -59,7 +59,6 @@ public TelesignResponse sms(String phoneNumber, Map<String, String> params) thro
5959 }
6060
6161 params .put ("phone_number" , phoneNumber );
62- this .setRestEndpoint (DEFAULT_FS_BASE_URL );
6362 return this .post (VERIFY_SMS_RESOURCE , params );
6463 }
6564
@@ -70,24 +69,8 @@ public TelesignResponse sms(String phoneNumber, Map<String, String> params) thro
7069 */
7170 public TelesignResponse createVerificationProcess (String phoneNumber , HashMap <String , Object > params ) throws IOException , GeneralSecurityException {
7271
73- if (params == null ) {
74- params = new HashMap <String , Object >();
75- }
76-
77- HashMap <String , String > infoRecipient = new HashMap <>();
78- infoRecipient .put ("phone_number" , phoneNumber );
79- params .put ("recipient" , infoRecipient );
80-
81- if (!params .containsKey ("verification_policy" )) {
82- List <Object > infoVerificationPolicy = new ArrayList <>();
83- HashMap <String , String > infoMethod = new HashMap <>();
84- infoMethod .put ("method" , "sms" );
85- infoVerificationPolicy .add (infoMethod );
86- params .put ("verification_policy" , infoVerificationPolicy );
87- }
88-
89- this .setRestEndpoint (BASE_URL_VERIFICATION_PROCESS );
90- return this .post (PATH_VERIFICATION , params , "application/json" , "Basic" );
72+ OmniVerifyClient omniVerifyClient = new OmniVerifyClient (this .customerId , this .apiKey );
73+ return omniVerifyClient .createVerificationProcess (phoneNumber , params );
9174 }
9275
9376 /**
@@ -145,4 +128,54 @@ public TelesignResponse status(String referenceId, Map<String, String> params) t
145128 public TelesignResponse completion (String referenceId , Map <String , String > params ) throws IOException , GeneralSecurityException {
146129 return this .put (String .format (VERIFY_COMPLETION_RESOURCE , referenceId ), params );
147130 }
131+
132+ static class OmniVerifyClient extends RestClient
133+ {
134+ private static final String PATH_VERIFICATION = "/verification" ;
135+
136+ public OmniVerifyClient (String customerId , String apiKey ) {
137+ super (customerId , apiKey , "https://verify.telesign.com" , sdkSource , sdkVersion , sdkVersionDependency );
138+ }
139+
140+ public OmniVerifyClient (String customerId , String apiKey , String restEndpoint ) {
141+ super (customerId , apiKey , restEndpoint , sdkSource , sdkVersion , sdkVersionDependency );
142+ }
143+
144+ public OmniVerifyClient (String customerId ,
145+ String apiKey ,
146+ String restEndpoint ,
147+ Integer connectTimeout ,
148+ Integer readTimeout ,
149+ Integer writeTimeout ,
150+ Proxy proxy ,
151+ final String proxyUsername ,
152+ final String proxyPassword ) {
153+ super (customerId , apiKey , restEndpoint , connectTimeout , readTimeout , writeTimeout , proxy , proxyUsername , proxyPassword , sdkSource , sdkVersion , sdkVersionDependency );
154+ }
155+
156+ /**
157+ * Use this action to create a verification process for the specified phone number.
158+ * <p>
159+ * See https://developer.telesign.com/enterprise/reference/createverificationprocess for detailed API documentation.
160+ */
161+ public TelesignResponse createVerificationProcess (String phoneNumber , HashMap <String , Object > params ) throws IOException , GeneralSecurityException {
162+
163+ if (params == null ) {
164+ params = new HashMap <String , Object >();
165+ }
166+
167+ HashMap <String , String > infoRecipient = new HashMap <>();
168+ infoRecipient .put ("phone_number" , phoneNumber );
169+ params .put ("recipient" , infoRecipient );
170+
171+ if (!params .containsKey ("verification_policy" )) {
172+ List <Object > infoVerificationPolicy = new ArrayList <>();
173+ HashMap <String , String > infoMethod = new HashMap <>();
174+ infoMethod .put ("method" , "sms" );
175+ infoVerificationPolicy .add (infoMethod );
176+ params .put ("verification_policy" , infoVerificationPolicy );
177+ }
178+ return this .post (PATH_VERIFICATION , params , "application/json" , "Basic" );
179+ }
180+ }
148181}
0 commit comments