Skip to content

Commit

Permalink
Phonum 3179 (#333)
Browse files Browse the repository at this point in the history
* added tf verification module

* example added

* example added

* rest client fix

* rest client fix

* rest client fix

* rest client fix

* fix for tfverify

* example fixed

* fix

* fix UTC

* fix UTC

* updated param names

* fix utcs

* fix utcs

* fix utcs

* added comments in getList

* bump version

---------

Co-authored-by: ajay <[email protected]>
Co-authored-by: kalyan-plivo <[email protected]>
  • Loading branch information
3 people authored Oct 31, 2023
1 parent feab8d3 commit 0061ba5
Show file tree
Hide file tree
Showing 15 changed files with 611 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## [4.59.0](https://github.com/plivo/plivo-php/tree/v4.59.0) (2023-10-31)
**Feature - TollFree Verification API Support**
- API support for Create, Update, Get, Delete and List Tollfree Verification.
- Added New Param `toll_free_sms_verification_id` and `toll_free_sms_verification_order_status `in to the response of the [list all numbers API], [list single number API]
- Added `toll_free_sms_verification_order_status` filter to AccountPhoneNumber - list all my numbers API.

## [4.58.0](https://github.com/plivo/plivo-php/tree/v4.58.0) (2023-10-18)
**Feature - Verify Caller Id API support**
-API support for verifying, updating, getting and deleting caller IDs.
Expand Down
81 changes: 81 additions & 0 deletions src/Examples/TollfreeVerification.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?php


require 'vendor/autoload.php';

use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;



$AUTH_ID = "authid";
$AUTH_TOKEN = "authtoken";

$client = new RestClient($AUTH_ID, $AUTH_TOKEN);
$client->client->setTimeout(40);


// Get TollfreeVerification by uuid
echo "########## Get TollfreeVerification ###################\n";
try {
$response = $client->tollfreeVerification->get(
"03420d77-4fa8-45e1-6aad-f37d41a2ee4a"
);

print_r($response->properties);
}
catch (PlivoRestException $ex) {
print_r($ex);
}


// List TollfreeVerification
echo "########## List TollfreeVerification ###################\n";
try {
$response = $client->tollfreeVerification->getList();

print_r($response);
}
catch (PlivoRestException $ex) {
print_r($ex);
}

// // Create TollfreeVerification
// echo "########## Create TollfreeVerification ###################\n";
// try {
// $response = $client->tollfreeVerification->create(
// "18554950186",
// "2FA",
// "42f92135-6ec2-4110-8da4-71171f6aad44",
// "VERBAL",
// "100",
// "hbv",
// "message_sample",
// "http://google.com",
// "https://plivobin-prod-usw1.plivops.com/1pcfjrt1",
// "POST",
// "this is additional_information",
// "this is extra_data"
// );
//
// print_r($response);
// }
// catch (PlivoRestException $ex) {
// print_r($ex);
// }
//
//
// // // Update TollfreeVerification by TollfreeVerification
// // echo "########## Update TollfreeVerification ###################\n";
// // try {
// // $response = $client->tollfreeVerification->update(
// // "81fc8b2d-1ab8-47c9-7245-e454227b7b7b",
// // ["3FA"]
// // );
// //
// // print_r($response);
// // }
// // catch (PlivoRestException $ex) {
// // print_r($ex);
// // }
//
2 changes: 2 additions & 0 deletions src/Plivo/Resources/Number/Number.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ function __construct(BaseClient $client, array $response, $authId)
'tendlcCampaignId' => $response['tendlc_campaign_id'],
'tendlcRegistrationStatus' => $response['tendlc_registration_status'],
'tollFreeSMSVerification' => $response['toll_free_sms_verification'],
'tollFreeSmsVerificationId' => $response['toll_free_sms_verification_id'],
'tollFreeSmsVerificationOrderStatus' => $response['toll_free_sms_verification_order_status'],
'renewalDate' => $response['renewal_date'],
'cnamLookup' => isset($response['cnam_lookup']) ? $response['cnam_lookup'] : null,
];
Expand Down
64 changes: 64 additions & 0 deletions src/Plivo/Resources/TollfreeVerification/TollfreeVerification.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php

namespace Plivo\Resources\TollfreeVerification;


use Plivo\BaseClient;
use Plivo\Resources\Resource;

/**
* Class EndUser
* @package Plivo\Resources\TollfreeVerification
* @property string $api_id
* @property string $callback_method
* @property string $callback_url
* @property string $created_at
* @property string $extra_data
* @property string $additional_information
* @property string $message_sample
* @property string $number
* @property string $optin_image_url
* @property string $optin_type
* @property string $profile_uuid
* @property string $rejection_reason
* @property string $status
* @property string $updated_at
* @property string $usecase
* @property string $usecase_summary
* @property string $uuid
* @property string $volume
*/
class TollfreeVerification extends Resource
{
function __construct(BaseClient $client, array $response, $authId)
{
parent::__construct($client);

$this->properties = [
'created' => $response['created'],
'number' => $response['number'],
'lastModified' => $response['last_modified'],
'callbackMethod' => $response['callback_method'],
'callbackUrl' => $response['callback_url'],
'extraData' => $response['extra_data'],
'additionalInformation' => $response['additional_information'],
'messageSample' => $response['message_sample'],
'optinImageUrl' => $response['optin_image_url'],
'optinType' => $response['optin_type'],
'profileUuid' => $response['profile_uuid'],
'errorMessage' => $response['error_message'],
'status' => $response['status'],
'usecase' => $response['usecase'],
'usecaseSummary' => $response['usecase_summary'],
'uuid' => $response['uuid'],
'volume' => $response['volume'],
];

$this->pathParams = [
'authId' => $authId,
'uuid' => $response['uuid']
];

$this->id = $response['uuid'];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace Plivo\Resources\TollfreeVerification;


use Plivo\Resources\ResponseUpdate;

/**
* Class TollfreeVerificationCreateResponse
* @package Plivo\Resources\TollfreeVerification
*/
class TollfreeVerificationCreateResponse extends ResponseUpdate
{
/**
* @var string The uuid of the Tollfree Verification
*/
public $uuid;


/**
* TollfreeVerificationCreateResponse constructor.
* @param string $uuid
* @param string $apiID
* @param string $message
*/

public function __construct($uuid, $message, $apiID, $statusCode)
{
parent::__construct($apiID, $message, $statusCode);

$this->uuid = $uuid;
}
}
Loading

0 comments on commit 0061ba5

Please sign in to comment.