mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
fix for company gateways if properties not set
This commit is contained in:
parent
3d8ddb23cf
commit
455e9a8e1d
@ -13,6 +13,7 @@ namespace App\Http\Requests\CompanyGateway;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use App\Http\ValidationRules\ValidCompanyGatewayFeesAndLimitsRule;
|
||||
use App\Models\Gateway;
|
||||
use App\Utils\Traits\CompanyGatewayFeesAndLimitsSaver;
|
||||
|
||||
class StoreCompanyGatewayRequest extends Request
|
||||
@ -43,6 +44,22 @@ class StoreCompanyGatewayRequest extends Request
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
$gateway = Gateway::where('key', $input['gateway_key'])->first();
|
||||
$default_gateway_fields = json_decode($gateway->fields);
|
||||
|
||||
/*Force gateway properties */
|
||||
if(isset($input['config']))
|
||||
{
|
||||
foreach(json_decode($input['config']) as $key => $value) {
|
||||
|
||||
$default_gateway_fields->{$key} = $value;
|
||||
|
||||
}
|
||||
|
||||
$input['config'] = json_encode($default_gateway_fields);
|
||||
}
|
||||
|
||||
|
||||
if (isset($input['config'])) {
|
||||
$input['config'] = encrypt($input['config']);
|
||||
}
|
||||
@ -51,6 +68,7 @@ class StoreCompanyGatewayRequest extends Request
|
||||
$input['fees_and_limits'] = $this->cleanFeesAndLimits($input['fees_and_limits']);
|
||||
}
|
||||
|
||||
|
||||
$this->replace($input);
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ namespace App\Http\Requests\CompanyGateway;
|
||||
use App\Http\Requests\Request;
|
||||
use App\Http\ValidationRules\ValidCompanyGatewayFeesAndLimitsRule;
|
||||
use App\Models\Company;
|
||||
use App\Models\Gateway;
|
||||
use App\Utils\Traits\CompanyGatewayFeesAndLimitsSaver;
|
||||
|
||||
class UpdateCompanyGatewayRequest extends Request
|
||||
@ -44,6 +45,21 @@ class UpdateCompanyGatewayRequest extends Request
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
/*Force gateway properties */
|
||||
if(isset($input['config']) && $input['gateway_key'])
|
||||
{
|
||||
$gateway = Gateway::where('key', $input['gateway_key'])->first();
|
||||
$default_gateway_fields = json_decode($gateway->fields);
|
||||
|
||||
foreach(json_decode($input['config']) as $key => $value) {
|
||||
|
||||
$default_gateway_fields->{$key} = $value;
|
||||
|
||||
}
|
||||
|
||||
$input['config'] = json_encode($default_gateway_fields);
|
||||
}
|
||||
|
||||
$input['config'] = encrypt($input['config']);
|
||||
|
||||
if (isset($input['fees_and_limits'])) {
|
||||
|
Loading…
Reference in New Issue
Block a user