Skip to content

Commit

Permalink
Merge branch 'release/5.2.4' into task/SHPWR-346_put-util-in-ps4-name…
Browse files Browse the repository at this point in the history
…space

# Conflicts:
#	Bootstrapping/DatabaseSetup.php
#	Bootstrapping/Events/BackendOrderControllerSubscriber.php
  • Loading branch information
eiriarte-mendez committed Sep 10, 2018
2 parents 65ff876 + 9210a16 commit 2ce5432
Show file tree
Hide file tree
Showing 63 changed files with 791 additions and 1,051 deletions.
43 changes: 22 additions & 21 deletions Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ class Shopware_Plugins_Frontend_RpayRatePay_Bootstrap extends Shopware_Component
{
private $str;

public static function getPaymentMethods() {
return array(
public static function getPaymentMethods()
{
return [
'rpayratepayinvoice',
'rpayratepayrate',
'rpayratepaydebit',
'rpayratepayrate0',
);
];
}

/**
Expand Down Expand Up @@ -62,7 +63,7 @@ public function afterInit()
*/
public function getVersion()
{
$info = json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR .'plugin.json'), true);
$info = json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'plugin.json'), true);
if ($info) {
return $info['currentVersion'];
} else {
Expand All @@ -78,7 +79,7 @@ public function getVersion()
*/
public static function getPCConfig()
{
$info = json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR .'plugin.json'), true);
$info = json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'plugin.json'), true);
if ($info) {
return $info['payment_confirm'];
} else {
Expand All @@ -93,11 +94,11 @@ public static function getPCConfig()
*/
public function getCapabilities()
{
return array(
return [
'install' => true,
'update' => true,
'enable' => true
);
'update' => true,
'enable' => true
];
}

/**
Expand Down Expand Up @@ -130,10 +131,10 @@ public function install()

$this->Plugin()->setActive(true);

return array(
return [
'success' => true,
'invalidateCache' => array('frontend', 'backend')
);
'invalidateCache' => ['frontend', 'backend']
];
}

/**
Expand Down Expand Up @@ -164,10 +165,10 @@ public function update($version)

\RpayRatePay\Component\Service\Logger::singleton()->addNotice('Successful module update');

return array(
return [
'success' => true,
'invalidateCache' => array('frontend', 'backend')
);
'invalidateCache' => ['frontend', 'backend']
];
}

/**
Expand All @@ -178,7 +179,7 @@ public function _dropOrderAdditionalAttributes()
$metaDataCache = Shopware()->Models()->getConfiguration()->getMetadataCacheImpl();
$metaDataCache->deleteAll();
Shopware()->Models()->generateAttributeModels(
array('s_order_attributes')
['s_order_attributes']
);
}

Expand Down Expand Up @@ -218,11 +219,11 @@ public function disable()
return true;
}

public function onRegisterSubscriber()
{
$subscribers = [
new \RpayRatePay\Bootstrapping\Events\OrderOperationsSubscriber(),
new \RpayRatePay\Bootstrapping\Events\TemplateExtensionSubscriber($this->Path()),
public function onRegisterSubscriber()
{
$subscribers = [
new \RpayRatePay\Bootstrapping\Events\OrderOperationsSubscriber(),
new \RpayRatePay\Bootstrapping\Events\TemplateExtensionSubscriber($this->Path()),
new \RpayRatePay\Bootstrapping\Events\PaymentControllerSubscriber($this->Path()),
new \RpayRatePay\Bootstrapping\Events\LoggingControllerSubscriber($this->Path()),
new \RpayRatePay\Bootstrapping\Events\OrderDetailControllerSubscriber($this->Path()),
Expand Down
20 changes: 7 additions & 13 deletions Bootstrapping/AdditionalOrderAttributeSetup.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
<?php
/**
* Created by PhpStorm.
* User: eiriarte-mendez
* Date: 10.07.18
* Time: 11:26
*/
namespace RpayRatePay\Bootstrapping;

use RpayRatePay\Bootstrapping\Bootstrapper;
namespace RpayRatePay\Bootstrapping;

class AdditionalOrderAttributeSetup extends Bootstrapper
{
Expand Down Expand Up @@ -64,15 +57,16 @@ private function assertMinimumVersion($version)
$sConfigured = explode('.', Shopware()->Config()->version);
$configured = array_map('intval', $sConfigured);


for ($i=0; $i<3; $i++) {
if ($expected[$i] < $configured[$i])
for ($i = 0; $i < 3; $i++) {
if ($expected[$i] < $configured[$i]) {
return true;
}

if ($expected[$i] > $configured[$i])
if ($expected[$i] > $configured[$i]) {
return false;
}
}

return true;
}
}
}
15 changes: 5 additions & 10 deletions Bootstrapping/Bootstrapper.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?php
/**
* Created by PhpStorm.
* User: eiriarte-mendez
* Date: 12.06.18
* Time: 14:02
*/

