diff --git a/docs/installation/essential.md b/docs/installation/essential.md index 79de46d4c..3e6f5131c 100644 --- a/docs/installation/essential.md +++ b/docs/installation/essential.md @@ -191,5 +191,4 @@ return [ There are currently two supported SMS-Gateways. -1. Bongo Live Tanzania -2. Inhouse SMS-Gateway Application +1. Inhouse SMS-Gateway Application diff --git a/src/backend/app/Sms/Bongo.php b/src/backend/app/Sms/Bongo.php deleted file mode 100644 index 802d742a0..000000000 --- a/src/backend/app/Sms/Bongo.php +++ /dev/null @@ -1,137 +0,0 @@ - 'Invalid XML format', - '-2' => 'Not enough credits in account', - '-3' => 'Invalid API key', - '-4' => 'Destination Mobile number missing /Invalid format', - '-5' => 'SMS text missing', - '-6' => 'Sender name missing / invalid format / Not active in account ', - '-7' => 'Network not covered', - '-8' => 'Error Undefined', - '-9' => 'Invalid message id, too long (max 36) or contains non numeric character.', - '-10' => 'Maximum number of recipient in one single API call is 100', - '-11' => 'Error – Undefined', - '-12' => 'Message too long (max 480 characters)', - '-13' => 'Invalid Username / Password', - '-14' => 'Invalid send time', - ]; - - /** - * @var Sms - */ - public function __construct() - { - } - - public $defer = true; - - /** - * @param string $number - * @param string $body - * - * @return StreamInterface - * - * @throws \Exception - */ - public function sendGetSms(string $number, string $body) - { - $httpClient = new Client(); - if ($number[0] !== '+') { - $number = '+'.$number; - } - - $request = $httpClient->get( - config()->get('services.sms.bongo.url'), - [ - 'query' => Query::build( - [ - 'sendername' => config()->get('services.sms.bongo.sender'), - 'username' => config()->get('services.sms.bongo.username'), - 'password' => config()->get('services.sms.bongo.password'), - 'apikey' => config()->get('services.sms.bongo.key'), - 'destnum' => $number, - 'message' => $body, - 'senddate' => '', - ] - ), - ] - ); - $response = (string) $request->getBody(); - if ((int) $response < 0) { - throw new \Exception($this->errorCodes[$response]); - } - - return $request->getBody(); - } - - /** - * @param string $number - * @param string $body - * @param string $callback - * - * @return mixed|StreamInterface - * - * @throws \Exception - */ - public function sendSms(string $number, string $body, string $callback, ?SmsAndroidSetting $smsAndroidSetting = null) - { - $httpClient = new Client(); - if ($number[0] !== '+') { - $number = '+'.$number; - } - - $apikey = 'c4a12fa8-ed6f-11df-a1f1-00181236674f'; - $messageXML = - ' - - '.config()->get('services.sms.bongo.sender').' - '.config()->get('services.sms.bongo.username').' - '.config()->get('services.sms.bongo.password').' - '.config()->get('services.sms.bongo.key').' - - - '.$body.' - - '.$number." - - '.$callback.' - - "; - - Log::critical('SMS CONTENT', [$messageXML]); - - $headers = [ - 'Accept' => 'application/xml', - 'Content-Type' => 'application/x-www-form-urlencoded;', - ]; - - $request = $httpClient->post( - 'http://www.bongolive.co.tz/api/broadcastSMS.php', - [ - 'form_params' => ['messageXML' => $messageXML], - 'headers' => $headers, - ] - ); - $response = (string) $request->getBody(); - - Log::critical('SMS', [$response, $request->getStatusCode()]); - if ((int) $response < 0) { - throw new \Exception($this->errorCodes[$response]); - } - - return $request->getBody(); - } -} diff --git a/src/backend/config/services.php b/src/backend/config/services.php index 8e51fd7fc..c025c8966 100644 --- a/src/backend/config/services.php +++ b/src/backend/config/services.php @@ -65,13 +65,6 @@ 'password_vend' => env('CALIN_SMART_PASSWORD_VENT'), ], 'sms' => [ - 'bongo' => [ - 'url' => 'http://www.bongolive.co.tz/api/sendSMS.php', - 'sender' => 'SENDER_NUMBER', - 'username' => 'USER NAME', - 'password' => 'PASSWORD', - 'key' => 'KEY', - ], 'android' => [ 'url' => 'https://fcm.googleapis.com/fcm/send', 'key' => 'AAAARAca1HM:APA91bHTTU2ksDRKWf7O7zsN5KZebDHVdnM_GeTAmFWtZp3R4__n0g8b3s9Vu7hWEEBfYpOq5_CmMMfJlLmW5FjNatp__4G3m1Mim7fRp-3CFs2ByKnvzXC8X9V1kxKZuBT_UK_bmQYO',