Skip to content

Commit

Permalink
Merge pull request #8 from ratepay/bug/SHPWR-298_update_fix
Browse files Browse the repository at this point in the history
Bug/shpwr 298 update fix
  • Loading branch information
rpWhittington authored Jul 3, 2018
2 parents ed70dac + 53da14b commit 6039bb8
Show file tree
Hide file tree
Showing 15 changed files with 168 additions and 109 deletions.
14 changes: 8 additions & 6 deletions Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@
class Shopware_Plugins_Frontend_RpayRatePay_Bootstrap extends Shopware_Components_Plugin_Bootstrap
{

const PAYMENT_METHODS = array(
'rpayratepayinvoice',
'rpayratepayrate',
'rpayratepaydebit',
'rpayratepayrate0',
);
public static function getPaymentMethods() {
return array(
'rpayratepayinvoice',
'rpayratepayrate',
'rpayratepaydebit',
'rpayratepayrate0',
);
}

/**
* Returns the Label of the Plugin
Expand Down
6 changes: 2 additions & 4 deletions Bootstrapping/Bootstrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

abstract class Shopware_Plugins_Frontend_RpayRatePay_Bootstrapping_Bootstrapper
{
const CONFIG_SRC_PATH = __DIR__ . DIRECTORY_SEPARATOR;

/**
* @var Shopware_Components_Plugin_Bootstrap
*/
Expand Down Expand Up @@ -46,8 +44,8 @@ public abstract function uninstall();
*/
public function loadConfig($configFile)
{
if (!empty($configFile) && file_exists(self::CONFIG_SRC_PATH . $configFile)) {
return json_decode(file_get_contents(self::CONFIG_SRC_PATH . $configFile), true);
if (!empty($configFile) && file_exists(__DIR__ . DIRECTORY_SEPARATOR . $configFile)) {
return json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . $configFile), true);
}

throw new Exception("Unable to load configuration file '$configFile'");
Expand Down
2 changes: 1 addition & 1 deletion Bootstrapping/CronjobSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class Shopware_Plugins_Frontend_RpayRatePay_Bootstrapping_CronjobSetup extends Shopware_Plugins_Frontend_RpayRatePay_Bootstrapping_Bootstrapper
{
const UPDATE_TRANSACTIONS_INTERVAL_SECONDS = 60 * 60;
const UPDATE_TRANSACTIONS_INTERVAL_SECONDS = 3600;
const UPDATE_TRANSACTIONS_ACTION = 'UpdateRatepayTransactions';

/**
Expand Down
23 changes: 14 additions & 9 deletions Bootstrapping/Database/CreateConfigInstallmentTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,19 @@

class Shopware_Plugins_Frontend_RpayRatePay_Bootstrapping_Database_CreateConfigInstallmentTable
{
protected $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";
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";
return $query;
}


/**
* @param Enlight_Components_Db_Adapter_Pdo_Mysql $database
Expand All @@ -24,6 +29,6 @@ class Shopware_Plugins_Frontend_RpayRatePay_Bootstrapping_Database_CreateConfigI
public function __invoke($database)
{
$database->query("DROP TABLE IF EXISTS `rpay_ratepay_config_installment`");
$database->query($this->query);
$database->query($this->getQuery());
}
}
31 changes: 20 additions & 11 deletions Bootstrapping/Database/CreateConfigPaymentTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,25 @@

class Shopware_Plugins_Frontend_RpayRatePay_Bootstrapping_Database_CreateConfigPaymentTable
{
protected $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 string
*/
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;
}



/**
* @param Enlight_Components_Db_Adapter_Pdo_Mysql $database
Expand All @@ -26,6 +35,6 @@ class Shopware_Plugins_Frontend_RpayRatePay_Bootstrapping_Database_CreateConfigP
public function __invoke($database)
{
$database->query("DROP TABLE IF EXISTS `rpay_ratepay_config_payment`");
$database->query($this->query);
$database->query($this->getQuery());
}
}
46 changes: 27 additions & 19 deletions Bootstrapping/Database/CreateConfigTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,32 @@

class Shopware_Plugins_Frontend_RpayRatePay_Bootstrapping_Database_CreateConfigTable
{
protected $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";
/**
* @return string
*/
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, " .
"`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";
return $query;
}


