tidy up some code locations

This commit is contained in:
Nathan Coad
2016-07-23 10:16:12 +10:00
parent 581b7d7537
commit cb97f64ecd
5 changed files with 78 additions and 61 deletions

View File

@@ -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 " .