No longer have to submit mandatory fields to account end point. Just submit the field you wish to update, the rest will be untouched.

This commit is contained in:
James Cole
2019-08-24 07:56:08 +02:00
parent e5e3797d9c
commit d836c8217d
6 changed files with 161 additions and 71 deletions

View File

@@ -95,12 +95,13 @@ trait AccountServiceTrait
if ($account->accountType->type === AccountType::ASSET) {
$fields = $this->validAssetFields;
}
if ($account->accountType->type === AccountType::ASSET && 'ccAsset' === $data['account_role']) {
if ($account->accountType->type === AccountType::ASSET && isset($data['account_role']) && 'ccAsset' === $data['account_role']) {
$fields = $this->validCCFields;
}
/** @var AccountMetaFactory $factory */
$factory = app(AccountMetaFactory::class);
foreach ($fields as $field) {
$factory->crud($account, $field, (string)($data[$field] ?? ''));
}
}