From f79f812e4e210c8d291bef88eb87983f3bef0669 Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Mon, 22 Aug 2016 09:54:51 +1000 Subject: [PATCH] fix confirmation form to handle stripe --- booking.admin.inc | 5 ++++- booking.confirm.inc | 21 ++++++++++++++------- booking.helper.inc | 4 +++- booking.module | 1 + 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/booking.admin.inc b/booking.admin.inc index e92ca3d..9e469f5 100644 --- a/booking.admin.inc +++ b/booking.admin.inc @@ -128,6 +128,7 @@ function booking_admin() { '#collapsible' => TRUE, //'#collapsed' => TRUE, ); + /* $form['paypal']['booking_use_paypal'] = array( '#type' => 'radios', '#title' => t('Use Paypal? (DEPRECATED)'), @@ -138,6 +139,7 @@ function booking_admin() { ), '#default_value' => variable_get('booking_use_paypal', 0) ); + */ $form['paypal']['booking_paypal_account'] = array( '#type' => 'textfield', '#title' => t('Specify Paypal Account Address'), @@ -494,7 +496,7 @@ function booking_admin() { ), '#default_value' => variable_get('booking_enable_tshirts', 0) ); - + /* $form['regn_options']['booking_enable_passport'] = array( '#type' => 'radios', '#title' => t('Enable passport information? (DEPRECATED)'), @@ -505,6 +507,7 @@ function booking_admin() { ), '#default_value' => variable_get('booking_enable_passport', 0) ); + */ $form['regn_options']['booking_enable_helpareas'] = array( '#type' => 'radios', '#title' => t('Enable help area questions?'), diff --git a/booking.confirm.inc b/booking.confirm.inc index 73bb083..cd71369 100644 --- a/booking.confirm.inc +++ b/booking.confirm.inc @@ -44,13 +44,20 @@ function booking_confirm_page() { //populate tokens $tokens = booking_define_personspecific_tokens($node); - - //add in the paypal forms as tokens - $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))); - + + //if paypal is enabled then add tokens for it + if ($payment_processor_type == 0) { + $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))); + } + //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 if (_booking_check_bookings_full() == True || $node->booking_status == 2) { $waiting_list = TRUE; diff --git a/booking.helper.inc b/booking.helper.inc index 24ac58b..147776f 100644 --- a/booking.helper.inc +++ b/booking.helper.inc @@ -828,9 +828,11 @@ function _booking_deposit_amount($person, $include_fees = TRUE) { //if we're using paypal or stripe, add the transaction fee $payment_processor_type = variable_get('booking_payment_processor', 0); if ($include_fees == TRUE) { + //paypal is enabled if ($payment_processor_type == 0) { $amount_owing = _booking_add_paypal_fees($deposit->booking_price, $person->booking_country); - } + } + //stripe is enabled elseif ($payment_processor_type == 1) { $amount_owing = _booking_add_stripe_fees($deposit->booking_price, $person->booking_country); } diff --git a/booking.module b/booking.module index 486c066..c1e3636 100644 --- a/booking.module +++ b/booking.module @@ -350,6 +350,7 @@ function booking_menu() { ); //show flight info report only if we have passport info enabled + //now deprecated if (variable_get('booking_enable_passport', 0) == 1) { $items['admin/booking/flights'] = array(