Made paypal fees customisable
This commit is contained in:
@@ -811,15 +811,23 @@ function _booking_datepaid_ts($nid)
|
||||
function _booking_add_paypal_fees($amount, $country)
|
||||
{
|
||||
//add the 30 cent fixed cost
|
||||
$result = $amount + 0.3;
|
||||
//and the 2.6 percent transaction fee
|
||||
if ($country === "Australia") {
|
||||
$result = $result / (1 - 0.026);
|
||||
$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 {
|
||||
watchdog('booking', "This is an international registration.");
|
||||
$result = $result / (1 - 0.036);
|
||||
$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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user