fix confirmation form to handle stripe

This commit is contained in:
Nathan Coad
2016-08-22 09:54:51 +10:00
parent d906c2e220
commit f79f812e4e
4 changed files with 22 additions and 9 deletions

View File

@@ -128,6 +128,7 @@ function booking_admin() {
'#collapsible' => TRUE, '#collapsible' => TRUE,
//'#collapsed' => TRUE, //'#collapsed' => TRUE,
); );
/*
$form['paypal']['booking_use_paypal'] = array( $form['paypal']['booking_use_paypal'] = array(
'#type' => 'radios', '#type' => 'radios',
'#title' => t('Use Paypal? (DEPRECATED)'), '#title' => t('Use Paypal? (DEPRECATED)'),
@@ -138,6 +139,7 @@ function booking_admin() {
), ),
'#default_value' => variable_get('booking_use_paypal', 0) '#default_value' => variable_get('booking_use_paypal', 0)
); );
*/
$form['paypal']['booking_paypal_account'] = array( $form['paypal']['booking_paypal_account'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Specify Paypal Account Address'), '#title' => t('Specify Paypal Account Address'),
@@ -494,7 +496,7 @@ function booking_admin() {
), ),
'#default_value' => variable_get('booking_enable_tshirts', 0) '#default_value' => variable_get('booking_enable_tshirts', 0)
); );
/*
$form['regn_options']['booking_enable_passport'] = array( $form['regn_options']['booking_enable_passport'] = array(
'#type' => 'radios', '#type' => 'radios',
'#title' => t('Enable passport information? (DEPRECATED)'), '#title' => t('Enable passport information? (DEPRECATED)'),
@@ -505,6 +507,7 @@ function booking_admin() {
), ),
'#default_value' => variable_get('booking_enable_passport', 0) '#default_value' => variable_get('booking_enable_passport', 0)
); );
*/
$form['regn_options']['booking_enable_helpareas'] = array( $form['regn_options']['booking_enable_helpareas'] = array(
'#type' => 'radios', '#type' => 'radios',
'#title' => t('Enable help area questions?'), '#title' => t('Enable help area questions?'),

View File

@@ -45,11 +45,18 @@ function booking_confirm_page() {
//populate tokens //populate tokens
$tokens = booking_define_personspecific_tokens($node); $tokens = booking_define_personspecific_tokens($node);
//add in the paypal forms as tokens //if paypal is enabled then add tokens for it
$tokens['paypal-deposit-form'] = _booking_paypal_form($node, $invoiceid, $tokens['paypal-deposit-amount'], "Pay Deposit"); if ($payment_processor_type == 0) {
$tokens['paypal-total-form'] = _booking_paypal_form($node, $invoiceid, $tokens['paypal-total-amount'], "Pay Full Amount"); $tokens['paypal-deposit-form'] = _booking_paypal_form($node, $invoiceid, $tokens['paypal-deposit-amount'], "Pay Deposit");
$tokens['paypal-total-form'] = _booking_paypal_form($node, $invoiceid, $tokens['paypal-total-amount'], "Pay Full Amount");
//watchdog('booking', 'Paypal form "@info"', array ('@info' => var_export($tokens['paypal-total-form'], TRUE))); //watchdog('booking', 'Paypal form "@info"', array ('@info' => var_export($tokens['paypal-total-form'], TRUE)));
}
//if stripe is enabled
elseif ($payment_processor_type == 1) {
//@todo confirm that the deposit amount is correct for a stripe deposit
$tokens['stripe-deposit-form'] = _booking_stripe_form($node, $invoiceid, $tokens['stripe-deposit-amount'], "Pay Deposit");
$tokens['stripe-total-form'] = _booking_stripe_form($node, $invoiceid, $tokens['payment-required'], "Pay Balance");
}
//check if this registration will be on the waiting list //check if this registration will be on the waiting list
if (_booking_check_bookings_full() == True || $node->booking_status == 2) { if (_booking_check_bookings_full() == True || $node->booking_status == 2) {

View File

@@ -828,9 +828,11 @@ function _booking_deposit_amount($person, $include_fees = TRUE) {
//if we're using paypal or stripe, add the transaction fee //if we're using paypal or stripe, add the transaction fee
$payment_processor_type = variable_get('booking_payment_processor', 0); $payment_processor_type = variable_get('booking_payment_processor', 0);
if ($include_fees == TRUE) { if ($include_fees == TRUE) {
//paypal is enabled
if ($payment_processor_type == 0) { if ($payment_processor_type == 0) {
$amount_owing = _booking_add_paypal_fees($deposit->booking_price, $person->booking_country); $amount_owing = _booking_add_paypal_fees($deposit->booking_price, $person->booking_country);
} }
//stripe is enabled
elseif ($payment_processor_type == 1) { elseif ($payment_processor_type == 1) {
$amount_owing = _booking_add_stripe_fees($deposit->booking_price, $person->booking_country); $amount_owing = _booking_add_stripe_fees($deposit->booking_price, $person->booking_country);
} }

View File

@@ -350,6 +350,7 @@ function booking_menu() {
); );
//show flight info report only if we have passport info enabled //show flight info report only if we have passport info enabled
//now deprecated
if (variable_get('booking_enable_passport', 0) == 1) if (variable_get('booking_enable_passport', 0) == 1)
{ {
$items['admin/booking/flights'] = array( $items['admin/booking/flights'] = array(