Skip to content

Commit

Permalink
Separate keys
Browse files Browse the repository at this point in the history
  • Loading branch information
remdex committed May 19, 2023
1 parent e0bca4e commit fefa0b3
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions providers/MessageBirdLiveHelperChat.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ public function __construct() {
$mbOptions = \erLhcoreClassModelChatConfig::fetch('mb_options');
$data = (array)$mbOptions->data;

if (!isset($data['access_key']) || empty($data['access_key'])) {
throw new \Exception('Access Key is not set!',100);
if (isset($data['access_key_sms']) && !empty($data['access_key_sms'])) {
$this->access_key_sms = $data['access_key_sms'];
}

if (isset($data['access_key']) && !empty($data['access_key'])) {
$this->access_key = $data['access_key'];
}

if (!isset($data['endpoint']) || empty($data['endpoint'])) {
Expand All @@ -40,7 +44,6 @@ public function __construct() {
}

$this->endpoint = $data['endpoint'];
$this->access_key = $data['access_key'];
$this->namespace = $data['namespace'];
$this->channel_id = $data['channel_id'];
$this->convendpoint = $data['convendpoint'];
Expand Down Expand Up @@ -74,7 +77,8 @@ public function sendSMS($item) {
'originator' => ($item->originator != '' ? $item->originator : $item->sender_phone->phone),
'recipients' => $item->phone,
'reference' => 'verification'
])
]),
'access_key' => $this->access_key_sms
];

$response = $this->getRestAPI($paramsRequest);
Expand Down Expand Up @@ -294,7 +298,7 @@ public function getRestAPI($params)

$headers = array(
'Accept: application/json',
'Authorization: AccessKey ' . $this->access_key
'Authorization: AccessKey ' . (isset($params['access_key']) ? $params['access_key'] : $this->access_key)
);

if (isset($params['body_json']) && !empty($params['body_json'])) {
Expand Down

0 comments on commit fefa0b3

Please sign in to comment.