Payment fixes

This commit is contained in:
Hillel Coren 2016-06-26 19:38:36 +03:00
parent 15781ff895
commit d71cf4dd49
8 changed files with 53 additions and 44 deletions

View File

@ -71,12 +71,10 @@ API_SECRET=password
WEPAY_CLIENT_ID=
WEPAY_CLIENT_SECRET=
WEPAY_AUTO_UPDATE=true # Requires permission from WePay
WEPAY_ENVIRONMENT=production # production or stage
WEPAY_AUTO_UPDATE=true # Requires permission from WePay
WEPAY_ENABLE_CANADA=true
WEPAY_FEE_PAYER=payee
WEPAY_APP_FEE_MULTIPLIER=0.002
WEPAY_APP_FEE_FIXED=0
# See https://www.wepay.com/developer/reference/structures#theme
WEPAY_THEME='{"name":"Invoice Ninja","primary_color":"0b4d78","secondary_color":"0b4d78","background_color":"f8f8f8","button_color":"33b753"}'
WEPAY_THEME='{"name":"Invoice Ninja","primary_color":"0b4d78","secondary_color":"0b4d78","background_color":"f8f8f8","button_color":"33b753"}' # See https://www.wepay.com/developer/reference/structures#theme

View File

@ -165,7 +165,7 @@ class ClientPortalController extends BaseController
Session::put('contact_key', $contactKey);// track current contact
return redirect()->to($client->account->enable_client_portal?'/client/dashboard':'/client/invoices/');
return redirect()->to($client->account->enable_client_portal_dashboard?'/client/dashboard':'/client/invoices/');
}
private function getPaymentTypes($account, $client, $invitation)
@ -694,7 +694,7 @@ class ClientPortalController extends BaseController
Session::flash('message', trans('texts.payment_method_verified'));
}
return redirect()->to($account->enable_client_portal?'/client/dashboard':'/client/payment_methods/');
return redirect()->to($account->enable_client_portal_dashboard?'/client/dashboard':'/client/payment_methods/');
}
public function removePaymentMethod($publicId)
@ -718,7 +718,7 @@ class ClientPortalController extends BaseController
Session::flash('error', $exception->getMessage());
}
return redirect()->to($client->account->enable_client_portal?'/client/dashboard':'/client/payment_methods/');
return redirect()->to($client->account->enable_client_portal_dashboard?'/client/dashboard':'/client/payment_methods/');
}
public function setDefaultPaymentMethod(){
@ -731,7 +731,7 @@ class ClientPortalController extends BaseController
$validator = Validator::make(Input::all(), array('source' => 'required'));
if ($validator->fails()) {
return Redirect::to($client->account->enable_client_portal?'/client/dashboard':'/client/payment_methods/');
return Redirect::to($client->account->enable_client_portal_dashboard?'/client/dashboard':'/client/payment_methods/');
}
$paymentDriver = $account->paymentDriver(false, GATEWAY_TYPE_TOKEN);
@ -745,7 +745,7 @@ class ClientPortalController extends BaseController
Session::flash('message', trans('texts.payment_method_set_as_default'));
return redirect()->to($client->account->enable_client_portal?'/client/dashboard':'/client/payment_methods/');
return redirect()->to($client->account->enable_client_portal_dashboard?'/client/dashboard':'/client/payment_methods/');
}
private function paymentMethodError($type, $error, $accountGateway = false, $exception = false)

View File

@ -210,7 +210,7 @@ class WePayPaymentDriver extends BasePaymentDriver
private function calculateApplicationFee($amount)
{
$fee = WEPAY_APP_FEE_MULTIPLIER * $amount + WEPAY_APP_FEE_FIXED;
$fee = (WEPAY_APP_FEE_MULTIPLIER * $amount) + WEPAY_APP_FEE_FIXED;
return floor(min($fee, $amount * 0.2));// Maximum fee is 20% of the amount.
}

View File

@ -27,6 +27,10 @@
{!! Former::populateField('show_address', 1) !!}
{!! Former::populateField('update_address', 1) !!}
@if (WEPAY_ENABLE_CANADA)
{!! Former::populateField('country', 'US') !!}
@endif
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.online_payments') !!}</h3>

View File

@ -256,4 +256,6 @@
</center>
<p>&nbsp;</p>
{!! Former::close() !!}
@stop

View File

@ -54,7 +54,7 @@
</div>
{!! Former::close() !!}
<script type="text/javascript">

View File

@ -2,8 +2,9 @@
@section('content')
<div class="container main-container">
<h3>{{ $title }}</h3>
@include('payments.paymentmethods_list')
<p></p>
</div>
@stop

View File

@ -127,28 +127,6 @@
@section('payment_details')
@if ($accountGateway->getPlaidEnabled())
<div id="plaid_container">
<a class="btn btn-default btn-lg" id="plaid_link_button">
<img src="{{ URL::to('images/plaid-logo.svg') }}">
<img src="{{ URL::to('images/plaid-logowhite.svg') }}" class="hoverimg">
{{ trans('texts.link_with_plaid') }}
</a>
<div id="plaid_linked">
<div id="plaid_linked_status"></div>
<a href="#" id="plaid_unlink">{{ trans('texts.unlink') }}</a>
</div>
</div>
@endif
<div id="manual_container">
@if($accountGateway->getPlaidEnabled())
<div id="plaid_or"><span>{{ trans('texts.or') }}</span></div>
<h4>{{ trans('texts.link_manually') }}</h4>
@endif
<p>{{ trans('texts.ach_verification_delay_help') }}</p><br/>
{!! Former::open($url)
->autocomplete('on')
->addClass('payment-form')
@ -179,6 +157,29 @@
</script>
@endif
@if ($accountGateway->getPlaidEnabled())
<div id="plaid_container">
<a class="btn btn-default btn-lg" id="plaid_link_button">
<img src="{{ URL::to('images/plaid-logo.svg') }}">
<img src="{{ URL::to('images/plaid-logowhite.svg') }}" class="hoverimg">
{{ trans('texts.link_with_plaid') }}
</a>
<div id="plaid_linked">
<div id="plaid_linked_status"></div>
<a href="#" id="plaid_unlink">{{ trans('texts.unlink') }}</a>
</div>
</div>
@endif
<div id="manual_container">
@if($accountGateway->getPlaidEnabled())
<div id="plaid_or"><span>{{ trans('texts.or') }}</span></div>
<h4>{{ trans('texts.link_manually') }}</h4>
@endif
<p>{{ trans('texts.ach_verification_delay_help') }}</p><br/>
{!! Former::radios('account_holder_type')->radios(array(
trans('texts.individual_account') => array('value' => 'individual'),
trans('texts.company_account') => array('value' => 'company'),
@ -244,6 +245,9 @@
</div>
{!! Former::close() !!}
<script type="text/javascript">
var routingNumberCache = {};
$('#routing_number, #country').on('change keypress keyup keydown paste', function(){setTimeout(function () {