diff --git a/Frontend/HeidelGateway/Bootstrap.php b/Frontend/HeidelGateway/Bootstrap.php
index 35f3ac1..d8411f8 100644
--- a/Frontend/HeidelGateway/Bootstrap.php
+++ b/Frontend/HeidelGateway/Bootstrap.php
@@ -9,6 +9,9 @@
* @copyright Copyright (c) 2018, heidelpay GmbH
* @author heidelpay Group
*/
+
+use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException;
+
require_once __DIR__ . '/Components/CSRFWhitelistAware.php';
class Shopware_Plugins_Frontend_HeidelGateway_Bootstrap extends Shopware_Components_Plugin_Bootstrap{
@@ -25,7 +28,7 @@ class Shopware_Plugins_Frontend_HeidelGateway_Bootstrap extends Shopware_Compone
* @return string version number
*/
public function getVersion(){
- return '19.06.19';
+ return '19.08.21';
}
/**
@@ -988,7 +991,7 @@ public function update($oldVersion){
} catch (Exception $e) {
$this->logError($msg,$e);
}
- case '19.06.19':
+ case '19.06.18':
try{
// integration of Flexipay
$this->createPayments();
@@ -1000,11 +1003,13 @@ public function update($oldVersion){
)
);
- $msg .= '* update 19.06.19
';
+ $msg .= '* update 19.06.18
';
} catch (Exception $e) {
$this->logError($msg,$e);
}
+ case '19.08.21':
+
// overwrite $msg if update was successful
$msg = 'Update auf Version '.$this->getVersion().' erfolgreich.';
}
@@ -1971,6 +1976,9 @@ public function onBeforeRenderDocument(Enlight_Hook_HookArgs $args){
/**
* Event for custom code
+ *
+ * @throws ServiceCircularReferenceException
+ * @throws RuntimeException
*/
public function onPostDispatch(Enlight_Event_EventArgs $args){
$request = $args->getSubject()->Request();
@@ -2536,7 +2544,7 @@ public function onPostDispatch(Enlight_Event_EventArgs $args){
$view->assign('sanGenderVal',['MR', 'MRS']);
$view->assign('sanGenderOut',['Herr', 'Frau']);
$view->assign('genderShop_HpSan',$user['additional']['user']['salutation'] == 'mrs'? 'MRS' : 'MR');
- if(Shopware::VERSION == '5.1.6'){
+ if($this->getSwVersion() === '5.1.6'){
$user = self::formatUserInfos($user);
$view->assign('accountHolder_HpSan',$user['billingaddress']['firstname'].' '.$user['billingaddress']['lastname']);
} else {
@@ -2609,8 +2617,17 @@ public function onPostDispatch(Enlight_Event_EventArgs $args){
}
/**
- * Event for custom code for nearly all Shopware-Events
- */
+ * Event for custom code for nearly all Shopware-Events
+ *
+ * @param Enlight_Event_EventArgs $args
+ *
+ * @throws Enlight_Event_Exception
+ * @throws Enlight_Exception
+ * @throws RuntimeException
+ * @throws ServiceCircularReferenceException
+ * @throws Zend_Db_Adapter_Exception
+ * @throws Zend_Db_Statement_Exception
+ */
public function onPostDispatchTemplate(Enlight_Event_EventArgs $args){
$request = $args->getSubject()->Request();
$view = $args->getSubject()->View();
@@ -2729,7 +2746,7 @@ public function onPostDispatchTemplate(Enlight_Event_EventArgs $args){
$view->assign('sanGenderVal',['MR', 'MRS']);
$view->assign('sanGenderOut',['Herr', 'Frau']);
$view->assign('genderShop_HpSan',$user['additional']['user']['salutation'] == 'mrs'? 'MRS' : 'MR');
- if(Shopware::VERSION == '5.1.6'){
+ if ($this->getSwVersion() === '5.1.6') {
$user = self::formatUserInfos($user);
$view->assign('accountHolder_HpSan',$user['billingaddress']['firstname'].' '.$user['billingaddress']['lastname']);
} else {
@@ -3066,8 +3083,17 @@ public function onPostDispatchTemplate(Enlight_Event_EventArgs $args){
/**
* Event for EasyCredit in Emotion-template
+ *
* @param Enlight_Event_EventArgs $args
+ *
* @return mixed
+ *
+ * @throws Enlight_Event_Exception
+ * @throws Enlight_Exception
+ * @throws RuntimeException
+ * @throws ServiceCircularReferenceException
+ * @throws Zend_Db_Adapter_Exception
+ * @throws Zend_Db_Statement_Exception
*/
public function onPostDispatchFrontendCheckoutAccount(Enlight_Event_EventArgs $args)
{
@@ -3202,7 +3228,7 @@ public function onPostDispatchFrontendCheckoutAccount(Enlight_Event_EventArgs $a
$view->sanGenderVal = ['MR', 'MRS'];
$view->sanGenderOut = ['Herr', 'Frau'];
$view->genderShop_HpSan = ($user['additional']['user']['salutation'] == 'mrs'? 'MRS' : 'MR');
- if(Shopware::VERSION == '5.1.6'){
+ if($this->getSwVersion() === '5.1.6'){
$user = self::formatUserInfos($user);
$view->accountHolder_HpSan = $user['billingaddress']['firstname'].' '.$user['billingaddress']['lastname'];
} else {
@@ -5479,4 +5505,21 @@ public static function formatUserInfos($user = null)
}
return $user;
}
+
+ /**
+ * Returns the version string of this Shopware installation.
+ *
+ * @return mixed|string
+ * @throws ServiceCircularReferenceException
+ * @throws RuntimeException
+ */
+ private function getSwVersion()
+ {
+ if (defined('Shopware::VERSION')) {
+ $swVersion = Shopware::VERSION;
+ } else {
+ $swVersion = Shopware()->Container()->get('config')->get('version');
+ }
+ return $swVersion;
+ }
}
\ No newline at end of file
diff --git a/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php b/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php
index 82fa25c..23fbbc7 100644
--- a/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php
+++ b/Frontend/HeidelGateway/Controllers/Frontend/PaymentHgw.php
@@ -10,6 +10,7 @@
* @author heidelpay Group
*/
use Shopware\Components\CSRFWhitelistAware;
+use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException;
class Shopware_Controllers_Frontend_PaymentHgw extends Shopware_Controllers_Frontend_Payment implements CSRFWhitelistAware{
var $dbtable = '';
@@ -1653,7 +1654,7 @@ public function cancelAction(){}
*/
public function savePaymentAction(){
try{
- $swVersion = Shopware::VERSION;
+ $swVersion = $this->getSwVersion();
$tplVersion = Shopware()->Shop()->getTemplate()->getVersion();
$postparams = array();
@@ -3812,7 +3813,8 @@ public function createAccount($data){
/* Try to fix problem with masterpass-quick-checkout */
Shopware()->Session()->sRegisterFinished = false;
- if(version_compare(Shopware::VERSION, '4.3.0', '>=') || Shopware::VERSION == '___VERSION___'){
+ $swVersion = $this->getSwVersion();
+ if(version_compare($swVersion, '4.3.0', '>=') || $swVersion === '___VERSION___'){
Shopware()->Session()->sRegister = $data;
}else{
Shopware()->Session()->sRegister = new ArrayObject($data, ArrayObject::ARRAY_AS_PROPS);
@@ -4537,4 +4539,20 @@ public function getWhitelistedCSRFActions()
'gateway'
);
}
+
+ /**
+ * Returns the version string of this Shopware installation.
+ *
+ * @return mixed|string
+ * @throws ServiceCircularReferenceException
+ */
+ private function getSwVersion()
+ {
+ if (defined('Shopware::VERSION')) {
+ $swVersion = Shopware::VERSION;
+ } else {
+ $swVersion = $this->container->get('config')->get('version');
+ }
+ return $swVersion;
+ }
}
\ No newline at end of file