catch recipient errors

Cette révision appartient à :
Daniel Seifert 2022-08-07 01:14:43 +02:00
Parent 26ea7b4e70
révision ea388af268
Signé par: DanielS
ID de la clé GPG: 6A513E13AEE66170

Voir le fichier

@ -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]);
}
}
}