Enabled setting accepted credit cards

This commit is contained in:
Hillel Coren 2014-07-17 23:44:34 +03:00
parent 80d0eaf478
commit 4620a06a9b
12 changed files with 66 additions and 68 deletions

View File

@ -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');
@ -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';
}
$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,7 +626,15 @@ 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;
@ -648,10 +645,17 @@ class AccountController extends \BaseController {
$accountGateway->config = json_encode($config);
$accountGateway->accepted_credit_cards = $cardCount;
$account->account_gateways()->delete();
$account->account_gateways()->save($accountGateway);
}
Session::flash('message', trans('texts.updated_settings'));
}
else
{
Session::flash('error', trans('validation.required', ['attribute' => 'gateway']));
}
return Redirect::to('company/payments');
}
}

View File

@ -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 = [

View File

@ -85,7 +85,8 @@ class Utils
static::logError($message . ' ' . $exception);
$data = [
'showBreadcrumbs' => false
'showBreadcrumbs' => false,
'hideHeader' => true
];
return View::make('error', $data)->with('error', $message);

View File

@ -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;
}
}

View File

@ -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);
});
/*

View File

@ -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
<!-- TODO: creditcard-types IS SET IN JS FURTHER DOWN IN THE SCRIPT PART,
AND THEN IN INLINE STYLE. REMOVE THIS WHEN RAZI HAS FIXED THE IMAGES AND STYLE -->
<!--
<div class="two-column">
{{ Former::checkboxes('creditCardTypes[]')
->label('Accepted Credit Cards')
->checkboxes($creditCardTypes)
->class('creditcard-types')
{{ Former::checkboxes('creditCardTypes[]')->label('Accepted Credit Cards')
->checkboxes($creditCardTypes)->class('creditcard-types')
}}
</div>
-->
<div class="two-column">
{{ Former::radios('recommendedGateway_id')->label('Recommended Gateways')

View File

@ -42,19 +42,6 @@
</div>
</section>
<!-- Only set with inline style CHANGE THIS -->
<!--
<section class="accepted-card-types" style="padding: 10px 0 10px 0; margin-top: 40px;">
<div class="container">
@if(isset($acceptedCreditCardTypes))
@foreach ($acceptedCreditCardTypes as $card)
<img src="{{ $card['source'] }}" alt="{{ $card['alt'] }}" style="width: 100px; display: inline; margin-right: 20px;"/>
@endforeach
@endif
</div>
</section>
-->
<section class="secure">
<div class="container">
@if (isset($paymentTitle))
@ -176,6 +163,17 @@
<!-- <p><span class="glyphicon glyphicon-credit-card" style="margin-right: 10px;"></span><a href="#">Where Do I find CVV?</a></p> -->
</div>
</div>
@if(isset($acceptedCreditCardTypes))
<div class="row">
<div class="form-group col-md-12">
@foreach ($acceptedCreditCardTypes as $card)
<img src="{{ $card['source'] }}" alt="{{ $card['alt'] }}" style="width: 70px; display: inline; margin-right: 6px;"/>
@endforeach
</div>
</div>
@endif
</div>

View File

@ -6,7 +6,7 @@
<div class="cell">Unlimited client invoices</div>
<div class="cell">Add your company logo</div>
<div class="cell">Live .PDF invoice creation </div>
<div class="cell">4 beatiful invoice templates</div>
<div class="cell">4 beautiful invoice templates</div>
<div class="cell">Accept credit card payments</div>
<div class="cell">Quotes/pro-forma invoices</div>
<div class="cell">Custom invoice fields and colors</div>
@ -23,7 +23,7 @@
<div class="cell"><div class="hide-desktop">Unlimited client invoices</div><span class="glyphicon glyphicon-ok"></div>
<div class="cell"><div class="hide-desktop">Add your company logo</div><span class="glyphicon glyphicon-ok"></div>
<div class="cell"><div class="hide-desktop">Live .PDF invoice creation</div><span class="glyphicon glyphicon-ok"></div>
<div class="cell"><div class="hide-desktop">4 beatiful invoice templates</div><span class="glyphicon glyphicon-ok"></div>
<div class="cell"><div class="hide-desktop">4 beautiful invoice templates</div><span class="glyphicon glyphicon-ok"></div>
<div class="cell"><div class="hide-desktop">Accept credit card payments</div><span class="glyphicon glyphicon-ok"></div>
<div class="cell"><div class="hide-desktop">Quotes/pro-forma invoices</div><span class="glyphicon glyphicon-remove"></div>
<div class="cell"><div class="hide-desktop">Custom fields and invoice colors</div><span class="glyphicon glyphicon-remove"></div>
@ -40,7 +40,7 @@
<div class="cell"><div class="hide-desktop">Unlimited client invoices</div><span class="glyphicon glyphicon-ok"></div>
<div class="cell"><div class="hide-desktop">Add your company logo</div><span class="glyphicon glyphicon-ok"></div>
<div class="cell"><div class="hide-desktop">Live .PDF invoice creation</div><span class="glyphicon glyphicon-ok"></div>
<div class="cell"><div class="hide-desktop">4 beatiful invoice templates</div><span class="glyphicon glyphicon-ok"></div>
<div class="cell"><div class="hide-desktop">4 beautiful invoice templates</div><span class="glyphicon glyphicon-ok"></div>
<div class="cell"><div class="hide-desktop">Accept credit card payments</div><span class="glyphicon glyphicon-ok"></div>
<div class="cell"><div class="hide-desktop">Quotes/pro-forma invoices</div><span class="glyphicon glyphicon-ok"></div>
<div class="cell"><div class="hide-desktop">Custom invoice fields and colors</div><span class="glyphicon glyphicon-ok"></div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 KiB

After

Width:  |  Height:  |  Size: 242 KiB