add code to handle stripe fees
This commit is contained in:
@@ -216,4 +216,61 @@ function booking_payment_completed_page() {
|
||||
);
|
||||
|
||||
return $return_array;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to generate paypal form for payments
|
||||
*/
|
||||
function _booking_paypal_form($person, $invoiceid, $amount_owing, $button_text) {
|
||||
$form = drupal_get_form('_booking_paypal_form_builder', $person, $invoiceid, $amount_owing, $button_text);
|
||||
return drupal_render($form);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to generate form elements for paypal form
|
||||
*/
|
||||
function _booking_paypal_form_builder($node, &$form_state, $person, $invoiceid, $amount_owing, $button_text) {
|
||||
global $event;
|
||||
|
||||
//get our current path so we can send the user back here if they cancel
|
||||
$path = isset($_GET['q']) ? $_GET['q'] : '<front>';
|
||||
|
||||
//paypal specific settings
|
||||
$vars = array(
|
||||
'module' => 'Booking System',
|
||||
'type' => $event->booking_eventname,
|
||||
//'custom' => $data,
|
||||
'item_name' => $event->booking_eventname . ' ' . $person->booking_price_descrip,
|
||||
'invoice' => $invoiceid,
|
||||
'no_shipping' => TRUE,
|
||||
'no_note' => TRUE,
|
||||
'currency_code' => 'AUD',
|
||||
'return' => url('bookingfinal', array('absolute' => TRUE)),
|
||||
'cancel_return' => url($path, array('absolute' => TRUE)),
|
||||
'rm' => '2',
|
||||
'amount' => $amount_owing,
|
||||
'last_name' => $person->booking_lastname,
|
||||
'first_name' => $person->booking_firstname,
|
||||
'cmd' => '_xclick',
|
||||
'notify_url' => url(BOOKING_PAYPAL_IPN_PATH, array('absolute' => TRUE)),
|
||||
'business' => variable_get('booking_paypal_account', '')
|
||||
);
|
||||
|
||||
$form['#action'] = url(variable_get('booking_paypal_sandbox', 0) ? BOOKING_PAYPAL_SUBMIT_URL_SANDBOX : BOOKING_PAYPAL_SUBMIT_URL, array('absolute' => TRUE));
|
||||
|
||||
//turn the array into a form
|
||||
foreach($vars as $name => $value) {
|
||||
$form[$name] = array(
|
||||
'#type' => 'hidden',
|
||||
'#value' => $value,
|
||||
);
|
||||
}
|
||||
|
||||
$form['submit'] = array(
|
||||
'#type' => 'button',
|
||||
'#value' => t($button_text),
|
||||
);
|
||||
|
||||
//watchdog('booking', 'Booking Balance payment: @info', array ('@info' => var_export($form, TRUE)));
|
||||
return $form;
|
||||
}
|
||||
|
Reference in New Issue
Block a user