Require authorization for ACH

This commit is contained in:
Joshua Dwire 2016-05-06 11:21:06 -04:00
parent 37f4430e62
commit 70b9c9bba7
4 changed files with 20 additions and 4 deletions

View File

@ -447,6 +447,11 @@ class PaymentController extends BaseController
// check if we're creating/using a billing token // check if we're creating/using a billing token
if ($accountGateway->gateway_id == GATEWAY_STRIPE) { if ($accountGateway->gateway_id == GATEWAY_STRIPE) {
if ($paymentType == PAYMENT_TYPE_STRIPE_ACH && !Input::get('authorize_ach')) {
Session::flash('error', trans('texts.ach_authorization_required'));
return Redirect::to('payment/'.$invitationKey)->withInput(Request::except('cvv'));
}
if ($useToken) { if ($useToken) {
$details['customerReference'] = $client->getGatewayToken(); $details['customerReference'] = $client->getGatewayToken();
unset($details['token']); unset($details['token']);

View File

@ -802,11 +802,16 @@ class PublicClientController extends BaseController
$details = array('plaidPublicToken' => Input::get('plaidPublicToken'), 'plaidAccountId' => Input::get('plaidAccountId')); $details = array('plaidPublicToken' => Input::get('plaidPublicToken'), 'plaidAccountId' => Input::get('plaidAccountId'));
} }
if ($paymentType == PAYMENT_TYPE_STRIPE_ACH && !Input::get('authorize_ach')) {
Session::flash('error', trans('texts.ach_authorization_required'));
return Redirect::to('client/paymentmethods/add/' . $typeLink)->withInput(Request::except('cvv'));
}
if (!empty($details)) { if (!empty($details)) {
$gateway = $this->paymentService->createGateway($accountGateway); $gateway = $this->paymentService->createGateway($accountGateway);
$sourceId = $this->paymentService->createToken($gateway, $details, $accountGateway, $client, $invitation->contact_id); $sourceId = $this->paymentService->createToken($gateway, $details, $accountGateway, $client, $invitation->contact_id);
} else { } else {
return Redirect::to('payment/'.$invitation->invitation_key)->withInput(Request::except('cvv')); return Redirect::to('client/paymentmethods/add/' . $typeLink)->withInput(Request::except('cvv'));
} }
if(empty($sourceId)) { if(empty($sourceId)) {

View File

@ -1265,6 +1265,8 @@ $LANG = array(
'plaid_linked_status' => 'Your bank account at :bank', 'plaid_linked_status' => 'Your bank account at :bank',
'add_payment_method' => 'Add Payment Method', 'add_payment_method' => 'Add Payment Method',
'account_holder_type' => 'Account Holder Type', 'account_holder_type' => 'Account Holder Type',
'ach_authorization' => 'I authorize :company to electronically debit my account and, if necessary, electronically credit my account to correct erroneous debits.',
'ach_authorization_required' => 'You must consent to ACH transactions.'
); );
return $LANG; return $LANG;

View File

@ -245,7 +245,8 @@
'account_number' => 'required', 'account_number' => 'required',
'routing_number' => 'required', 'routing_number' => 'required',
'account_holder_name' => 'required', 'account_holder_name' => 'required',
'account_holder_type' => 'required' 'account_holder_type' => 'required',
'authorize_ach' => 'required',
)) !!} )) !!}
@else @else
{!! Former::vertical_open($url) {!! Former::vertical_open($url)
@ -457,9 +458,12 @@
{!! Former::text('') {!! Former::text('')
->id('confirm_account_number') ->id('confirm_account_number')
->label(trans('texts.confirm_account_number')) !!} ->label(trans('texts.confirm_account_number')) !!}
{!! Former::checkbox('authorize_ach')
->text(trans('texts.ach_authorization', ['company'=>$account->getDisplayName()]))
->label(' ') !!}
</div> </div>
</div> </div>
<center> <div class="col-md-8 col-md-offset-4">
{!! Button::success(strtoupper(trans('texts.add_account'))) {!! Button::success(strtoupper(trans('texts.add_account')))
->submit() ->submit()
->withAttributes(['id'=>'add_account_button']) ->withAttributes(['id'=>'add_account_button'])
@ -470,7 +474,7 @@
->withAttributes(['style'=>'display:none', 'id'=>'pay_now_button']) ->withAttributes(['style'=>'display:none', 'id'=>'pay_now_button'])
->large() !!} ->large() !!}
@endif @endif
</center> </div>
@else @else
<div class="row"> <div class="row">
<div class="col-md-9"> <div class="col-md-9">