mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Refactoring payments code...
This commit is contained in:
parent
f67990d636
commit
ffa67cef3b
@ -424,20 +424,13 @@ class AccountController extends BaseController
|
|||||||
if ($trashedCount == 0) {
|
if ($trashedCount == 0) {
|
||||||
return Redirect::to('gateways/create');
|
return Redirect::to('gateways/create');
|
||||||
} else {
|
} else {
|
||||||
$switchToWepay = WEPAY_CLIENT_ID && !$account->getGatewayConfig(GATEWAY_WEPAY);
|
|
||||||
|
|
||||||
if ($switchToWepay && $account->token_billing_type_id != TOKEN_BILLING_DISABLED) {
|
|
||||||
$switchToWepay = !$account->getGatewayConfig(GATEWAY_BRAINTREE) && !$account->getGatewayConfig(GATEWAY_STRIPE);
|
|
||||||
}
|
|
||||||
|
|
||||||
$tokenBillingOptions = [];
|
$tokenBillingOptions = [];
|
||||||
for ($i=1; $i<=4; $i++) {
|
for ($i=1; $i<=4; $i++) {
|
||||||
$tokenBillingOptions[$i] = trans("texts.token_billing_{$i}");
|
$tokenBillingOptions[$i] = trans("texts.token_billing_{$i}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return View::make('accounts.payments', [
|
return View::make('accounts.payments', [
|
||||||
'showSwitchToWepay' => $switchToWepay,
|
'showAdd' => $count < count(Gateway::$alternate) + 1,
|
||||||
'showAdd' => $count < count(Gateway::$paymentTypes),
|
|
||||||
'title' => trans('texts.online_payments'),
|
'title' => trans('texts.online_payments'),
|
||||||
'tokenBillingOptions' => $tokenBillingOptions,
|
'tokenBillingOptions' => $tokenBillingOptions,
|
||||||
'account' => $account,
|
'account' => $account,
|
||||||
|
@ -82,27 +82,34 @@ class AccountGatewayController extends BaseController
|
|||||||
* Displays the form for account creation
|
* Displays the form for account creation
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function create()
|
public function create($showWepay = true)
|
||||||
{
|
{
|
||||||
$data = self::getViewModel();
|
|
||||||
$data['url'] = 'gateways';
|
|
||||||
$data['method'] = 'POST';
|
|
||||||
$data['title'] = trans('texts.add_gateway');
|
|
||||||
$data['selectGateways'] = Gateway::where('payment_library_id', '=', 1)
|
|
||||||
->where('id', '!=', GATEWAY_PAYPAL_EXPRESS)
|
|
||||||
->where('id', '!=', GATEWAY_BITPAY)
|
|
||||||
->where('id', '!=', GATEWAY_GOCARDLESS)
|
|
||||||
->where('id', '!=', GATEWAY_DWOLLA)
|
|
||||||
->where('id', '!=', GATEWAY_STRIPE)
|
|
||||||
->where('id', '!=', GATEWAY_WEPAY)
|
|
||||||
->orderBy('name')->get();
|
|
||||||
$data['hiddenFields'] = Gateway::$hiddenFields;
|
|
||||||
|
|
||||||
if ( ! \Request::secure() && ! Utils::isNinjaDev()) {
|
if ( ! \Request::secure() && ! Utils::isNinjaDev()) {
|
||||||
Session::flash('warning', trans('texts.enable_https'));
|
Session::flash('warning', trans('texts.enable_https'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return View::make('accounts.account_gateway', $data);
|
$account = Auth::user()->account;
|
||||||
|
$accountGatewaysIds = $account->gatewayIds();
|
||||||
|
$showWepay = filter_var($showWepay, FILTER_VALIDATE_BOOLEAN);
|
||||||
|
|
||||||
|
if ( ! Utils::isNinja() || Gateway::hasStandardGateway($accountGatewaysIds)) {
|
||||||
|
$showWepay = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = self::getViewModel();
|
||||||
|
$data['url'] = 'gateways';
|
||||||
|
$data['method'] = 'POST';
|
||||||
|
$data['title'] = trans('texts.add_gateway');
|
||||||
|
|
||||||
|
if ($showWepay) {
|
||||||
|
return View::make('accounts.account_gateway_wepay', $data);
|
||||||
|
} else {
|
||||||
|
$data['primaryGateways'] = Gateway::primary($accountGatewaysIds)->orderBy('name', 'desc')->get();
|
||||||
|
$data['secondaryGateways'] = Gateway::secondary($accountGatewaysIds)->orderBy('name')->get();
|
||||||
|
$data['hiddenFields'] = Gateway::$hiddenFields;
|
||||||
|
|
||||||
|
return View::make('accounts.account_gateway', $data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getViewModel($accountGateway = false)
|
private function getViewModel($accountGateway = false)
|
||||||
@ -111,20 +118,6 @@ class AccountGatewayController extends BaseController
|
|||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
$account =$user->account;
|
$account =$user->account;
|
||||||
|
|
||||||
$paymentTypes = [];
|
|
||||||
foreach (Gateway::$paymentTypes as $type) {
|
|
||||||
if ($accountGateway || $account->canAddGateway($type)) {
|
|
||||||
$paymentTypes[$type] = $type == PAYMENT_TYPE_CREDIT_CARD ? trans('texts.other_providers'): trans('texts.'.strtolower($type));
|
|
||||||
|
|
||||||
if ($type == PAYMENT_TYPE_BITCOIN) {
|
|
||||||
$paymentTypes[$type] .= ' - BitPay';
|
|
||||||
}
|
|
||||||
if ($type == PAYMENT_TYPE_DIRECT_DEBIT) {
|
|
||||||
$paymentTypes[$type] .= ' - GoCardless';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$creditCardsArray = unserialize(CREDIT_CARDS);
|
$creditCardsArray = unserialize(CREDIT_CARDS);
|
||||||
$creditCards = [];
|
$creditCards = [];
|
||||||
foreach ($creditCardsArray as $card => $name) {
|
foreach ($creditCardsArray as $card => $name) {
|
||||||
@ -149,7 +142,6 @@ class AccountGatewayController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'paymentTypes' => $paymentTypes,
|
|
||||||
'account' => $account,
|
'account' => $account,
|
||||||
'user' => $user,
|
'user' => $user,
|
||||||
'accountGateway' => $accountGateway,
|
'accountGateway' => $accountGateway,
|
||||||
@ -178,29 +170,10 @@ class AccountGatewayController extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function save($accountGatewayPublicId = false)
|
public function save($accountGatewayPublicId = false)
|
||||||
{
|
{
|
||||||
$rules = array();
|
$gatewayId = Input::get('primary_gateway_id') ?: Input::get('secondary_gateway_id');
|
||||||
$paymentType = Input::get('payment_type_id');
|
|
||||||
$gatewayId = Input::get('gateway_id');
|
|
||||||
|
|
||||||
if ($paymentType == PAYMENT_TYPE_PAYPAL) {
|
|
||||||
$gatewayId = GATEWAY_PAYPAL_EXPRESS;
|
|
||||||
} elseif ($paymentType == PAYMENT_TYPE_BITCOIN) {
|
|
||||||
$gatewayId = GATEWAY_BITPAY;
|
|
||||||
} elseif ($paymentType == PAYMENT_TYPE_DIRECT_DEBIT) {
|
|
||||||
$gatewayId = GATEWAY_GOCARDLESS;
|
|
||||||
} elseif ($paymentType == PAYMENT_TYPE_DWOLLA) {
|
|
||||||
$gatewayId = GATEWAY_DWOLLA;
|
|
||||||
} elseif ($paymentType == PAYMENT_TYPE_STRIPE) {
|
|
||||||
$gatewayId = GATEWAY_STRIPE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$gatewayId) {
|
|
||||||
Session::flash('error', trans('validation.required', ['attribute' => 'gateway']));
|
|
||||||
return Redirect::to('gateways/create')
|
|
||||||
->withInput();
|
|
||||||
}
|
|
||||||
|
|
||||||
$gateway = Gateway::findOrFail($gatewayId);
|
$gateway = Gateway::findOrFail($gatewayId);
|
||||||
|
|
||||||
|
$rules = array();
|
||||||
$fields = $gateway->getFields();
|
$fields = $gateway->getFields();
|
||||||
$optional = array_merge(Gateway::$hiddenFields, Gateway::$optionalFields);
|
$optional = array_merge(Gateway::$hiddenFields, Gateway::$optionalFields);
|
||||||
|
|
||||||
@ -438,10 +411,6 @@ class AccountGatewayController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($gateway = $account->getGatewayByType(PAYMENT_TYPE_CREDIT_CARD)) || ($gateway = $account->getGatewayByType(PAYMENT_TYPE_STRIPE))) {
|
|
||||||
$gateway->delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
$accountGateway->gateway_id = GATEWAY_WEPAY;
|
$accountGateway->gateway_id = GATEWAY_WEPAY;
|
||||||
$accountGateway->setConfig(array(
|
$accountGateway->setConfig(array(
|
||||||
'userId' => $wepayUser->user_id,
|
'userId' => $wepayUser->user_id,
|
||||||
@ -495,17 +464,4 @@ class AccountGatewayController extends BaseController
|
|||||||
return Redirect::to("gateways/{$accountGateway->public_id}/edit");
|
return Redirect::to("gateways/{$accountGateway->public_id}/edit");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function switchToWepay()
|
|
||||||
{
|
|
||||||
$data = self::getViewModel();
|
|
||||||
$data['url'] = 'gateways';
|
|
||||||
$data['method'] = 'POST';
|
|
||||||
unset($data['gateways']);
|
|
||||||
|
|
||||||
if ( ! \Request::secure() && ! Utils::isNinjaDev()) {
|
|
||||||
Session::flash('warning', trans('texts.enable_https'));
|
|
||||||
}
|
|
||||||
|
|
||||||
return View::make('accounts.account_gateway_switch_wepay', $data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -244,9 +244,9 @@ Route::group([
|
|||||||
Route::post('/import', 'ImportController@doImport');
|
Route::post('/import', 'ImportController@doImport');
|
||||||
Route::post('/import_csv', 'ImportController@doImportCSV');
|
Route::post('/import_csv', 'ImportController@doImportCSV');
|
||||||
|
|
||||||
|
Route::get('gateways/create/{show_wepay?}', 'AccountGatewayController@create');
|
||||||
Route::resource('gateways', 'AccountGatewayController');
|
Route::resource('gateways', 'AccountGatewayController');
|
||||||
Route::get('gateways/{public_id}/resend_confirmation', 'AccountGatewayController@resendConfirmation');
|
Route::get('gateways/{public_id}/resend_confirmation', 'AccountGatewayController@resendConfirmation');
|
||||||
Route::get('gateways/switch/wepay', 'AccountGatewayController@switchToWepay');
|
|
||||||
Route::get('api/gateways', array('as'=>'api.gateways', 'uses'=>'AccountGatewayController@getDatatable'));
|
Route::get('api/gateways', array('as'=>'api.gateways', 'uses'=>'AccountGatewayController@getDatatable'));
|
||||||
Route::post('account_gateways/bulk', 'AccountGatewayController@bulk');
|
Route::post('account_gateways/bulk', 'AccountGatewayController@bulk');
|
||||||
|
|
||||||
|
@ -415,6 +415,16 @@ class Account extends Eloquent
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function gatewayIds()
|
||||||
|
{
|
||||||
|
return $this->account_gateways()->pluck('gateway_id')->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function hasGatewayId($gatewayId)
|
||||||
|
{
|
||||||
|
return in_array($gatewayId, $this->gatewayIds());
|
||||||
|
}
|
||||||
|
|
||||||
public function getGatewayConfig($gatewayId)
|
public function getGatewayConfig($gatewayId)
|
||||||
{
|
{
|
||||||
foreach ($this->account_gateways as $gateway) {
|
foreach ($this->account_gateways as $gateway) {
|
||||||
|
@ -8,6 +8,25 @@ class Gateway extends Eloquent
|
|||||||
{
|
{
|
||||||
public $timestamps = true;
|
public $timestamps = true;
|
||||||
|
|
||||||
|
// these will appear in the primary gateway select
|
||||||
|
// the rest are shown when selecting 'more options'
|
||||||
|
public static $preferred = [
|
||||||
|
GATEWAY_PAYPAL_EXPRESS,
|
||||||
|
GATEWAY_BITPAY,
|
||||||
|
GATEWAY_DWOLLA,
|
||||||
|
GATEWAY_STRIPE,
|
||||||
|
GATEWAY_BRAINTREE,
|
||||||
|
];
|
||||||
|
|
||||||
|
// allow adding these gateway if another gateway
|
||||||
|
// is already configured
|
||||||
|
public static $alternate = [
|
||||||
|
GATEWAY_PAYPAL_EXPRESS,
|
||||||
|
GATEWAY_BITPAY,
|
||||||
|
GATEWAY_DWOLLA,
|
||||||
|
];
|
||||||
|
|
||||||
|
// TODO remove this
|
||||||
public static $paymentTypes = [
|
public static $paymentTypes = [
|
||||||
PAYMENT_TYPE_STRIPE,
|
PAYMENT_TYPE_STRIPE,
|
||||||
PAYMENT_TYPE_CREDIT_CARD,
|
PAYMENT_TYPE_CREDIT_CARD,
|
||||||
@ -52,6 +71,38 @@ class Gateway extends Eloquent
|
|||||||
return Utils::toCamelCase(strtolower(str_replace('PAYMENT_TYPE_', '', $type)));
|
return Utils::toCamelCase(strtolower(str_replace('PAYMENT_TYPE_', '', $type)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function hasStandardGateway($gatewayIds)
|
||||||
|
{
|
||||||
|
$diff = array_diff($gatewayIds, static::$alternate);
|
||||||
|
|
||||||
|
return count($diff);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function scopePrimary($query, $accountGatewaysIds)
|
||||||
|
{
|
||||||
|
$query->where('payment_library_id', '=', 1)
|
||||||
|
->where('id', '!=', GATEWAY_WEPAY)
|
||||||
|
->whereIn('id', Gateway::$preferred)
|
||||||
|
->whereNotIn('id', $accountGatewaysIds);
|
||||||
|
|
||||||
|
// if the user has a credit card gateway only show alternate options
|
||||||
|
if (static::hasStandardGateway($accountGatewaysIds)) {
|
||||||
|
$query->whereNotIn('id', array_diff(static::$preferred, static::$alternate));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function scopeSecondary($query, $accountGatewaysIds)
|
||||||
|
{
|
||||||
|
// if the user has a credit card don't show an secondary options
|
||||||
|
if (static::hasStandardGateway($accountGatewaysIds)) {
|
||||||
|
$query->where('id', '=', 0);
|
||||||
|
} else {
|
||||||
|
$query->where('payment_library_id', '=', 1)
|
||||||
|
->where('id', '!=', GATEWAY_WEPAY)
|
||||||
|
->whereNotIn('id', static::$preferred);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
public static function getPaymentTypeLinks() {
|
public static function getPaymentTypeLinks() {
|
||||||
$data = [];
|
$data = [];
|
||||||
|
@ -78,7 +78,7 @@ class ConstantsSeeder extends Seeder
|
|||||||
Size::create(array('name' => '11 - 50'));
|
Size::create(array('name' => '11 - 50'));
|
||||||
Size::create(array('name' => '51 - 100'));
|
Size::create(array('name' => '51 - 100'));
|
||||||
Size::create(array('name' => '101 - 500'));
|
Size::create(array('name' => '101 - 500'));
|
||||||
Size::create(array('name' => '500+'));
|
Size::create(array('name' => '500+'));
|
||||||
|
|
||||||
PaymentTerm::create(array('num_days' => 7, 'name' => 'Net 7', 'public_id' => 1));
|
PaymentTerm::create(array('num_days' => 7, 'name' => 'Net 7', 'public_id' => 1));
|
||||||
PaymentTerm::create(array('num_days' => 10, 'name' => 'Net 10', 'public_id' => 2));
|
PaymentTerm::create(array('num_days' => 10, 'name' => 'Net 10', 'public_id' => 2));
|
||||||
@ -87,11 +87,11 @@ class ConstantsSeeder extends Seeder
|
|||||||
PaymentTerm::create(array('num_days' => 30, 'name' => 'Net 30', 'public_id' => 5));
|
PaymentTerm::create(array('num_days' => 30, 'name' => 'Net 30', 'public_id' => 5));
|
||||||
PaymentTerm::create(array('num_days' => 60, 'name' => 'Net 60', 'public_id' => 6));
|
PaymentTerm::create(array('num_days' => 60, 'name' => 'Net 60', 'public_id' => 6));
|
||||||
PaymentTerm::create(array('num_days' => 90, 'name' => 'Net 90', 'public_id' => 7));
|
PaymentTerm::create(array('num_days' => 90, 'name' => 'Net 90', 'public_id' => 7));
|
||||||
|
|
||||||
PaymentLibrary::create(['name' => 'Omnipay']);
|
PaymentLibrary::create(['name' => 'Omnipay']);
|
||||||
PaymentLibrary::create(['name' => 'PHP-Payments [Deprecated]']);
|
PaymentLibrary::create(['name' => 'PHP-Payments [Deprecated]']);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
d, dd: Numeric date, no leading zero and leading zero, respectively. Eg, 5, 05.
|
d, dd: Numeric date, no leading zero and leading zero, respectively. Eg, 5, 05.
|
||||||
D, DD: Abbreviated and full weekday names, respectively. Eg, Mon, Monday.
|
D, DD: Abbreviated and full weekday names, respectively. Eg, Mon, Monday.
|
||||||
m, mm: Numeric month, no leading zero and leading zero, respectively. Eg, 7, 07.
|
m, mm: Numeric month, no leading zero and leading zero, respectively. Eg, 7, 07.
|
||||||
@ -99,42 +99,6 @@ class ConstantsSeeder extends Seeder
|
|||||||
yy, yyyy: 2- and 4-digit years, respectively. Eg, 12, 2012.)
|
yy, yyyy: 2- and 4-digit years, respectively. Eg, 12, 2012.)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$gateways = [
|
|
||||||
array('name'=>'Authorize.Net AIM', 'provider'=>'AuthorizeNet_AIM'),
|
|
||||||
array('name'=>'Authorize.Net SIM', 'provider'=>'AuthorizeNet_SIM'),
|
|
||||||
array('name'=>'CardSave', 'provider'=>'CardSave'),
|
|
||||||
array('name'=>'Eway Rapid', 'provider'=>'Eway_Rapid'),
|
|
||||||
array('name'=>'FirstData Connect', 'provider'=>'FirstData_Connect'),
|
|
||||||
array('name'=>'GoCardless', 'provider'=>'GoCardless'),
|
|
||||||
array('name'=>'Migs ThreeParty', 'provider'=>'Migs_ThreeParty'),
|
|
||||||
array('name'=>'Migs TwoParty', 'provider'=>'Migs_TwoParty'),
|
|
||||||
array('name'=>'Mollie', 'provider'=>'Mollie'),
|
|
||||||
array('name'=>'MultiSafepay', 'provider'=>'MultiSafepay'),
|
|
||||||
array('name'=>'Netaxept', 'provider'=>'Netaxept'),
|
|
||||||
array('name'=>'NetBanx', 'provider'=>'NetBanx'),
|
|
||||||
array('name'=>'PayFast', 'provider'=>'PayFast'),
|
|
||||||
array('name'=>'Payflow Pro', 'provider'=>'Payflow_Pro'),
|
|
||||||
array('name'=>'PaymentExpress PxPay', 'provider'=>'PaymentExpress_PxPay'),
|
|
||||||
array('name'=>'PaymentExpress PxPost', 'provider'=>'PaymentExpress_PxPost'),
|
|
||||||
array('name'=>'PayPal Express', 'provider'=>'PayPal_Express'),
|
|
||||||
array('name'=>'PayPal Pro', 'provider'=>'PayPal_Pro'),
|
|
||||||
array('name'=>'Pin', 'provider'=>'Pin'),
|
|
||||||
array('name'=>'SagePay Direct', 'provider'=>'SagePay_Direct'),
|
|
||||||
array('name'=>'SagePay Server', 'provider'=>'SagePay_Server'),
|
|
||||||
array('name'=>'SecurePay DirectPost', 'provider'=>'SecurePay_DirectPost'),
|
|
||||||
array('name'=>'Stripe', 'provider'=>'Stripe'),
|
|
||||||
array('name'=>'TargetPay Direct eBanking', 'provider'=>'TargetPay_Directebanking'),
|
|
||||||
array('name'=>'TargetPay Ideal', 'provider'=>'TargetPay_Ideal'),
|
|
||||||
array('name'=>'TargetPay Mr Cash', 'provider'=>'TargetPay_Mrcash'),
|
|
||||||
array('name'=>'TwoCheckout', 'provider'=>'TwoCheckout'),
|
|
||||||
array('name'=>'WorldPay', 'provider'=>'WorldPay'),
|
|
||||||
];
|
|
||||||
|
|
||||||
foreach ($gateways as $gateway)
|
|
||||||
{
|
|
||||||
Gateway::create($gateway);
|
|
||||||
}
|
|
||||||
|
|
||||||
$timezones = array(
|
$timezones = array(
|
||||||
'Pacific/Midway' => "(GMT-11:00) Midway Island",
|
'Pacific/Midway' => "(GMT-11:00) Midway Island",
|
||||||
'US/Samoa' => "(GMT-11:00) Samoa",
|
'US/Samoa' => "(GMT-11:00) Samoa",
|
||||||
@ -250,7 +214,7 @@ class ConstantsSeeder extends Seeder
|
|||||||
'Pacific/Auckland' => "(GMT+12:00) Auckland",
|
'Pacific/Auckland' => "(GMT+12:00) Auckland",
|
||||||
'Pacific/Fiji' => "(GMT+12:00) Fiji",
|
'Pacific/Fiji' => "(GMT+12:00) Fiji",
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($timezones as $name => $location) {
|
foreach ($timezones as $name => $location) {
|
||||||
Timezone::create(array('name'=>$name, 'location'=>$location));
|
Timezone::create(array('name'=>$name, 'location'=>$location));
|
||||||
}
|
}
|
||||||
|
@ -15,46 +15,75 @@ class PaymentLibrariesSeeder extends Seeder
|
|||||||
Eloquent::unguard();
|
Eloquent::unguard();
|
||||||
|
|
||||||
$gateways = [
|
$gateways = [
|
||||||
|
['name' => 'Authorize.Net AIM', 'provider' => 'AuthorizeNet_AIM'],
|
||||||
|
['name' => 'Authorize.Net SIM', 'provider' => 'AuthorizeNet_SIM'],
|
||||||
|
['name' => 'CardSave', 'provider' => 'CardSave'],
|
||||||
|
['name' => 'Eway Rapid', 'provider' => 'Eway_Rapid'],
|
||||||
|
['name' => 'FirstData Connect', 'provider' => 'FirstData_Connect'],
|
||||||
|
['name' => 'GoCardless', 'provider' => 'GoCardless', 'is_offsite' => true],
|
||||||
|
['name' => 'Migs ThreeParty', 'provider' => 'Migs_ThreeParty'],
|
||||||
|
['name' => 'Migs TwoParty', 'provider' => 'Migs_TwoParty'],
|
||||||
|
['name' => 'Mollie', 'provider' => 'Mollie'],
|
||||||
|
['name' => 'MultiSafepay', 'provider' => 'MultiSafepay'],
|
||||||
|
['name' => 'Netaxept', 'provider' => 'Netaxept'],
|
||||||
|
['name' => 'NetBanx', 'provider' => 'NetBanx'],
|
||||||
|
['name' => 'PayFast', 'provider' => 'PayFast'],
|
||||||
|
['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],
|
||||||
|
['name' => 'PayPal Pro', 'provider' => 'PayPal_Pro'],
|
||||||
|
['name' => 'Pin', 'provider' => 'Pin'],
|
||||||
|
['name' => 'SagePay Direct', 'provider' => 'SagePay_Direct'],
|
||||||
|
['name' => 'SagePay Server', 'provider' => 'SagePay_Server'],
|
||||||
|
['name' => 'SecurePay DirectPost', 'provider' => 'SecurePay_DirectPost'],
|
||||||
|
['name' => 'Stripe', 'provider' => 'Stripe'],
|
||||||
|
['name' => 'TargetPay Direct eBanking', 'provider' => 'TargetPay_Directebanking'],
|
||||||
|
['name' => 'TargetPay Ideal', 'provider' => 'TargetPay_Ideal'],
|
||||||
|
['name' => 'TargetPay Mr Cash', 'provider' => 'TargetPay_Mrcash'],
|
||||||
|
['name' => 'TwoCheckout', 'provider' => 'TwoCheckout'],
|
||||||
|
['name' => 'WorldPay', 'provider' => 'WorldPay'],
|
||||||
['name' => 'BeanStream', 'provider' => 'BeanStream', 'payment_library_id' => 2],
|
['name' => 'BeanStream', 'provider' => 'BeanStream', 'payment_library_id' => 2],
|
||||||
['name' => 'Psigate', 'provider' => 'Psigate', 'payment_library_id' => 2],
|
['name' => 'Psigate', 'provider' => 'Psigate', 'payment_library_id' => 2],
|
||||||
['name' => 'moolah', 'provider' => 'AuthorizeNet_AIM', 'sort_order' => 1, 'recommended' => 1, 'site_url' => 'https://invoiceninja.mymoolah.com/', 'payment_library_id' => 1],
|
['name' => 'moolah', 'provider' => 'AuthorizeNet_AIM'],
|
||||||
['name' => 'Alipay', 'provider' => 'Alipay_Express', 'payment_library_id' => 1],
|
['name' => 'Alipay', 'provider' => 'Alipay_Express'],
|
||||||
['name' => 'Buckaroo', 'provider' => 'Buckaroo_CreditCard', 'payment_library_id' => 1],
|
['name' => 'Buckaroo', 'provider' => 'Buckaroo_CreditCard'],
|
||||||
['name' => 'Coinbase', 'provider' => 'Coinbase', 'payment_library_id' => 1],
|
['name' => 'Coinbase', 'provider' => 'Coinbase'],
|
||||||
['name' => 'DataCash', 'provider' => 'DataCash', 'payment_library_id' => 1],
|
['name' => 'DataCash', 'provider' => 'DataCash'],
|
||||||
['name' => 'Neteller', 'provider' => 'Neteller', 'payment_library_id' => 2],
|
['name' => 'Neteller', 'provider' => 'Neteller', 'payment_library_id' => 2],
|
||||||
['name' => 'Pacnet', 'provider' => 'Pacnet', 'payment_library_id' => 1],
|
['name' => 'Pacnet', 'provider' => 'Pacnet'],
|
||||||
['name' => 'PaymentSense', 'provider' => 'PaymentSense', 'payment_library_id' => 1],
|
['name' => 'PaymentSense', 'provider' => 'PaymentSense'],
|
||||||
['name' => 'Realex', 'provider' => 'Realex_Remote', 'payment_library_id' => 1],
|
['name' => 'Realex', 'provider' => 'Realex_Remote'],
|
||||||
['name' => 'Sisow', 'provider' => 'Sisow', 'payment_library_id' => 1],
|
['name' => 'Sisow', 'provider' => 'Sisow'],
|
||||||
['name' => 'Skrill', 'provider' => 'Skrill', 'payment_library_id' => 1],
|
['name' => 'Skrill', 'provider' => 'Skrill'],
|
||||||
['name' => 'BitPay', 'provider' => 'BitPay', 'payment_library_id' => 1],
|
['name' => 'BitPay', 'provider' => 'BitPay', 'is_offsite' => true],
|
||||||
['name' => 'Dwolla', 'provider' => 'Dwolla', 'payment_library_id' => 1],
|
['name' => 'Dwolla', 'provider' => 'Dwolla', 'is_offsite' => true],
|
||||||
['name' => 'Eway Rapid', 'provider' => 'Eway_RapidShared', 'payment_library_id' => 1],
|
['name' => 'Eway Rapid', 'provider' => 'Eway_RapidShared'],
|
||||||
['name' => 'AGMS', 'provider' => 'Agms', 'payment_library_id' => 1],
|
['name' => 'AGMS', 'provider' => 'Agms'],
|
||||||
['name' => 'Barclays', 'provider' => 'BarclaysEpdq\Essential', 'payment_library_id' => 1],
|
['name' => 'Barclays', 'provider' => 'BarclaysEpdq\Essential'],
|
||||||
['name' => 'Cardgate', 'provider' => 'Cardgate', 'payment_library_id' => 1],
|
['name' => 'Cardgate', 'provider' => 'Cardgate'],
|
||||||
['name' => 'Checkout.com', 'provider' => 'CheckoutCom', 'payment_library_id' => 1],
|
['name' => 'Checkout.com', 'provider' => 'CheckoutCom'],
|
||||||
['name' => 'Creditcall', 'provider' => 'Creditcall', 'payment_library_id' => 1],
|
['name' => 'Creditcall', 'provider' => 'Creditcall'],
|
||||||
['name' => 'Cybersource', 'provider' => 'Cybersource', 'payment_library_id' => 1],
|
['name' => 'Cybersource', 'provider' => 'Cybersource'],
|
||||||
['name' => 'ecoPayz', 'provider' => 'Ecopayz', 'payment_library_id' => 1],
|
['name' => 'ecoPayz', 'provider' => 'Ecopayz'],
|
||||||
['name' => 'Fasapay', 'provider' => 'Fasapay', 'payment_library_id' => 1],
|
['name' => 'Fasapay', 'provider' => 'Fasapay'],
|
||||||
['name' => 'Komoju', 'provider' => 'Komoju', 'payment_library_id' => 1],
|
['name' => 'Komoju', 'provider' => 'Komoju'],
|
||||||
['name' => 'Multicards', 'provider' => 'Multicards', 'payment_library_id' => 1],
|
['name' => 'Multicards', 'provider' => 'Multicards'],
|
||||||
['name' => 'Pagar.Me', 'provider' => 'Pagarme', 'payment_library_id' => 1],
|
['name' => 'Pagar.Me', 'provider' => 'Pagarme'],
|
||||||
['name' => 'Paysafecard', 'provider' => 'Paysafecard', 'payment_library_id' => 1],
|
['name' => 'Paysafecard', 'provider' => 'Paysafecard'],
|
||||||
['name' => 'Paytrace', 'provider' => 'Paytrace_CreditCard', 'payment_library_id' => 1],
|
['name' => 'Paytrace', 'provider' => 'Paytrace_CreditCard'],
|
||||||
['name' => 'Secure Trading', 'provider' => 'SecureTrading', 'payment_library_id' => 1],
|
['name' => 'Secure Trading', 'provider' => 'SecureTrading'],
|
||||||
['name' => 'SecPay', 'provider' => 'SecPay', 'payment_library_id' => 1],
|
['name' => 'SecPay', 'provider' => 'SecPay'],
|
||||||
['name' => 'WeChat Express', 'provider' => 'WeChat_Express', 'payment_library_id' => 1],
|
['name' => 'WeChat Express', 'provider' => 'WeChat_Express'],
|
||||||
['name' => 'WePay', 'provider' => 'WePay', 'payment_library_id' => 1],
|
['name' => 'WePay', 'provider' => 'WePay'],
|
||||||
['name' => 'Braintree', 'provider' => 'Braintree', 'payment_library_id' => 1],
|
['name' => 'Braintree', 'provider' => 'Braintree'],
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($gateways as $gateway) {
|
foreach ($gateways as $gateway) {
|
||||||
$record = Gateway::where('name', '=', $gateway['name'])->first();
|
$record = Gateway::where('name', '=', $gateway['name'])->first();
|
||||||
if ($record) {
|
if ($record) {
|
||||||
$record->provider = $gateway['provider'];
|
$record->provider = $gateway['provider'];
|
||||||
|
$record->is_offsite = isset($gateway['is_offsite']);
|
||||||
$record->save();
|
$record->save();
|
||||||
} else {
|
} else {
|
||||||
Gateway::create($gateway);
|
Gateway::create($gateway);
|
||||||
|
@ -1350,6 +1350,7 @@ $LANG = array(
|
|||||||
'verification_pending' => 'Verification Pending',
|
'verification_pending' => 'Verification Pending',
|
||||||
|
|
||||||
'update_font_cache' => 'Please force refresh the page to update the font cache.',
|
'update_font_cache' => 'Please force refresh the page to update the font cache.',
|
||||||
|
'more_options' => 'More options',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -5,11 +5,6 @@
|
|||||||
|
|
||||||
@include('accounts.nav', ['selected' => ACCOUNT_PAYMENTS])
|
@include('accounts.nav', ['selected' => ACCOUNT_PAYMENTS])
|
||||||
|
|
||||||
@if(!$accountGateway && WEPAY_CLIENT_ID && !$account->getGatewayByType(PAYMENT_TYPE_CREDIT_CARD) && !$account->getGatewayByType(PAYMENT_TYPE_STRIPE))
|
|
||||||
@include('accounts.partials.account_gateway_wepay')
|
|
||||||
@endif
|
|
||||||
|
|
||||||
<div id="other-providers">
|
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h3 class="panel-title">{!! trans($title) !!}</h3>
|
<h3 class="panel-title">{!! trans($title) !!}</h3>
|
||||||
@ -40,7 +35,6 @@
|
|||||||
@endforeach
|
@endforeach
|
||||||
@endif
|
@endif
|
||||||
@else
|
@else
|
||||||
{!! Former::populateField('gateway_id', GATEWAY_STRIPE) !!}
|
|
||||||
{!! Former::populateField('show_address', 1) !!}
|
{!! Former::populateField('show_address', 1) !!}
|
||||||
{!! Former::populateField('update_address', 1) !!}
|
{!! Former::populateField('update_address', 1) !!}
|
||||||
|
|
||||||
@ -50,29 +44,28 @@
|
|||||||
@endif
|
@endif
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
{!! Former::select('payment_type_id')
|
@if ($accountGateway)
|
||||||
->options($paymentTypes)
|
<div style="display: none">
|
||||||
->addGroupClass('payment-type-option')
|
{!! Former::text('primary_gateway_id')->value($accountGateway->gateway_id) !!}
|
||||||
->onchange('setPaymentType()') !!}
|
</div>
|
||||||
|
@else
|
||||||
|
{!! Former::select('primary_gateway_id')
|
||||||
|
->fromQuery($primaryGateways, 'name', 'id')
|
||||||
|
->label(trans('texts.gateway_id'))
|
||||||
|
->onchange('setFieldsShown()') !!}
|
||||||
|
|
||||||
{!! Former::select('gateway_id')
|
@if (count($secondaryGateways))
|
||||||
->dataClass('gateway-dropdown')
|
{!! Former::select('secondary_gateway_id')
|
||||||
->addGroupClass('gateway-option gateway-choice')
|
->fromQuery($secondaryGateways, 'name', 'id')
|
||||||
->fromQuery($selectGateways, 'name', 'id')
|
->addGroupClass('secondary-gateway')
|
||||||
->onchange('setFieldsShown()') !!}
|
->label(' ')
|
||||||
|
->onchange('setFieldsShown()') !!}
|
||||||
|
@endif
|
||||||
|
@endif
|
||||||
|
|
||||||
@foreach ($gateways as $gateway)
|
@foreach ($gateways as $gateway)
|
||||||
|
|
||||||
<div id="gateway_{{ $gateway->id }}_div" class='gateway-fields' style="display: none">
|
<div id="gateway_{{ $gateway->id }}_div" class='gateway-fields' style="display: none">
|
||||||
@if ($gateway->getHelp())
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="control-label col-lg-4 col-sm-4"></label>
|
|
||||||
<div class="col-lg-8 col-sm-8 help-block">
|
|
||||||
{!! $gateway->getHelp() !!}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
@foreach ($gateway->fields as $field => $details)
|
@foreach ($gateway->fields as $field => $details)
|
||||||
|
|
||||||
@if ($details && !$accountGateway && !is_array($details))
|
@if ($details && !$accountGateway && !is_array($details))
|
||||||
@ -96,9 +89,7 @@
|
|||||||
|
|
||||||
@if ($gateway->id == GATEWAY_STRIPE)
|
@if ($gateway->id == GATEWAY_STRIPE)
|
||||||
{!! Former::text('publishable_key') !!}
|
{!! Former::text('publishable_key') !!}
|
||||||
@endif
|
|
||||||
|
|
||||||
@if ($gateway->id == GATEWAY_STRIPE)
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-lg-4 col-sm-4">{{ trans('texts.webhook_url') }}</label>
|
<label class="control-label col-lg-4 col-sm-4">{{ trans('texts.webhook_url') }}</label>
|
||||||
<div class="col-lg-8 col-sm-8 help-block">
|
<div class="col-lg-8 col-sm-8 help-block">
|
||||||
@ -108,10 +99,8 @@
|
|||||||
]) !!}</strong></div>
|
]) !!}</strong></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@elseif ($gateway->id == GATEWAY_BRAINTREE)
|
||||||
|
@if ($account->hasGatewayId(GATEWAY_PAYPAL_EXPRESS))
|
||||||
@if ($gateway->id == GATEWAY_BRAINTREE)
|
|
||||||
@if ($account->getGatewayByType(PAYMENT_TYPE_PAYPAL, isset($accountGateway)?$accountGateway:null))
|
|
||||||
{!! Former::checkbox('enable_paypal')
|
{!! Former::checkbox('enable_paypal')
|
||||||
->label(trans('texts.paypal'))
|
->label(trans('texts.paypal'))
|
||||||
->text(trans('texts.braintree_enable_paypal'))
|
->text(trans('texts.braintree_enable_paypal'))
|
||||||
@ -128,50 +117,39 @@
|
|||||||
->text(trans('texts.braintree_enable_paypal')) !!}
|
->text(trans('texts.braintree_enable_paypal')) !!}
|
||||||
@endif
|
@endif
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
@if ($gateway->getHelp())
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-lg-4 col-sm-4"></label>
|
||||||
|
<div class="col-lg-8 col-sm-8 help-block">
|
||||||
|
{!! $gateway->getHelp() !!}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
||||||
{!! Former::checkbox('show_address')
|
<div class="onsite-fields" style="display:none">
|
||||||
->label(trans('texts.billing_address'))
|
{!! Former::checkbox('show_address')
|
||||||
->text(trans('texts.show_address_help'))
|
->label(trans('texts.billing_address'))
|
||||||
->addGroupClass('gateway-option') !!}
|
->text(trans('texts.show_address_help'))
|
||||||
{!! Former::checkbox('update_address')
|
->addGroupClass('gateway-option') !!}
|
||||||
->label(' ')
|
{!! Former::checkbox('update_address')
|
||||||
->text(trans('texts.update_address_help'))
|
->label(' ')
|
||||||
->addGroupClass('gateway-option') !!}
|
->text(trans('texts.update_address_help'))
|
||||||
|
->addGroupClass('gateway-option') !!}
|
||||||
|
|
||||||
{!! Former::checkboxes('creditCardTypes[]')
|
{!! Former::checkboxes('creditCardTypes[]')
|
||||||
->label('Accepted Credit Cards')
|
->label('Accepted Credit Cards')
|
||||||
->checkboxes($creditCardTypes)
|
->checkboxes($creditCardTypes)
|
||||||
->class('creditcard-types')
|
->class('creditcard-types')
|
||||||
->addGroupClass('gateway-option')
|
->addGroupClass('gateway-option')
|
||||||
!!}
|
!!}
|
||||||
|
</div>
|
||||||
|
|
||||||
@if(!isset($accountGateway) && $accountGateway->gateway_id == GATEWAY_WEPAY)
|
@if (!$accountGateway || $accountGateway->gateway_id == GATEWAY_STRIPE)
|
||||||
@if ($account->getGatewayByType(PAYMENT_TYPE_DIRECT_DEBIT, $accountGateway))
|
|
||||||
{!! Former::checkbox('enable_ach')
|
|
||||||
->label(trans('texts.ach'))
|
|
||||||
->text(trans('texts.enable_ach'))
|
|
||||||
->value(null)
|
|
||||||
->disabled(true)
|
|
||||||
->help(trans('texts.ach_disabled')) !!}
|
|
||||||
@else
|
|
||||||
{!! Former::checkbox('enable_ach')
|
|
||||||
->label(trans('texts.ach'))
|
|
||||||
->text(trans('texts.enable_ach')) !!}
|
|
||||||
@endif
|
|
||||||
|
|
||||||
@elseif(!isset($accountGateway) && $accountGateway->gateway_id == GATEWAY_STRIPE)
|
|
||||||
<div class="stripe-ach">
|
<div class="stripe-ach">
|
||||||
@if ($account->getGatewayByType(PAYMENT_TYPE_DIRECT_DEBIT, isset($accountGateway)?$accountGateway:null))
|
|
||||||
{!! Former::checkbox('enable_ach')
|
|
||||||
->label(trans('texts.ach'))
|
|
||||||
->text(trans('texts.enable_ach'))
|
|
||||||
->value(null)
|
|
||||||
->disabled(true)
|
|
||||||
->help(trans('texts.ach_disabled')) !!}
|
|
||||||
@else
|
|
||||||
{!! Former::checkbox('enable_ach')
|
{!! Former::checkbox('enable_ach')
|
||||||
->label(trans('texts.ach'))
|
->label(trans('texts.ach'))
|
||||||
->text(trans('texts.enable_ach'))
|
->text(trans('texts.enable_ach'))
|
||||||
@ -188,56 +166,43 @@
|
|||||||
{!! Former::text('plaid_public_key')->label(trans('texts.public_key'))
|
{!! Former::text('plaid_public_key')->label(trans('texts.public_key'))
|
||||||
->help(trans('texts.plaid_environment_help')) !!}
|
->help(trans('texts.plaid_environment_help')) !!}
|
||||||
</div>
|
</div>
|
||||||
@endif
|
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p/> <p/>
|
<br/>
|
||||||
|
|
||||||
|
<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')) !!}
|
||||||
|
</center>
|
||||||
|
|
||||||
{!! Former::actions(
|
|
||||||
$countGateways > 0 ? Button::normal(trans('texts.cancel'))->large()->asLinkTo(URL::to('/settings/online_payments'))->appendIcon(Icon::create('remove-circle')) : false,
|
|
||||||
Button::success(trans('texts.save'))->submit()->large()->appendIcon(Icon::create('floppy-disk'))) !!}
|
|
||||||
{!! Former::close() !!}
|
{!! Former::close() !!}
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
function setPaymentType() {
|
function setFieldsShown() {
|
||||||
var val = $('#payment_type_id').val();
|
var primaryId = $('#primary_gateway_id').val();
|
||||||
if (val == 'PAYMENT_TYPE_CREDIT_CARD') {
|
var secondaryId = $('#secondary_gateway_id').val();
|
||||||
$('.gateway-option').show();
|
|
||||||
$('.stripe-ach').hide();
|
if (primaryId) {
|
||||||
setFieldsShown();
|
$('.secondary-gateway').hide();
|
||||||
} else {
|
} else {
|
||||||
$('.gateway-option').hide();
|
$('.secondary-gateway').show();
|
||||||
$('.stripe-ach').hide();
|
|
||||||
|
|
||||||
if (val == 'PAYMENT_TYPE_PAYPAL') {
|
|
||||||
setFieldsShown({{ GATEWAY_PAYPAL_EXPRESS }});
|
|
||||||
} else if (val == 'PAYMENT_TYPE_DWOLLA') {
|
|
||||||
setFieldsShown({{ GATEWAY_DWOLLA }});
|
|
||||||
} else if (val == 'PAYMENT_TYPE_DIRECT_DEBIT') {
|
|
||||||
setFieldsShown({{ GATEWAY_GOCARDLESS }});
|
|
||||||
} else if (val == 'PAYMENT_TYPE_STRIPE') {
|
|
||||||
$('.gateway-option:not(.gateway-choice)').show();
|
|
||||||
$('.stripe-ach').show();
|
|
||||||
setFieldsShown({{ GATEWAY_STRIPE }});
|
|
||||||
} else {
|
|
||||||
setFieldsShown({{ GATEWAY_BITPAY }});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setFieldsShown(val) {
|
|
||||||
if (!val) {
|
|
||||||
val = $('#gateway_id').val();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var val = primaryId || secondaryId;
|
||||||
$('.gateway-fields').hide();
|
$('.gateway-fields').hide();
|
||||||
$('#gateway_' + val + '_div').show();
|
$('#gateway_' + val + '_div').show();
|
||||||
|
|
||||||
|
var gateway = _.findWhere(gateways, {'id': parseInt(val)});
|
||||||
|
if (parseInt(gateway.is_offsite)) {
|
||||||
|
$('.onsite-fields').hide();
|
||||||
|
} else {
|
||||||
|
$('.onsite-fields').show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function gatewayLink(url) {
|
function gatewayLink(url) {
|
||||||
@ -263,22 +228,24 @@
|
|||||||
$('.stripe-ach-options').toggle(visible);
|
$('.stripe-ach-options').toggle(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var gateways = {!! Cache::get('gateways') !!};
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
setPaymentType();
|
|
||||||
|
setFieldsShown();
|
||||||
enablePlaidSettings();
|
enablePlaidSettings();
|
||||||
@if ($accountGateway)
|
|
||||||
$('.payment-type-option').hide();
|
|
||||||
@endif
|
|
||||||
|
|
||||||
$('#show_address').change(enableUpdateAddress);
|
$('#show_address').change(enableUpdateAddress);
|
||||||
enableUpdateAddress();
|
enableUpdateAddress();
|
||||||
|
|
||||||
$('#enable_ach').change(enablePlaidSettings)
|
$('#enable_ach').change(enablePlaidSettings)
|
||||||
|
|
||||||
$('#show-other-providers').click(function(){
|
@if (!$accountGateway && count($secondaryGateways))
|
||||||
$(this).hide();
|
$('#primary_gateway_id').append($('<option>', {
|
||||||
$('#other-providers').show();
|
value: '',
|
||||||
})
|
text: "{{ trans('texts.more_options') }}"
|
||||||
|
}));
|
||||||
|
@endif
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
@extends('header')
|
|
||||||
|
|
||||||
@section('content')
|
|
||||||
@parent
|
|
||||||
@include('accounts.nav', ['selected' => ACCOUNT_PAYMENTS])
|
|
||||||
@include('accounts.partials.account_gateway_wepay')
|
|
||||||
@stop
|
|
114
resources/views/accounts/account_gateway_wepay.blade.php
Normal file
114
resources/views/accounts/account_gateway_wepay.blade.php
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
@extends('header')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
@parent
|
||||||
|
|
||||||
|
@include('accounts.nav', ['selected' => ACCOUNT_PAYMENTS])
|
||||||
|
|
||||||
|
{!! Former::open($url)->method($method)->rules(array(
|
||||||
|
'first_name' => 'required',
|
||||||
|
'last_name' => 'required',
|
||||||
|
'email' => 'required',
|
||||||
|
'description' => 'required',
|
||||||
|
'company_name' => 'required',
|
||||||
|
'tos_agree' => 'required',
|
||||||
|
'country' => 'required',
|
||||||
|
))->addClass('warn-on-exit') !!}
|
||||||
|
|
||||||
|
{!! Former::populateField('company_name', $account->getDisplayName()) !!}
|
||||||
|
|
||||||
|
@if ($account->country)
|
||||||
|
{!! Former::populateField('country', $account->country->iso_3166_2) !!}
|
||||||
|
@endif
|
||||||
|
|
||||||
|
{!! Former::populateField('first_name', $user->first_name) !!}
|
||||||
|
{!! Former::populateField('last_name', $user->last_name) !!}
|
||||||
|
{!! Former::populateField('email', $user->email) !!}
|
||||||
|
{!! Former::populateField('show_address', 1) !!}
|
||||||
|
{!! Former::populateField('update_address', 1) !!}
|
||||||
|
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h3 class="panel-title">{!! trans('texts.online_payments') !!}</h3>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body form-padding-right">
|
||||||
|
{!! Former::text('first_name') !!}
|
||||||
|
{!! Former::text('last_name') !!}
|
||||||
|
{!! Former::text('email') !!}
|
||||||
|
{!! Former::text('company_name')->help('wepay_company_name_help')->maxlength(255) !!}
|
||||||
|
{!! Former::text('description')->help('wepay_description_help') !!}
|
||||||
|
|
||||||
|
@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')) !!}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
{!! Former::checkbox('show_address')
|
||||||
|
->label(trans('texts.billing_address'))
|
||||||
|
->text(trans('texts.show_address_help')) !!}
|
||||||
|
{!! Former::checkbox('update_address')
|
||||||
|
->label(' ')
|
||||||
|
->text(trans('texts.update_address_help')) !!}
|
||||||
|
{!! Former::checkboxes('creditCardTypes[]')
|
||||||
|
->label('Accepted Credit Cards')
|
||||||
|
->checkboxes($creditCardTypes)
|
||||||
|
->class('creditcard-types') !!}
|
||||||
|
@if ($account->getGatewayByType(PAYMENT_TYPE_DIRECT_DEBIT))
|
||||||
|
{!! Former::checkbox('enable_ach')
|
||||||
|
->label(trans('texts.ach'))
|
||||||
|
->text(trans('texts.enable_ach'))
|
||||||
|
->value(null)
|
||||||
|
->disabled(true)
|
||||||
|
->help(trans('texts.ach_disabled')) !!}
|
||||||
|
@else
|
||||||
|
{!! Former::checkbox('enable_ach')
|
||||||
|
->label(trans('texts.ach'))
|
||||||
|
->text(trans('texts.enable_ach')) !!}
|
||||||
|
@endif
|
||||||
|
|
||||||
|
{!! Former::checkbox('tos_agree')->label(' ')->text(trans('texts.wepay_tos_agree',
|
||||||
|
['link'=>'<a id="wepay-tos-link" href="https://go.wepay.com/terms-of-service-us" target="_blank">'.trans('texts.wepay_tos_link_text').'</a>']
|
||||||
|
))->value('true') !!}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
<center>
|
||||||
|
{!! Button::normal(trans('texts.use_another_provider'))->large()->asLinkTo(URL::to('/gateways/create/0')) !!}
|
||||||
|
{!! Button::success(trans('texts.sign_up_with_wepay'))->submit()->large() !!}
|
||||||
|
</center>
|
||||||
|
|
||||||
|
|
||||||
|
<style>
|
||||||
|
#other-providers{display:none}
|
||||||
|
#wepay-country .radio{display:inline-block;padding-right:15px}
|
||||||
|
#wepay-country .radio label{padding-left:0}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function(){
|
||||||
|
$('#wepay-country input').change(handleCountryChange)
|
||||||
|
function handleCountryChange(){
|
||||||
|
var country = $('#wepay-country input:checked').val();
|
||||||
|
if(country) {
|
||||||
|
$('#wepay-accept-debit').toggle(country == 'CA');
|
||||||
|
$('#wepay-tos-link').attr('href', 'https://go.wepay.com/terms-of-service-' + country.toLowerCase());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
handleCountryChange();
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<input type="hidden" name="gateway_id" value="{{ GATEWAY_WEPAY }}">
|
||||||
|
{!! Former::close() !!}
|
||||||
|
|
||||||
|
@stop
|
@ -1,97 +0,0 @@
|
|||||||
{!! Former::open($url)->method($method)->rules(array(
|
|
||||||
'first_name' => 'required',
|
|
||||||
'last_name' => 'required',
|
|
||||||
'email' => 'required',
|
|
||||||
'description' => 'required',
|
|
||||||
'company_name' => 'required',
|
|
||||||
'tos_agree' => 'required',
|
|
||||||
'country' => 'required',
|
|
||||||
))->addClass('warn-on-exit') !!}
|
|
||||||
{!! Former::populateField('company_name', $account->getDisplayName()) !!}
|
|
||||||
@if($account->country)
|
|
||||||
{!! Former::populateField('country', $account->country->iso_3166_2) !!}
|
|
||||||
@endif
|
|
||||||
{!! Former::populateField('first_name', $user->first_name) !!}
|
|
||||||
{!! Former::populateField('last_name', $user->last_name) !!}
|
|
||||||
{!! Former::populateField('email', $user->email) !!}
|
|
||||||
{!! Former::populateField('show_address', 1) !!}
|
|
||||||
{!! Former::populateField('update_address', 1) !!}
|
|
||||||
<div class="panel panel-default">
|
|
||||||
<div class="panel-heading">
|
|
||||||
<h3 class="panel-title">{!! trans('texts.online_payments') !!}</h3>
|
|
||||||
</div>
|
|
||||||
<div class="panel-body form-padding-right">
|
|
||||||
{!! Former::text('first_name') !!}
|
|
||||||
{!! Former::text('last_name') !!}
|
|
||||||
{!! Former::text('email') !!}
|
|
||||||
{!! Former::text('company_name')->help('wepay_company_name_help')->maxlength(255) !!}
|
|
||||||
{!! Former::text('description')->help('wepay_description_help') !!}
|
|
||||||
@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')) !!}
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
{!! Former::checkbox('show_address')
|
|
||||||
->label(trans('texts.billing_address'))
|
|
||||||
->text(trans('texts.show_address_help')) !!}
|
|
||||||
{!! Former::checkbox('update_address')
|
|
||||||
->label(' ')
|
|
||||||
->text(trans('texts.update_address_help')) !!}
|
|
||||||
{!! Former::checkboxes('creditCardTypes[]')
|
|
||||||
->label('Accepted Credit Cards')
|
|
||||||
->checkboxes($creditCardTypes)
|
|
||||||
->class('creditcard-types') !!}
|
|
||||||
@if ($account->getGatewayByType(PAYMENT_TYPE_DIRECT_DEBIT))
|
|
||||||
{!! Former::checkbox('enable_ach')
|
|
||||||
->label(trans('texts.ach'))
|
|
||||||
->text(trans('texts.enable_ach'))
|
|
||||||
->value(null)
|
|
||||||
->disabled(true)
|
|
||||||
->help(trans('texts.ach_disabled')) !!}
|
|
||||||
@else
|
|
||||||
{!! Former::checkbox('enable_ach')
|
|
||||||
->label(trans('texts.ach'))
|
|
||||||
->text(trans('texts.enable_ach')) !!}
|
|
||||||
@endif
|
|
||||||
{!! Former::checkbox('tos_agree')->label(' ')->text(trans('texts.wepay_tos_agree',
|
|
||||||
['link'=>'<a id="wepay-tos-link" href="https://go.wepay.com/terms-of-service-us" target="_blank">'.trans('texts.wepay_tos_link_text').'</a>']
|
|
||||||
))->value('true') !!}
|
|
||||||
<center>
|
|
||||||
{!! Button::primary(trans('texts.sign_up_with_wepay'))
|
|
||||||
->submit()
|
|
||||||
->large() !!}
|
|
||||||
@if(isset($gateways))
|
|
||||||
<br><br>
|
|
||||||
<a href="javascript::void" id="show-other-providers">{{ trans('texts.use_another_provider') }}</a>
|
|
||||||
@endif
|
|
||||||
</center>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<style>
|
|
||||||
#other-providers{display:none}
|
|
||||||
#wepay-country .radio{display:inline-block;padding-right:15px}
|
|
||||||
#wepay-country .radio label{padding-left:0}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(function(){
|
|
||||||
$('#wepay-country input').change(handleCountryChange)
|
|
||||||
function handleCountryChange(){
|
|
||||||
var country = $('#wepay-country input:checked').val();
|
|
||||||
if(country) {
|
|
||||||
$('#wepay-accept-debit').toggle(country == 'CA');
|
|
||||||
$('#wepay-tos-link').attr('href', 'https://go.wepay.com/terms-of-service-' + country.toLowerCase());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
handleCountryChange();
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
<input type="hidden" name="gateway_id" value="{{ GATEWAY_WEPAY }}">
|
|
||||||
{!! Former::close() !!}
|
|
@ -1,7 +1,7 @@
|
|||||||
@extends('header')
|
@extends('header')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
@parent
|
@parent
|
||||||
@include('accounts.nav', ['selected' => ACCOUNT_PAYMENTS])
|
@include('accounts.nav', ['selected' => ACCOUNT_PAYMENTS])
|
||||||
|
|
||||||
{!! Former::open()->addClass('warn-on-exit') !!}
|
{!! Former::open()->addClass('warn-on-exit') !!}
|
||||||
@ -31,12 +31,6 @@
|
|||||||
</div>
|
</div>
|
||||||
{!! Former::close() !!}
|
{!! Former::close() !!}
|
||||||
|
|
||||||
@if ($showSwitchToWepay)
|
|
||||||
{!! Button::success(trans('texts.switch_to_wepay'))
|
|
||||||
->asLinkTo(URL::to('/gateways/switch/wepay'))
|
|
||||||
->appendIcon(Icon::create('circle-arrow-up')) !!}
|
|
||||||
|
|
||||||
@endif
|
|
||||||
<label for="trashed" style="font-weight:normal; margin-left: 10px;">
|
<label for="trashed" style="font-weight:normal; margin-left: 10px;">
|
||||||
<input id="trashed" type="checkbox" onclick="setTrashVisible()"
|
<input id="trashed" type="checkbox" onclick="setTrashVisible()"
|
||||||
{{ Session::get("show_trash:gateway") ? 'checked' : ''}}/> {{ trans('texts.show_archived_deleted')}} {{ Utils::transFlowText('gateways') }}
|
{{ Session::get("show_trash:gateway") ? 'checked' : ''}}/> {{ trans('texts.show_archived_deleted')}} {{ Utils::transFlowText('gateways') }}
|
||||||
@ -76,4 +70,4 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@stop
|
@stop
|
||||||
|
@ -23,15 +23,13 @@ class OnlinePaymentCest
|
|||||||
|
|
||||||
// set gateway info
|
// set gateway info
|
||||||
$I->wantTo('create a gateway');
|
$I->wantTo('create a gateway');
|
||||||
$I->amOnPage('/settings/online_payments');
|
$I->amOnPage('/gateways/create/0');
|
||||||
|
|
||||||
if (strpos($I->grabFromCurrentUrl(), 'create') !== false) {
|
$I->fillField(['name' =>'23_apiKey'], env('stripe_secret_key') ?: Fixtures::get('stripe_secret_key'));
|
||||||
$I->fillField(['name' =>'23_apiKey'], env('stripe_secret_key') ?: Fixtures::get('stripe_secret_key'));
|
// Fails to load StripeJS causing "ReferenceError: Can't find variable: Stripe"
|
||||||
// Fails to load StripeJS causing "ReferenceError: Can't find variable: Stripe"
|
//$I->fillField(['name' =>'stripe_publishable_key'], env('stripe_secret_key') ?: Fixtures::get('stripe_publishable_key'));
|
||||||
//$I->fillField(['name' =>'stripe_publishable_key'], env('stripe_secret_key') ?: Fixtures::get('stripe_publishable_key'));
|
$I->click('Save');
|
||||||
$I->click('Save');
|
$I->see('Successfully created gateway');
|
||||||
$I->see('Successfully created gateway');
|
|
||||||
}
|
|
||||||
|
|
||||||
// create client
|
// create client
|
||||||
$I->amOnPage('/clients/create');
|
$I->amOnPage('/clients/create');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user