diff --git a/app/Http/Controllers/OnlinePaymentController.php b/app/Http/Controllers/OnlinePaymentController.php index e25defd2a0d2..004554c29819 100644 --- a/app/Http/Controllers/OnlinePaymentController.php +++ b/app/Http/Controllers/OnlinePaymentController.php @@ -311,25 +311,23 @@ class OnlinePaymentController extends BaseController $query->where('contact_key', $contactKey); })->first(); } - if (! $client) { - $rules = [ - 'first_name' => 'string|max:100', - 'last_name' => 'string|max:100', - 'email' => 'email|string|max:100', - ]; + $rules = [ + 'first_name' => 'string|max:100', + 'last_name' => 'string|max:100', + 'email' => 'email|string|max:100', + ]; - $validator = Validator::make(Input::all(), $rules); - if ($validator->fails()) { - return redirect()->to("{$failureUrl}/?error=" . $validator->errors()->first()); - } - - $data = [ - 'currency_id' => $account->currency_id, - 'contact' => Input::all(), - ]; - $client = $clientRepo->save($data); + $validator = Validator::make(Input::all(), $rules); + if ($validator->fails()) { + return redirect()->to("{$failureUrl}/?error=" . $validator->errors()->first()); } + $data = [ + 'currency_id' => $account->currency_id, + 'contact' => Input::all(), + ]; + $client = $clientRepo->save($data, $client); + $data = [ 'client_id' => $client->id, 'is_public' => true,