forked from printsites/commerce_omnipay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommerce_omnipay.module
105 lines (89 loc) · 3.21 KB
/
commerce_omnipay.module
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
102
103
104
105
<?php
/**
* Implements hook_menu().
*/
function commerce_omnipay_menu() {
$items = array();
$items['admin/commerce/payment-gateways'] = array(
'title' => 'Payment Gateways',
'page callback' => 'commerce_omnipay_settings_page',
'access arguments' => array('administer payment gateways'),
'type' => MENU_NORMAL_ITEM,
'file' => 'includes/commerce_omnipay.admin.inc',
);
return $items;
}
/**
* Implements hook_access().
*/
function commerce_omnipay_permission() {
return array(
'administer payment gateways' => array(
'title' => t('Administer Payment Gateways'),
'description' => t('Administer Commerce Omnipay Payment Gateway Settings.'),
),
);
}
/**
* Implements hook_commerce_payment_method_info().
*/
function commerce_omnipay_commerce_payment_method_info() {
$payment_methods['omnipay'] = array(
'base' => 'commerce_omnipay_omnipay',
'title' => t('Omnipay'),
'short_title' => t('Omnipay'),
'description' => t('Omnipay'),
'terminal' => FALSE,
'offsite' => FALSE,
'offsite_autoredirect' => FALSE,
'file' => 'includes/commerce_omnipay.payment_method.inc',
);
return $payment_methods;
}
/**
* List supported gateways.
* @return array
*/
function commerce_omnipay_supported_gateways() {
$gateways = array();
$gateways['stripe'] = array(
'label' => "Stripe",
'gateway' => "Stripe",
'description' => "Stripe is a suite of APIs that powers commerce for businesses of all sizes.",
'website' => "http://stripe.com",
);
$gateways['PayPal_Pro'] = array(
'label' => "PayPal Pro",
'gateway' => "PayPal_Pro",
'description' => "PayPal Payments Pro has the customization capability, technical maturity, and proven security that is needed to build professional-grade eCommerce sites.",
'website' => "https://www.paypal.com/webapps/mpp/paypal-payments-pro",
);
$gateways['WorldPay'] = array(
'label' => "PayPal",
'gateway' => "PayPal",
'description' => "PayPal is the faster, safer way to send money, make an online payment, receive money or set up a merchant account.",
'website' => "https://www.paypal.com/us/webapps/mpp/accept-payments-online",
);
$gateways['WorldPay'] = array(
'label' => "WorldPay",
'gateway' => "WorldPay",
'description' => "At Worldpay, we can provide you with card processing services for your business from card machines, online payments to mail and telephone orders.",
'website' => "http://www.worldpay.com/us",
);
$gateways['AuthorizeNet_AIM'] = array(
'label' => "AuthorizeNet_AIM",
'gateway' => "AuthorizeNet_AIM",
'description' => "Authorize.net payment gateway enables internet merchants to accept online payments via credit card and e-check.",
'website' => "http://www.authorize.net/",
);
drupal_alter('commerce_omnipay_gateways', $gateways);
return $gateways;
}
function commerce_omnipay_get_gateway_settings($gateway) {
$settings = variable_get("commerce_omnipay_gateway_settings_" . $gateway, array());
drupal_alter('commerce_omnipay_settings', $settings, $gateway);
return $settings;
}
function commerce_omnipay_set_gateway_settings($gateway, $settings) {
return variable_set("commerce_omnipay_gateway_settings_" . $gateway, $settings);
}