mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Better WePay configuration support
This commit is contained in:
parent
ce04c994dd
commit
947cb4a6f7
@ -1,5 +1,6 @@
|
|||||||
<?php namespace App\Http\Controllers;
|
<?php namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\AccountGateway;
|
||||||
use Auth;
|
use Auth;
|
||||||
use File;
|
use File;
|
||||||
use Image;
|
use Image;
|
||||||
@ -420,6 +421,7 @@ class AccountController extends BaseController
|
|||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
$account->load('account_gateways');
|
$account->load('account_gateways');
|
||||||
$count = count($account->account_gateways);
|
$count = count($account->account_gateways);
|
||||||
|
$trashedCount = AccountGateway::scope($account->id)->withTrashed()->count();
|
||||||
|
|
||||||
if ($accountGateway = $account->getGatewayConfig(GATEWAY_STRIPE)) {
|
if ($accountGateway = $account->getGatewayConfig(GATEWAY_STRIPE)) {
|
||||||
if (! $accountGateway->getPublishableStripeKey()) {
|
if (! $accountGateway->getPublishableStripeKey()) {
|
||||||
@ -427,7 +429,7 @@ class AccountController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($count == 0) {
|
if ($trashedCount == 0) {
|
||||||
return Redirect::to('gateways/create');
|
return Redirect::to('gateways/create');
|
||||||
} else {
|
} else {
|
||||||
$switchToWepay = WEPAY_CLIENT_ID && !$account->getGatewayConfig(GATEWAY_WEPAY);
|
$switchToWepay = WEPAY_CLIENT_ID && !$account->getGatewayConfig(GATEWAY_WEPAY);
|
||||||
|
@ -45,10 +45,6 @@ class AccountGatewayController extends BaseController
|
|||||||
$accountGateway = AccountGateway::scope($publicId)->firstOrFail();
|
$accountGateway = AccountGateway::scope($publicId)->firstOrFail();
|
||||||
$config = $accountGateway->getConfig();
|
$config = $accountGateway->getConfig();
|
||||||
|
|
||||||
if ($accountGateway->gateway_id == GATEWAY_WEPAY) {
|
|
||||||
return Redirect::to('gateways');
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($config as $field => $value) {
|
foreach ($config as $field => $value) {
|
||||||
$config->$field = str_repeat('*', strlen($value));
|
$config->$field = str_repeat('*', strlen($value));
|
||||||
}
|
}
|
||||||
@ -109,31 +105,7 @@ class AccountGatewayController extends BaseController
|
|||||||
|
|
||||||
$paymentTypes = [];
|
$paymentTypes = [];
|
||||||
foreach (Gateway::$paymentTypes as $type) {
|
foreach (Gateway::$paymentTypes as $type) {
|
||||||
if ($accountGateway || !$account->getGatewayByType($type)) {
|
if ($accountGateway || $account->canAddGateway($type)) {
|
||||||
if ($type == PAYMENT_TYPE_CREDIT_CARD && $account->getGatewayByType(PAYMENT_TYPE_STRIPE)) {
|
|
||||||
// Stripe is already handling credit card payments
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($type == PAYMENT_TYPE_STRIPE && $account->getGatewayByType(PAYMENT_TYPE_CREDIT_CARD)) {
|
|
||||||
// Another gateway is already handling credit card payments
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($type == PAYMENT_TYPE_DIRECT_DEBIT && $stripeGateway = $account->getGatewayByType(PAYMENT_TYPE_STRIPE)) {
|
|
||||||
if (!empty($stripeGateway->getAchEnabled())) {
|
|
||||||
// Stripe is already handling ACH payments
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($type == PAYMENT_TYPE_PAYPAL && $braintreeGateway = $account->getGatewayConfig(GATEWAY_BRAINTREE)) {
|
|
||||||
if (!empty($braintreeGateway->getPayPalEnabled())) {
|
|
||||||
// PayPal is already enabled
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$paymentTypes[$type] = $type == PAYMENT_TYPE_CREDIT_CARD ? trans('texts.other_providers'): trans('texts.'.strtolower($type));
|
$paymentTypes[$type] = $type == PAYMENT_TYPE_CREDIT_CARD ? trans('texts.other_providers'): trans('texts.'.strtolower($type));
|
||||||
|
|
||||||
if ($type == PAYMENT_TYPE_BITCOIN) {
|
if ($type == PAYMENT_TYPE_BITCOIN) {
|
||||||
@ -162,7 +134,7 @@ class AccountGatewayController extends BaseController
|
|||||||
foreach ($gateways as $gateway) {
|
foreach ($gateways as $gateway) {
|
||||||
$fields = $gateway->getFields();
|
$fields = $gateway->getFields();
|
||||||
asort($fields);
|
asort($fields);
|
||||||
$gateway->fields = $fields;
|
$gateway->fields = $gateway->id == GATEWAY_WEPAY ? [] : $fields;
|
||||||
if ($accountGateway && $accountGateway->gateway_id == $gateway->id) {
|
if ($accountGateway && $accountGateway->gateway_id == $gateway->id) {
|
||||||
$accountGateway->fields = $gateway->fields;
|
$accountGateway->fields = $gateway->fields;
|
||||||
}
|
}
|
||||||
@ -193,7 +165,7 @@ class AccountGatewayController extends BaseController
|
|||||||
$ids = Input::get('bulk_public_id');
|
$ids = Input::get('bulk_public_id');
|
||||||
$count = $this->accountGatewayService->bulk($ids, $action);
|
$count = $this->accountGatewayService->bulk($ids, $action);
|
||||||
|
|
||||||
Session::flash('message', trans('texts.archived_account_gateway'));
|
Session::flash('message', trans("texts.{$action}d_account_gateway"));
|
||||||
|
|
||||||
return Redirect::to('settings/' . ACCOUNT_PAYMENTS);
|
return Redirect::to('settings/' . ACCOUNT_PAYMENTS);
|
||||||
}
|
}
|
||||||
@ -208,10 +180,6 @@ class AccountGatewayController extends BaseController
|
|||||||
$paymentType = Input::get('payment_type_id');
|
$paymentType = Input::get('payment_type_id');
|
||||||
$gatewayId = Input::get('gateway_id');
|
$gatewayId = Input::get('gateway_id');
|
||||||
|
|
||||||
if ($gatewayId == GATEWAY_WEPAY) {
|
|
||||||
return $this->setupWePay();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($paymentType == PAYMENT_TYPE_PAYPAL) {
|
if ($paymentType == PAYMENT_TYPE_PAYPAL) {
|
||||||
$gatewayId = GATEWAY_PAYPAL_EXPRESS;
|
$gatewayId = GATEWAY_PAYPAL_EXPRESS;
|
||||||
} elseif ($paymentType == PAYMENT_TYPE_BITCOIN) {
|
} elseif ($paymentType == PAYMENT_TYPE_BITCOIN) {
|
||||||
@ -245,14 +213,16 @@ class AccountGatewayController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($fields as $field => $details) {
|
if ($gatewayId != GATEWAY_WEPAY) {
|
||||||
if (!in_array($field, $optional)) {
|
foreach ($fields as $field => $details) {
|
||||||
if (strtolower($gateway->name) == 'beanstream') {
|
if (!in_array($field, $optional)) {
|
||||||
if (in_array($field, ['merchant_id', 'passCode'])) {
|
if (strtolower($gateway->name) == 'beanstream') {
|
||||||
$rules[$gateway->id.'_'.$field] = 'required';
|
if (in_array($field, ['merchant_id', 'passCode'])) {
|
||||||
|
$rules[$gateway->id . '_' . $field] = 'required';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$rules[$gateway->id . '_' . $field] = 'required';
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$rules[$gateway->id.'_'.$field] = 'required';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -274,20 +244,29 @@ class AccountGatewayController extends BaseController
|
|||||||
} else {
|
} else {
|
||||||
$accountGateway = AccountGateway::createNew();
|
$accountGateway = AccountGateway::createNew();
|
||||||
$accountGateway->gateway_id = $gatewayId;
|
$accountGateway->gateway_id = $gatewayId;
|
||||||
|
|
||||||
|
if ($gatewayId == GATEWAY_WEPAY && !$this->setupWePay($accountGateway, $wepayResponse)) {
|
||||||
|
return $wepayResponse;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$config = new stdClass();
|
$config = new stdClass();
|
||||||
foreach ($fields as $field => $details) {
|
|
||||||
$value = trim(Input::get($gateway->id.'_'.$field));
|
if ($gatewayId != GATEWAY_WEPAY) {
|
||||||
// if the new value is masked use the original value
|
foreach ($fields as $field => $details) {
|
||||||
if ($oldConfig && $value && $value === str_repeat('*', strlen($value))) {
|
$value = trim(Input::get($gateway->id . '_' . $field));
|
||||||
$value = $oldConfig->$field;
|
// if the new value is masked use the original value
|
||||||
}
|
if ($oldConfig && $value && $value === str_repeat('*', strlen($value))) {
|
||||||
if (!$value && ($field == 'testMode' || $field == 'developerMode')) {
|
$value = $oldConfig->$field;
|
||||||
// do nothing
|
}
|
||||||
} else {
|
if (!$value && ($field == 'testMode' || $field == 'developerMode')) {
|
||||||
$config->$field = $value;
|
// do nothing
|
||||||
|
} else {
|
||||||
|
$config->$field = $value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$config = clone $oldConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
$publishableKey = Input::get('publishable_key');
|
$publishableKey = Input::get('publishable_key');
|
||||||
@ -349,15 +328,18 @@ class AccountGatewayController extends BaseController
|
|||||||
$account->save();
|
$account->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($accountGatewayPublicId) {
|
if(isset($wepayResponse)) {
|
||||||
$message = trans('texts.updated_gateway');
|
return $wepayResponse;
|
||||||
} else {
|
} else {
|
||||||
$message = trans('texts.created_gateway');
|
if ($accountGatewayPublicId) {
|
||||||
|
$message = trans('texts.updated_gateway');
|
||||||
|
} else {
|
||||||
|
$message = trans('texts.created_gateway');
|
||||||
|
}
|
||||||
|
|
||||||
|
Session::flash('message', $message);
|
||||||
|
return Redirect::to("gateways/{$accountGateway->public_id}/edit");
|
||||||
}
|
}
|
||||||
|
|
||||||
Session::flash('message', $message);
|
|
||||||
|
|
||||||
return Redirect::to("gateways/{$accountGateway->public_id}/edit");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,7 +360,7 @@ class AccountGatewayController extends BaseController
|
|||||||
return $update_uri_data->uri;
|
return $update_uri_data->uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function setupWePay()
|
protected function setupWePay($accountGateway, &$response)
|
||||||
{
|
{
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
$account = $user->account;
|
$account = $user->account;
|
||||||
@ -441,7 +423,6 @@ class AccountGatewayController extends BaseController
|
|||||||
$gateway->delete();
|
$gateway->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
$accountGateway = AccountGateway::createNew();
|
|
||||||
$accountGateway->gateway_id = GATEWAY_WEPAY;
|
$accountGateway->gateway_id = GATEWAY_WEPAY;
|
||||||
$accountGateway->setConfig(array(
|
$accountGateway->setConfig(array(
|
||||||
'userId' => $wepayUser->user_id,
|
'userId' => $wepayUser->user_id,
|
||||||
@ -451,7 +432,6 @@ class AccountGatewayController extends BaseController
|
|||||||
'accountId' => $wepayAccount->account_id,
|
'accountId' => $wepayAccount->account_id,
|
||||||
'testMode' => WEPAY_ENVIRONMENT == WEPAY_STAGE,
|
'testMode' => WEPAY_ENVIRONMENT == WEPAY_STAGE,
|
||||||
));
|
));
|
||||||
$account->account_gateways()->save($accountGateway);
|
|
||||||
|
|
||||||
if ($confirmationRequired) {
|
if ($confirmationRequired) {
|
||||||
Session::flash('message', trans('texts.created_wepay_confirmation_required'));
|
Session::flash('message', trans('texts.created_wepay_confirmation_required'));
|
||||||
@ -461,14 +441,17 @@ class AccountGatewayController extends BaseController
|
|||||||
'redirect_uri' => URL::to('gateways'),
|
'redirect_uri' => URL::to('gateways'),
|
||||||
));
|
));
|
||||||
|
|
||||||
return Redirect::to($updateUri->uri);
|
$response = Redirect::to($updateUri->uri);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Redirect::to("gateways");
|
$response = Redirect::to("gateways/{$accountGateway->public_id}/edit");
|
||||||
|
return true;
|
||||||
} catch (\WePayException $e) {
|
} catch (\WePayException $e) {
|
||||||
Session::flash('error', $e->getMessage());
|
Session::flash('error', $e->getMessage());
|
||||||
return Redirect::to('gateways/create')
|
$response = Redirect::to('gateways/create')
|
||||||
->withInput();
|
->withInput();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1412,6 +1412,37 @@ class Account extends Eloquent
|
|||||||
public function getFontFolders(){
|
public function getFontFolders(){
|
||||||
return array_map(function($item){return $item['folder'];}, $this->getFontsData());
|
return array_map(function($item){return $item['folder'];}, $this->getFontsData());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function canAddGateway($type){
|
||||||
|
if($this->getGatewayByType($type)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ($type == PAYMENT_TYPE_CREDIT_CARD && $this->getGatewayByType(PAYMENT_TYPE_STRIPE)) {
|
||||||
|
// Stripe is already handling credit card payments
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($type == PAYMENT_TYPE_STRIPE && $this->getGatewayByType(PAYMENT_TYPE_CREDIT_CARD)) {
|
||||||
|
// Another gateway is already handling credit card payments
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($type == PAYMENT_TYPE_DIRECT_DEBIT && $stripeGateway = $this->getGatewayByType(PAYMENT_TYPE_STRIPE)) {
|
||||||
|
if (!empty($stripeGateway->getAchEnabled())) {
|
||||||
|
// Stripe is already handling ACH payments
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($type == PAYMENT_TYPE_PAYPAL && $braintreeGateway = $this->getGatewayConfig(GATEWAY_BRAINTREE)) {
|
||||||
|
if (!empty($braintreeGateway->getPayPalEnabled())) {
|
||||||
|
// PayPal is already enabled
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Account::updated(function ($account) {
|
Account::updated(function ($account) {
|
||||||
|
@ -15,10 +15,14 @@ class AccountGatewayRepository extends BaseRepository
|
|||||||
|
|
||||||
public function find($accountId)
|
public function find($accountId)
|
||||||
{
|
{
|
||||||
return DB::table('account_gateways')
|
$query = DB::table('account_gateways')
|
||||||
->join('gateways', 'gateways.id', '=', 'account_gateways.gateway_id')
|
->join('gateways', 'gateways.id', '=', 'account_gateways.gateway_id')
|
||||||
->where('account_gateways.deleted_at', '=', null)
|
->where('account_gateways.account_id', '=', $accountId);
|
||||||
->where('account_gateways.account_id', '=', $accountId)
|
|
||||||
->select('account_gateways.id', 'account_gateways.public_id', 'gateways.name', 'account_gateways.deleted_at', 'account_gateways.gateway_id');
|
if (!\Session::get('show_trash:gateway')) {
|
||||||
|
$query->where('account_gateways.deleted_at', '=', null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query->select('account_gateways.id', 'account_gateways.public_id', 'gateways.name', 'account_gateways.deleted_at', 'account_gateways.gateway_id');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,9 @@ class AccountGatewayService extends BaseService
|
|||||||
[
|
[
|
||||||
'name',
|
'name',
|
||||||
function ($model) {
|
function ($model) {
|
||||||
if ($model->gateway_id != GATEWAY_WEPAY) {
|
if ($model->deleted_at) {
|
||||||
|
return $model->name;
|
||||||
|
} elseif ($model->gateway_id != GATEWAY_WEPAY) {
|
||||||
return link_to("gateways/{$model->public_id}/edit", $model->name)->toHtml();
|
return link_to("gateways/{$model->public_id}/edit", $model->name)->toHtml();
|
||||||
} else {
|
} else {
|
||||||
$accountGateway = AccountGateway::find($model->id);
|
$accountGateway = AccountGateway::find($model->id);
|
||||||
@ -89,20 +91,12 @@ class AccountGatewayService extends BaseService
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[
|
[
|
||||||
uctrans('texts.edit_gateway'),
|
|
||||||
function ($model) {
|
|
||||||
return URL::to("gateways/{$model->public_id}/edit");
|
|
||||||
},
|
|
||||||
function($model) {
|
|
||||||
return $model->gateway_id != GATEWAY_WEPAY;
|
|
||||||
}
|
|
||||||
], [
|
|
||||||
uctrans('texts.resend_confirmation_email'),
|
uctrans('texts.resend_confirmation_email'),
|
||||||
function ($model) {
|
function ($model) {
|
||||||
return $model->resendConfirmationUrl;
|
return $model->resendConfirmationUrl;
|
||||||
},
|
},
|
||||||
function($model) {
|
function($model) {
|
||||||
return $model->gateway_id == GATEWAY_WEPAY && !empty($model->resendConfirmationUrl);
|
return !$model->deleted_at && $model->gateway_id == GATEWAY_WEPAY && !empty($model->resendConfirmationUrl);
|
||||||
}
|
}
|
||||||
], [
|
], [
|
||||||
uctrans('texts.finish_setup'),
|
uctrans('texts.finish_setup'),
|
||||||
@ -110,9 +104,17 @@ class AccountGatewayService extends BaseService
|
|||||||
return $model->setupUrl;
|
return $model->setupUrl;
|
||||||
},
|
},
|
||||||
function($model) {
|
function($model) {
|
||||||
return $model->gateway_id == GATEWAY_WEPAY && !empty($model->setupUrl);
|
return !$model->deleted_at && $model->gateway_id == GATEWAY_WEPAY && !empty($model->setupUrl);
|
||||||
}
|
}
|
||||||
] , [
|
] , [
|
||||||
|
uctrans('texts.edit_gateway'),
|
||||||
|
function ($model) {
|
||||||
|
return URL::to("gateways/{$model->public_id}/edit");
|
||||||
|
},
|
||||||
|
function($model) {
|
||||||
|
return !$model->deleted_at;
|
||||||
|
}
|
||||||
|
], [
|
||||||
uctrans('texts.manage_wepay_account'),
|
uctrans('texts.manage_wepay_account'),
|
||||||
function ($model) {
|
function ($model) {
|
||||||
$accountGateway = AccountGateway::find($model->id);
|
$accountGateway = AccountGateway::find($model->id);
|
||||||
@ -123,7 +125,7 @@ class AccountGatewayService extends BaseService
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
function($model) {
|
function($model) {
|
||||||
return $model->gateway_id == GATEWAY_WEPAY;
|
return !$model->deleted_at && $model->gateway_id == GATEWAY_WEPAY;
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
@ -60,11 +60,7 @@ class DatatableService
|
|||||||
$str .= '<div class="tr-status"></div>';
|
$str .= '<div class="tr-status"></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$str .= '<div class="btn-group tr-action" style="height:auto;display:none">
|
$dropdown_contents = '';
|
||||||
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" style="width:100px">
|
|
||||||
'.trans('texts.select').' <span class="caret"></span>
|
|
||||||
</button>
|
|
||||||
<ul class="dropdown-menu" role="menu">';
|
|
||||||
|
|
||||||
$lastIsDivider = false;
|
$lastIsDivider = false;
|
||||||
if (!$model->deleted_at || $model->deleted_at == '0000-00-00') {
|
if (!$model->deleted_at || $model->deleted_at == '0000-00-00') {
|
||||||
@ -78,7 +74,7 @@ class DatatableService
|
|||||||
list($value, $url, $visible) = $action;
|
list($value, $url, $visible) = $action;
|
||||||
if ($visible($model)) {
|
if ($visible($model)) {
|
||||||
if($value == '--divider--'){
|
if($value == '--divider--'){
|
||||||
$str .= "<li class=\"divider\"></li>";
|
$dropdown_contents .= "<li class=\"divider\"></li>";
|
||||||
$lastIsDivider = true;
|
$lastIsDivider = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -88,14 +84,14 @@ class DatatableService
|
|||||||
if (!empty($urlVal['attributes'])) {
|
if (!empty($urlVal['attributes'])) {
|
||||||
$attributes = ' '.$urlVal['attributes'];
|
$attributes = ' '.$urlVal['attributes'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$str .= "<li><a href=\"$urlStr\"{$attributes}>{$value}</a></li>";
|
$dropdown_contents .= "<li><a href=\"$urlStr\"{$attributes}>{$value}</a></li>";
|
||||||
$hasAction = true;
|
$hasAction = true;
|
||||||
$lastIsDivider = false;
|
$lastIsDivider = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ( ! $lastIsDivider) {
|
} elseif ( ! $lastIsDivider) {
|
||||||
$str .= "<li class=\"divider\"></li>";
|
$dropdown_contents .= "<li class=\"divider\"></li>";
|
||||||
$lastIsDivider = true;
|
$lastIsDivider = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -105,24 +101,35 @@ class DatatableService
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( $can_edit && ! $lastIsDivider) {
|
if ( $can_edit && ! $lastIsDivider) {
|
||||||
$str .= "<li class=\"divider\"></li>";
|
$dropdown_contents .= "<li class=\"divider\"></li>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($entityType != ENTITY_USER || $model->public_id) && $can_edit) {
|
if (($entityType != ENTITY_USER || $model->public_id) && $can_edit) {
|
||||||
$str .= "<li><a href=\"javascript:archiveEntity({$model->public_id})\">"
|
$dropdown_contents .= "<li><a href=\"javascript:archiveEntity({$model->public_id})\">"
|
||||||
. trans("texts.archive_{$entityType}") . "</a></li>";
|
. trans("texts.archive_{$entityType}") . "</a></li>";
|
||||||
}
|
}
|
||||||
} else if($can_edit) {
|
} else if($can_edit) {
|
||||||
$str .= "<li><a href=\"javascript:restoreEntity({$model->public_id})\">"
|
if ($entityType != ENTITY_ACCOUNT_GATEWAY || Auth::user()->account->canAddGateway(\App\Models\Gateway::getPaymentType($model->gateway_id))) {
|
||||||
|
$dropdown_contents .= "<li><a href=\"javascript:restoreEntity({$model->public_id})\">"
|
||||||
. trans("texts.restore_{$entityType}") . "</a></li>";
|
. trans("texts.restore_{$entityType}") . "</a></li>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property_exists($model, 'is_deleted') && !$model->is_deleted && $can_edit) {
|
if (property_exists($model, 'is_deleted') && !$model->is_deleted && $can_edit) {
|
||||||
$str .= "<li><a href=\"javascript:deleteEntity({$model->public_id})\">"
|
$dropdown_contents .= "<li><a href=\"javascript:deleteEntity({$model->public_id})\">"
|
||||||
. trans("texts.delete_{$entityType}") . "</a></li>";
|
. trans("texts.delete_{$entityType}") . "</a></li>";
|
||||||
}
|
}
|
||||||
|
|
||||||
return $str.'</ul></div></center>';
|
if (!empty($dropdown_contents)) {
|
||||||
|
$str .= '<div class="btn-group tr-action" style="height:auto;display:none">
|
||||||
|
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" style="width:100px">
|
||||||
|
'.trans('texts.select').' <span class="caret"></span>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu" role="menu">';
|
||||||
|
$str .= $dropdown_contents . '</ul>';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $str.'</div></center>';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30933,7 +30933,7 @@ function truncate(string, length){
|
|||||||
|
|
||||||
// Show/hide the 'Select' option in the datalists
|
// Show/hide the 'Select' option in the datalists
|
||||||
function actionListHandler() {
|
function actionListHandler() {
|
||||||
$('tbody tr').mouseover(function() {
|
$('tbody tr .tr-action').closest('tr').mouseover(function() {
|
||||||
$(this).closest('tr').find('.tr-action').show();
|
$(this).closest('tr').find('.tr-action').show();
|
||||||
$(this).closest('tr').find('.tr-status').hide();
|
$(this).closest('tr').find('.tr-status').hide();
|
||||||
}).mouseout(function() {
|
}).mouseout(function() {
|
||||||
|
@ -1042,7 +1042,7 @@ function truncate(string, length){
|
|||||||
|
|
||||||
// Show/hide the 'Select' option in the datalists
|
// Show/hide the 'Select' option in the datalists
|
||||||
function actionListHandler() {
|
function actionListHandler() {
|
||||||
$('tbody tr').mouseover(function() {
|
$('tbody tr .tr-action').closest('tr').mouseover(function() {
|
||||||
$(this).closest('tr').find('.tr-action').show();
|
$(this).closest('tr').find('.tr-action').show();
|
||||||
$(this).closest('tr').find('.tr-status').hide();
|
$(this).closest('tr').find('.tr-status').hide();
|
||||||
}).mouseout(function() {
|
}).mouseout(function() {
|
||||||
|
@ -1311,6 +1311,8 @@ $LANG = array(
|
|||||||
'created_wepay_confirmation_required' => 'Please check your email and confirm your email address with WePay.',
|
'created_wepay_confirmation_required' => 'Please check your email and confirm your email address with WePay.',
|
||||||
'switch_to_wepay' => 'Switch to WePay',
|
'switch_to_wepay' => 'Switch to WePay',
|
||||||
'switch' => 'Switch',
|
'switch' => 'Switch',
|
||||||
|
'restore_account_gateway' => 'Restore Gateway',
|
||||||
|
'restored_account_gateway' => 'Successfully restored gateway',
|
||||||
);
|
);
|
||||||
|
|
||||||
return $LANG;
|
return $LANG;
|
||||||
|
@ -94,7 +94,7 @@
|
|||||||
{!! Former::text('publishable_key') !!}
|
{!! Former::text('publishable_key') !!}
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if ($gateway->id == GATEWAY_STRIPE || $gateway->id == GATEWAY_BRAINTREE)
|
@if ($gateway->id == GATEWAY_STRIPE || $gateway->id == GATEWAY_BRAINTREE || $gateway->id == GATEWAY_WEPAY)
|
||||||
{!! Former::select('token_billing_type_id')
|
{!! Former::select('token_billing_type_id')
|
||||||
->options($tokenBillingOptions)
|
->options($tokenBillingOptions)
|
||||||
->help(trans('texts.token_billing_help')) !!}
|
->help(trans('texts.token_billing_help')) !!}
|
||||||
|
@ -8,7 +8,12 @@
|
|||||||
{!! Button::success(trans('texts.switch_to_wepay'))
|
{!! Button::success(trans('texts.switch_to_wepay'))
|
||||||
->asLinkTo(URL::to('/gateways/switch/wepay'))
|
->asLinkTo(URL::to('/gateways/switch/wepay'))
|
||||||
->appendIcon(Icon::create('circle-arrow-up')) !!}
|
->appendIcon(Icon::create('circle-arrow-up')) !!}
|
||||||
|
|
||||||
@endif
|
@endif
|
||||||
|
<label for="trashed" style="font-weight:normal; margin-left: 10px;">
|
||||||
|
<input id="trashed" type="checkbox" onclick="setTrashVisible()"
|
||||||
|
{{ Session::get("show_trash:gateway") ? 'checked' : ''}}/> {{ trans('texts.show_archived_deleted')}} {{ Utils::transFlowText('gateways') }}
|
||||||
|
</label>
|
||||||
|
|
||||||
@if ($showAdd)
|
@if ($showAdd)
|
||||||
{!! Button::primary(trans('texts.add_gateway'))
|
{!! Button::primary(trans('texts.add_gateway'))
|
||||||
@ -34,6 +39,14 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
window.onDatatableReady = actionListHandler;
|
window.onDatatableReady = actionListHandler;
|
||||||
|
function setTrashVisible() {
|
||||||
|
var checked = $('#trashed').is(':checked');
|
||||||
|
var url = '{{ URL::to('view_archive/gateway') }}' + (checked ? '/true' : '/false');
|
||||||
|
|
||||||
|
$.get(url, function(data) {
|
||||||
|
refreshDatatable();
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@stop
|
@stop
|
@ -26,7 +26,7 @@
|
|||||||
<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:{$entityType}") ? 'checked' : ''}}/> {{ trans('texts.show_archived_deleted')}} {{ Utils::transFlowText($entityType.'s') }}
|
{{ Session::get("show_trash:{$entityType}") ? 'checked' : ''}}/> {{ trans('texts.show_archived_deleted')}} {{ Utils::transFlowText($entityType.'s') }}
|
||||||
</label>
|
</label>-onli
|
||||||
|
|
||||||
<div id="top_right_buttons" class="pull-right">
|
<div id="top_right_buttons" class="pull-right">
|
||||||
<input id="tableFilter" type="text" style="width:140px;margin-right:17px;background-color: white !important"
|
<input id="tableFilter" type="text" style="width:140px;margin-right:17px;background-color: white !important"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user