namespace RpayRatePay\Bootstrapping;

abstract class Bootstrapper
Expand All @@ -26,17 +21,17 @@ public function __construct($bootstrap)
/**
* @return mixed
*/
public abstract function install();
abstract public function install();

/**
* @return mixed
*/
public abstract function update();
abstract public function update();

/**
* @return mixed
*/
public abstract function uninstall();
abstract public function uninstall();

/**
* @param $configFile
Expand All @@ -56,4 +51,4 @@ public function getName()
{
return end(explode('_', get_class($this)));
}
}
}
5 changes: 2 additions & 3 deletions Bootstrapping/CronjobSetup.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php
namespace RpayRatePay\Bootstrapping;

use RpayRatePay\Bootstrapping\Bootstrapper;
namespace RpayRatePay\Bootstrapping;

class CronjobSetup extends Bootstrapper
{
Expand Down Expand Up @@ -35,4 +34,4 @@ public function uninstall()
{
Shopware()->Db()->query('DELETE FROM s_crontab WHERE `action` = ?', [self::UPDATE_TRANSACTIONS_ACTION]);
}
}
}
28 changes: 11 additions & 17 deletions Bootstrapping/Database/CreateConfigInstallmentTable.php
Original file line number Diff line number Diff line change
@@ -1,35 +1,29 @@
<?php
/**
* Created by PhpStorm.
* User: eiriarte-mendez
* Date: 12.06.18
* Time: 11:01
*/

namespace RpayRatePay\Bootstrapping\Database;

class CreateConfigInstallmentTable
{
protected function getQuery()
{
$query = "CREATE TABLE IF NOT EXISTS `rpay_ratepay_config_installment` (" .
"`rpay_id` int(2) NOT NULL," .
"`month-allowed` varchar(255) NOT NULL," .
"`payment-firstday` varchar(10) NOT NULL," .
"`interestrate-default` float NOT NULL," .
"`rate-min-normal` float NOT NULL," .
"PRIMARY KEY (`rpay_id`)" .
") ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
$query = 'CREATE TABLE IF NOT EXISTS `rpay_ratepay_config_installment` (' .
'`rpay_id` int(2) NOT NULL,' .
'`month-allowed` varchar(255) NOT NULL,' .
'`payment-firstday` varchar(10) NOT NULL,' .
'`interestrate-default` float NOT NULL,' .
'`rate-min-normal` float NOT NULL,' .
'PRIMARY KEY (`rpay_id`)' .
') ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
return $query;
}


/**
* @param Enlight_Components_Db_Adapter_Pdo_Mysql $database
* @throws Zend_Db_Adapter_Exception
*/
public function __invoke($database)
{
$database->query("DROP TABLE IF EXISTS `rpay_ratepay_config_installment`");
$database->query('DROP TABLE IF EXISTS `rpay_ratepay_config_installment`');
$database->query($this->getQuery());
}
}
}
35 changes: 14 additions & 21 deletions Bootstrapping/Database/CreateConfigPaymentTable.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?php
/**
* Created by PhpStorm.
* User: eiriarte-mendez
* Date: 12.06.18
* Time: 11:01
*/

namespace RpayRatePay\Bootstrapping\Database;

class CreateConfigPaymentTable
Expand All @@ -14,28 +9,26 @@ class CreateConfigPaymentTable
*/
protected function getQuery()
{
$query = "CREATE TABLE IF NOT EXISTS `rpay_ratepay_config_payment` (" .
"`rpay_id` int(2) NOT NULL AUTO_INCREMENT," .
"`status` varchar(255) NOT NULL," .
"`b2b` int(2) NOT NULL," .
"`limit_min` int NOT NULL," .
"`limit_max` int NOT NULL," .
"`limit_max_b2b` int," .
"`address` int(2) NOT NULL," .
"PRIMARY KEY (`rpay_id`)" .
") ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
return $query;
$query = 'CREATE TABLE IF NOT EXISTS `rpay_ratepay_config_payment` (' .
'`rpay_id` int(2) NOT NULL AUTO_INCREMENT,' .
'`status` varchar(255) NOT NULL,' .
'`b2b` int(2) NOT NULL,' .
'`limit_min` int NOT NULL,' .
'`limit_max` int NOT NULL,' .
'`limit_max_b2b` int,' .
'`address` int(2) NOT NULL,' .
'PRIMARY KEY (`rpay_id`)' .
') ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
return $query;
}



