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

View File

@ -9,7 +9,7 @@ class PaymentLibrariesSeeder extends Seeder
Eloquent::unguard();
$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' => 'CardSave', 'provider' => 'CardSave'],
['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' => 'Migs ThreeParty', 'provider' => 'Migs_ThreeParty'],
['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' => 'Netaxept', 'provider' => 'Netaxept'],
['name' => 'NetBanx', 'provider' => 'NetBanx'],
@ -25,7 +25,7 @@ class PaymentLibrariesSeeder extends Seeder
['name' => 'Payflow Pro', 'provider' => 'Payflow_Pro'],
['name' => 'PaymentExpress PxPay', 'provider' => 'PaymentExpress_PxPay'],
['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' => 'Pin', 'provider' => 'Pin'],
['name' => 'SagePay Direct', 'provider' => 'SagePay_Direct'],
@ -50,8 +50,8 @@ class PaymentLibrariesSeeder extends Seeder
['name' => 'Realex', 'provider' => 'Realex_Remote'],
['name' => 'Sisow', 'provider' => 'Sisow'],
['name' => 'Skrill', 'provider' => 'Skrill', 'is_offsite' => true],
['name' => 'BitPay', 'provider' => 'BitPay', 'is_offsite' => true, 'sort_order' => 6],
['name' => 'Dwolla', 'provider' => 'Dwolla', 'is_offsite' => true, 'sort_order' => 5],
['name' => 'BitPay', 'provider' => 'BitPay', 'is_offsite' => true, 'sort_order' => 7],
['name' => 'Dwolla', 'provider' => 'Dwolla', 'is_offsite' => true, 'sort_order' => 6],
['name' => 'AGMS', 'provider' => 'Agms'],
['name' => 'Barclays', 'provider' => 'BarclaysEpdq\Essential'],
['name' => 'Cardgate', 'provider' => 'Cardgate'],
@ -68,11 +68,11 @@ class PaymentLibrariesSeeder extends Seeder
['name' => 'Secure Trading', 'provider' => 'SecureTrading'],
['name' => 'SecPay', 'provider' => 'SecPay'],
['name' => 'WeChat Express', 'provider' => 'WeChat_Express', 'payment_library_id' => 2],
['name' => 'WePay', 'provider' => 'WePay', 'is_offsite' => false],
['name' => 'Braintree', 'provider' => 'Braintree', 'sort_order' => 2],
['name' => 'Custom', 'provider' => 'Custom', 'is_offsite' => true, 'sort_order' => 9],
['name' => 'WePay', 'provider' => 'WePay', 'is_offsite' => false, 'sort_order' => 3],
['name' => 'Braintree', 'provider' => 'Braintree', 'sort_order' => 3],
['name' => 'Custom', 'provider' => 'Custom', 'is_offsite' => true, 'sort_order' => 20],
['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'],
];

View File

@ -386,6 +386,7 @@ $LANG = array(
'gateway_help_2' => ':link to sign up for Authorize.net.',
'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_60' => ':link to create a WePay account.',
'more_designs' => 'More designs',
'more_designs_title' => 'Additional Invoice Designs',
'more_designs_cloud_header' => 'Go Pro for more invoice designs',

View File

@ -14,14 +14,6 @@
</style>
@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')
@parent
@ -283,7 +275,7 @@
<center>
{!! 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>
{!! Former::close() !!}
@ -300,6 +292,12 @@
$('.secondary-gateway').show();
}
if (primaryId == {{ GATEWAY_WEPAY }}) {
$('.save-button').prop('disabled', true);
} else {
$('.save-button').prop('disabled', false);
}
var val = primaryId || secondaryId;
$('.gateway-fields').hide();
$('#gateway_' + val + '_div').show();

View File

@ -1,5 +1,19 @@
@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')
@parent
@ -64,6 +78,7 @@
->label('accepted_card_logos')
->checkboxes($creditCardTypes)
->class('creditcard-types')
->inline()
->value(1) !!}
{!! Former::checkbox('enable_ach')
->label(trans('texts.ach'))