Include WePay in select list

This commit is contained in:
Hillel Coren 2017-12-03 10:49:00 +02:00
parent 6ed2d5b8c4
commit fc1afe05a5
5 changed files with 36 additions and 23 deletions

View File

@ -42,9 +42,8 @@ class Gateway extends Eloquent
*/ */
public static $preferred = [ public static $preferred = [
GATEWAY_PAYPAL_EXPRESS, GATEWAY_PAYPAL_EXPRESS,
GATEWAY_BITPAY,
GATEWAY_DWOLLA,
GATEWAY_STRIPE, GATEWAY_STRIPE,
GATEWAY_WEPAY,
GATEWAY_BRAINTREE, GATEWAY_BRAINTREE,
GATEWAY_AUTHORIZE_NET, GATEWAY_AUTHORIZE_NET,
GATEWAY_MOLLIE, GATEWAY_MOLLIE,
@ -140,7 +139,6 @@ class Gateway extends Eloquent
public function scopePrimary($query, $accountGatewaysIds) public function scopePrimary($query, $accountGatewaysIds)
{ {
$query->where('payment_library_id', '=', 1) $query->where('payment_library_id', '=', 1)
->where('id', '!=', GATEWAY_WEPAY)
->whereIn('id', static::$preferred) ->whereIn('id', static::$preferred)
->whereIn('id', $accountGatewaysIds); ->whereIn('id', $accountGatewaysIds);
} }
@ -152,7 +150,6 @@ class Gateway extends Eloquent
public function scopeSecondary($query, $accountGatewaysIds) public function scopeSecondary($query, $accountGatewaysIds)
{ {
$query->where('payment_library_id', '=', 1) $query->where('payment_library_id', '=', 1)
->where('id', '!=', GATEWAY_WEPAY)
->whereNotIn('id', static::$preferred) ->whereNotIn('id', static::$preferred)
->whereIn('id', $accountGatewaysIds); ->whereIn('id', $accountGatewaysIds);
} }
@ -178,11 +175,13 @@ class Gateway extends Eloquent
$link = 'https://applications.sagepay.com/apply/2C02C252-0F8A-1B84-E10D-CF933EFCAA99'; $link = 'https://applications.sagepay.com/apply/2C02C252-0F8A-1B84-E10D-CF933EFCAA99';
} elseif ($this->id == GATEWAY_STRIPE) { } elseif ($this->id == GATEWAY_STRIPE) {
$link = 'https://dashboard.stripe.com/account/apikeys'; $link = 'https://dashboard.stripe.com/account/apikeys';
} elseif ($this->id == GATEWAY_WEPAY) {
$link = url('/gateways/create?wepay=true');
} }
$key = 'texts.gateway_help_'.$this->id; $key = 'texts.gateway_help_'.$this->id;
$str = trans($key, [ $str = trans($key, [
'link' => "<a href='$link' target='_blank'>Click here</a>", 'link' => "<a href='$link' >Click here</a>",
'complete_link' => url('/complete'), 'complete_link' => url('/complete'),
]); ]);

View File

@ -9,7 +9,7 @@ class PaymentLibrariesSeeder extends Seeder
Eloquent::unguard(); Eloquent::unguard();
$gateways = [ $gateways = [
['name' => 'Authorize.Net AIM', 'provider' => 'AuthorizeNet_AIM', 'sort_order' => 4], ['name' => 'Authorize.Net AIM', 'provider' => 'AuthorizeNet_AIM', 'sort_order' => 5],
['name' => 'Authorize.Net SIM', 'provider' => 'AuthorizeNet_SIM', 'payment_library_id' => 2], ['name' => 'Authorize.Net SIM', 'provider' => 'AuthorizeNet_SIM', 'payment_library_id' => 2],
['name' => 'CardSave', 'provider' => 'CardSave'], ['name' => 'CardSave', 'provider' => 'CardSave'],
['name' => 'Eway Rapid', 'provider' => 'Eway_RapidShared', 'is_offsite' => true], ['name' => 'Eway Rapid', 'provider' => 'Eway_RapidShared', 'is_offsite' => true],
@ -17,7 +17,7 @@ class PaymentLibrariesSeeder extends Seeder
['name' => 'GoCardless', 'provider' => 'GoCardless', 'is_offsite' => true, 'payment_library_id' => 2], ['name' => 'GoCardless', 'provider' => 'GoCardless', 'is_offsite' => true, 'payment_library_id' => 2],
['name' => 'Migs ThreeParty', 'provider' => 'Migs_ThreeParty'], ['name' => 'Migs ThreeParty', 'provider' => 'Migs_ThreeParty'],
['name' => 'Migs TwoParty', 'provider' => 'Migs_TwoParty'], ['name' => 'Migs TwoParty', 'provider' => 'Migs_TwoParty'],
['name' => 'Mollie', 'provider' => 'Mollie', 'is_offsite' => true, 'sort_order' => 7], ['name' => 'Mollie', 'provider' => 'Mollie', 'is_offsite' => true, 'sort_order' => 8],
['name' => 'MultiSafepay', 'provider' => 'MultiSafepay'], ['name' => 'MultiSafepay', 'provider' => 'MultiSafepay'],
['name' => 'Netaxept', 'provider' => 'Netaxept'], ['name' => 'Netaxept', 'provider' => 'Netaxept'],
['name' => 'NetBanx', 'provider' => 'NetBanx'], ['name' => 'NetBanx', 'provider' => 'NetBanx'],
@ -25,7 +25,7 @@ class PaymentLibrariesSeeder extends Seeder
['name' => 'Payflow Pro', 'provider' => 'Payflow_Pro'], ['name' => 'Payflow Pro', 'provider' => 'Payflow_Pro'],
['name' => 'PaymentExpress PxPay', 'provider' => 'PaymentExpress_PxPay'], ['name' => 'PaymentExpress PxPay', 'provider' => 'PaymentExpress_PxPay'],
['name' => 'PaymentExpress PxPost', 'provider' => 'PaymentExpress_PxPost'], ['name' => 'PaymentExpress PxPost', 'provider' => 'PaymentExpress_PxPost'],
['name' => 'PayPal Express', 'provider' => 'PayPal_Express', 'is_offsite' => true, 'sort_order' => 3], ['name' => 'PayPal Express', 'provider' => 'PayPal_Express', 'is_offsite' => true, 'sort_order' => 4],
['name' => 'PayPal Pro', 'provider' => 'PayPal_Pro'], ['name' => 'PayPal Pro', 'provider' => 'PayPal_Pro'],
['name' => 'Pin', 'provider' => 'Pin'], ['name' => 'Pin', 'provider' => 'Pin'],
['name' => 'SagePay Direct', 'provider' => 'SagePay_Direct'], ['name' => 'SagePay Direct', 'provider' => 'SagePay_Direct'],
@ -50,8 +50,8 @@ class PaymentLibrariesSeeder extends Seeder
['name' => 'Realex', 'provider' => 'Realex_Remote'], ['name' => 'Realex', 'provider' => 'Realex_Remote'],
['name' => 'Sisow', 'provider' => 'Sisow'], ['name' => 'Sisow', 'provider' => 'Sisow'],
['name' => 'Skrill', 'provider' => 'Skrill', 'is_offsite' => true], ['name' => 'Skrill', 'provider' => 'Skrill', 'is_offsite' => true],
['name' => 'BitPay', 'provider' => 'BitPay', 'is_offsite' => true, 'sort_order' => 6], ['name' => 'BitPay', 'provider' => 'BitPay', 'is_offsite' => true, 'sort_order' => 7],
['name' => 'Dwolla', 'provider' => 'Dwolla', 'is_offsite' => true, 'sort_order' => 5], ['name' => 'Dwolla', 'provider' => 'Dwolla', 'is_offsite' => true, 'sort_order' => 6],
['name' => 'AGMS', 'provider' => 'Agms'], ['name' => 'AGMS', 'provider' => 'Agms'],
['name' => 'Barclays', 'provider' => 'BarclaysEpdq\Essential'], ['name' => 'Barclays', 'provider' => 'BarclaysEpdq\Essential'],
['name' => 'Cardgate', 'provider' => 'Cardgate'], ['name' => 'Cardgate', 'provider' => 'Cardgate'],
@ -68,11 +68,11 @@ class PaymentLibrariesSeeder extends Seeder
['name' => 'Secure Trading', 'provider' => 'SecureTrading'], ['name' => 'Secure Trading', 'provider' => 'SecureTrading'],
['name' => 'SecPay', 'provider' => 'SecPay'], ['name' => 'SecPay', 'provider' => 'SecPay'],
['name' => 'WeChat Express', 'provider' => 'WeChat_Express', 'payment_library_id' => 2], ['name' => 'WeChat Express', 'provider' => 'WeChat_Express', 'payment_library_id' => 2],
['name' => 'WePay', 'provider' => 'WePay', 'is_offsite' => false], ['name' => 'WePay', 'provider' => 'WePay', 'is_offsite' => false, 'sort_order' => 3],
['name' => 'Braintree', 'provider' => 'Braintree', 'sort_order' => 2], ['name' => 'Braintree', 'provider' => 'Braintree', 'sort_order' => 3],
['name' => 'Custom', 'provider' => 'Custom', 'is_offsite' => true, 'sort_order' => 9], ['name' => 'Custom', 'provider' => 'Custom', 'is_offsite' => true, 'sort_order' => 20],
['name' => 'FirstData Payeezy', 'provider' => 'FirstData_Payeezy'], ['name' => 'FirstData Payeezy', 'provider' => 'FirstData_Payeezy'],
['name' => 'GoCardless', 'provider' => 'GoCardlessV2\Redirect', 'sort_order' => 8, 'is_offsite' => true], ['name' => 'GoCardless', 'provider' => 'GoCardlessV2\Redirect', 'sort_order' => 9, 'is_offsite' => true],
['name' => 'PagSeguro', 'provider' => 'PagSeguro'], ['name' => 'PagSeguro', 'provider' => 'PagSeguro'],
]; ];

