Skip to content

Commit 10fc313

Browse files
Pull request #11: Added methods to get info from PhoneId
Merge in SDK/php_telesign_enterprise from feature/EOA2091 to developer Squashed commit of the following: commit be2e28afbdabebd7c170fe846d3a18630f4bc491 Author: Juan Camilo Martinez <jmartinez@telesign.com> Date: Thu Jun 26 14:36:51 2025 -0500 fix description of RELEASE file commit 65fd817c9877678e71dbc14180281eb694893eda Author: Juan Camilo Martinez <jmartinez@telesign.com> Date: Wed Jun 25 16:08:20 2025 -0500 Added methods to get info from PhoneId
1 parent 676cc5a commit 10fc313

3 files changed

Lines changed: 54 additions & 0 deletions

File tree

RELEASE

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
3.3.0
2+
- Added methods to get information about a specified phone number
3+
14
3.2.0
25
- Added method to update verification process.
36
- Added method to retrieve verification process.

src/phoneid/PhoneIdClient.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ class PhoneIdClient extends _PhoneIdClient {
2020
const PHONEID_CONTACT_RESOURCE = "/v1/phoneid/contact/%s";
2121
const PHONEID_LIVE_RESOURCE = "/v1/phoneid/live/%s";
2222
const PHONEID_NUMBER_DEACTIVATION_RESOURCE = "/v1/phoneid/number_deactivation/%s";
23+
const PHONEID_GET_INFO_PATH = "/v1/phoneid/%s";
24+
const PHONEID_GET_INFO_PATH_ALT = "/v1/phoneid";
2325

2426
function __construct ($customer_id, $api_key, $rest_endpoint = "https://rest-ww.telesign.com", ...$other) {
2527
$sdk_version_origin = Config::getVersion('telesign/telesignenterprise');
@@ -85,4 +87,35 @@ function numberDeactivation ($phone_number, $ucid, array $other = []) {
8587
]));
8688
}
8789

90+
/**
91+
* Enter a phone number with country code to receive detailed information about carrier, location, and other details.
92+
*
93+
* See https://developer.telesign.com/enterprise/reference/submitphonenumberforidentity for detailed API documentation.
94+
*/
95+
96+
function getInfo ($phone_number, array $params = []) {
97+
if (!isset($params["consent"])) {
98+
$params["consent"] = [
99+
"method" => 1
100+
];
101+
}
102+
return $this->post(sprintf(self::PHONEID_GET_INFO_PATH, $phone_number), $params, null, null, "application/json", "Basic");
103+
}
104+
105+
/**
106+
* Enter a phone number with country code to receive detailed information about carrier, location, and other details.
107+
*
108+
* See https://developer.telesign.com/enterprise/reference/submitphonenumberforidentityalt for detailed API documentation.
109+
*/
110+
111+
function getInfoAlt ($phone_number, array $params = []) {
112+
$params["phone_number"] = $phone_number;
113+
114+
if (!isset($params["consent"])) {
115+
$params["consent"] = [
116+
"method" => 1
117+
];
118+
}
119+
return $this->post(self::PHONEID_GET_INFO_PATH_ALT, $params, null, null, "application/json", "Basic");
120+
}
88121
}

test/phoneid/PhoneIdClientTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,24 @@ function getRequestExamples () {
8484
],
8585
"uri" => self::EXAMPLE_REST_ENDPOINT . "/v1/phoneid/" . self::EXAMPLE_PHONE_NUMBER,
8686
"{}",
87+
],
88+
[
89+
PhoneIdClient::class,
90+
"getInfo",
91+
[
92+
self::EXAMPLE_PHONE_NUMBER,
93+
],
94+
"uri" => self::EXAMPLE_REST_ENDPOINT . "/v1/phoneid/" . self::EXAMPLE_PHONE_NUMBER,
95+
'{"consent":{"method":1}}',
96+
],
97+
[
98+
PhoneIdClient::class,
99+
"getInfoAlt",
100+
[
101+
self::EXAMPLE_PHONE_NUMBER,
102+
],
103+
"uri" => self::EXAMPLE_REST_ENDPOINT . "/v1/phoneid",
104+
'{"phone_number":"'.self::EXAMPLE_PHONE_NUMBER.'","consent":{"method":1}}',
87105
]
88106
];
89107
}

0 commit comments

Comments
 (0)