mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-20 16:37:48 +02:00
Add octopsuh shortcode adapter, still testing. Add callback reception support. Add callback show in adapter.
This commit is contained in:
parent
89cb3db678
commit
6ad299f21e
14 changed files with 591 additions and 42 deletions
|
@ -28,11 +28,6 @@ namespace adapters;
|
|||
*/
|
||||
private $api;
|
||||
|
||||
/**
|
||||
* Number formated to be compatible with http query according to the ovh way.
|
||||
*/
|
||||
private $formatted_number;
|
||||
|
||||
/**
|
||||
* Adapter constructor, called when instanciated by RaspiSMS.
|
||||
*
|
||||
|
@ -83,14 +78,10 @@ namespace adapters;
|
|||
*/
|
||||
public static function meta_description(): string
|
||||
{
|
||||
$callback = \descartes\Router::url('Callback', 'update_sended_status', ['adapter_uid' => self::meta_uid()], ['api_key' => $_SESSION['user']['api_key'] ?? '<your_api_key>']);
|
||||
$generate_credentials_url = 'https://eu.api.ovh.com/createToken/index.cgi?GET=/sms&GET=/sms/*&POST=/sms/*&PUT=/sms/*&DELETE=/sms/*&';
|
||||
|
||||
return '
|
||||
Solution de SMS proposé par le groupe <a target="_blank" href="https://www.ovhtelecom.fr/sms/">OVH</a>. Pour générer les clefs API OVH, <a target="_blank" href="' . $generate_credentials_url . '">cliquez ici.</a>
|
||||
<br/>
|
||||
<br/>
|
||||
<div class="alert alert-info">Adresse URL de callback de changement d\'état : <b>' . $callback . '</b></div>
|
||||
';
|
||||
}
|
||||
|
||||
|
@ -160,6 +151,15 @@ namespace adapters;
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the implemented service support reception callback.
|
||||
*/
|
||||
public static function meta_support_reception(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method called to send a SMS to a number.
|
||||
|
@ -300,7 +300,7 @@ namespace adapters;
|
|||
{
|
||||
$success = true;
|
||||
|
||||
if ($this->datas['sender'] && mb_strlen($this->datas['sender']))
|
||||
if ($this->datas['sender'] && (mb_strlen($this->datas['sender']) < 3 || mb_strlen($this->datas['sender'] > 11)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -352,4 +352,24 @@ namespace adapters;
|
|||
|
||||
return ['uid' => $uid, 'status' => $status];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method called on reception of a sms notification.
|
||||
*
|
||||
* @return array : [
|
||||
* bool 'error' => false on success, true on error
|
||||
* ?string 'error_message' => null on success, error message else
|
||||
* array 'sms' => array [
|
||||
* string 'at' : Recepetion date format Y-m-d H:i:s,
|
||||
* string 'text' : SMS body,
|
||||
* string 'origin' : SMS sender,
|
||||
* ]
|
||||
*
|
||||
* ]
|
||||
*/
|
||||
public static function reception_callback() : array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue