1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Change gateway flow

This commit is contained in:
Hillel Coren 2017-10-11 13:02:41 +03:00
parent 91faf106bd
commit 37752eb4ff
5 changed files with 14 additions and 11 deletions

View File

@ -89,26 +89,23 @@ class AccountGatewayController extends BaseController
$account = Auth::user()->account;
$accountGatewaysIds = $account->gatewayIds();
$otherProviders = Input::get('other_providers');
if (! env('WEPAY_CLIENT_ID') || Gateway::hasStandardGateway($accountGatewaysIds)) {
$otherProviders = true;
}
$wepay = Input::get('wepay');
$data = self::getViewModel();
$data['url'] = 'gateways';
$data['method'] = 'POST';
$data['title'] = trans('texts.add_gateway');
if ($otherProviders) {
if ($wepay) {
return View::make('accounts.account_gateway_wepay', $data);
} else {
$availableGatewaysIds = $account->availableGatewaysIds();
$data['primaryGateways'] = Gateway::primary($availableGatewaysIds)->orderBy('sort_order')->get();
$data['secondaryGateways'] = Gateway::secondary($availableGatewaysIds)->orderBy('name')->get();
$data['hiddenFields'] = Gateway::$hiddenFields;
$data['accountGatewaysIds'] = $accountGatewaysIds;
return View::make('accounts.account_gateway', $data);
} else {
return View::make('accounts.account_gateway_wepay', $data);
}
}

View File

@ -1,5 +1,12 @@
@extends('header')
@section('top-right')
@if (! count($accountGatewaysIds))
{!! Button::primary(trans('texts.sign_up_with_wepay'))
->asLinkTo(URL::to('/gateways/create?wepay=true')) !!}
@endif
@stop
@section('content')
@parent

View File

@ -145,7 +145,7 @@
<br/>
<center>
{!! Button::normal(trans('texts.use_another_provider'))->large()->asLinkTo(URL::to('/gateways/create?other_providers=true')) !!}
{!! Button::normal(trans('texts.cancel'))->large()->asLinkTo(HTMLUtils::previousUrl('/gateways/create'))->appendIcon(Icon::create('remove-circle')) !!}
{!! Button::success(trans('texts.sign_up_with_wepay'))->submit()->large() !!}
</center>

View File

@ -1,6 +1,5 @@
{!! Former::populateField(GATEWAY_STRIPE . '_apiKey', env('STRIPE_TEST_SECRET_KEY')) !!}
{!! Former::populateField('publishable_key', env('STRIPE_TEST_PUBLISHABLE_KEY')) !!}
{!! Former::populateField('enable_ach', 1) !!}
{!! Former::populateField('plaid_client_id', env('PLAID_TEST_CLIENT_ID')) !!}
{!! Former::populateField('plaid_secret', env('PLAID_TEST_SECRET')) !!}
{!! Former::populateField('plaid_public_key', env('PLAID_TEST_PUBLIC_KEY')) !!}

View File

@ -66,7 +66,7 @@ class AcceptanceTester extends \Codeception\Actor
{
if ( ! $I->grabFromDatabase('account_gateways', 'id', ['id' => 1])) {
$I->wantTo('create a gateway');
$I->amOnPage('/gateways/create?other_providers=true');
$I->amOnPage('/gateways/create');
$I->fillField(['name' =>'23_apiKey'], env('stripe_secret_key') ?: Fixtures::get('stripe_secret_key'));
$I->fillField(['name' =>'publishable_key'], '');
$I->click('Save');