1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Added moolah as recommended payment gateway

This commit is contained in:
Hillel Coren 2014-10-05 16:07:04 +03:00
parent a4e949daec
commit e7184ab59d
5 changed files with 58 additions and 37 deletions

View File

@ -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)

View File

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

View File

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

View File

@ -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
<div class="two-column">
<div class="two-column">
{{ Former::checkboxes('creditCardTypes[]')->label('Accepted Credit Cards')
->checkboxes($creditCardTypes)->class('creditcard-types')
}}
</div>
<p/>&nbsp;<p/>
<div class="two-column">
{{ Former::radios('recommendedGateway_id')->label('Recommended Gateways')
{{ Former::radios('recommendedGateway_id')->label('Recommended Gateway')
->radios($recommendedGateways)->class('recommended-gateway')
}}
</div>
{{ 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
<p/>&nbsp;<p/>
{{ Former::actions( Button::lg_success_submit('Save')->append_with_icon('floppy-disk') ) }}
{{ Former::close() }}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB