diff --git a/.env.example b/.env.example index 20b6756d2570..b538ab1a0796 100644 --- a/.env.example +++ b/.env.example @@ -87,7 +87,6 @@ WEPAY_CLIENT_ID= WEPAY_CLIENT_SECRET= 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_CC_MULTIPLIER=0 WEPAY_APP_FEE_ACH_MULTIPLIER=0 diff --git a/app/Constants.php b/app/Constants.php index be072a65e520..7fbece5fe35a 100644 --- a/app/Constants.php +++ b/app/Constants.php @@ -511,7 +511,6 @@ if (! defined('APP_NAME')) { define('WEPAY_CLIENT_SECRET', env('WEPAY_CLIENT_SECRET')); define('WEPAY_AUTO_UPDATE', env('WEPAY_AUTO_UPDATE', false)); define('WEPAY_ENVIRONMENT', env('WEPAY_ENVIRONMENT', WEPAY_PRODUCTION)); - define('WEPAY_ENABLE_CANADA', env('WEPAY_ENABLE_CANADA', false)); define('WEPAY_THEME', env('WEPAY_THEME', '{"name":"Invoice Ninja","primary_color":"0b4d78","secondary_color":"0b4d78","background_color":"f8f8f8","button_color":"33b753"}')); define('SKYPE_CARD_RECEIPT', 'message/card.receipt'); diff --git a/app/Http/Controllers/AccountGatewayController.php b/app/Http/Controllers/AccountGatewayController.php index d70679115ec2..f7f273411e55 100644 --- a/app/Http/Controllers/AccountGatewayController.php +++ b/app/Http/Controllers/AccountGatewayController.php @@ -378,12 +378,9 @@ class AccountGatewayController extends BaseController 'first_name' => 'required', 'last_name' => 'required', 'email' => 'required|email', + 'country' => 'required|in:US,CA,GB', ]; - if (WEPAY_ENABLE_CANADA) { - $rules['country'] = 'required|in:US,CA'; - } - $validator = Validator::make(Input::all(), $rules); if ($validator->fails()) { @@ -428,15 +425,14 @@ class AccountGatewayController extends BaseController 'theme_object' => json_decode(WEPAY_THEME), 'callback_uri' => $accountGateway->getWebhookUrl(), 'rbits' => $account->present()->rBits, + 'country' => Input::get('country'), ]; - if (WEPAY_ENABLE_CANADA) { - $accountDetails['country'] = Input::get('country'); - - if (Input::get('country') == 'CA') { - $accountDetails['currencies'] = ['CAD']; - $accountDetails['country_options'] = ['debit_opt_in' => boolval(Input::get('debit_cards'))]; - } + if (Input::get('country') == 'CA') { + $accountDetails['currencies'] = ['CAD']; + $accountDetails['country_options'] = ['debit_opt_in' => boolval(Input::get('debit_cards'))]; + } elseif (Input::get('country') == 'GB') { + $accountDetails['currencies'] = ['GBP']; } $wepayAccount = $wepay->request('account/create/', $accountDetails); @@ -461,7 +457,7 @@ class AccountGatewayController extends BaseController 'accountId' => $wepayAccount->account_id, 'state' => $wepayAccount->state, 'testMode' => WEPAY_ENVIRONMENT == WEPAY_STAGE, - 'country' => WEPAY_ENABLE_CANADA ? Input::get('country') : 'US', + 'country' => Input::get('country'), ]); if ($confirmationRequired) { diff --git a/resources/views/accounts/account_gateway_wepay.blade.php b/resources/views/accounts/account_gateway_wepay.blade.php index faa61463cf55..4093d2f02ce7 100644 --- a/resources/views/accounts/account_gateway_wepay.blade.php +++ b/resources/views/accounts/account_gateway_wepay.blade.php @@ -25,10 +25,7 @@ {!! Former::populateField('email', $user->email) !!} {!! Former::populateField('show_address', 1) !!} {!! Former::populateField('update_address', 1) !!} - - @if (WEPAY_ENABLE_CANADA) - {!! Former::populateField('country', 'US') !!} - @endif + {!! Former::populateField('country', 'US') !!}
@@ -40,21 +37,20 @@ {!! Former::text('email') !!} {!! Former::text('company_name')->help('wepay_company_name_help')->maxlength(255) !!} - @if (WEPAY_ENABLE_CANADA) -
- {!! Former::radios('country') - ->radios([ - trans('texts.united_states') => ['value' => 'US'], - trans('texts.canada') => ['value' => 'CA'], - ]) !!} -
-
- {!! Former::checkbox('debit_cards') - ->text(trans('texts.accept_debit_cards')) - ->value(1) !!} +
+ {!! Former::radios('country') + ->radios([ + trans('texts.country_United States') => ['value' => 'US'], + trans('texts.country_Canada') => ['value' => 'CA'], + trans('texts.country_United Kingdom') => ['value' => 'GB'], + ]) !!} +
+ - @endif +
{!! Former::checkbox('show_address') ->label(trans('texts.billing_address'))