customise checkout form
This commit is contained in:
117
booking.module
117
booking.module
@@ -759,64 +759,6 @@ function booking_node_info() {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_library().
|
||||
*/
|
||||
function booking_library() {
|
||||
$module_path = drupal_get_path('module', 'booking');
|
||||
|
||||
$items['booking-stripe'] = array(
|
||||
'title' => t('Stripe'),
|
||||
'version' => '1.0',
|
||||
'js' => array(
|
||||
'https://js.stripe.com/v1/' => array(),
|
||||
'https://checkout.stripe.com/checkout.js' => array(),
|
||||
$module_path . '/booking.stripe.js' => array(),
|
||||
),
|
||||
);
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_libraries_info().
|
||||
* @todo does this even do anything useful?
|
||||
*/
|
||||
function booking_libraries_info() {
|
||||
$libraries['stripe'] = array(
|
||||
'name' => 'Stripe Payment API PHP Library',
|
||||
'vendor url' => 'https://github.com/stripe/stripe-php',
|
||||
'download url' => 'https://github.com/stripe/stripe-php/archive/master.zip',
|
||||
'version arguments' => array(
|
||||
'file' => 'VERSION',
|
||||
'pattern' => '/([0-9a-zA-Z\.-]+)/',
|
||||
'lines' => 1,
|
||||
),
|
||||
'files' => array('php' => array('init.php')),
|
||||
'callbacks' => array('post-load' => array('booking_libraries_postload_callback')),
|
||||
);
|
||||
return $libraries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Post-load callback for the Stripe PHP Library.
|
||||
*
|
||||
* @param array $library
|
||||
* An array of library information.
|
||||
* @param string $version
|
||||
* If the $library array belongs to a certain version, a string containing the
|
||||
* version.
|
||||
* @param string $variant
|
||||
* If the $library array belongs to a certain variant, a string containing the
|
||||
* variant name.
|
||||
*/
|
||||
function booking_libraries_postload_callback($library, $version = NULL, $variant = NULL) {
|
||||
if (!empty($library['loaded'])) {
|
||||
\Stripe\Stripe::setApiKey(_booking_get_stripe_private_key());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of access related hooks for booking_registration node type.
|
||||
*/
|
||||
@@ -928,8 +870,65 @@ function booking_mail($key, &$message, $params) {
|
||||
if (isset($params['headers']) && is_array($params['headers'])) {
|
||||
$message['headers'] += $params['headers'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_library().
|
||||
*/
|
||||
function booking_library() {
|
||||
$module_path = drupal_get_path('module', 'booking');
|
||||
|
||||
$items['booking-stripe'] = array(
|
||||
'title' => t('Stripe'),
|
||||
'version' => '1.0',
|
||||
'js' => array(
|
||||
//'https://js.stripe.com/v1/' => array(),
|
||||
'https://checkout.stripe.com/checkout.js' => array(),
|
||||
$module_path . '/booking.stripe.js' => array(),
|
||||
),
|
||||
);
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_libraries_info().
|
||||
*/
|
||||
function booking_libraries_info() {
|
||||
$libraries['stripe'] = array(
|
||||
'name' => 'Stripe Payment API PHP Library',
|
||||
'vendor url' => 'https://github.com/stripe/stripe-php',
|
||||
'download url' => 'https://github.com/stripe/stripe-php/archive/master.zip',
|
||||
'version arguments' => array(
|
||||
'file' => 'VERSION',
|
||||
'pattern' => '/([0-9a-zA-Z\.-]+)/',
|
||||
'lines' => 1,
|
||||
),
|
||||
'files' => array('php' => array('init.php')),
|
||||
'callbacks' => array('post-load' => array('booking_libraries_postload_callback')),
|
||||
);
|
||||
return $libraries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Post-load callback for the Stripe PHP Library.
|
||||
*
|
||||
* @param array $library
|
||||
* An array of library information.
|
||||
* @param string $version
|
||||
* If the $library array belongs to a certain version, a string containing the
|
||||
* version.
|
||||
* @param string $variant
|
||||
* If the $library array belongs to a certain variant, a string containing the
|
||||
* variant name.
|
||||
*/
|
||||
function booking_libraries_postload_callback($library, $version = NULL, $variant = NULL) {
|
||||
if (!empty($library['loaded'])) {
|
||||
\Stripe\Stripe::setApiKey(_booking_get_stripe_private_key());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_requirements().
|
||||
*/
|
||||
|
Reference in New Issue
Block a user