diff --git a/.env.example b/.env.example index c7cd8ea6d6d9..346e181095b7 100644 --- a/.env.example +++ b/.env.example @@ -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 diff --git a/app/Http/Controllers/ClientPortalController.php b/app/Http/Controllers/ClientPortalController.php index 5962a3ce4cbf..2755ae71992d 100644 --- a/app/Http/Controllers/ClientPortalController.php +++ b/app/Http/Controllers/ClientPortalController.php @@ -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) diff --git a/app/Ninja/PaymentDrivers/WePayPaymentDriver.php b/app/Ninja/PaymentDrivers/WePayPaymentDriver.php index 74a979c09cf3..096172cfd727 100644 --- a/app/Ninja/PaymentDrivers/WePayPaymentDriver.php +++ b/app/Ninja/PaymentDrivers/WePayPaymentDriver.php @@ -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. } diff --git a/resources/views/accounts/account_gateway_wepay.blade.php b/resources/views/accounts/account_gateway_wepay.blade.php index 00367af2de8a..5017f43fc2bd 100644 --- a/resources/views/accounts/account_gateway_wepay.blade.php +++ b/resources/views/accounts/account_gateway_wepay.blade.php @@ -27,6 +27,10 @@ {!! Former::populateField('show_address', 1) !!} {!! Former::populateField('update_address', 1) !!} + @if (WEPAY_ENABLE_CANADA) + {!! Former::populateField('country', 'US') !!} + @endif +
+ {!! Former::close() !!} + @stop diff --git a/resources/views/payments/payment_method.blade.php b/resources/views/payments/payment_method.blade.php index 27d58d9b6aba..02ea7e1b2c20 100644 --- a/resources/views/payments/payment_method.blade.php +++ b/resources/views/payments/payment_method.blade.php @@ -54,7 +54,7 @@