diff --git a/booking.admin.inc b/booking.admin.inc index 05f766d..a689ac8 100644 --- a/booking.admin.inc +++ b/booking.admin.inc @@ -249,7 +249,7 @@ function booking_admin() { $form['stripe']['booking_stripe_logo'] = array ( '#type' => 'textfield', '#title' => t('Logo URL for Stripe Checkout Form'), - '#description' => 'Enter the full URL to a logo png file that will be used on the stripe checkout form.', + '#description' => 'Enter the full URL to a logo file that will be used on the stripe checkout form.
The recommended minimum size is 128x128px. The supported image types are: .gif, .jpeg, and .png.', '#default_value' => variable_get('booking_stripe_logo', 'https://stripe.com/img/documentation/checkout/marketplace.png'), ); diff --git a/booking.helper.inc b/booking.helper.inc index 1d850f8..24ac58b 100644 --- a/booking.helper.inc +++ b/booking.helper.inc @@ -813,60 +813,10 @@ function _booking_datepaid_ts($nid) { } } -/** - * Helper function to calculate paypal fees - */ -function _booking_add_paypal_fees($amount, $country) -{ - //add the 30 cent fixed cost - $result = '0.00'; - $result = (float) ($amount + (float) variable_get('booking_paypal_transaction_fee_fixedcost', '0.3')); - - //and the 2.6 percent transaction fee for australian transaction with no currency conversion - if ($country == variable_get('booking_default_country', 'Australia')) { - $percentage = (float) variable_get('booking_paypal_transaction_fee_percentage', '2.6'); - } else { - $percentage = (float) variable_get('booking_paypal_transaction_fee_percentage_intl', '3.6'); - //watchdog('booking', "Calculating paypal fees for a currency conversion transaction which adds $percentage percent."); - } - - //apply the percentage - $percentage = (float) $percentage / 100; - //watchdog('booking', "Paypal percentage transaction fee works out to $percentage."); - $result = $result / (1 - $percentage); - - //return result - return $result; -} - -/** - * Helper function to calculate stripe transaction fees - */ -function _booking_add_stripe_fees($amount, $country) { - //add the 30 cent fixed cost - $result = '0.00'; - $result = (float) ($amount + (float) variable_get('booking_stripe_transaction_fee_fixedcost', '0.3')); - - //and the 2.6 percent transaction fee for australian transaction with no currency conversion - if ($country == variable_get('booking_default_country', 'Australia')) { - $percentage = (float) variable_get('booking_stripe_transaction_fee_percentage', '1.75'); - } else { - $percentage = (float) variable_get('booking_stripe_transaction_fee_percentage_intl', '2.9'); - } - - //apply the percentage - $percentage = (float) $percentage / 100; - $result = $result / (1 - $percentage); - - //return result - return $result; -} - /** * Helper function to return the amount for a booking deposit, if there is one */ -function _booking_deposit_amount($person, $include_fees = TRUE) -{ +function _booking_deposit_amount($person, $include_fees = TRUE) { global $event; $deposit = db_query("SELECT price.booking_price, price.booking_price_descrip " . diff --git a/booking.paypal.inc b/booking.paypal.inc index 43a5661..2ff29ed 100644 --- a/booking.paypal.inc +++ b/booking.paypal.inc @@ -1,5 +1,34 @@ $value) { @@ -10,7 +39,10 @@ function _booking_paypal_post($data = array()) { return $post; } -//see https://github.com/paypal/ipn-code-samples/blob/master/paypal_ipn.php for more details +/** + * Helper function to verify a successful IPN from Paypal + * @see https://github.com/paypal/ipn-code-samples/blob/master/paypal_ipn.php + */ function _booking_paypal_ipn_verify($vars = array()) { if (variable_get('booking_paypal_sandbox', 0)) { diff --git a/booking.stripe.inc b/booking.stripe.inc index 0a988ce..3d12c1d 100644 --- a/booking.stripe.inc +++ b/booking.stripe.inc @@ -31,6 +31,29 @@ function _booking_get_stripe_private_key() { } } +/** + * Helper function to calculate stripe transaction fees + */ +function _booking_add_stripe_fees($amount, $country) { + //add the 30 cent fixed cost + $result = '0.00'; + $result = (float) ($amount + (float) variable_get('booking_stripe_transaction_fee_fixedcost', '0.3')); + + //and the 2.6 percent transaction fee for australian transaction with no currency conversion + if ($country == variable_get('booking_default_country', 'Australia')) { + $percentage = (float) variable_get('booking_stripe_transaction_fee_percentage', '1.75'); + } else { + $percentage = (float) variable_get('booking_stripe_transaction_fee_percentage_intl', '2.9'); + } + + //apply the percentage + $percentage = (float) $percentage / 100; + $result = $result / (1 - $percentage); + + //return result + return $result; +} + /** * Helper function to generate paypal form for payments */ diff --git a/booking.tokens.inc b/booking.tokens.inc index eefd25c..233825b 100644 --- a/booking.tokens.inc +++ b/booking.tokens.inc @@ -626,34 +626,46 @@ function booking_define_personspecific_tokens($node) //if paypal is enabled if ($payment_processor_type == 0) { $tokens['paypal-deposit-amount'] = _booking_deposit_amount($node, TRUE); - $tokens['paypal-total-amount'] = _booking_amount_owing($node, $amount_paid); + $tokens['paypal-total-amount'] = _booking_amount_owing($node, $amount_paid); + $tokens['stripe-deposit-amount'] = ""; + $tokens['stripe-total-amount'] = ""; + $tokens['stripe-total-intl'] = ""; } //if stripe is enabled elseif ($payment_processor_type == 1) { - //@todo remove the paypal tokens from here - $tokens['paypal-deposit-amount'] = _booking_deposit_amount($node, TRUE); - $tokens['paypal-total-amount'] = _booking_amount_owing($node, $amount_paid); + $tokens['paypal-deposit-amount'] = ""; + $tokens['paypal-total-amount'] = ""; $tokens['stripe-deposit-amount'] = _booking_deposit_amount($node, TRUE); $tokens['stripe-total-amount'] = _booking_amount_owing($node, $amount_paid, TRUE, FALSE); $tokens['stripe-total-intl'] = _booking_amount_owing($node, $amount_paid, TRUE, TRUE); } - + //if travelform is enabled if (variable_get('booking_enable_travelform', 0) == 1) { $tokens['travel-link'] = url('travel/' . $tempid, array('absolute' => TRUE)); $tokens['travel-summary'] = _booking_travelform_email_summary($node); - } else { + } + else { $tokens['travel-link'] = ""; $tokens['travel-summary'] = ""; } + //if studygroups are enabled if (variable_get('booking_enable_studygroups', 0) == 1) { $tokens['studygroup-summary'] = _booking_studygroup_email_summary($node); $tokens['leaderhelper-pair'] = _booking_leader_helper_email_summary($node); } - if (variable_get('booking_enable_roomallocations', 0) == 1) - { + else { + $tokens['studygroup-summary'] = ""; + $tokens['leaderhelper-pair'] = ""; + } + //if room allocations are enabled + if (variable_get('booking_enable_roomallocations', 0) == 1) { $tokens['room-allocation'] = _booking_room_email_summary($node); $tokens['bed-type'] = _booking_room_bedtype_lookup(empty($node->booking_room_bedtype) ? '0' : $node->booking_room_bedtype); } + else { + $tokens['room-allocation'] = ""; + $tokens['bed-type'] = ""; + } //watchdog('booking_debug', "
Person specific tokens:\n@info
", array('@info' => print_r( $tokens, true))); return $tokens; }