Submenu desarrolladores

SDK Usage

This section will explain how to use the SDK to register to Tuidd sites and how to use Tuidd services.

 

Authorization

There are several possibilities to log in at a site that has incorporated the TUIDD button, through a telephone number or through ALIAS

Access with Number (MSISDN):

Type the number beginning with a '+' and the area code. EJ: +54 11 XXXX XXXX

The country will be detected in this way automatically.

Press the 'ENTER' button.

(PICTURE OF TUIDD BUTTON WITH number)

Access with Alias:

Enter the Alias ​​registered in the platform.

Press the 'INGREAR' button

(PICTURE OF TUIDD BUTTON WITH ALIAS)

 

Services

Tuidd SDK provides facilities to the provider when it comes to consuming advertising services, surveys, payments, notifications and coupons. For this, an API, programming interface, TuiddServicesClient is provided. To use this api you must follow the following steps:

  1. Inclusion of API Services
  2. Generation of Service information
  3. Call to Service function

 

Inclusion of Services:

require_once("tuidd/libs/tuidd_lib/client/TuiddServicesClient.php");

 

Generation of Service information

Authorization information is required, the service token (obtained by the provider) and the login_hint (PCR example) of the user to whom the service is to be sent. This information will be packaged in an array () of php.

Then, the service information is necessary, being the id of the service (service_id) the only one required. Finally, you can add additional information in an ExtraParams (For more information see the section Class Reference and Examples.)

 

Call to Service function

The possible functions to execute are the following:

  • SendAdvertisement
  • SendSurvey
  • SendNotification
  • SendCoupon
  • SendPayment

The arguments received by these functions have to do with information of authentication, information of the service that is wanted to be consumed and that was registered in the Tuidd platform and additional information of the service, as for example the visualization of the service.

 

Examples

 

Send Survey

require_once("tuidd/libs/tuidd_lib/client/TuiddClient.php");
require_once("tuidd/libs/tuidd_lib/client/TuiddServicesClient.php");

TuiddClient::getSingleton()->isLoggedIn();

// get user information
$userInfo = TuiddClient::getSingleton()->getUserInfo();
$sc = TuiddServicesClient::getSingleton();

// var_dump($userInfo);
// print user information...
echo Hello;
if ($userInfo['nickname'])
echo $userInfo['nickname'];
else if ($userInfo['name'])
echo $userInfo['name'];
else
echo $userInfo['given_name']." ".$userInfo['family_name'];

echo Your ID is:
echo $userInfo['sub'];

echo Your email is:
echo $userInfo['email'];

if (isset($_GET['encuesta'] ))
{
$service_id = $_GET['encuesta'];

$token = TuiddClient::getSingleton()->getSurveyServiceToken();
$authInfo = array(
'service_token' => $token->token,
'login_hint' => 'PCR:'. $userInfo['sub'],
);
$extraParams['display'] = 'push';
$serviceResult = $sc->sendSurvey( $service_id, $authInfo, $extraParams );

var_dump($serviceResult);
}

Send Advertising

require_once("tuidd/libs/tuidd_lib/client/TuiddClient.php");
require_once("tuidd/libs/tuidd_lib/client/TuiddServicesClient.php");


$sess_ = TuiddClient::blockStart('sdk-session');
TuiddClient::getSingleton()->isLoggedIn($sess_);

// get user information
$sc = TuiddServicesClient::getSingleton();
var_dump( $_GET['publicidad'] );

if (isset($_GET['publicidad'] ))

$service_id = $_GET['publicidad'];

$userInfo = TuiddClient::getSingleton()->getUserInfo();
$token = TuiddClient::getSingleton()->getSurveyServiceToken();
$authInfo = array(
'service_token' => $token->token,
'login_hint' => 'PCR:'. $userInfo['sub'],
);
$extraParams['display'] = 'push';
$redirect_link = 'url_link';

if ($service_id == 'any')

$serviceResult = $sc->sendAdvertisement( NULL, $authInfo, $extraParams );

else

$source = 'service_id';
$serviceResult = $sc->sendAdvertisement( $service_id, $authInfo, null, null, null, null, $redirect_link, $source, $extraParams );
TuiddClient::blockEnd($sess_);
var_dump( $serviceResult );

 

Class Reference

 
TuiddServicesClient Class Reference

