From 653fb6357a109a4ab556c98bade02eb277d05331 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 20 Mar 2017 12:14:06 +0200 Subject: [PATCH] Fix for buy now clients --- .../Controllers/OnlinePaymentController.php | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/app/Http/Controllers/OnlinePaymentController.php b/app/Http/Controllers/OnlinePaymentController.php index 004554c29819..af2822cff6d1 100644 --- a/app/Http/Controllers/OnlinePaymentController.php +++ b/app/Http/Controllers/OnlinePaymentController.php @@ -311,23 +311,25 @@ class OnlinePaymentController extends BaseController $query->where('contact_key', $contactKey); })->first(); } - $rules = [ - 'first_name' => 'string|max:100', - 'last_name' => 'string|max:100', - 'email' => 'email|string|max:100', - ]; + if (! $client) { + $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()); + $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 = [ - 'currency_id' => $account->currency_id, - 'contact' => Input::all(), - ]; - $client = $clientRepo->save($data, $client); - $data = [ 'client_id' => $client->id, 'is_public' => true,