mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 12:12:48 +01:00
Support WePay in UK
This commit is contained in:
parent
c2d2c05c81
commit
3f1720a4d5
@ -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
|
||||
|
@ -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');
|
||||
|
@ -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) {
|
||||
|
@ -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') !!}
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
@ -40,21 +37,20 @@
|
||||
{!! Former::text('email') !!}
|
||||
{!! Former::text('company_name')->help('wepay_company_name_help')->maxlength(255) !!}
|
||||
|
||||
@if (WEPAY_ENABLE_CANADA)
|
||||
<div id="wepay-country">
|
||||
{!! Former::radios('country')
|
||||
->radios([
|
||||
trans('texts.united_states') => ['value' => 'US'],
|
||||
trans('texts.canada') => ['value' => 'CA'],
|
||||
]) !!}
|
||||
</div>
|
||||
<div id="wepay-accept-debit">
|
||||
{!! Former::checkbox('debit_cards')
|
||||
->text(trans('texts.accept_debit_cards'))
|
||||
->value(1) !!}
|
||||
<div id="wepay-country">
|
||||
{!! Former::radios('country')
|
||||
->radios([
|
||||
trans('texts.country_United States') => ['value' => 'US'],
|
||||
trans('texts.country_Canada') => ['value' => 'CA'],
|
||||
trans('texts.country_United Kingdom') => ['value' => 'GB'],
|
||||
]) !!}
|
||||
</div>
|
||||
<div id="wepay-accept-debit" style="display:none">
|
||||
{!! Former::checkbox('debit_cards')
|
||||
->text(trans('texts.accept_debit_cards'))
|
||||
->value(1) !!}
|
||||
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
{!! Former::checkbox('show_address')
|
||||
->label(trans('texts.billing_address'))
|
||||
|
Loading…
Reference in New Issue
Block a user