forked from Bindambc/whatsapp-business-java-api
-
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.
Merge pull request Bindambc#111 from Bindambc/35-two-step-verification
Send Two-Step verification code
- Loading branch information
Showing
6 changed files
with
97 additions
and
14 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
src/main/java/com/whatsapp/api/domain/phone/TwoStepCode.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,13 @@ | ||
package com.whatsapp.api.domain.phone; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
/** | ||
* The type Two-Step Code | ||
* | ||
* @param pin Required. A 6-digit PIN you wish to use for two-step verification. | ||
*/ | ||
public record TwoStepCode( | ||
@JsonProperty("pin") String pin | ||
) { | ||
} |
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
24 changes: 24 additions & 0 deletions
24
src/test/java/com/whatsapp/api/examples/TwoStepVerificationExample.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,24 @@ | ||
package com.whatsapp.api.examples; | ||
|
||
import static com.whatsapp.api.TestConstants.PHONE_NUMBER_ID; | ||
import static com.whatsapp.api.TestConstants.TOKEN; | ||
|
||
import com.whatsapp.api.WhatsappApiFactory; | ||
import com.whatsapp.api.domain.phone.TwoStepCode; | ||
import com.whatsapp.api.impl.WhatsappBusinessCloudApi; | ||
|
||
public class TwoStepVerificationExample { | ||
|
||
public static void main(String[] args) { | ||
WhatsappApiFactory factory = WhatsappApiFactory.newInstance(TOKEN); | ||
|
||
WhatsappBusinessCloudApi whatsappBusinessCloudApi = factory.newBusinessCloudApi(); | ||
|
||
final var twoStepCode = new TwoStepCode("123456"); | ||
|
||
var response = whatsappBusinessCloudApi.twoStepVerification(PHONE_NUMBER_ID, twoStepCode); | ||
|
||
System.out.println(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
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,3 @@ | ||
{ | ||
"pin": "123456" | ||
} |