catch recipient errors

This commit is contained in:
Daniel Seifert 2022-08-07 01:14:43 +02:00
parent 26ea7b4e70
commit ea388af268
Signed by: DanielS
GPG Key ID: 6A513E13AEE66170
1 changed files with 9 additions and 2 deletions

View File

@ -19,6 +19,7 @@ use D3\Linkmobility4Ordermanager\Application\Model\Exceptions\emptyMesageExcepti
use D3\Linkmobility4OXID\Application\Model\Exceptions\noRecipientFoundException;
use D3\Linkmobility4OXID\Application\Model\MessageTypes\Sms;
use D3\Linkmobility4OXID\Application\Model\OrderRecipients;
use D3\LinkmobilityClient\Exceptions\RecipientException;
use D3\LinkmobilityClient\ValueObject\Recipient;
use D3\ModCfg\Application\Model\d3str;
use D3\ModCfg\Application\Model\Exception\d3ParameterNotFoundException;
@ -217,13 +218,19 @@ die();
{
$recipients = [];
if ((bool) $this->getManager()->getValue('blLinkMobilityMessageToCustomer')) {
$recipients[] = (oxNew(OrderRecipients::class, $this->getItem()))->getSmsRecipient();
try {
$recipients[] = (oxNew(OrderRecipients::class, $this->getItem()))->getSmsRecipient();
} catch (noRecipientFoundException $e) {}
}
if ((bool) $this->getManager()->getValue('blLinkMobilityMessageToCustom') &&
strlen(trim($this->getManager()->getValue('sLinkMobilityMessageToCustomAddress')))
) {
foreach ($this->extractCustomAddresses() as $phoneNumber => $countryId) {
$recipients[] = oxNew(Recipient::class, $phoneNumber, $countryId);
try {
$recipients[] = oxNew(Recipient::class, $phoneNumber, $countryId);
} catch (RecipientException $e) {
Registry::getLogger()->info($e->getMessage(), [$phoneNumber, $countryId]);
}
}
}