diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php index 7109f763417d..a531cab6d183 100755 --- a/app/controllers/AccountController.php +++ b/app/controllers/AccountController.php @@ -166,7 +166,7 @@ class AccountController extends \BaseController { { $accountGateway = $account->account_gateways[0]; $config = $accountGateway->config; - $selectedCards = $accountGateway->accepted_credit_cards; + $selectedCards = $accountGateway->accepted_credit_cards; $configFields = json_decode($config); @@ -174,6 +174,9 @@ class AccountController extends \BaseController { { $configFields->$configField = str_repeat('*', strlen($value)); } + } else { + $accountGateway = AccountGateway::createNew(); + $accountGateway->gateway_id = GATEWAY_MOOLAH; } $recommendedGateways = Gateway::remember(DEFAULT_QUERY_CACHE) @@ -191,8 +194,8 @@ class AccountController extends \BaseController { 'data-siteUrl' => $recommendedGateway->site_url ); $recommendedGatewayArray[$recommendedGateway->name] = $arrayItem; - } - + } + $creditCardsArray = unserialize(CREDIT_CARDS); $creditCards = []; foreach($creditCardsArray as $card => $name) @@ -210,25 +213,12 @@ class AccountController extends \BaseController { 'data-siteUrl' => '' ); $recommendedGatewayArray['Other Options'] = $otherItem; - - $data = [ - 'account' => $account, - 'accountGateway' => $accountGateway, - 'config' => $configFields, - 'gateways' => Gateway::remember(DEFAULT_QUERY_CACHE) - ->orderBy('name') - ->get(), - 'dropdownGateways' => Gateway::remember(DEFAULT_QUERY_CACHE) - ->where('recommended', '=', '0') - ->orderBy('name') - ->get(), - 'recommendedGateways' => $recommendedGatewayArray, - 'creditCardTypes' => $creditCards, - ]; - - foreach ($data['gateways'] as $gateway) + + $gateways = Gateway::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(); + + foreach ($gateways as $gateway) { - $paymentLibrary = $gateway->paymentlibrary; + $paymentLibrary = $gateway->paymentlibrary; $gateway->fields = $gateway->getFields(); @@ -237,7 +227,20 @@ class AccountController extends \BaseController { $accountGateway->fields = $gateway->fields; } } - + + $data = [ + 'account' => $account, + 'accountGateway' => $accountGateway, + 'config' => $configFields, + 'gateways' => $gateways, + 'dropdownGateways' => Gateway::remember(DEFAULT_QUERY_CACHE) + ->where('recommended', '=', '0') + ->orderBy('name') + ->get(), + 'recommendedGateways' => $recommendedGatewayArray, + 'creditCardTypes' => $creditCards, + ]; + return View::make('accounts.payments', $data); } else if ($section == ACCOUNT_NOTIFICATIONS) diff --git a/app/database/seeds/PaymentLibrariesSeeder.php b/app/database/seeds/PaymentLibrariesSeeder.php index 07bb1e63be02..24a958228eef 100644 --- a/app/database/seeds/PaymentLibrariesSeeder.php +++ b/app/database/seeds/PaymentLibrariesSeeder.php @@ -12,6 +12,20 @@ class PaymentLibrariesSeeder extends Seeder array('name'=>'Psigate', 'provider'=>'Psigate', 'payment_library_id' => 2) ]; + foreach ($gateways as $gateway) + { + Gateway::create($gateway); + } + + Gateway::create([ + 'name' => 'moolah', + 'provider' => 'AuthorizeNet_AIM', + 'sort_order' => 1, + 'recommended' => 1, + 'site_url' => 'https://invoiceninja.mymoolah.com/', + ]); + + /* $updateProviders = array( 0 => 'AuthorizeNet_AIM', //1 => 'BeanStream', @@ -21,11 +35,6 @@ class PaymentLibrariesSeeder extends Seeder 5 => 'TwoCheckout' ); - foreach ($gateways as $gateway) - { - Gateway::create($gateway); - } - Gateway::whereIn('provider', $updateProviders)->update(array('recommended' => 1)); Gateway::where('provider', '=', 'AuthorizeNet_AIM')->update(array('sort_order' => 5, 'site_url' => 'http://reseller.authorize.net/application/?id=5560364')); @@ -33,5 +42,7 @@ class PaymentLibrariesSeeder extends Seeder //Gateway::where('provider', '=', 'FirstData_Connect')->update(array('sort_order' => 20, 'site_url' => 'https://www.firstdata.com/')); Gateway::where('provider', '=', 'PayPal_Pro')->update(array('sort_order' => 25, 'site_url' => 'https://www.paypal.com/')); Gateway::where('provider', '=', 'TwoCheckout')->update(array('sort_order' => 30, 'site_url' => 'https://www.2checkout.com/referral?r=2c37ac2298')); + */ + } } \ No newline at end of file diff --git a/app/routes.php b/app/routes.php index 9befd80562c1..4afaa5980ab5 100755 --- a/app/routes.php +++ b/app/routes.php @@ -224,6 +224,7 @@ define('GATEWAY_AUTHORIZE_NET', 1); define('GATEWAY_PAYPAL_EXPRESS', 17); define('GATEWAY_BEANSTREAM', 29); define('GATEWAY_PSIGATE', 30); +define('GATEWAY_MOOLAH', 31); define('EVENT_CREATE_CLIENT', 1); define('EVENT_CREATE_INVOICE', 2); diff --git a/app/views/accounts/payments.blade.php b/app/views/accounts/payments.blade.php index 88b0abad5e85..73684db59234 100755 --- a/app/views/accounts/payments.blade.php +++ b/app/views/accounts/payments.blade.php @@ -11,28 +11,32 @@ @if ($accountGateway) {{ Former::populateField('gateway_id', $accountGateway->gateway_id) }} {{ Former::populateField('recommendedGateway_id', $accountGateway->gateway_id) }} - @foreach ($accountGateway->fields as $field => $junk) - @if (in_array($field, ['solutionType', 'landingPage', 'headerImageUrl', 'brandName'])) - {{-- do nothing --}} - @else - {{ Former::populateField($accountGateway->gateway_id.'_'.$field, $config->$field) }} - @endif - @endforeach + @if ($config) + @foreach ($accountGateway->fields as $field => $junk) + @if (in_array($field, ['solutionType', 'landingPage', 'headerImageUrl', 'brandName'])) + {{-- do nothing --}} + @else + {{ Former::populateField($accountGateway->gateway_id.'_'.$field, $config->$field) }} + @endif + @endforeach + @endif @endif -
+
{{ Former::checkboxes('creditCardTypes[]')->label('Accepted Credit Cards') ->checkboxes($creditCardTypes)->class('creditcard-types') }}
+ +

 

- {{ Former::radios('recommendedGateway_id')->label('Recommended Gateways') + {{ Former::radios('recommendedGateway_id')->label('Recommended Gateway') ->radios($recommendedGateways)->class('recommended-gateway') }}
- {{ Former::select('gateway_id')->label('PayPal & Other Gateways')->addOption('', '') + {{ Former::select('gateway_id')->label('Select Gateway')->addOption('', '') ->dataClass('gateway-dropdown') ->fromQuery($dropdownGateways, 'name', 'id') ->onchange('setFieldsShown()'); }} @@ -57,6 +61,8 @@ @endforeach +

 

+ {{ Former::actions( Button::lg_success_submit('Save')->append_with_icon('floppy-disk') ) }} {{ Former::close() }} diff --git a/public/images/gateways/logo_AuthorizeNet_AIM.png b/public/images/gateways/logo_AuthorizeNet_AIM.png index 7aa524e38e1c..aeea9fba0f8e 100755 Binary files a/public/images/gateways/logo_AuthorizeNet_AIM.png and b/public/images/gateways/logo_AuthorizeNet_AIM.png differ