Skip to content

Commit

Permalink
Merge pull request #25 in DEV-MO/shopware5-module from release/5.2.4 …
Browse files Browse the repository at this point in the history
…to master

* commit 'd8506fc23650b6f5d2d6a4e9fe7a836b708d0174':
  Update Readme for correct version and changelog
  Change version
  [SHPWR-359] Update changelog in README file
  [SHPWR-347] round item prices for b2b shops
  [SHPWR-336] Fix extra indents of code and PSR2 formatting
  task/SHPWR-346_put-util-in-ps4-namespace
  [SHPWR-347] fix rounded price discrepancies
  [MGNT-353] disable error notifications if payment changed
  [SHPWR-359] update readme file
  [SHPWR-356] wrap logger component into service
  • Loading branch information
eiriarte-mendez committed Sep 13, 2018
2 parents 2967995 + d8506fc commit 2cb672e
Show file tree
Hide file tree
Showing 71 changed files with 1,594 additions and 1,777 deletions.
428 changes: 216 additions & 212 deletions Bootstrap.php

Large diffs are not rendered by default.

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());
}
}
}
52 changes: 23 additions & 29 deletions Bootstrapping/Database/CreateConfigTable.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
<?php
/**
* Created by PhpStorm.
* User: eiriarte-mendez
* Date: 12.06.18
* Time: 11:01
*/

namespace RpayRatePay\Bootstrapping\Database;

use Shopware_Plugins_Frontend_RpayRatePay_Component_Service_Util as Util;
use RpayRatePay\Component\Service\ShopwareUtil;

class CreateConfigTable
{
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 @@ -46,14 +40,14 @@ public function __invoke($database)
{
$database->query($this->getQuery());

$hasColumnBackend = Util::tableHasColumn('rpay_ratepay_config', 'backend');
$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);
}
}
}
24 changes: 9 additions & 15 deletions Bootstrapping/Database/CreateLoggingTable.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 CreateLoggingTable
Expand All @@ -14,23 +9,22 @@ class CreateLoggingTable
*/
protected function getQuery()
{
$query = "CREATE TABLE IF NOT EXISTS `rpay_ratepay_logging` (" .
"`id` int(11) NOT NULL AUTO_INCREMENT," .
"`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP," .
$query = 'CREATE TABLE IF NOT EXISTS `rpay_ratepay_logging` (' .
'`id` int(11) NOT NULL AUTO_INCREMENT,' .
'`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,' .
"`version` varchar(10) DEFAULT 'N/A'," .
"`operation` varchar(255) DEFAULT 'N/A'," .
"`suboperation` varchar(255) DEFAULT 'N/A'," .
"`transactionId` varchar(255) DEFAULT 'N/A'," .
"`firstname` varchar(255) DEFAULT 'N/A'," .
"`lastname` varchar(255) DEFAULT 'N/A'," .
"`request` text," .
"`response` text," .
"PRIMARY KEY (`id`)" .
") ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
'`request` text,' .
'`response` text,' .
'PRIMARY KEY (`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
Expand All @@ -39,4 +33,4 @@ public function __invoke($database)
{
$database->query($this->getQuery());
}
}
}
34 changes: 14 additions & 20 deletions Bootstrapping/Database/CreateOrderHistoryTable.php
Original file line number Diff line number Diff line change
@@ -1,34 +1,28 @@
<?php
/**
* Created by PhpStorm.
* User: eiriarte-mendez
* Date: 12.06.18
* Time: 11:01
*/

namespace RpayRatePay\Bootstrapping\Database;

class CreateOrderHistoryTable
{

/**
* @return string
*/
private function getQuery() {
$query = "CREATE TABLE IF NOT EXISTS `rpay_ratepay_order_history` (" .
"`id` int(11) NOT NULL AUTO_INCREMENT," .
"`orderId` varchar(50) ," .
"`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, " .
"`event` varchar(100), " .
"`articlename` varchar(100), " .
"`articlenumber` varchar(50), " .
"`quantity` varchar(50), " .
"PRIMARY KEY (`id`)" .
") ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
private function getQuery()
{
$query = 'CREATE TABLE IF NOT EXISTS `rpay_ratepay_order_history` (' .
'`id` int(11) NOT NULL AUTO_INCREMENT,' .
'`orderId` varchar(50) ,' .
'`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, ' .
'`event` varchar(100), ' .
'`articlename` varchar(100), ' .
'`articlenumber` varchar(50), ' .
'`quantity` varchar(50), ' .
'PRIMARY KEY (`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
Expand All @@ -37,4 +31,4 @@ public function __invoke($database)
{
$database->query($this->getQuery());
}
}
}
Loading

0 comments on commit 2cb672e

Please sign in to comment.