mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 09:28:40 +00:00
getCountryCode
This commit is contained in:
parent
17b9f136f1
commit
88e67c8d58
2 changed files with 555 additions and 204 deletions
734
composer.lock
generated
734
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -441,31 +441,24 @@ class Messaging extends Action
|
||||||
try {
|
try {
|
||||||
$adapter->send($data);
|
$adapter->send($data);
|
||||||
|
|
||||||
$countryCode = $sms->getCountryCode($payload['recipient']);
|
$countryCode = $adapter->getCountryCode($message['to']);
|
||||||
|
if (!empty($countryCode)) {
|
||||||
if (!empty($countryCode)) {
|
$queueForUsage
|
||||||
$queueForUsage
|
->addMetric(str_replace('{countryCode}', $countryCode, METRIC_MESSAGES_COUNTRY_CODE), 1);
|
||||||
->addMetric(str_replace('{countryCode}', $countryCode, METRIC_MESSAGES_COUNTRY_CODE), 1);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$queueForUsage
|
|
||||||
->setProject($project)
|
|
||||||
->addMetric(METRIC_MESSAGES, 1)
|
|
||||||
->trigger();
|
|
||||||
} catch (\Exception $error) {
|
|
||||||
throw new Exception('Error sending message: ' . $error->getMessage(), 500);
|
|
||||||
}
|
|
||||||
$queueForUsage
|
$queueForUsage
|
||||||
->addMetric(METRIC_MESSAGES, 1)
|
->addMetric(METRIC_MESSAGES, 1)
|
||||||
->setProject($project)
|
->setProject($project)
|
||||||
->trigger();
|
->trigger();
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $th) {
|
||||||
throw new \Exception('Failed sending to targets with error: ' . $e->getMessage());
|
throw new \Exception('Failed sending to targets with error: ' . $th->getMessage());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}, $batches));
|
}, $batches));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private function getSmsAdapter(Document $provider): ?SMSAdapter
|
private function getSmsAdapter(Document $provider): ?SMSAdapter
|
||||||
{
|
{
|
||||||
$credentials = $provider->getAttribute('credentials');
|
$credentials = $provider->getAttribute('credentials');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue