From dac110e7e081ca17917bc2b26db239efc25241cc Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 13 Mar 2017 19:57:16 +0200 Subject: [PATCH] Support updating client with buy now link --- .../Controllers/OnlinePaymentController.php | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) 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,