Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Novalnet-Technic committed Jun 13, 2024
0 parents commit e57faf5
Show file tree
Hide file tree
Showing 101 changed files with 15,737 additions and 0 deletions.
89 changes: 89 additions & 0 deletions Bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?php
/**
* Novalnet payment plugin
*
* NOTICE OF LICENSE
*
* This source file is subject to the Novalnet End User License Agreement
*
* DISCLAIMER
*
* If you wish to customize Novalnet payment extension for your needs,
* please contact [email protected] for more information.
*
* @author Novalnet AG
* @copyright Copyright (c) Novalnet
* @license https://www.novalnet.de/payment-plugins/kostenlos/lizenz
*
* Script: Bootstrap.php
*
*/

namespace Plugin\jtl_novalnet;

use JTL\Events\Dispatcher;
use JTL\Plugin\Bootstrapper;
use JTL\Shop;
use JTL\Smarty\JTLSmarty;
use Plugin\jtl_novalnet\frontend\NovalnetHookHandler;
use Plugin\jtl_novalnet\adminmenu\NovalnetBackendTabRenderer;
use Plugin\jtl_novalnet\frontend\NovalnetPostDataController;

/**
* Class Bootstrap
* @package Plugin\jtl_novalnet
*/
class Bootstrap extends Bootstrapper
{
/**
* Boot additional services for the payment method
*/
public function boot(Dispatcher $dispatcher): void
{
parent::boot($dispatcher);

if (Shop::isFrontend()) {

$novalnetHookHandler = new NovalnetHookHandler($this->getPlugin());

// Custom frontend operations for the Novalnet Plugin
$dispatcher->listen('shop.hook.' . \HOOK_BESTELLABSCHLUSS_INC_BESTELLUNGINDB, [$novalnetHookHandler, 'orderStatusPage']);
$dispatcher->listen('shop.hook.' . \HOOK_SMARTY_OUTPUTFILTER, [$novalnetHookHandler, 'contentUpdate']);
$dispatcher->listen('shop.hook.' . \HOOK_BESTELLVORGANG_PAGE, [$novalnetHookHandler, 'removeSavedDetails']);
$dispatcher->listen('shop.hook.' . \HOOK_JTL_PAGE, [$novalnetHookHandler, 'accountPage']);
$dispatcher->listen('shop.hook.' . \HOOK_BESTELLABSCHLUSS_INC_BESTELLUNGINDB_ENDE, [$novalnetHookHandler, 'changeWawiPickupStatus']);
$dispatcher->listen('shop.hook.' . \HOOK_IO_HANDLE_REQUEST, function (array $args) {
$novalnetPostDataController = new NovalnetPostDataController($args['io'], $args['request'], $this->getPlugin());
$novalnetPostDataController->handlePostData();
});

if (isset($_REQUEST['novalnet_webhook'])) {

// When the Novalnet webhook is triggered and known through URL, we call the appropriate Novalnet webhook handler
$novalnetWebhookHandler = new NovalnetWebhookHandler($this->getPlugin());
$dispatcher->listen('shop.hook.' . \HOOK_INDEX_NAVI_HEAD_POSTGET, [$novalnetWebhookHandler, 'handleNovalnetWebhook']);
}

if (isset($_REQUEST['novalnet_refund'])) {

// When the Novalnet webhook is triggered and known through URL, we call the appropriate Novalnet webhook handler
$novalnetWebhookHandler = new NovalnetWebhookHandler($this->getPlugin());
$dispatcher->listen('shop.hook.' . \HOOK_INDEX_NAVI_HEAD_POSTGET, [$novalnetWebhookHandler, 'handleNovalnetRefund']);
}
}
}

/**
* @param string $tabName
* @param int $menuID
* @param JTLSmarty $smarty
* @return string
*/
public function renderAdminMenuTab(string $tabName, int $menuID, JTLSmarty $smarty): string
{
// Render Novalnet Plugin's backend tabs and it's related functions
$backendRenderer = new NovalnetBackendTabRenderer($this->getPlugin(), $this->getDB());
return $backendRenderer->renderNovalnetTabs($tabName, $menuID, $smarty);
}
}

78 changes: 78 additions & 0 deletions Migrations/Migration20210608221920.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php
/**
* Novalnet payment plugin
*
* NOTICE OF LICENSE
*
* This source file is subject to the Novalnet End User License Agreement
*
* DISCLAIMER
*
* If you wish to customize Novalnet payment extension for your needs,
* please contact [email protected] for more information.
*
* @author Novalnet AG
* @copyright Copyright (c) Novalnet
* @license https://www.novalnet.de/payment-plugins/kostenlos/lizenz
*
* Script: Migration20210608221920.php
*/

namespace Plugin\jtl_novalnet\Migrations;

use JTL\Plugin\Migration;
use JTL\Update\IMigration;

/**
* Class Migration20210608221920
* @package Plugin\jtl_novalnetag\Migrations
*/
class Migration20210608221920 extends Migration implements IMigration
{
/**
* Create Novalnet transaction details table during the novalnet plugin installation
*
*/
public function up()
{
$this->execute('CREATE TABLE IF NOT EXISTS `xplugin_novalnet_transaction_details` (
`kId` int(10) NOT NULL AUTO_INCREMENT,
`cNnorderid` VARCHAR(64) NOT NULL,
`nNntid` BIGINT(20) NOT NULL,
`cZahlungsmethode` VARCHAR(64) NOT NULL,
`cMail` VARCHAR(255) NOT NULL,
`cStatuswert` VARCHAR(64),
`nBetrag` INT(11) NOT NULL,
`cSaveOnetimeToken` TINYINT(1) DEFAULT 0,
`cTokenInfo` LONGTEXT DEFAULT NULL,
`cAdditionalInfo` LONGTEXT DEFAULT NULL,
INDEX (cNnorderid, nNntid, cZahlungsmethode),
PRIMARY KEY (`kId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci'
);

$this->execute('CREATE TABLE IF NOT EXISTS `xplugin_novalnet_callback` (
`kId` INT(10) NOT NULL AUTO_INCREMENT,
`cNnorderid` VARCHAR(64) NOT NULL,
`nCallbackTid` BIGINT(20) NOT NULL,
`nReferenzTid` BIGINT(20) NOT NULL,
`cZahlungsmethode` VARCHAR(64) NOT NULL,
`dDatum` datetime NOT NULL,
`nCallbackAmount` INT(11) DEFAULT NULL,
`cWaehrung` VARCHAR(64) DEFAULT NULL,
INDEX (cNnorderid),
PRIMARY KEY (`kId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci'
);
}

/**
* Delete Novalnet transaction details table during the novalnet plugin uninstallation
*
*/
public function down()
{
$this->execute('DROP TABLE IF EXISTS `xplugin_novalnet_transaction_details`');
$this->execute('DROP TABLE IF EXISTS `xplugin_novalnet_callback`');
}
}
Loading

0 comments on commit e57faf5

Please sign in to comment.