mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-03 08:44:35 -04:00
Tests for fees and limits
This commit is contained in:
parent
6a11fae857
commit
5698a8a8d1
@ -457,12 +457,11 @@ class Client extends BaseModel implements HasLocalePreference
|
|||||||
$fees_and_limits = $method->fees_and_limits->{"1"};
|
$fees_and_limits = $method->fees_and_limits->{"1"};
|
||||||
else
|
else
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
||||||
if ((property_exists($fees_and_limits, 'min_limit')) && $fees_and_limits->min_limit !== null && $amount < $fees_and_limits->min_limit)
|
if ((property_exists($fees_and_limits, 'min_limit')) && $fees_and_limits->min_limit !== null && $amount < $fees_and_limits->min_limit)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ((property_exists($fees_and_limits, 'max_limit')) && $fees_and_limits->max_limit !== null && $amount > $fees_and_limits->min_limit)
|
if ((property_exists($fees_and_limits, 'max_limit')) && $fees_and_limits->max_limit !== null && $amount > $fees_and_limits->max_limit)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -65,5 +65,61 @@ class CompanyGatewayTest extends TestCase
|
|||||||
|
|
||||||
|
|
||||||
//confirm amount filtering works
|
//confirm amount filtering works
|
||||||
|
$amount = 100;
|
||||||
|
|
||||||
|
if(isset($cg->fees_and_limits))
|
||||||
|
$fees_and_limits = $cg->fees_and_limits->{"1"};
|
||||||
|
else
|
||||||
|
$passes = true;
|
||||||
|
|
||||||
|
if ((property_exists($fees_and_limits, 'min_limit')) && $fees_and_limits->min_limit !== null && $amount < $fees_and_limits->min_limit)
|
||||||
|
$passes = false;
|
||||||
|
else if ((property_exists($fees_and_limits, 'max_limit')) && $fees_and_limits->max_limit !== null && $amount > $fees_and_limits->max_limit)
|
||||||
|
$passes = false;
|
||||||
|
else
|
||||||
|
$passes = true;
|
||||||
|
|
||||||
|
$this->assertFalse($passes);
|
||||||
|
|
||||||
|
$amount = 235;
|
||||||
|
|
||||||
|
if(isset($cg->fees_and_limits))
|
||||||
|
$fees_and_limits = $cg->fees_and_limits->{"1"};
|
||||||
|
else
|
||||||
|
$passes = true;
|
||||||
|
|
||||||
|
if ((property_exists($fees_and_limits, 'min_limit')) && $fees_and_limits->min_limit !== null && $amount < $fees_and_limits->min_limit) {
|
||||||
|
info("amount {$amount} less than ". $fees_and_limits->min_limit);
|
||||||
|
$passes = false;
|
||||||
|
}
|
||||||
|
else if ((property_exists($fees_and_limits, 'max_limit')) && $fees_and_limits->max_limit !== null && $amount > $fees_and_limits->max_limit){
|
||||||
|
info("amount {$amount} greater than ". $fees_and_limits->max_limit);
|
||||||
|
$passes = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$passes = true;
|
||||||
|
|
||||||
|
$this->assertTrue($passes);
|
||||||
|
|
||||||
|
$amount = 70000;
|
||||||
|
|
||||||
|
if(isset($cg->fees_and_limits))
|
||||||
|
$fees_and_limits = $cg->fees_and_limits->{"1"};
|
||||||
|
else
|
||||||
|
$passes = true;
|
||||||
|
|
||||||
|
if ((property_exists($fees_and_limits, 'min_limit')) && $fees_and_limits->min_limit !== null && $amount < $fees_and_limits->min_limit) {
|
||||||
|
info("amount {$amount} less than ". $fees_and_limits->min_limit);
|
||||||
|
$passes = false;
|
||||||
|
}
|
||||||
|
else if ((property_exists($fees_and_limits, 'max_limit')) && $fees_and_limits->max_limit !== null && $amount > $fees_and_limits->max_limit){
|
||||||
|
info("amount {$amount} greater than ". $fees_and_limits->max_limit);
|
||||||
|
$passes = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$passes = true;
|
||||||
|
|
||||||
|
$this->assertFalse($passes);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user