diff --git a/app/Http/Controllers/AccountGatewayController.php b/app/Http/Controllers/AccountGatewayController.php index 34a378379d21..fef9a511636e 100644 --- a/app/Http/Controllers/AccountGatewayController.php +++ b/app/Http/Controllers/AccountGatewayController.php @@ -87,6 +87,7 @@ class AccountGatewayController extends BaseController ->where('id', '!=', GATEWAY_GOCARDLESS) ->where('id', '!=', GATEWAY_DWOLLA) ->where('id', '!=', GATEWAY_STRIPE) + ->where('id', '!=', GATEWAY_WEPAY) ->orderBy('name')->get(); $data['hiddenFields'] = Gateway::$hiddenFields; @@ -245,8 +246,11 @@ class AccountGatewayController extends BaseController $accountGateway = AccountGateway::createNew(); $accountGateway->gateway_id = $gatewayId; - if ($gatewayId == GATEWAY_WEPAY && !$this->setupWePay($accountGateway, $wepayResponse)) { - return $wepayResponse; + if ($gatewayId == GATEWAY_WEPAY) { + if(!$this->setupWePay($accountGateway, $wepayResponse)) { + return $wepayResponse; + } + $oldConfig = $accountGateway->getConfig(); } } @@ -265,7 +269,7 @@ class AccountGatewayController extends BaseController $config->$field = $value; } } - } else { + } elseif($oldConfig) { $config = clone $oldConfig; } diff --git a/resources/views/accounts/partials/account_gateway_wepay.blade.php b/resources/views/accounts/partials/account_gateway_wepay.blade.php index edda271d1479..4d6832a8c1f5 100644 --- a/resources/views/accounts/partials/account_gateway_wepay.blade.php +++ b/resources/views/accounts/partials/account_gateway_wepay.blade.php @@ -10,6 +10,9 @@ {!! Former::populateField('first_name', $user->first_name) !!} {!! Former::populateField('last_name', $user->last_name) !!} {!! Former::populateField('email', $user->email) !!} +{!! Former::populateField('show_address', 1) !!} +{!! Former::populateField('update_address', 1) !!} +{!! Former::populateField('token_billing_type_id', $account->token_billing_type_id) !!}

{!! trans('texts.online_payments') !!}

@@ -20,6 +23,23 @@ {!! Former::text('email') !!} {!! Former::text('company_name')->help('wepay_company_name_help')->maxlength(255) !!} {!! Former::text('description')->help('wepay_description_help') !!} + {!! Former::select('token_billing_type_id') + ->options($tokenBillingOptions) + ->help(trans('texts.token_billing_help')) !!} + {!! Former::checkbox('show_address') + ->label(trans('texts.billing_address')) + ->text(trans('texts.show_address_help')) + ->addGroupClass('gateway-option') !!} + {!! Former::checkbox('update_address') + ->label(' ') + ->text(trans('texts.update_address_help')) + ->addGroupClass('gateway-option') !!} + {!! Former::checkboxes('creditCardTypes[]') + ->label('Accepted Credit Cards') + ->checkboxes($creditCardTypes) + ->class('creditcard-types') + ->addGroupClass('gateway-option') + !!} {!! Former::checkbox('tos_agree')->label(' ')->text(trans('texts.wepay_tos_agree', ['link'=>''.trans('texts.wepay_tos_link_text').''] ))->value('true') !!}