/**
* @param Enlight_Components_Db_Adapter_Pdo_Mysql $database
Expand All @@ -34,6 +42,6 @@ class Shopware_Plugins_Frontend_RpayRatePay_Bootstrapping_Database_CreateConfigT
public function __invoke($database)
{
$database->query("DROP TABLE IF EXISTS `rpay_ratepay_config`");
$database->query($this->query);
$database->query($this->getQuery());
}
}
36 changes: 22 additions & 14 deletions Bootstrapping/Database/CreateLoggingTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,34 @@

class Shopware_Plugins_Frontend_RpayRatePay_Bootstrapping_Database_CreateLoggingTable
{
protected $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";
/**
* @return string
*/
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," .
"`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";
return $query;
}


/**
* @param Enlight_Components_Db_Adapter_Pdo_Mysql $database
* @throws Zend_Db_Adapter_Exception
*/
public function __invoke($database)
{
$database->query($this->query);
$database->query($this->getQuery());
}
}
31 changes: 20 additions & 11 deletions Bootstrapping/Database/CreateOrderHistoryTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,32 @@

class Shopware_Plugins_Frontend_RpayRatePay_Bootstrapping_Database_CreateOrderHistoryTable
{
protected $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 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";

return $query;
}


/**
* @param Enlight_Components_Db_Adapter_Pdo_Mysql $database
* @throws Zend_Db_Adapter_Exception
*/
public function __invoke($database)
{
$database->query($this->query);
$database->query($this->getQuery());
}
}
24 changes: 16 additions & 8 deletions Bootstrapping/Database/CreateOrderPositionsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,28 @@

class Shopware_Plugins_Frontend_RpayRatePay_Bootstrapping_Database_CreateOrderPositionsTable
{
protected $query = "CREATE TABLE IF NOT EXISTS `rpay_ratepay_order_positions` (" .
"`s_order_details_id` int(11) NOT NULL," .
"`delivered` int NOT NULL DEFAULT 0, " .
"`cancelled` int NOT NULL DEFAULT 0, " .
"`returned` int NOT NULL DEFAULT 0, " .
"PRIMARY KEY (`s_order_details_id`)" .
") ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
/**
* @return string
*/
protected function getQuery()
{
$query = "CREATE TABLE IF NOT EXISTS `rpay_ratepay_order_positions` (" .
"`s_order_details_id` int(11) NOT NULL," .
"`delivered` int NOT NULL DEFAULT 0, " .
"`cancelled` int NOT NULL DEFAULT 0, " .
"`returned` int NOT NULL DEFAULT 0, " .
"PRIMARY KEY (`s_order_details_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($this->query);
$database->query($this->getQuery());
}
}
24 changes: 16 additions & 8 deletions Bootstrapping/Database/CreateOrderShippingTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,28 @@

class Shopware_Plugins_Frontend_RpayRatePay_Bootstrapping_Database_CreateOrderShippingTable
{
protected $query = "CREATE TABLE IF NOT EXISTS `rpay_ratepay_order_shipping` (" .
"`s_order_id` int(11) NOT NULL," .
"`delivered` int NOT NULL DEFAULT 0, " .
"`cancelled` int NOT NULL DEFAULT 0, " .
"`returned` int NOT NULL DEFAULT 0, " .
"PRIMARY KEY (`s_order_id`)" .
") ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
/**
* @return string
*/
protected function getQuery()
{
$query = "CREATE TABLE IF NOT EXISTS `rpay_ratepay_order_shipping` (" .
"`s_order_id` int(11) NOT NULL," .
"`delivered` int NOT NULL DEFAULT 0, " .
"`cancelled` int NOT NULL DEFAULT 0, " .
"`returned` int NOT NULL DEFAULT 0, " .
"PRIMARY KEY (`s_order_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($this->query);
$database->query($this->getQuery());
}
}
Loading

0 comments on commit 6039bb8

Please sign in to comment.