Public Member Functions

  sendAdvertisement ($service_id, $authInfo, $title=NULL, $message=NULL, $link=NULL, $image_link=NULL, $redirect_link=NULL, $extraParams=NULL)
 
  sendPayment ( $price, $detail, $concept, $currency, $authInfo, $extraParams=NULL)
 
  sendNotification ( $service_id, $authInfo, $title=NULL, $message=NULL, $link=NULL, $extraParams=NULL)
 
  sendSurvey ( $service_id, $authInfo, $extraParams=NULL)
 
  sendCoupon ( $service_id, $authInfo, $title=NULL, $message=NULL, $coupon_type=NULL, $link=NULL, $image_link=NULL, $extraParams=NULL)
 

Static Public Member Functions

static  getSingleton ()
 

Member Function Documentation


◆  getSingleton()

static TuiddServicesClient::getSingleton (   )  
static

Gets Singleton's instance of TuiddClient

Parameters
none  
Returns
[type] [description]


◆  sendAdvertisement()

TuiddServicesClient::sendAdvertisement (   $service_id ,
      $authInfo ,
      $title = NULL ,
      $message = NULL ,
      $link = NULL ,
      $image_link = NULL ,
      $redirect_link = NULL ,
      $extraParams = NULL  
  )    

Envía una publicidad con la información recibida en los parámetros.

Parameters
string service_id [ID de servicio]
array authInfo [description]
string title [titulo de la publicidad]
string message [mensaje de la publicidad]
string link [link de la publicidad]
string image_link [link de la imagen publicidad]
string redirect_link [link de la redirect luego de recibir publicidad]
array extrParams [description]
Returns
array int $status Estado de envío de publicidad 200: OK 400: BAD REQUEST 401: UNAUTHORIZED 500: INTERNAL SERVER ERROR int $transaction_id ID de transacción de servicio


◆  sendCoupon()

TuiddServicesClient::sendCoupon (   $service_id ,
      $authInfo ,
      $title = NULL ,
      $message = NULL ,
      $coupon_type = NULL ,
      $link = NULL ,
      $image_link = NULL ,
      $extraParams = NULL  
  )    

Consume un servicio de cupon mediante la informacion enviada por parametro

Parameters
string service_id [ID de servicio]
array authInfo [description]
string title [titulo del cupon]
string message [mensaje del cupon]
string coupon_type [tipo de cupon ]
string link [link del cupon]
string image_link [link de la imagen de cupon]
array extraParams [description]
Returns
array int $status Estado de envío de publicidad 200: OK 400: BAD REQUEST 401: UNAUTHORIZED 500: INTERNAL SERVER ERROR int $transaction_id ID de transacción de servicio

◆  sendNotification()

TuiddServicesClient::sendNotification (   $service_id ,
      $authInfo ,
      $title = NULL ,
      $message = NULL ,
      $link = NULL ,
      $extraParams = NULL  
  )    

Consume un servicio de notificacion.

Parameters
string service_id [ID de servicio]
array authInfo [description]
string title [titulo de la notificacion]
string message [mensaje de la notificacion]
string link [link de la notificacion]
array extraParams [description]
Returns
array int $status Estado de envío de notificacion 200: OK 400: BAD REQUEST 401: UNAUTHORIZED 500: INTERNAL SERVER ERROR int $transaction_id ID de transacción de servicio


◆  sendPayment()

TuiddServicesClient::sendPayment (   $price ,
      $detail ,
      $concept ,
      $currency ,
      $authInfo ,
      $extraParams = NULL  
  )    

Consume un servicio de pago .

Parameters
float price [titulo de la pago]
string detail [description]
string concept [description]
string currency [description]
array authInfo [description]
array extraParams [description]
Returns
array int $status Estado de envío de pago 200: OK 400: BAD REQUEST 401: UNAUTHORIZED 500: INTERNAL SERVER ERROR int $transaction_id ID de transacción de servicio


◆  sendSurvey()

TuiddServicesClient::sendSurvey (   $service_id ,
      $authInfo ,
      $extraParams = NULL  
  )    

Consume un servicio de encuesta mediante el id del servicio.

Parameters
string serviceID [titulo de la encuesta]
array authInfo [description]
array extraParams [description]
Returns
array int $status Estado de envío de encuesta 200: OK 400: BAD REQUEST 401: UNAUTHORIZED 500: INTERNAL SERVER ERROR int $transaction_id ID de transacción de servicio

The documentation for this class was generated from the following file:
  • TuiddServicesClient.php

 

Entity Pager Example