forked from easytransac/EasyTransac-Prestashop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
easytransac_install.php
80 lines (73 loc) · 2.38 KB
/
easytransac_install.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
if (!defined('_PS_VERSION_'))
exit;
/**
* Prestashop installation class.
*/
class EasyTransacInstall
{
/**
* Set configuration table
*/
public function updateConfiguration()
{
Configuration::updateValue('EASYTRANSAC_API_KEY', 0);
Configuration::updateValue('EASYTRANSAC_DEBUG', 0);
Configuration::updateValue('EASYTRANSAC_ONECLICK', 0);
Configuration::updateValue('EASYTRANSAC_MULTIPAY', 0);
Configuration::updateValue('EASYTRANSAC_MULTIPAY2X', 0);
Configuration::updateValue('EASYTRANSAC_MULTIPAY3X', 0);
Configuration::updateValue('EASYTRANSAC_MULTIPAY4X', 0);
}
/**
* Delete EasyTransac configuration
*/
public function deleteConfiguration()
{
Configuration::deleteByName('EASYTRANSAC_API_KEY');
}
/**
* Create EasyTransac table
*/
public function createTables()
{
if (!Db::getInstance()->Execute('
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'easytransac_customer` (
`id_customer` int(10) unsigned NOT NULL,
`client_id` VARCHAR(20) NOT NULL,
PRIMARY KEY (`id_customer`)
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;
ALTER TABLE `'._DB_PREFIX_.'easytransac_customer` ADD KEY `easytransac_client_id` (`client_id`);')) {
return false;
}
if (!Db::getInstance()->Execute('
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'easytransac_transaction` (
`id_order` int(10) unsigned NOT NULL,
`external_id` VARCHAR(20) NOT NULL,
PRIMARY KEY (`id_order`)
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;')) {
return false;
}
if (!Db::getInstance()->Execute('
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'easytransac_message` (
`id_order` int(10) unsigned NOT NULL,
`date` DATETIME NOT NULL,
`message` VARCHAR(256) NOT NULL,
`status` VARCHAR(20) NOT NULL,
`external_id` VARCHAR(20) NOT NULL,
`amount` int(10) NULL,
INDEX (`id_order`)
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;')) {
return false;
}
}
/**
* Delete EasyTransac table
*/
public function deleteTables()
{
Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'easytransac_customer`;');
Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'easytransac_transaction`;');
Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'easytransac_message`;');
}
}