mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 20:14:31 -04:00
validate and save to account_gateways
This commit is contained in:
parent
0f6e374402
commit
92fdf49c10
@ -569,7 +569,7 @@ class AccountController extends \BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function savePayments()
|
private function savePayments()
|
||||||
{
|
{
|
||||||
Validator::extend('notmasked', function($attribute, $value, $parameters)
|
Validator::extend('notmasked', function($attribute, $value, $parameters)
|
||||||
{
|
{
|
||||||
return $value != str_repeat('*', strlen($value));
|
return $value != str_repeat('*', strlen($value));
|
||||||
@ -604,6 +604,12 @@ class AccountController extends \BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$creditcards = Input::get('creditCardTypes');
|
||||||
|
if (count($creditcards) < 1)
|
||||||
|
{
|
||||||
|
$rules['creditCardTypes'] = 'required';
|
||||||
|
}
|
||||||
|
|
||||||
$validator = Validator::make(Input::all(), $rules);
|
$validator = Validator::make(Input::all(), $rules);
|
||||||
|
|
||||||
@ -627,9 +633,16 @@ class AccountController extends \BaseController {
|
|||||||
foreach ($fields as $field => $details)
|
foreach ($fields as $field => $details)
|
||||||
{
|
{
|
||||||
$config->$field = trim(Input::get($gateway->id.'_'.$field));
|
$config->$field = trim(Input::get($gateway->id.'_'.$field));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$cardCount = 0;
|
||||||
|
foreach($creditcards as $card => $value)
|
||||||
|
{
|
||||||
|
$cardCount += intval($value);
|
||||||
|
}
|
||||||
|
|
||||||
$accountGateway->config = json_encode($config);
|
$accountGateway->config = json_encode($config);
|
||||||
|
$accountGateway->accepted_credit_cards = $cardCount;
|
||||||
$account->account_gateways()->save($accountGateway);
|
$account->account_gateways()->save($accountGateway);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<!-- TODO: creditcard-types IS SET IN JS FURTHER DOWN IN THE SCRIPT PART,
|
<!-- 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 -->
|
AND THEN IN INLINE STYLE. REMOVE THIS WHEN RAZI HAS FIXED THE IMAGES AND STYLE -->
|
||||||
<div class="two-column">
|
<div class="two-column">
|
||||||
{{ Former::checkboxes('creditCardType_id')
|
{{ Former::checkboxes('creditCardTypes[]')
|
||||||
->label('Accepted Credit Cards')
|
->label('Accepted Credit Cards')
|
||||||
->checkboxes($creditCardTypes)
|
->checkboxes($creditCardTypes)
|
||||||
->class('creditcard-types')
|
->class('creditcard-types')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user