mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Fixes for fees and settings object
This commit is contained in:
parent
715fdf5e2d
commit
a5d2ac2cb9
@ -475,8 +475,12 @@ class Client extends BaseModel implements HasLocalePreference
|
||||
|
||||
$valid_gateways = $gateways->filter(function ($method) use ($amount) {
|
||||
|
||||
if(isset($method->fees_and_limits))
|
||||
$fees_and_limits = $method->fees_and_limits->{"1"};
|
||||
if(isset($method->fees_and_limits)){
|
||||
//sometimes the key value of the fees and limits object are not static,
|
||||
//we have to harvest the key value as follows
|
||||
$properties = array_keys(get_object_vars($method->fees_and_limits));
|
||||
$fees_and_limits = $method->fees_and_limits->{$properties[0]};
|
||||
}
|
||||
else
|
||||
return true;
|
||||
|
||||
|
@ -63,7 +63,11 @@ class CompanyGatewayTest extends TestCase
|
||||
$cg->save();
|
||||
|
||||
$this->assertNotNull($cg->fees_and_limits);
|
||||
$this->assertNotNull($cg->fees_and_limits->{"1"});
|
||||
|
||||
$properties = array_keys(get_object_vars($cg->fees_and_limits));
|
||||
$fees_and_limits = $cg->fees_and_limits->{$properties[0]};
|
||||
|
||||
$this->assertNotNull($fees_and_limits);
|
||||
|
||||
|
||||
//confirm amount filtering works
|
||||
@ -83,8 +87,10 @@ class CompanyGatewayTest extends TestCase
|
||||
|
||||
public function checkSieve($cg, $amount)
|
||||
{
|
||||
if(isset($cg->fees_and_limits))
|
||||
$fees_and_limits = $cg->fees_and_limits->{"1"};
|
||||
if(isset($cg->fees_and_limits)){
|
||||
$properties = array_keys(get_object_vars($cg->fees_and_limits));
|
||||
$fees_and_limits = $cg->fees_and_limits->{$properties[0]};
|
||||
}
|
||||
else
|
||||
$passes = true;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user