mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Fixes for tests
This commit is contained in:
parent
2e29bbce3c
commit
3e916e0f1f
@ -52,7 +52,7 @@ class CreateAccountRequest extends Request
|
||||
];
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -42,7 +42,7 @@ class UpdateAccountRequest extends Request
|
||||
}
|
||||
|
||||
/* Only allow single field to update account table */
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -34,7 +34,7 @@ class ShowChartRequest extends Request
|
||||
];
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -44,7 +44,7 @@ class AdjustClientLedgerRequest extends Request
|
||||
];
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -89,7 +89,7 @@ class StoreClientRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
@ -99,7 +99,9 @@ class StoreClientRequest extends Request
|
||||
/* Stub settings if they don't exist */
|
||||
if(!array_key_exists('settings', $input))
|
||||
$input['settings'] = [];
|
||||
|
||||
elseif(is_object($input['settings']))
|
||||
$input['settings'] = (array)$input['settings'];
|
||||
|
||||
/* Merge default into base settings */
|
||||
$input['settings'] = array_merge($input['settings'], $settings);
|
||||
|
||||
|
@ -93,7 +93,7 @@ class UpdateClientRequest extends Request
|
||||
];
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -48,7 +48,7 @@ class StoreClientGatewayTokenRequest extends Request
|
||||
return $this->globalRules($rules);
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -46,7 +46,7 @@ class UpdateClientGatewayTokenRequest extends Request
|
||||
];
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -34,7 +34,7 @@ class ShowStatementRequest extends FormRequest
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function prepareForValidation(): void
|
||||
public function prepareForValidation(): void
|
||||
{
|
||||
$this->merge([
|
||||
'show_payments_table' => $this->has('show_payments_table') ? \boolval($this->show_payments_table) : false,
|
||||
|
@ -32,7 +32,7 @@ class EditCompanyRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -57,7 +57,7 @@ class StoreCompanyRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -59,7 +59,7 @@ class UpdateCompanyRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
|
||||
$input = $this->all();
|
||||
|
@ -32,7 +32,7 @@ class DestroyCompanyGatewayRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -32,7 +32,7 @@ class EditCompanyGatewayRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -32,7 +32,7 @@ class ShowCompanyGatewayRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -40,7 +40,7 @@ class StoreCompanyGatewayRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -39,7 +39,7 @@ class UpdateCompanyGatewayRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -69,7 +69,7 @@ class StoreCreditRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -63,7 +63,7 @@ class UpdateCreditRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -33,7 +33,7 @@ class DefaultDesignRequest extends Request
|
||||
];
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -34,7 +34,7 @@ class StoreDesignRequest extends Request
|
||||
];
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -33,7 +33,7 @@ class UpdateDesignRequest extends Request
|
||||
return [];
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -32,7 +32,7 @@ class StoreDocumentRequest extends Request
|
||||
];
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -33,7 +33,7 @@ class UpdateDocumentRequest extends Request
|
||||
return [];
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -42,7 +42,7 @@ class SendEmailRequest extends Request
|
||||
];
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -46,7 +46,7 @@ class StoreExpenseRequest extends Request
|
||||
return $this->globalRules($rules);
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -56,7 +56,7 @@ class UpdateExpenseRequest extends Request
|
||||
];
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -35,7 +35,7 @@ class StoreExpenseCategoryRequest extends Request
|
||||
return $this->globalRules($rules);
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -41,7 +41,7 @@ class UpdateExpenseCategoryRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -37,7 +37,7 @@ class StoreGroupSettingRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -36,7 +36,7 @@ class UpdateGroupSettingRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -42,7 +42,7 @@ class ActionInvoiceRequest extends Request
|
||||
];
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -73,7 +73,7 @@ class StoreInvoiceRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -69,7 +69,7 @@ class UpdateInvoiceRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -47,7 +47,7 @@ class LoginRequest extends Request
|
||||
];
|
||||
}
|
||||
|
||||
// protected function prepareForValidation()
|
||||
// public function prepareForValidation()
|
||||
// {
|
||||
// $input = $this->all();
|
||||
|
||||
|
@ -37,7 +37,7 @@ class OneTimeRouterRequest extends Request
|
||||
];
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
// $input = $this->all();
|
||||
// $this->replace($input);
|
||||
|
@ -37,7 +37,7 @@ class OneTimeTokenRequest extends Request
|
||||
];
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
// $input = $this->all();
|
||||
// $this->replace($input);
|
||||
|
@ -32,7 +32,7 @@ class EditPaymentRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -31,7 +31,7 @@ class RefundPaymentRequest extends Request
|
||||
return auth()->user()->isAdmin();
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -36,7 +36,7 @@ class StorePaymentRequest extends Request
|
||||
return auth()->user()->can('create', Payment::class);
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -58,7 +58,7 @@ class UpdatePaymentRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -32,7 +32,7 @@ class EditPaymentTermRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -28,7 +28,7 @@ class StorePaymentTermRequest extends Request
|
||||
return auth()->user()->isAdmin();
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -35,7 +35,7 @@ class UpdatePaymentTermRequest extends Request
|
||||
];
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -45,7 +45,7 @@ class PreviewInvoiceRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -48,7 +48,7 @@ class StoreProductRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -51,7 +51,7 @@ class UpdateProductRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -45,7 +45,7 @@ class StoreProjectRequest extends Request
|
||||
return $this->globalRules($rules);
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->decodePrimaryKeys($this->all());
|
||||
|
||||
|
@ -40,7 +40,7 @@ class UpdateProjectRequest extends Request
|
||||
return $this->globalRules($rules);
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->decodePrimaryKeys($this->all());
|
||||
|
||||
|
@ -40,7 +40,7 @@ class ActionPurchaseOrderRequest extends Request
|
||||
];
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -50,7 +50,7 @@ class StorePurchaseOrderRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -51,7 +51,7 @@ class UpdatePurchaseOrderRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -60,7 +60,7 @@ class StoreQuoteRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -58,7 +58,7 @@ class UpdateQuoteRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -51,7 +51,7 @@ class StoreRecurringExpenseRequest extends Request
|
||||
return $this->globalRules($rules);
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -60,7 +60,7 @@ class UpdateRecurringExpenseRequest extends Request
|
||||
];
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -32,7 +32,7 @@ class EditRecurringInvoiceRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -62,7 +62,7 @@ class StoreRecurringInvoiceRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -58,7 +58,7 @@ class UpdateRecurringInvoiceRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -32,7 +32,7 @@ class EditRecurringQuoteRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -59,7 +59,7 @@ class StoreRecurringQuoteRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
$input = $this->decodePrimaryKeys($input);
|
||||
|
@ -55,7 +55,7 @@ class UpdateRecurringQuoteRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
$input = $this->decodePrimaryKeys($input);
|
||||
|
@ -179,7 +179,7 @@ class Request extends FormRequest
|
||||
return $input;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ class StoreSetupRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -72,7 +72,7 @@ class StoreShopClientRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$this->company = Company::where('company_key', request()->header('X-API-COMPANY-KEY'))->firstOrFail();
|
||||
|
||||
|
@ -57,7 +57,7 @@ class StoreShopInvoiceRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$this->company = Company::where('company_key', request()->header('X-API-COMPANY-KEY'))->firstOrFail();
|
||||
|
||||
|
@ -39,7 +39,7 @@ class CreateStatementRequest extends Request
|
||||
];
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -60,7 +60,7 @@ class StoreSubscriptionRequest extends Request
|
||||
return $this->globalRules($rules);
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -62,7 +62,7 @@ class UpdateSubscriptionRequest extends Request
|
||||
return $this->globalRules($rules);
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -41,7 +41,7 @@ class StoreTaskRequest extends Request
|
||||
return $this->globalRules($rules);
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -42,7 +42,7 @@ class UpdateTaskRequest extends Request
|
||||
return $this->globalRules($rules);
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->decodePrimaryKeys($this->all());
|
||||
|
||||
|
@ -32,7 +32,7 @@ class EditTaskStatusRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -28,7 +28,7 @@ class StoreTaskStatusRequest extends Request
|
||||
return auth()->user()->isAdmin();
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -41,7 +41,7 @@ class UpdateTaskStatusRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -37,7 +37,7 @@ class ShowTemplateRequest extends Request
|
||||
];
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -30,7 +30,7 @@ class AttachCompanyUserRequest extends Request
|
||||
return auth()->user()->isAdmin();
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$is_admin = request()->has('is_admin') ? request()->input('is_admin') : false;
|
||||
$permissions = request()->has('permissions') ? request()->input('permissions') : '';
|
||||
|
@ -39,7 +39,7 @@ class BulkUserRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -54,7 +54,7 @@ class StoreUserRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -41,7 +41,7 @@ class UpdateUserRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -52,7 +52,7 @@ class StoreVendorRequest extends Request
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -59,7 +59,7 @@ class UpdateVendorRequest extends Request
|
||||
];
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -33,7 +33,7 @@ class StoreWebhookRequest extends Request
|
||||
];
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -37,7 +37,7 @@ class UpdateWebhookRequest extends Request
|
||||
];
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
@ -150,6 +150,22 @@ class BaseImport
|
||||
return $this->error_array;
|
||||
}
|
||||
|
||||
|
||||
private function runValidation($data)
|
||||
{
|
||||
$_syn_request_class = new $this->request_name;
|
||||
$_syn_request_class->setContainer(app());
|
||||
$_syn_request_class->initialize($data);
|
||||
$_syn_request_class->prepareForValidation();
|
||||
|
||||
$validator = Validator::make($_syn_request_class->all(), $_syn_request_class->rules());
|
||||
|
||||
$_syn_request_class->setValidator($validator);
|
||||
|
||||
return $validator;
|
||||
|
||||
}
|
||||
|
||||
public function ingest($data, $entity_type)
|
||||
{
|
||||
$count = 0;
|
||||
@ -157,7 +173,8 @@ class BaseImport
|
||||
foreach ($data as $key => $record) {
|
||||
try {
|
||||
$entity = $this->transformer->transform($record);
|
||||
$validator = $this->request_name::runFormRequest($entity);
|
||||
// $validator = $this->request_name::runFormRequest($entity);
|
||||
$validator = $this->runValidation($entity);
|
||||
|
||||
if ($validator->fails()) {
|
||||
$this->error_array[$entity_type][] = [
|
||||
@ -172,7 +189,6 @@ class BaseImport
|
||||
$this->getUserIDForRecord($entity)
|
||||
)
|
||||
);
|
||||
|
||||
$entity->saveQuietly();
|
||||
$count++;
|
||||
}
|
||||
@ -192,6 +208,8 @@ class BaseImport
|
||||
$entity_type => $record,
|
||||
'error' => $message,
|
||||
];
|
||||
|
||||
nlog($ex->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -166,6 +166,7 @@ class Csv extends BaseImport implements ImportInterface
|
||||
|
||||
return;
|
||||
}
|
||||
nlog($data);
|
||||
|
||||
$this->request_name = StorePaymentRequest::class;
|
||||
$this->repository_name = PaymentRepository::class;
|
||||
@ -178,6 +179,8 @@ class Csv extends BaseImport implements ImportInterface
|
||||
|
||||
$payment_count = $this->ingest($data, $entity_type);
|
||||
|
||||
nlog($payment_count);
|
||||
|
||||
$this->entity_count['payments'] = $payment_count;
|
||||
}
|
||||
|
||||
|
16
composer.lock
generated
16
composer.lock
generated
@ -378,16 +378,16 @@
|
||||
},
|
||||
{
|
||||
"name": "aws/aws-sdk-php",
|
||||
"version": "3.228.1",
|
||||
"version": "3.228.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/aws/aws-sdk-php.git",
|
||||
"reference": "53b7f43945b19bb0700c75d4c5f130055096e817"
|
||||
"reference": "e7c4d70aef99e71f9114a302ec576dc2689df283"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/53b7f43945b19bb0700c75d4c5f130055096e817",
|
||||
"reference": "53b7f43945b19bb0700c75d4c5f130055096e817",
|
||||
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/e7c4d70aef99e71f9114a302ec576dc2689df283",
|
||||
"reference": "e7c4d70aef99e71f9114a302ec576dc2689df283",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -395,7 +395,7 @@
|
||||
"ext-json": "*",
|
||||
"ext-pcre": "*",
|
||||
"ext-simplexml": "*",
|
||||
"guzzlehttp/guzzle": "^6.5.7 || ^7.4.4",
|
||||
"guzzlehttp/guzzle": "^6.5.8 || ^7.4.5",
|
||||
"guzzlehttp/promises": "^1.4.0",
|
||||
"guzzlehttp/psr7": "^1.8.5 || ^2.3",
|
||||
"mtdowling/jmespath.php": "^2.6",
|
||||
@ -463,9 +463,9 @@
|
||||
"support": {
|
||||
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
|
||||
"issues": "https://github.com/aws/aws-sdk-php/issues",
|
||||
"source": "https://github.com/aws/aws-sdk-php/tree/3.228.1"
|
||||
"source": "https://github.com/aws/aws-sdk-php/tree/3.228.2"
|
||||
},
|
||||
"time": "2022-06-22T18:16:48+00:00"
|
||||
"time": "2022-06-23T18:17:44+00:00"
|
||||
},
|
||||
{
|
||||
"name": "bacon/bacon-qr-code",
|
||||
@ -14641,5 +14641,5 @@
|
||||
"platform-dev": {
|
||||
"php": "^7.4|^8.0"
|
||||
},
|
||||
"plugin-api-version": "2.0.0"
|
||||
"plugin-api-version": "2.3.0"
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ return [
|
||||
Illuminate\Filesystem\FilesystemServiceProvider::class,
|
||||
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
|
||||
Illuminate\Hashing\HashServiceProvider::class,
|
||||
App\Providers\MailServiceProvider::class,
|
||||
Illuminate\Mail\MailServiceProvider::class,
|
||||
Illuminate\Notifications\NotificationServiceProvider::class,
|
||||
Illuminate\Pagination\PaginationServiceProvider::class,
|
||||
Illuminate\Pipeline\PipelineServiceProvider::class,
|
||||
|
@ -39,7 +39,7 @@ class CompanySettingsTest extends TestCase
|
||||
Session::start();
|
||||
|
||||
$this->faker = \Faker\Factory::create();
|
||||
$this->withoutExceptionHandling();
|
||||
// $this->withoutExceptionHandling();
|
||||
Model::reguard();
|
||||
}
|
||||
|
||||
@ -53,14 +53,11 @@ class CompanySettingsTest extends TestCase
|
||||
|
||||
$response = false;
|
||||
|
||||
nlog($this->company->toJson());
|
||||
|
||||
|
||||
try {
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-Token' => $this->token,
|
||||
])->put('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $this->company->toArray());
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->putJson('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $this->company->toArray());
|
||||
} catch (ValidationException $e) {
|
||||
$message = json_decode($e->validator->getMessageBag(), 1);
|
||||
}
|
||||
@ -86,7 +83,7 @@ nlog($this->company->toJson());
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-Token' => $this->token,
|
||||
])->put('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $this->company->toArray());
|
||||
])->putJson('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $this->company->toArray());
|
||||
} catch (ValidationException $e) {
|
||||
$message = json_decode($e->validator->getMessageBag(), 1);
|
||||
nlog($message);
|
||||
@ -113,7 +110,7 @@ nlog($this->company->toJson());
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-Token' => $this->token,
|
||||
])->put('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $this->company->toArray());
|
||||
])->putJson('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $this->company->toArray());
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
@ -139,7 +136,7 @@ nlog($this->company->toJson());
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-Token' => $this->token,
|
||||
])->put('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $this->company->toArray());
|
||||
])->putJson('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $this->company->toArray());
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
@ -166,7 +163,7 @@ nlog($this->company->toJson());
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-Token' => $this->token,
|
||||
])->put('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $this->company->toArray());
|
||||
])->putJson('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $this->company->toArray());
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
@ -189,7 +186,7 @@ nlog($this->company->toJson());
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-Token' => $this->token,
|
||||
])->post('/api/v1/companies?include=company', $this->company->toArray());
|
||||
])->postJson('/api/v1/companies?include=company', $this->company->toArray());
|
||||
|
||||
$arr = $response->json();
|
||||
$response->assertStatus(200);
|
||||
@ -207,7 +204,7 @@ nlog($this->company->toJson());
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-Token' => $this->token,
|
||||
])->post('/api/v1/companies?include=company', $this->company->toArray());
|
||||
])->postJson('/api/v1/companies?include=company', $this->company->toArray());
|
||||
|
||||
$arr = $response->json();
|
||||
$response->assertStatus(200);
|
||||
@ -225,7 +222,7 @@ nlog($this->company->toJson());
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-Token' => $this->token,
|
||||
])->post('/api/v1/companies?include=company', $this->company->toArray());
|
||||
])->postJson('/api/v1/companies?include=company', $this->company->toArray());
|
||||
|
||||
$arr = $response->json();
|
||||
$response->assertStatus(200);
|
||||
@ -243,7 +240,7 @@ nlog($this->company->toJson());
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-Token' => $this->token,
|
||||
])->post('/api/v1/companies?include=company', $this->company->toArray());
|
||||
])->postJson('/api/v1/companies?include=company', $this->company->toArray());
|
||||
|
||||
$arr = $response->json();
|
||||
$response->assertStatus(200);
|
||||
|
@ -99,7 +99,7 @@ class CompanyTest extends TestCase
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->put('/api/v1/companies/'.$this->encodePrimaryKey($company->id), $company_update)
|
||||
])->putJson('/api/v1/companies/'.$this->encodePrimaryKey($company->id), $company_update)
|
||||
->assertStatus(200);
|
||||
|
||||
$settings = CompanySettings::defaults();
|
||||
@ -112,7 +112,7 @@ class CompanyTest extends TestCase
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->put('/api/v1/companies/'.$this->encodePrimaryKey($company->id), $company->toArray())
|
||||
])->putJson('/api/v1/companies/'.$this->encodePrimaryKey($company->id), $company->toArray())
|
||||
->assertStatus(200)->decodeResponseJson();
|
||||
|
||||
$response = $this->withHeaders([
|
||||
|
@ -51,7 +51,7 @@ class GroupSettingTest extends TestCase
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->post('/api/v1/group_settings', $data);
|
||||
])->postJson('/api/v1/group_settings', $data);
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
@ -74,7 +74,7 @@ class GroupSettingTest extends TestCase
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->post('/api/v1/group_settings', $data);
|
||||
])->postJson('/api/v1/group_settings', $data);
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
@ -88,7 +88,7 @@ class GroupSettingTest extends TestCase
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->post('/api/v1/group_settings/bulk', $data);
|
||||
])->postJson('/api/v1/group_settings/bulk', $data);
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
|
@ -149,7 +149,6 @@ class CsvImportTest extends TestCase
|
||||
$base_transformer = new BaseTransformer($this->company);
|
||||
|
||||
$this->assertTrue($base_transformer->hasProduct('officiis'));
|
||||
// $this->assertTrue($base_transformer->hasProduct('maxime'));
|
||||
}
|
||||
|
||||
public function testClientImport()
|
||||
@ -280,7 +279,7 @@ class CsvImportTest extends TestCase
|
||||
|
||||
$csv_importer->import('invoice');
|
||||
|
||||
$this->assertTrue($base_transformer->hasInvoice('801'));
|
||||
$this->assertTrue($base_transformer->hasInvoice('780'));
|
||||
|
||||
/* Lets piggy back payments tests here to save rebuilding the test multiple times*/
|
||||
|
||||
@ -309,15 +308,15 @@ class CsvImportTest extends TestCase
|
||||
|
||||
$csv_importer->import('payment');
|
||||
|
||||
$this->assertTrue($base_transformer->hasInvoice('801'));
|
||||
$this->assertTrue($base_transformer->hasInvoice('780'));
|
||||
|
||||
$invoice_id = $base_transformer->getInvoiceId('801');
|
||||
$invoice_id = $base_transformer->getInvoiceId('780');
|
||||
|
||||
$invoice = Invoice::find($invoice_id);
|
||||
$invoice = Invoice::with('payments')->find($invoice_id);
|
||||
|
||||
$this->assertTrue($invoice->payments()->exists());
|
||||
$this->assertEquals(3, $invoice->payments()->count());
|
||||
$this->assertEquals(1200, $invoice->payments()->sum('payments.amount'));
|
||||
$this->assertEquals(1, $invoice->payments()->count());
|
||||
$this->assertEquals(51.03, round($invoice->payments()->sum('payments.amount'),2));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -403,5 +403,3 @@ Ms. Alena Cassin,golden.green@example.org,777,$17.94,$12.76,,Partial,2019-12-05,
|
||||
Ms. Alena Cassin,golden.green@example.org,778,$14.88,$7.97,,Partial,2020-02-27,2019-11-29,,$0.00,,,,sed,In nulla eos ipsam molestias. Perferendis sunt et consequuntur qui ex nesciunt et. Amet animi aut dicta qui facilis voluptatem.,4.96,3
|
||||
Ms. Alena Cassin,golden.green@example.org,779,$49.00,$28.77,,Partial,2019-10-25,2020-01-10,,$0.00,,,,facere,Reiciendis voluptas unde et ut. Omnis dolorum modi facere exercitationem fuga. Eum recusandae ut ea qui autem.,4.9,10
|
||||
Ms. Alena Cassin,golden.green@example.org,780,$51.03,$51.03,,Paid,2019-12-01,2020-01-14,,$0.00,,,,voluptas,Saepe eius placeat sit mollitia magni. Porro ipsam praesentium tempora iste. Suscipit dolorem omnis eligendi corrupti est nobis.,7.29,7
|
||||
Ludwig Krajcik DVM,brook59@example.org,801,$-400.00,$0.00,,Sent,2020-01-22,2020-01-29,,$0.00,,,,1,10,1,-200
|
||||
Ludwig Krajcik DVM,brook59@example.org,801,$-400.00,$0.00,,Sent,2020-01-22,2020-01-29,,$0.00,,,,2,5,1,-200
|
||||
|
|
Loading…
x
Reference in New Issue
Block a user