linkmobility4oxid/src/Application/Controller/Admin/AdminOrder.php

55 regels
1.6 KiB
PHP

<?php
/**
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\Linkmobility4OXID\Application\Controller\Admin;
use D3\Linkmobility4OXID\Application\Model\Exceptions\noRecipientFoundException;
use D3\Linkmobility4OXID\Application\Model\MessageTypes\Sms;
use D3\Linkmobility4OXID\Application\Model\OrderRecipients;
use D3\TestingTools\Production\IsMockable;
use OxidEsales\Eshop\Application\Model\Order;
class AdminOrder extends AdminSendController
{
use IsMockable;
protected $_sThisTemplate = 'd3adminorder.tpl';
/** @var Order */
protected $item;
/** @var OrderRecipients */
protected $itemRecipients;
public function __construct()
{
$this->item = $this->d3GetMockableOxNewObject(Order::class);
$this->itemRecipients = $this->d3GetMockableOxNewObject(OrderRecipients::class, $this->item);
parent::__construct();
}
/**
* @return string
* @throws noRecipientFoundException
*/
protected function sendMessage(): string
{
$sms = $this->d3GetMockableOxNewObject(Sms::class, $this->getMessageBody());
return $sms->sendOrderMessage($this->item) ?
(string) $this->getSuccessSentMessage($sms) :
$this->getUnsuccessfullySentMessage($sms);
}
}