diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php index 985ca192934f..926b47f0bce6 100755 --- a/app/controllers/AccountController.php +++ b/app/controllers/AccountController.php @@ -102,7 +102,7 @@ class AccountController extends \BaseController { $accountGateway = null; $config = null; $configFields = null; - $selectedCards = 0; + $selectedCards = 0; if (count($account->account_gateways) > 0) { @@ -135,14 +135,14 @@ class AccountController extends \BaseController { $recommendedGatewayArray[$recommendedGateway->name] = $arrayItem; } - $creditCardsArray = unserialize(CREDIT_CARDS); - $creditCards = []; + $creditCardsArray = unserialize(CREDIT_CARDS); + $creditCards = []; foreach($creditCardsArray as $card => $name) { - if($selectedCards > 0 && ($selectedCards & $card) == $card) - $creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card']), 'checked' => 'checked']; - else - $creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card'])]; + if($selectedCards > 0 && ($selectedCards & $card) == $card) + $creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card']), 'checked' => 'checked']; + else + $creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card'])]; } $otherItem = array( @@ -152,7 +152,7 @@ class AccountController extends \BaseController { 'data-siteUrl' => '' ); $recommendedGatewayArray['Other Options'] = $otherItem; - + $data = [ 'account' => $account, 'accountGateway' => $accountGateway, @@ -165,7 +165,7 @@ class AccountController extends \BaseController { ->orderBy('name') ->get(), 'recommendedGateways' => $recommendedGatewayArray, - 'creditCardTypes' => $creditCards, + 'creditCardTypes' => $creditCards, ]; foreach ($data['gateways'] as $gateway) @@ -575,11 +575,6 @@ class AccountController extends \BaseController { private function savePayments() { - Validator::extend('notmasked', function($attribute, $value, $parameters) - { - return $value != str_repeat('*', strlen($value)); - }); - $rules = array(); $recommendedId = Input::get('recommendedGateway_id'); @@ -587,7 +582,7 @@ class AccountController extends \BaseController { { $gateway = Gateway::findOrFail($gatewayId); - $paymentLibrary = $gateway->paymentlibrary; + $paymentLibrary = $gateway->paymentlibrary; $fields = $gateway->getFields(); @@ -599,23 +594,18 @@ class AccountController extends \BaseController { { if(in_array($field, ['merchant_id', 'passCode'])) { - $rules[$gateway->id.'_'.$field] = 'required|notmasked'; + $rules[$gateway->id.'_'.$field] = 'required'; } } else { - $rules[$gateway->id.'_'.$field] = 'required|notmasked'; + $rules[$gateway->id.'_'.$field] = 'required'; } } } } - $creditcards = Input::get('creditCardTypes'); - if (count($creditcards) < 1) - { - $rules['creditCardTypes'] = 'required'; - } - + $creditcards = Input::get('creditCardTypes'); $validator = Validator::make(Input::all(), $rules); if ($validator->fails()) @@ -627,7 +617,6 @@ class AccountController extends \BaseController { else { $account = Account::findOrFail(Auth::user()->account_id); - $account->account_gateways()->delete(); if ($gatewayId) { @@ -637,21 +626,36 @@ class AccountController extends \BaseController { $config = new stdClass; foreach ($fields as $field => $details) { - $config->$field = trim(Input::get($gateway->id.'_'.$field)); + $value = trim(Input::get($gateway->id.'_'.$field)); + + if ($value && $value === str_repeat('*', strlen($value))) + { + Session::flash('error', trans('validation.notmasked')); + return Redirect::to('company/payments'); + } + + $config->$field = $value; } - $cardCount = 0; - foreach($creditcards as $card => $value) - { - $cardCount += intval($value); - } - + $cardCount = 0; + foreach($creditcards as $card => $value) + { + $cardCount += intval($value); + } + $accountGateway->config = json_encode($config); - $accountGateway->accepted_credit_cards = $cardCount; + $accountGateway->accepted_credit_cards = $cardCount; + + $account->account_gateways()->delete(); $account->account_gateways()->save($accountGateway); - } - Session::flash('message', trans('texts.updated_settings')); + Session::flash('message', trans('texts.updated_settings')); + } + else + { + Session::flash('error', trans('validation.required', ['attribute' => 'gateway'])); + } + return Redirect::to('company/payments'); } } diff --git a/app/controllers/ClientController.php b/app/controllers/ClientController.php index 4468eced2d30..6acbb50c80b4 100755 --- a/app/controllers/ClientController.php +++ b/app/controllers/ClientController.php @@ -115,7 +115,7 @@ class ClientController extends \BaseController { { if (Client::scope()->count() > Auth::user()->getMaxNumClients()) { - return View::make('error', ['error' => "Sorry, you've exceeded the limit of " . Auth::user()->getMaxNumClients() . " clients"]); + return View::make('error', ['hideHeader' => true, 'error' => "Sorry, you've exceeded the limit of " . Auth::user()->getMaxNumClients() . " clients"]); } $data = [ diff --git a/app/libraries/utils.php b/app/libraries/utils.php index f2ae828a1aac..fa69fe457940 100755 --- a/app/libraries/utils.php +++ b/app/libraries/utils.php @@ -84,8 +84,9 @@ class Utils static::logError($message . ' ' . $exception); - $data = [ - 'showBreadcrumbs' => false + $data = [ + 'showBreadcrumbs' => false, + 'hideHeader' => true ]; return View::make('error', $data)->with('error', $message); diff --git a/app/models/Gateway.php b/app/models/Gateway.php index 64623caeab7b..bb6afda0a3ef 100755 --- a/app/models/Gateway.php +++ b/app/models/Gateway.php @@ -19,7 +19,7 @@ class Gateway extends Eloquent { $paymentLibrary = $this->paymentlibrary; - if($paymentLibrary->id == PAYMENT_LIBRARY_OMNIPAY) + if ($paymentLibrary->id == PAYMENT_LIBRARY_OMNIPAY) { $fields = Omnipay::create($this->provider)->getDefaultParameters(); } @@ -28,11 +28,12 @@ class Gateway extends Eloquent $fields = Payment_Utility::load('config', 'drivers/'.strtolower($this->provider)); } - if($fields == null) + if ($fields == null) { $fields = array(); } return $fields; } + } \ No newline at end of file diff --git a/app/start/global.php b/app/start/global.php index 76d8360be6b4..4314e7817ca6 100755 --- a/app/start/global.php +++ b/app/start/global.php @@ -60,7 +60,7 @@ App::error(function(Exception $exception, $code) { Utils::logError($exception . ' ' . $code); - return Response::view('error', ['error' => "A {$code} error occurred."], $code); + return Response::view('error', ['hideHeader' => true, 'error' => "A {$code} error occurred."], $code); }); /* diff --git a/app/views/accounts/payments.blade.php b/app/views/accounts/payments.blade.php index 0f3d9f45523d..88b0abad5e85 100755 --- a/app/views/accounts/payments.blade.php +++ b/app/views/accounts/payments.blade.php @@ -3,7 +3,7 @@ @section('content') @parent - {{ Former::open()->addClass('col-md-8 col-md-offset-2 warn-on-exit') }} + {{ Former::open()->rule()->addClass('col-md-8 col-md-offset-2 warn-on-exit') }} {{ Former::populate($account) }} {{ Former::legend('Payment Gateway') }} @@ -20,17 +20,11 @@ @endforeach @endif - -
{{ Former::radios('recommendedGateway_id')->label('Recommended Gateways') @@ -117,8 +111,8 @@ $(this).parent().children().last().after('Create an account'); }); - // TODO: THIS IS JUST TO SHOW THE IMAGES, STYLE IS SET INLINE STYLE - $('.creditcard-types').each(function(){ + // TODO: THIS IS JUST TO SHOW THE IMAGES, STYLE IS SET INLINE STYLE + $('.creditcard-types').each(function(){ var contents = $(this).parent().contents(); contents[contents.length - 1].nodeValue = ''; $(this).after('
'); diff --git a/app/views/payments/payment.blade.php b/app/views/payments/payment.blade.php index 150c58eaa41a..db672ed2c805 100755 --- a/app/views/payments/payment.blade.php +++ b/app/views/payments/payment.blade.php @@ -42,19 +42,6 @@
- - -
@if (isset($paymentTitle)) @@ -176,6 +163,17 @@
+ + @if(isset($acceptedCreditCardTypes)) +
+
+ @foreach ($acceptedCreditCardTypes as $card) + {{ $card['alt'] }} + @endforeach +
+
+ @endif + diff --git a/app/views/plans.blade.php b/app/views/plans.blade.php index 3321229b3b9f..17524404c24c 100644 --- a/app/views/plans.blade.php +++ b/app/views/plans.blade.php @@ -6,7 +6,7 @@
Unlimited client invoices
Add your company logo
Live .PDF invoice creation
-
4 beatiful invoice templates
+
4 beautiful invoice templates
Accept credit card payments
Quotes/pro-forma invoices
Custom invoice fields and colors
@@ -23,7 +23,7 @@
Unlimited client invoices
Add your company logo
Live .PDF invoice creation
-
4 beatiful invoice templates
+
4 beautiful invoice templates
Accept credit card payments
Quotes/pro-forma invoices
Custom fields and invoice colors
@@ -40,7 +40,7 @@
Unlimited client invoices
Add your company logo
Live .PDF invoice creation
-
4 beatiful invoice templates
+
4 beautiful invoice templates
Accept credit card payments
Quotes/pro-forma invoices
Custom invoice fields and colors
diff --git a/public/images/credit_cards/Test-AmericanExpress-Icon.png b/public/images/credit_cards/Test-AmericanExpress-Icon.png index 0b3976d48d42..2eae73e088e7 100644 Binary files a/public/images/credit_cards/Test-AmericanExpress-Icon.png and b/public/images/credit_cards/Test-AmericanExpress-Icon.png differ diff --git a/public/images/credit_cards/Test-Diners-Icon.png b/public/images/credit_cards/Test-Diners-Icon.png index 30428faaf7f6..a5ccf183678e 100644 Binary files a/public/images/credit_cards/Test-Diners-Icon.png and b/public/images/credit_cards/Test-Diners-Icon.png differ diff --git a/public/images/credit_cards/Test-Discover-Icon.png b/public/images/credit_cards/Test-Discover-Icon.png index f1cdf93436a1..413ed79a3abd 100644 Binary files a/public/images/credit_cards/Test-Discover-Icon.png and b/public/images/credit_cards/Test-Discover-Icon.png differ diff --git a/public/images/features1.jpg b/public/images/features1.jpg index 4b9f4af7ffdb..505dd5f81d6f 100644 Binary files a/public/images/features1.jpg and b/public/images/features1.jpg differ