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

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

View File

@ -127,6 +127,36 @@
@section('payment_details')
{!! Former::open($url)
->autocomplete('on')
->addClass('payment-form')
->id('payment-form')
->rules(array(
'country_id' => 'required',
'currency_id' => 'required',
'account_number' => 'required',
'routing_number' => 'required',
'account_holder_name' => 'required',
'account_holder_type' => 'required',
'authorize_ach' => 'required',
)) !!}
{!! Former::populateField('account_holder_type', 'individual') !!}
{!! Former::populateField('country_id', $client->country_id) !!}
{!! Former::populateField('currency_id', $client->getCurrencyCode()) !!}
@if (Utils::isNinjaDev())
{!! Former::populateField('account_holder_name', 'Test Client') !!}
<script>
$(function() {
$('#routing_number').val('110000000');
$('#account_number').val('000123456789');
$('#confirm_account_number').val('000123456789');
$('#authorize_ach').prop('checked', true);
})
</script>
@endif
@if ($accountGateway->getPlaidEnabled())
<div id="plaid_container">
<a class="btn btn-default btn-lg" id="plaid_link_button">
@ -149,35 +179,6 @@
<p>{{ trans('texts.ach_verification_delay_help') }}</p><br/>
{!! Former::open($url)
->autocomplete('on')
->addClass('payment-form')
->id('payment-form')
->rules(array(
'country_id' => 'required',
'currency_id' => 'required',
'account_number' => 'required',
'routing_number' => 'required',
'account_holder_name' => 'required',
'account_holder_type' => 'required',
'authorize_ach' => 'required',
)) !!}
{!! Former::populateField('account_holder_type', 'individual') !!}
{!! Former::populateField('country_id', $client->country_id) !!}
{!! Former::populateField('currency_id', $client->getCurrencyCode()) !!}
@if (Utils::isNinjaDev())
{!! Former::populateField('account_holder_name', 'Test Client') !!}
<script>
$(function() {
$('#routing_number').val('110000000');
$('#account_number').val('000123456789');
$('#confirm_account_number').val('000123456789');
$('#authorize_ach').prop('checked', true);
})
</script>
@endif
{!! Former::radios('account_holder_type')->radios(array(
trans('texts.individual_account') => array('value' => 'individual'),
@ -235,7 +236,7 @@
->withAttributes(['id'=>'add_account_button'])
->large() !!}
@if($accountGateway->getPlaidEnabled() && !empty($amount))
@if ($accountGateway->getPlaidEnabled() && !empty($amount))
{!! Button::success(strtoupper(trans('texts.pay_now') . ' - ' . $account->formatMoney($amount, $client, true) ))
->submit()
->withAttributes(['style'=>'display:none', 'id'=>'pay_now_button'])
@ -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 () {