View File

@ -386,6 +386,7 @@ $LANG = array(
'gateway_help_2' => ':link to sign up for Authorize.net.', 'gateway_help_2' => ':link to sign up for Authorize.net.',
'gateway_help_17' => ':link to get your PayPal API signature.', 'gateway_help_17' => ':link to get your PayPal API signature.',
'gateway_help_27' => ':link to sign up for 2Checkout.com. To ensure payments are tracked set :complete_link as the redirect URL under Account > Site Management in the 2Checkout portal.', 'gateway_help_27' => ':link to sign up for 2Checkout.com. To ensure payments are tracked set :complete_link as the redirect URL under Account > Site Management in the 2Checkout portal.',
'gateway_help_60' => ':link to create a WePay account.',
'more_designs' => 'More designs', 'more_designs' => 'More designs',
'more_designs_title' => 'Additional Invoice Designs', 'more_designs_title' => 'Additional Invoice Designs',
'more_designs_cloud_header' => 'Go Pro for more invoice designs', 'more_designs_cloud_header' => 'Go Pro for more invoice designs',

View File

@ -14,14 +14,6 @@
</style> </style>
@stop @stop
@section('top-right')
@if (env('WEPAY_CLIENT_ID') && isset($accountGatewaysIds) && ! count($accountGatewaysIds))
{!! Button::primary(trans('texts.sign_up_with_wepay'))
->asLinkTo(URL::to('/gateways/create?wepay=true')) !!}
@endif
@stop
@section('content') @section('content')
@parent @parent
@ -283,7 +275,7 @@
<center> <center>
{!! Button::normal(trans('texts.cancel'))->large()->asLinkTo(URL::to('/settings/online_payments'))->appendIcon(Icon::create('remove-circle')) !!} {!! Button::normal(trans('texts.cancel'))->large()->asLinkTo(URL::to('/settings/online_payments'))->appendIcon(Icon::create('remove-circle')) !!}
{!! Button::success(trans('texts.save'))->submit()->large()->appendIcon(Icon::create('floppy-disk')) !!} {!! Button::success(trans('texts.save'))->addClass(['save-button'])->submit()->large()->appendIcon(Icon::create('floppy-disk')) !!}
</center> </center>
{!! Former::close() !!} {!! Former::close() !!}
@ -300,6 +292,12 @@
$('.secondary-gateway').show(); $('.secondary-gateway').show();
} }
if (primaryId == {{ GATEWAY_WEPAY }}) {
$('.save-button').prop('disabled', true);
} else {
$('.save-button').prop('disabled', false);
}
var val = primaryId || secondaryId; var val = primaryId || secondaryId;
$('.gateway-fields').hide(); $('.gateway-fields').hide();
$('#gateway_' + val + '_div').show(); $('#gateway_' + val + '_div').show();

View File

@ -1,5 +1,19 @@
@extends('header') @extends('header')
@section('head')
@parent
<style type="text/css">
label.checkbox-inline {
padding-left: 0px;
}
label.checkbox-inline div {
padding-left: 20px;
}
</style>
@stop
@section('content') @section('content')
@parent @parent
@ -64,6 +78,7 @@
->label('accepted_card_logos') ->label('accepted_card_logos')
->checkboxes($creditCardTypes) ->checkboxes($creditCardTypes)
->class('creditcard-types') ->class('creditcard-types')
->inline()
->value(1) !!} ->value(1) !!}
{!! Former::checkbox('enable_ach') {!! Former::checkbox('enable_ach')
->label(trans('texts.ach')) ->label(trans('texts.ach'))