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

@@ -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
*/