-
Notifications
You must be signed in to change notification settings - Fork 3
/
stripe.module
77 lines (67 loc) · 2.42 KB
/
stripe.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
<?php
/**
* @file stripe.module
* Drupal hooks used for integrating the Stripe service.
*/
/**
* Implements hook_help().
*/
function stripe_help($path, $arg) {
if ($path == 'admin/config/stripe/keys') {
$output = '<ol>';
$output .= '<li>' . t('Enter the API keys you get from your <a href="@url">Stripe account page</a>.', array('@url' => 'https://manage.stripe.com/account')) . '</li>';
$output .= '<li>' . t('Use the radio buttons to choose which API Key should be used with this site.') . '</li>';
$output .= '<li>' . t('After designating an API Key, you might want to try out <a href="@url">the test form</a>.', array('@url' => '/admin/config/stripe/test')) . '</li>';
$output .= '</ol>';
return $output;
}
if ($path == 'admin/config/stripe/test') {
return '<p>' . t('This form is to test responses from Stripe. The default values are accepted by Stripe for testing purposes. Before you can use this form, you should <a href="@url">designate an active API Key</a>.', array('@url' => '/admin/config/stripe/keys')) . '</p>';
}
}
/**
* Implements hook_permission().
*/
function stripe_permission() {
return array(
'administer stripe' => array(
'title' => t('Administer the Stripe module'),
'description' => t('Allows access to configure API Keys and to the test form.'),
),
);
}
/**
* Implements hook_theme().
function stripe_theme() {
}
/**
* Implements hook_menu().
*/
function stripe_menu() {
$items['admin/config/stripe'] = array(
'title' => 'Stripe',
'description' => 'List of what the stripe module offers.',
'position' => 'right',
'page callback' => 'system_admin_menu_block_page',
'access arguments' => array('administer stripe'),
'weight' => -10,
'file' => 'system.admin.inc',
);
$items['admin/config/stripe/keys'] = array(
'title' => 'API Keys',
'description' => 'Enter API Keys and set which one should be active.',
'page callback' => 'drupal_get_form',
'page arguments' => array('stripe_admin_keys'),
'access arguments' => array('administer stripe'),
'file' => 'stripe.admin.inc',
);
$items['admin/config/stripe/test'] = array(
'title' => 'Test form',
'description' => 'A form for testing Stripe responses.',
'page callback' => 'drupal_get_form',
'page arguments' => array('stripe_admin_test'),
'access arguments' => array('administer stripe'),
'file' => 'stripe.admin.inc',
);
return $items;
}