| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,53 @@ |
| 1 |
+<?php |
|
| 2 |
+ |
|
| 3 |
+namespace Telnyx; |
|
| 4 |
+ |
|
| 5 |
+/** |
|
| 6 |
+ * Class Verification |
|
| 7 |
+ * |
|
| 8 |
+ * @package Telnyx |
|
| 9 |
+ */ |
|
| 10 |
+class Verification extends ApiResource |
|
| 11 |
+{
|
|
| 12 |
+ const OBJECT_NAME = "verification"; |
|
| 13 |
+ |
|
| 14 |
+ use ApiOperations\Create; |
|
| 15 |
+ use ApiOperations\Retrieve; |
|
| 16 |
+ |
|
| 17 |
+ /** |
|
| 18 |
+ * Retrieve a verification by phone number |
|
| 19 |
+ * |
|
| 20 |
+ * @param string $phone_number |
|
| 21 |
+ * @param array|string|null $options |
|
| 22 |
+ * |
|
| 23 |
+ * @return \Telnyx\TwoFactorVerify |
|
| 24 |
+ */ |
|
| 25 |
+ public static function retrieve_by_phone_number($phone_number, $options = null) |
|
| 26 |
+ {
|
|
| 27 |
+ $url = '/v2/verifications/by_phone_number/' . urlencode($phone_number); |
|
| 28 |
+ |
|
| 29 |
+ list($response, $opts) = static::_staticRequest('get', $url, null, $options);
|
|
| 30 |
+ $obj = \Telnyx\Util\Util::convertToTelnyxObject($response->json, $opts); |
|
| 31 |
+ return $obj; |
|
| 32 |
+ } |
|
| 33 |
+ |
|
| 34 |
+ /** |
|
| 35 |
+ * Submit a verification code |
|
| 36 |
+ * |
|
| 37 |
+ * @param string $phone_number |
|
| 38 |
+ * @param string $verification_code |
|
| 39 |
+ * @param array|string|null $options |
|
| 40 |
+ * |
|
| 41 |
+ * @return \Telnyx\TelnyxObject |
|
| 42 |
+ */ |
|
| 43 |
+ public static function submit_verification($phone_number, $verification_code, $options = null) |
|
| 44 |
+ {
|
|
| 45 |
+ $params = ['code' => $verification_code]; |
|
| 46 |
+ self::_validateParams($params); |
|
| 47 |
+ $url = '/v2/verifications/by_phone_number/' . urlencode($phone_number) . '/actions/verify'; |
|
| 48 |
+ |
|
| 49 |
+ list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
|
|
| 50 |
+ $obj = \Telnyx\Util\Util::convertToTelnyxObject($response->json, $opts); |
|
| 51 |
+ return $obj; |
|
| 52 |
+ } |
|
| 53 |
+} |
|
| 0 | 54 |
\ No newline at end of file |