-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from sinch/DEVEXP-467-verification-v1-become-p…
…ublic DEVEXP-467: verification "v1" become public
- Loading branch information
Showing
23 changed files
with
296 additions
and
317 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
2 changes: 1 addition & 1 deletion
2
client/src/main/com/sinch/sdk/domains/verification/api/v1/VerificationReportService.java
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
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
57 changes: 57 additions & 0 deletions
57
sample-app/src/main/java/com/sinch/sample/verification/report/ReportById.java
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package com.sinch.sample.verification.report; | ||
|
||
import com.sinch.sample.BaseApplication; | ||
import com.sinch.sdk.domains.verification.api.v1.VerificationReportService; | ||
import com.sinch.sdk.domains.verification.models.v1.VerificationMethod; | ||
import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestFlashCall; | ||
import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestPhoneCall; | ||
import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestSms; | ||
import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponse; | ||
import java.io.IOException; | ||
import java.util.logging.Logger; | ||
|
||
public class ReportById extends BaseApplication { | ||
|
||
private static final Logger LOGGER = Logger.getLogger(ReportById.class.getName()); | ||
|
||
public ReportById() throws IOException {} | ||
|
||
public static void main(String[] args) { | ||
try { | ||
new ReportById().run(); | ||
} catch (Exception e) { | ||
LOGGER.severe(e.getMessage()); | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
public void run() { | ||
|
||
LOGGER.info("Get report by id for : " + verificationId); | ||
|
||
VerificationReportService service = client.verification().v1().verificationReport(); | ||
|
||
VerificationMethod method = VerificationMethod.FLASH_CALL; | ||
|
||
VerificationReportResponse response; | ||
|
||
if (method == VerificationMethod.FLASH_CALL) { | ||
response = | ||
service.reportFlashCallById( | ||
verificationId, | ||
VerificationReportRequestFlashCall.builder().setCli("+17074661874").build()); | ||
} else if (method == VerificationMethod.SMS) { | ||
response = | ||
service.reportSmsById( | ||
verificationId, VerificationReportRequestSms.builder().setCode("1234").build()); | ||
} else if (method == VerificationMethod.PHONE_CALL) { | ||
response = | ||
service.reportPhoneCallById( | ||
verificationId, VerificationReportRequestPhoneCall.builder().setCode("4567").build()); | ||
} else { | ||
throw new UnsupportedOperationException("Unknown method " + method); | ||
} | ||
|
||
LOGGER.info("Response: " + response); | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
sample-app/src/main/java/com/sinch/sample/verification/report/ReportByIdentity.java
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package com.sinch.sample.verification.report; | ||
|
||
import com.sinch.sample.BaseApplication; | ||
import com.sinch.sdk.domains.verification.api.v1.VerificationReportService; | ||
import com.sinch.sdk.domains.verification.models.v1.NumberIdentity; | ||
import com.sinch.sdk.domains.verification.models.v1.VerificationMethod; | ||
import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestFlashCall; | ||
import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestPhoneCall; | ||
import com.sinch.sdk.domains.verification.models.v1.report.request.VerificationReportRequestSms; | ||
import com.sinch.sdk.domains.verification.models.v1.report.response.VerificationReportResponse; | ||
import java.io.IOException; | ||
import java.util.logging.Logger; | ||
|
||
public class ReportByIdentity extends BaseApplication { | ||
|
||
private static final Logger LOGGER = Logger.getLogger(ReportByIdentity.class.getName()); | ||
|
||
public ReportByIdentity() throws IOException {} | ||
|
||
public static void main(String[] args) { | ||
try { | ||
new ReportByIdentity().run(); | ||
} catch (Exception e) { | ||
LOGGER.severe(e.getMessage()); | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
public void run() { | ||
|
||
LOGGER.info("Get report by identity for : " + phoneNumber); | ||
|
||
VerificationReportService service = client.verification().v1().verificationReport(); | ||
|
||
var identity = NumberIdentity.builder().setEndpoint(phoneNumber).build(); | ||
|
||
VerificationMethod method = VerificationMethod.FLASH_CALL; | ||
|
||
VerificationReportResponse response; | ||
|
||
if (method == VerificationMethod.FLASH_CALL) { | ||
response = | ||
service.reportFlashCallByIdentity( | ||
identity, | ||
VerificationReportRequestFlashCall.builder().setCli("+17074661874").build()); | ||
} else if (method == VerificationMethod.SMS) { | ||
response = | ||
service.reportSmsByIdentity( | ||
identity, VerificationReportRequestSms.builder().setCode("1234").build()); | ||
} else if (method == VerificationMethod.PHONE_CALL) { | ||
response = | ||
service.reportPhoneCallByIdentity( | ||
identity, VerificationReportRequestPhoneCall.builder().setCode("4567").build()); | ||
} else { | ||
throw new UnsupportedOperationException("Unknown method " + method); | ||
} | ||
|
||
LOGGER.info("Response: " + response); | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
sample-app/src/main/java/com/sinch/sample/verification/start/Start.java
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 |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package com.sinch.sample.verification.start; | ||
|
||
import com.sinch.sample.BaseApplication; | ||
import com.sinch.sdk.domains.verification.api.v1.VerificationStartService; | ||
import com.sinch.sdk.domains.verification.models.v1.NumberIdentity; | ||
import com.sinch.sdk.domains.verification.models.v1.VerificationMethod; | ||
import com.sinch.sdk.domains.verification.models.v1.start.request.PhoneCallSpeech; | ||
import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestData; | ||
import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestFlashCall; | ||
import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestPhoneCall; | ||
import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestSms; | ||
import com.sinch.sdk.domains.verification.models.v1.start.request.VerificationStartRequestSms.CodeTypeEnum; | ||
import com.sinch.sdk.domains.verification.models.v1.start.response.VerificationStartResponse; | ||
import java.io.IOException; | ||
import java.util.logging.Logger; | ||
|
||
public class Start extends BaseApplication { | ||
|
||
private static final Logger LOGGER = Logger.getLogger(Start.class.getName()); | ||
|
||
public Start() throws IOException {} | ||
|
||
public static void main(String[] args) { | ||
try { | ||
new Start().run(); | ||
} catch (Exception e) { | ||
LOGGER.severe(e.getMessage()); | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
public void run() { | ||
|
||
LOGGER.info("Start verification for : " + phoneNumber); | ||
|
||
NumberIdentity identity = NumberIdentity.valueOf(phoneNumber); | ||
VerificationMethod method = VerificationMethod.FLASH_CALL; | ||
|
||
VerificationStartService service = client.verification().v1().verificationStart(); | ||
|
||
VerificationStartResponse response; | ||
if (method == VerificationMethod.PHONE_CALL) { | ||
response = | ||
service.startPhoneCall( | ||
VerificationStartRequestPhoneCall.builder() | ||
.setIdentity(identity) | ||
.setSpeech(PhoneCallSpeech.builder().setLocale("es-ES").build()) | ||
.build()); | ||
} else if (method == VerificationMethod.SMS) { | ||
response = | ||
service.startSms( | ||
VerificationStartRequestSms.builder() | ||
.setIdentity(identity) | ||
.setCodeType(CodeTypeEnum.ALPHANUMERIC) | ||
.setAcceptLanguage("fr-FR") | ||
.build()); | ||
} else if (method == VerificationMethod.DATA) { | ||
response = | ||
service.startData(VerificationStartRequestData.builder().setIdentity(identity).build()); | ||
} else if (method == VerificationMethod.FLASH_CALL) { | ||
response = | ||
service.startFlashCall( | ||
VerificationStartRequestFlashCall.builder().setIdentity(identity).build()); | ||
} else { | ||
throw new IllegalArgumentException("Unexpected method type '%s'".formatted(method)); | ||
} | ||
|
||
LOGGER.info("Response: " + response); | ||
} | ||
} |
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
Oops, something went wrong.