1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Fixes for fee calculations - tests

This commit is contained in:
David Bomba 2022-03-16 21:40:11 +11:00
parent b6ef517d93
commit 035a152a96
2 changed files with 4 additions and 2 deletions

View File

@ -349,7 +349,6 @@ class CompanyGateway extends BaseModel
if ($fees_and_limits->fee_percent) {
$divisor = 1 - ($fees_and_limits->fee_percent/100);
$gross_amount = round($adjusted_fee/$divisor,2);
@ -368,10 +367,12 @@ class CompanyGateway extends BaseModel
if($fees_and_limits->fee_percent == 100){ //unusual edge case if the user wishes to charge a fee of 100% 09/01/2022
$fee += $amount;
}
else
$fee += round(($amount * $fees_and_limits->fee_percent / 100), 2);
//elseif ($fees_and_limits->adjust_fee_percent) {
// $fee += round(($amount / (1 - $fees_and_limits->fee_percent / 100) - $amount), 2);
//} else {
$fee += round(($amount * $fees_and_limits->fee_percent / 100), 2);
//}
}
}

View File

@ -326,6 +326,7 @@ class CompanyGatewayApiTest extends TestCase
$fee = new FeesAndLimits;
$fee->fee_amount = 0;
$fee->fee_percent = 100;
$fee->adjust_fee_percent = false;
// $fee->fee_tax_name1 = 'GST';
// $fee->fee_tax_rate1 = '10.0';