-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmultisafepay_payment.install
101 lines (92 loc) · 2.72 KB
/
multisafepay_payment.install
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
/**
* @file multisafepay_payment.install
* Installation and uninstallation functions.
*/
/**
* Implements hook_schema().
*/
function multisafepay_payment_schema() {
$schema['multisafepay_payment_payment'] = array(
'fields' => array(
'msp_id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'plugin' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'api_key' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'api_server' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 1,
),
'configuration' => array(
'description' => 'The configurations used to configure plugin for this payment method.',
'type' => 'text',
'serialize' => TRUE,
'not null' => FALSE,
),
),
'primary key' => array('msp_id'),
'unique keys' => array(
'msp_id' => array('msp_id'),
),
);
return $schema;
}
function multisafepay_payment_requirements($phase) {
$requirements = array();
// Ensure translations do not break at install time
$t = get_t();
$requirements['multisafepay_php'] = array(
'title' => $t('MultiSafePay Library PHP'),
);
$libraries = libraries_get_libraries();
if (isset($libraries['multisafepay_php'])) {
$requirements['multisafepay_php']['value'] = $t('Installed');
$requirements['multisafepay_php']['severity'] = REQUIREMENT_OK;
}
else {
$requirements['multisafepay_php']['value'] = $t('Not Installed');
$requirements['multisafepay_php']['severity'] = REQUIREMENT_ERROR;
$requirements['multisafepay_php']['description'] = $t('Please install the MultiSafePay Library PHP: %url.', array('%url' => 'https://github.com/MultiSafepay/PHP'));
}
return $requirements;
}
/**
* Implements hook_enable().
*/
function multisafepay_payment_enable() {
// foreach (multisafepay_payment_payment_method_defaults() as $payment_method) {
// entity_save('payment_method', $payment_method);
// }
}
/**
* Returns default empty payment methods.
*/
function multisafepay_payment_payment_method_defaults() {
$payment_methods[] = new PaymentMethod(array(
'controller' => payment_method_controller_load('MultiSafePayPaymentMethodController'),
'controller_data' => array(
'type' => 'redirect',
'api_key' => '0ff28d5cc3a6e7475be5fa174703788fa155fc94',
'api_server' => 1,
),
'name' => 'multisafepay_test',
'enabled' => FALSE,
'title_generic' => t('MultiSafePay payment Test'),
'title_specific' => t('MultiSafePay payment Test'),
));
return $payment_methods;
}