8
0

use request factory to get related instance by message type

Dieser Commit ist enthalten in:
Daniel Seifert 2022-06-27 15:59:22 +02:00
Ursprung 52d3fe294c
Commit 6e5f307862
Signiert von: DanielS
GPG-Schlüssel-ID: 8A7C4C6ED1915C6F

Datei anzeigen

@ -18,6 +18,7 @@ namespace D3\Linkmobility4OXID\Modules\Application\Controller;
use D3\LinkmobilityClient\Client;
use D3\LinkmobilityClient\Request\RequestInterface;
use D3\LinkmobilityClient\SMS\Request;
use D3\LinkmobilityClient\SMS\RequestFactory;
use D3\LinkmobilityClient\SMS\TextRequest;
use D3\LinkmobilityClient\ValueObject\Recipient;
use D3\LinkmobilityClient\ValueObject\Sender;
@ -28,19 +29,20 @@ class StartController extends StartController_parent
{
public function render()
{
$message = "testMessage";
//$message = "testMessagetestMessagetestMessagetestMessagetestMessagetestMessage";
$message = "test\tMessage\ttest\tMessage";
$lmClient = oxNew(Client::class, trim(Registry::getConfig()->getConfigParam('d3linkmobility_apitoken')));
$request = oxNew(TextRequest::class, oxNew(SmsMessage::class, $message));
$request->setTest((bool) Registry::getConfig()->getConfigParam('d3linkmobility_debug'))
$request = oxNew(RequestFactory::class, $message)->getRequest();
$request->setTestMode( (bool) Registry::getConfig()->getConfigParam( 'd3linkmobility_debug'))
->setMethod(RequestInterface::METHOD_POST)
->setSenderAddress(oxNew(Sender::class, '017621164371', 'DE'))
->setSenderAddressType(RequestInterface::SENDERADDRESSTYPE_INTERNATIONAL);
$recipientsList = $request->getRecipientsList()
$request->getRecipientsList()
->add(oxNew(Recipient::class, '+49(0)176-21164371', 'DE'))
->add(oxNew(Recipient::class, '+49176 211def64372', 'DE'))
->add(oxNew(Recipient::class, '+49176 21164372', 'DE'))
->add(oxNew(Recipient::class, '03721268090', 'DE'))
->add(oxNew(Recipient::class, '0049176abc21164373', 'DE'));
try {
$response = $lmClient->request( $request );
} catch (\Exception $e) {
@ -48,6 +50,7 @@ class StartController extends StartController_parent
}
dumpvar($response->isSuccessful());
dumpvar($response->getErrorMessage());
dumpvar($response->getSmsCount());
return parent::render();