show API error message in admin, log SMS messaging error
This commit is contained in:
parent
807b98012f
commit
6d947f6d6e
@ -92,7 +92,12 @@ class AdminOrder extends AdminController
|
||||
oxNew(successfullySentException::class, $sms->getResponse()->getSmsCount() )
|
||||
);
|
||||
} else {
|
||||
Registry::getUtilsView()->addErrorToDisplay( Registry::getLang()->translateString( 'D3LM_EXC_MESSAGE_UNEXPECTED_ERR_SEND' ) );
|
||||
Registry::getUtilsView()->addErrorToDisplay(
|
||||
sprintf(
|
||||
Registry::getLang()->translateString( 'D3LM_EXC_MESSAGE_UNEXPECTED_ERR_SEND' ),
|
||||
$sms->getResponse()->getErrorMessage()
|
||||
)
|
||||
);
|
||||
}
|
||||
} catch (noRecipientFoundException $e) {
|
||||
Registry::getUtilsView()->addErrorToDisplay($e);
|
||||
|
@ -94,7 +94,10 @@ class AdminUser extends AdminController
|
||||
);
|
||||
} else {
|
||||
Registry::getUtilsView()->addErrorToDisplay(
|
||||
Registry::getLang()->translateString('D3LM_EXC_MESSAGE_UNEXPECTED_ERR_SEND')
|
||||
sprintf(
|
||||
Registry::getLang()->translateString( 'D3LM_EXC_MESSAGE_UNEXPECTED_ERR_SEND' ),
|
||||
$sms->getResponse()->getErrorMessage()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ use D3\Linkmobility4OXID\Application\Model\RequestFactory;
|
||||
use D3\LinkmobilityClient\Exceptions\ApiException;
|
||||
use D3\LinkmobilityClient\Request\RequestInterface;
|
||||
use D3\LinkmobilityClient\Response\ResponseInterface;
|
||||
use D3\LinkmobilityClient\SMS\SmsRequestInterface;
|
||||
use D3\LinkmobilityClient\ValueObject\Recipient;
|
||||
use D3\LinkmobilityClient\ValueObject\Sender;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
@ -99,8 +100,17 @@ class Sms
|
||||
$configuration = oxNew( Configuration::class );
|
||||
$client = oxNew( MessageClient::class )->getClient();
|
||||
|
||||
/** @var SmsRequestInterface $request */
|
||||
$request = oxNew( RequestFactory::class, $this->getMessage(), $client )->getSmsRequest();
|
||||
$request->setTestMode( $configuration->getTestMode() )->setMethod( RequestInterface::METHOD_POST )->setSenderAddress( oxNew( Sender::class, $configuration->getSmsSenderNumber(), $configuration->getSmsSenderCountry() ) )->setSenderAddressType( RequestInterface::SENDERADDRESSTYPE_INTERNATIONAL );
|
||||
$request->setTestMode( $configuration->getTestMode() )->setMethod( RequestInterface::METHOD_POST )
|
||||
->setSenderAddress(
|
||||
oxNew(
|
||||
Sender::class,
|
||||
$configuration->getSmsSenderNumber(),
|
||||
$configuration->getSmsSenderCountry()
|
||||
)
|
||||
)
|
||||
->setSenderAddressType( RequestInterface::SENDERADDRESSTYPE_INTERNATIONAL );
|
||||
|
||||
$recipientsList = $request->getRecipientsList();
|
||||
foreach ($recipientsArray as $recipient) {
|
||||
@ -111,6 +121,10 @@ class Sms
|
||||
|
||||
$this->response = $response;
|
||||
|
||||
if (false === $response->isSuccessful()) {
|
||||
Registry::getLogger()->warning( $response->getErrorMessage(), [$request->getBody()] );
|
||||
}
|
||||
|
||||
return $response->isSuccessful();
|
||||
} catch (abortSendingExceptionInterface $e) {
|
||||
Registry::getLogger()->warning($e->getMessage());
|
||||
|
@ -30,7 +30,7 @@ $aLang = [
|
||||
|
||||
'SHOP_MODULE_GROUP_d3linkmobility_sms' => 'SMS-Versand',
|
||||
'SHOP_MODULE_d3linkmobility_smsSenderNumber' => 'Sendernummer',
|
||||
'HELP_SHOP_MODULE_d3linkmobility_smsSenderNumber' => 'Ihre Mobilfunknummer, die als Antwortziel verwendet werden kann.',
|
||||
'HELP_SHOP_MODULE_d3linkmobility_smsSenderNumber' => 'Ihre Mobilfunknummer, die als Antwortziel verwendet werden kann., Bitte lassen Sie die gewünschte Telefonnummer in Ihrem Konto hinterlegen.',
|
||||
'SHOP_MODULE_d3linkmobility_smsSenderCountry' => 'Landeskürzel',
|
||||
'HELP_SHOP_MODULE_d3linkmobility_smsSenderCountry' => 'Geben Sie hier das Landeskürzel (ISO-Alpha-2, z.B. DE, AT, FR) an, zu dem Ihre Mobilfunknummer zugeordnet ist.',
|
||||
'SHOP_MODULE_d3linkmobility_smsUserRecipientsFields'=> 'Felder des Benutzerkontos, die auf gültige Mobilfunknummern geprüft werden',
|
||||
@ -52,7 +52,7 @@ $aLang = [
|
||||
|
||||
'D3LM_EXC_MESSAGE_NO_LENGTH' => 'Die Mitteilung muss Inhalt haben',
|
||||
'D3LM_EXC_SMS_SUCC_SENT' => 'Die Mitteilung wurde erfolgreich versendet. (%1$s Nachricht(en) verwendet)',
|
||||
'D3LM_EXC_MESSAGE_UNEXPECTED_ERR_SEND' => 'Beim Versenden der Nachricht(en) ist ein unerwarteter Fehler aufgetreten.',
|
||||
'D3LM_EXC_MESSAGE_UNEXPECTED_ERR_SEND' => 'Beim Versenden der Nachricht(en) ist dieser Fehler aufgetreten: %1$s',
|
||||
'D3LM_EXC_NO_RECIPIENT_SET' => 'Kein (verwendbarer) Empfänger gesetzt.',
|
||||
|
||||
'D3LM_REMARK_SMS' => 'SMS-Nachr.',
|
||||
|
Loading…
Reference in New Issue
Block a user