/**
* @param Enlight_Components_Db_Adapter_Pdo_Mysql $database
* @throws Zend_Db_Adapter_Exception
*/
public function __invoke($database)
{
$database->query("DROP TABLE IF EXISTS `rpay_ratepay_config_payment`");
$database->query('DROP TABLE IF EXISTS `rpay_ratepay_config_payment`');
$database->query($this->getQuery());
}
}
}
48 changes: 21 additions & 27 deletions Bootstrapping/Database/CreateConfigTable.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?php
/**
* Created by PhpStorm.
* User: eiriarte-mendez
* Date: 12.06.18
* Time: 11:01
*/

namespace RpayRatePay\Bootstrapping\Database;

use RpayRatePay\Component\Service\ShopwareUtil;
Expand All @@ -16,28 +11,27 @@ class CreateConfigTable
*/
protected function getQuery()
{
$query = "CREATE TABLE IF NOT EXISTS `rpay_ratepay_config` (" .
"`profileId` varchar(255) NOT NULL," .
"`shopId` int(5) NOT NULL, " .
"`invoice` int(2) NOT NULL, " .
"`debit` int(2) NOT NULL, " .
"`installment` int(2) NOT NULL, " .
"`installment0` int(2) NOT NULL, " .
"`installmentDebit` int(2) NOT NULL, " .
"`device-fingerprint-status` varchar(3) NOT NULL, " .
"`device-fingerprint-snippet-id` varchar(55) NULL, " .
"`country-code-billing` varchar(30) NULL, " .
"`country-code-delivery` varchar(30) NULL, " .
"`currency` varchar(30) NULL, " .
"`country` varchar(30) NOT NULL, " .
$query = 'CREATE TABLE IF NOT EXISTS `rpay_ratepay_config` (' .
'`profileId` varchar(255) NOT NULL,' .
'`shopId` int(5) NOT NULL, ' .
'`invoice` int(2) NOT NULL, ' .
'`debit` int(2) NOT NULL, ' .
'`installment` int(2) NOT NULL, ' .
'`installment0` int(2) NOT NULL, ' .
'`installmentDebit` int(2) NOT NULL, ' .
'`device-fingerprint-status` varchar(3) NOT NULL, ' .
'`device-fingerprint-snippet-id` varchar(55) NULL, ' .
'`country-code-billing` varchar(30) NULL, ' .
'`country-code-delivery` varchar(30) NULL, ' .
'`currency` varchar(30) NULL, ' .
'`country` varchar(30) NOT NULL, ' .
"`error-default` VARCHAR(535) NOT NULL DEFAULT 'Leider ist eine Bezahlung mit RatePAY nicht möglich. Diese Entscheidung ist auf Grundlage einer automatisierten Datenverarbeitung getroffen worden. Einzelheiten hierzu finden Sie in der <a href=\"http://www.ratepay.com/zusaetzliche-geschaeftsbedingungen-und-datenschutzhinweis-dach\" target=\"_blank\">RatePAY-Datenschutzerklärung</a>', " .
"`sandbox` int(1) NOT NULL, " .
"PRIMARY KEY (`shopId`, `country`)" .
") ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
'`sandbox` int(1) NOT NULL, ' .
'PRIMARY KEY (`shopId`, `country`)' .
') ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
return $query;
}


/**
* @param Enlight_Components_Db_Adapter_Pdo_Mysql $database
* @throws Zend_Db_Adapter_Exception
Expand All @@ -49,11 +43,11 @@ public function __invoke($database)
$hasColumnBackend = ShopwareUtil::tableHasColumn('rpay_ratepay_config', 'backend');

if (!$hasColumnBackend) {
$sql = "ALTER TABLE rpay_ratepay_config ADD COLUMN backend int(1) NOT NULL";
$sql = 'ALTER TABLE rpay_ratepay_config ADD COLUMN backend int(1) NOT NULL';
$database->query($sql);
}

$sql = "ALTER TABLE rpay_ratepay_config DROP PRIMARY KEY, ADD PRIMARY KEY (shopId, country, backend);";
$sql = 'ALTER TABLE rpay_ratepay_config DROP PRIMARY KEY, ADD PRIMARY KEY (shopId, country, backend);';
$database->query($sql);
}
}
}
Loading

0 comments on commit 2ce5432

Please sign in to comment.