Skip to content

Commit

Permalink
Merge pull request #4 from PAYONE-GmbH/OX7-3-Refactoring
Browse files Browse the repository at this point in the history
Ox7 3 refactoring
  • Loading branch information
janteuber authored May 13, 2024
2 parents a66872a + f65b698 commit 327cec9
Show file tree
Hide file tree
Showing 91 changed files with 4,019 additions and 4,368 deletions.
2 changes: 1 addition & 1 deletion Application/Controller/Admin/FcPayOneAdmin.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/**
* PAYONE OXID Connector is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand Down Expand Up @@ -30,4 +29,5 @@ class FcPayOneAdmin extends FcPayOneAdminView
* @var string
*/
protected $_sThisTemplate = '@fcpayone/admin/fcpayone';

}
62 changes: 42 additions & 20 deletions Application/Controller/Admin/FcPayOneAdminDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

namespace Fatchip\PayOne\Application\Controller\Admin;


use Fatchip\PayOne\Application\Model\FcPoConfigExport;
use Fatchip\PayOne\Application\Model\FcPoErrorMapping;
use Fatchip\PayOne\Application\Model\FcPoForwarding;
Expand All @@ -32,77 +31,80 @@
use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController;
use OxidEsales\Eshop\Core\Database\Adapter\DatabaseInterface;
use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use stdClass;

class FcPayOneAdminDetails extends AdminDetailsController
{

/**
* Helper object for dealing with different shop versions
*
* @var object
* @var FcPoHelper
*/
protected $_oFcPoHelper = null;
protected FcPoHelper $_oFcPoHelper;

/**
* Centralized Database instance
*
* @var object
* @var DatabaseInterface
*/
protected DatabaseInterface $_oFcPoDb;

/**
* fcpoconfigexport instance
*
* @var object
* @var FcPoConfigExport
*/
protected $_oFcPoConfigExport = null;
protected FcPoConfigExport $_oFcPoConfigExport;

/**
* fcpopaypal instance
*
* @var object
* @var FcPoPaypal
*/

protected $_oFcPoPayPal = null;
protected FcPoPaypal $_oFcPoPayPal;

/**
* fcpopaypal instance
*
* @var object
* @var FcPoKlarna
*/
protected $_oFcPoKlarna = null;
protected FcPoKlarna $_oFcPoKlarna;

/**
* fcpomapping instance
*
* @var object
* @var FcPoMapping
*/
protected $_oFcPoMapping = null;
protected FcPoMapping $_oFcPoMapping;

/**
* fcpoforwarding instance
*
* @var object
* @var FcPoForwarding
*/
protected $_oFcPoForwarding = null;
protected FcPoForwarding $_oFcPoForwarding;

/**
* fcporatepay instance
*
* @var null|object
* @var FcPoRatePay
*/
protected $_oFcPoRatePay = null;
protected FcPoRatePay $_oFcPoRatePay;

/**
* fcpoerrormapping instance
*
* @var null|object
* @var FcPoErrorMapping
*/
protected $_oFcPoErrorMapping = null;
protected FcPoErrorMapping $_oFcPoErrorMapping;


/**
* Init needed data
* @throws DatabaseConnectionException
*/
public function __construct()
{
Expand All @@ -113,9 +115,9 @@ public function __construct()
$this->_oFcPoPayPal = oxNew(FcPoPayPal::class);
$this->_oFcPoKlarna = oxNew(FcPoKlarna::class);
$this->_oFcPoMapping = oxNew(FcPoMapping::class);
$this->_oFcPoErrorMapping = oxNew(FcPoErrorMapping::class);
$this->_oFcPoForwarding = oxNew(FcPoForwarding::class);
$this->_oFcPoRatePay = oxNew(FcPoRatePay::class);
$this->_oFcPoErrorMapping = oxNew(FcPoErrorMapping::class);
}

/**
Expand All @@ -124,9 +126,29 @@ public function __construct()
* @param string $sClassName
* @return object
*/
public function fcpoGetInstance($sClassName)
public function fcpoGetInstance(string $sClassName): object
{
return oxNew($sClassName);
}

/**
* Returns payone status list
*
* @return stdClass[]
*/
public function getPayoneStatusList(): array
{
$aPayoneStatusList = $this->_oFcPoHelper->fcpoGetPayoneStatusList();

$aNewList = [];
foreach ($aPayoneStatusList as $sPayoneStatusId) {
$oStatus = new stdClass();
$oStatus->sId = $sPayoneStatusId;
$oStatus->sTitle = $this->_oFcPoHelper->fcpoGetLang()->translateString('fcpo_status_' . $sPayoneStatusId, null, true);
$aNewList[] = $oStatus;
}

return $aNewList;
}

}
25 changes: 13 additions & 12 deletions Application/Controller/Admin/FcPayOneAdminList.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
<?php

namespace Fatchip\PayOne\Application\Controller\Admin;


use Fatchip\PayOne\Lib\FcPoHelper;
use OxidEsales\Eshop\Application\Controller\Admin\AdminListController;
use OxidEsales\Eshop\Core\Database\Adapter\DatabaseInterface;
use OxidEsales\Eshop\Core\DatabaseProvider;

