initial
This commit is contained in:
commit
640fdb41c9
36
composer.json
Normal file
36
composer.json
Normal file
@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "d3/linkmobility4oxid",
|
||||
"description": "Linkmobility for OXID eShop",
|
||||
"type": "oxideshop-module",
|
||||
"keywords": [
|
||||
"linkmobility",
|
||||
"php",
|
||||
"sms",
|
||||
"sms gateway"
|
||||
],
|
||||
"homepage": "https://d3data.de/",
|
||||
"authors": [
|
||||
{
|
||||
"name": "D3 Data Development (Inh. Thomas Dartsch)",
|
||||
"email": "info@shopmodule.com",
|
||||
"homepage": "https://www.d3data.de",
|
||||
"role": "Owner"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.0 || ^8.0",
|
||||
"oxid-esales/oxideshop-ce": "6.7 - 6.10",
|
||||
"d3/linkmobility-php-client": "*"
|
||||
},
|
||||
"extra": {
|
||||
"oxideshop": {
|
||||
"source-directory": "/src",
|
||||
"target-directory": "d3/linkmobility"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"D3\\Linkmobility4OXID\\": "src"
|
||||
}
|
||||
}
|
||||
}
|
34
src/Application/Model/contactMessageSender.php
Normal file
34
src/Application/Model/contactMessageSender.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This Software is the property of Data Development and is protected
|
||||
* by copyright law - it is NOT Freeware.
|
||||
* Any unauthorized use of this software without a valid license
|
||||
* is a violation of the license agreement and will be prosecuted by
|
||||
* civil and criminal law.
|
||||
* http://www.shopmodule.com
|
||||
*
|
||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
|
||||
* @link http://www.oxidmodule.com
|
||||
*/
|
||||
|
||||
namespace D3\Linkmobility4OXID\Modules\Application\Controller;
|
||||
|
||||
use D3\LinkmobilityClient\Client;
|
||||
use D3\LinkmobilityClient\Request\RequestInterface;
|
||||
use D3\LinkmobilityClient\SMS\Request;
|
||||
use D3\LinkmobilityClient\ValueObject\Sender;
|
||||
use D3\LinkmobilityClient\ValueObject\SmsMessage;
|
||||
|
||||
class contactMessageSender
|
||||
{
|
||||
public function send($email, $subject, $message)
|
||||
{
|
||||
$lmClient = oxNew(Client::class, 'token');
|
||||
$request = oxNew(Request::class, oxNew(Sender::class, 'sender'), oxNew(SmsMessage::class, $message));
|
||||
$request->setMethod(RequestInterface::METHOD_POST);
|
||||
$response = $lmClient->request($request);
|
||||
dumpvar($response);
|
||||
}
|
||||
}
|
28
src/Application/views/admin/de/d3Linkmobility_lang.php
Normal file
28
src/Application/views/admin/de/d3Linkmobility_lang.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?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 <info@shopmodule.com>
|
||||
* @link https://www.oxidmodule.com
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$sLangName = "Deutsch";
|
||||
// -------------------------------
|
||||
// RESOURCE IDENTITFIER = STRING
|
||||
// -------------------------------
|
||||
$aLang = [
|
||||
|
||||
//Navigation
|
||||
'charset' => 'UTF-8',
|
||||
|
||||
'SHOP_MODULE_GROUP_d3linkmobility_general' => 'Grundeinstellungen',
|
||||
'SHOP_MODULE_d3linkmobility_debug' => 'Debug-Modus',
|
||||
'SHOP_MODULE_d3linkmobility_apitoken' => 'API-Token'
|
||||
];
|
21
src/IntelliSenseHelper.php
Normal file
21
src/IntelliSenseHelper.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This Software is the property of Data Development and is protected
|
||||
* by copyright law - it is NOT Freeware.
|
||||
* Any unauthorized use of this software without a valid license
|
||||
* is a violation of the license agreement and will be prosecuted by
|
||||
* civil and criminal law.
|
||||
* http://www.shopmodule.com
|
||||
*
|
||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
|
||||
* @link http://www.oxidmodule.com
|
||||
*/
|
||||
|
||||
namespace D3\Linkmobility4OXID\Modules\Application\Controller
|
||||
{
|
||||
class ContactController_parent extends ContactController {}
|
||||
|
||||
class StartController_parent extends StartController {}
|
||||
}
|
49
src/Modules/Application/Controller/ContactController.php
Normal file
49
src/Modules/Application/Controller/ContactController.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This Software is the property of Data Development and is protected
|
||||
* by copyright law - it is NOT Freeware.
|
||||
* Any unauthorized use of this software without a valid license
|
||||
* is a violation of the license agreement and will be prosecuted by
|
||||
* civil and criminal law.
|
||||
* http://www.shopmodule.com
|
||||
*
|
||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
|
||||
* @link http://www.oxidmodule.com
|
||||
*/
|
||||
|
||||
namespace D3\Linkmobility4OXID\Modules\Application\Controller;
|
||||
|
||||
use D3\LinkmobilityClient\Client;
|
||||
use D3\LinkmobilityClient\SMS\Request;
|
||||
use D3\LinkmobilityClient\ValueObject\Sender;
|
||||
use D3\LinkmobilityClient\ValueObject\SmsMessage;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\EshopCommunity\Internal\Domain\Contact\Form\ContactFormBridgeInterface;
|
||||
|
||||
class ContactController extends ContactController_parent
|
||||
{
|
||||
public function send()
|
||||
{
|
||||
$contactFormBridge = $this->getContainer()->get(ContactFormBridgeInterface::class);
|
||||
|
||||
$form = $contactFormBridge->getContactForm();
|
||||
$form->handleRequest($this->getMappedContactFormRequest());
|
||||
|
||||
if ($form->isValid()) {
|
||||
$contactMessageSender = oxNew(contactMessageSender::class);
|
||||
$contactMessageSender->send(
|
||||
$form->email->getValue(),
|
||||
$form->subject->getValue(),
|
||||
$contactFormBridge->getContactFormMessage($form)
|
||||
);
|
||||
} else {
|
||||
foreach ($form->getErrors() as $error) {
|
||||
Registry::getUtilsView()->addErrorToDisplay($error);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
37
src/Modules/Application/Controller/StartController.php
Normal file
37
src/Modules/Application/Controller/StartController.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This Software is the property of Data Development and is protected
|
||||
* by copyright law - it is NOT Freeware.
|
||||
* Any unauthorized use of this software without a valid license
|
||||
* is a violation of the license agreement and will be prosecuted by
|
||||
* civil and criminal law.
|
||||
* http://www.shopmodule.com
|
||||
*
|
||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
|
||||
* @link http://www.oxidmodule.com
|
||||
*/
|
||||
|
||||
namespace D3\Linkmobility4OXID\Modules\Application\Controller;
|
||||
|
||||
use D3\LinkmobilityClient\Client;
|
||||
use D3\LinkmobilityClient\Request\RequestInterface;
|
||||
use D3\LinkmobilityClient\SMS\Request;
|
||||
use D3\LinkmobilityClient\ValueObject\Sender;
|
||||
use D3\LinkmobilityClient\ValueObject\SmsMessage;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
|
||||
class StartController extends StartController_parent
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
$lmClient = oxNew(Client::class, trim(Registry::getConfig()->getConfigParam('d3linkmobility_apitoken')));
|
||||
$request = oxNew(Request::class, oxNew(Sender::class, 'sender'), oxNew(SmsMessage::class, $message));
|
||||
$request->setMethod(RequestInterface::METHOD_POST);
|
||||
$response = $lmClient->request($request);
|
||||
dumpvar($response);
|
||||
|
||||
return parent::render();
|
||||
}
|
||||
}
|
45
src/metadata.php
Normal file
45
src/metadata.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* Metadata version
|
||||
*/
|
||||
$sMetadataVersion = '2.1';
|
||||
$sModuleId = 'd3linkmobility';
|
||||
$sD3Logo = '<img src="https://logos.oxidmodule.com/d3logo.svg" alt="(D3)" style="height:1em;width:1em"> ';
|
||||
|
||||
/**
|
||||
* Module information
|
||||
*/
|
||||
$aModule = [
|
||||
'id' => $sModuleId,
|
||||
'title' => $sD3Logo . ' Linkmobility',
|
||||
'description' => [
|
||||
'de' => 'Anbiundung an die Linkmobility API <ul><li>Nachrichtenversand per SMS</li></ul>',
|
||||
'en' => '',
|
||||
],
|
||||
'thumbnail' => 'picture.png',
|
||||
'version' => '0.1',
|
||||
'author' => 'D³ Data Development (Inh.: Thomas Dartsch)',
|
||||
'email' => 'support@shopmodule.com',
|
||||
'url' => 'https://www.oxidmodule.com/',
|
||||
'extend' => [
|
||||
\OxidEsales\Eshop\Application\Controller\StartController::class => \D3\Linkmobility4OXID\Modules\Application\Controller\StartController::class,
|
||||
\OxidEsales\Eshop\Application\Controller\ContactController::class => \D3\Linkmobility4OXID\Modules\Application\Controller\ContactController::class
|
||||
],
|
||||
'controllers' => [],
|
||||
'templates' => [],
|
||||
'events' => [],
|
||||
'settings' => [
|
||||
[
|
||||
'group' => $sModuleId.'_general',
|
||||
'name' => $sModuleId.'_debug',
|
||||
'type' => 'bool',
|
||||
'value' => false
|
||||
],
|
||||
[
|
||||
'group' => $sModuleId.'_general',
|
||||
'name' => $sModuleId.'_apitoken',
|
||||
'type' => 'str',
|
||||
'value' => false
|
||||
]
|
||||
]
|
||||
];
|
Loading…
Reference in New Issue
Block a user