/**
* PAYONE OXID Connector is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand All @@ -26,26 +17,36 @@
* @copyright (C) Payone GmbH
* @version OXID eShop CE
*/

namespace Fatchip\PayOne\Application\Controller\Admin;

use Fatchip\PayOne\Lib\FcPoHelper;
use OxidEsales\Eshop\Application\Controller\Admin\AdminListController;
use OxidEsales\Eshop\Core\Database\Adapter\DatabaseInterface;
use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;

class FcPayOneAdminList extends AdminListController
{

/**
* Helper object for dealing with different shop versions
*
* @var object
* @var FcPoHelper
*/
protected $_oFcPoHelper = null;
protected FcPoHelper $_oFcPoHelper;

/**
* Centralized Database instance
*
* @var object
* @var DatabaseInterface
*/
protected DatabaseInterface $_oFcPoDb;


/**
* Init needed data
* @throws DatabaseConnectionException
*/
public function __construct()
{
Expand Down
46 changes: 20 additions & 26 deletions Application/Controller/Admin/FcPayOneAdminView.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
<?php

namespace Fatchip\PayOne\Application\Controller\Admin;

use Fatchip\PayOne\Lib\FcPoHelper;
use OxidEsales\Eshop\Application\Controller\Admin\AdminController;
use OxidEsales\Eshop\Core\Database\Adapter\DatabaseInterface;
use OxidEsales\Eshop\Core\DatabaseProvider;

/**
* PAYONE OXID Connector is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand All @@ -25,26 +17,36 @@
* @copyright (C) Payone GmbH
* @version OXID eShop CE
*/

namespace Fatchip\PayOne\Application\Controller\Admin;

use Fatchip\PayOne\Lib\FcPoHelper;
use OxidEsales\Eshop\Application\Controller\Admin\AdminController;
use OxidEsales\Eshop\Core\Database\Adapter\DatabaseInterface;
use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;

class FcPayOneAdminView extends AdminController
{

/**
* Helper object for dealing with different shop versions
*
* @var object
* @var FcPoHelper
*/
protected $_oFcPoHelper = null;
protected FcPoHelper $_oFcPoHelper;

/**
* Centralized Database instance
*
* @var object
* @var DatabaseInterface
*/
protected DatabaseInterface $_oFcPoDb;


/**
* Init needed data
* @throws DatabaseConnectionException
*/
public function __construct()
{
Expand All @@ -53,50 +55,42 @@ public function __construct()
$this->_oFcPoDb = DatabaseProvider::getDb();
}


/**
* Return admin template seperator sign by shop-version
* Return admin template separator sign by shop-version
*
* @return string
*/
public function fcGetAdminSeperator()
public function fcGetAdminSeparator(): string
{
$iVersion = $this->_oFcPoHelper->fcpoGetIntShopVersion();
if ($iVersion < 4300) {
return '?';
} else {
return '&';
}
return '&';
}

/**
* Returns current view identifier
*
* @return string
*/
public function getViewId()
public function getViewId(): string
{
return 'dyn_fcpayone';
}


/**
* Template getter for integrator ID
*
* @return string
*/
public function fcpoGetIntegratorId()
public function fcpoGetIntegratorId(): string
{
return $this->_oFcPoHelper->fcpoGetIntegratorId();
}


/**
* Template getter returns payone connector version
*
* @return string
*/
public function fcpoGetVersion()
public function fcpoGetVersion(): string
{
return $this->_oFcPoHelper->fcpoGetModuleVersion();
}
Expand All @@ -106,7 +100,7 @@ public function fcpoGetVersion()
*
* @return string
*/
public function fcpoGetMerchantId()
public function fcpoGetMerchantId(): string
{
$oConfig = $this->_oFcPoHelper->fcpoGetConfig();
return $oConfig->getConfigParam('sFCPOMerchantID');
Expand Down
21 changes: 10 additions & 11 deletions Application/Controller/Admin/FcPayOneApiLog.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
<?php

namespace Fatchip\PayOne\Application\Controller\Admin;


use Fatchip\PayOne\Application\Model\FcPoRequestLog;

/**
* PAYONE OXID Connector is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand All @@ -23,6 +17,11 @@
* @copyright (C) Payone GmbH
* @version OXID eShop CE
*/

namespace Fatchip\PayOne\Application\Controller\Admin;

use Fatchip\PayOne\Application\Model\FcPoRequestLog;

class FcPayOneApiLog extends FcPayOneAdminDetails
{

Expand All @@ -36,19 +35,19 @@ class FcPayOneApiLog extends FcPayOneAdminDetails
/**
* Array with existing status of order
*
* @var array
* @var array|null
*/
protected $_aStatus = null;
protected ?array $_aStatus = null;


/**
* Loads transaction log entry with given oxid, passes
* it's data to Smarty engine and returns name of template file
* "fcpayone_apilog.tpl".
* its data to Twig engine and returns path to a template
* "fcpayone_apilog".
*
* @return string
*/
public function render()
public function render(): string
{
parent::render();

Expand Down
Loading

0 comments on commit 327cec9

Please sign in to comment.