diff --git a/app/Models/AccountGateway.php b/app/Models/AccountGateway.php index a5757ad7448e..535ec60de72c 100644 --- a/app/Models/AccountGateway.php +++ b/app/Models/AccountGateway.php @@ -268,4 +268,13 @@ class AccountGateway extends EntityModel return \URL::to(env('WEBHOOK_PREFIX', '').'payment_hook/'.$account->account_key.'/'.$this->gateway_id.env('WEBHOOK_SUFFIX', '')); } + + public function isTestMode() + { + if ($this->isGateway(GATEWAY_STRIPE)) { + return strpos($this->getPublishableStripeKey(), 'test') !== false; + } else { + return $this->getConfigField('testMode'); + } + } } diff --git a/app/Ninja/Datatables/AccountGatewayDatatable.php b/app/Ninja/Datatables/AccountGatewayDatatable.php index e427ed5e17b1..a97df299b869 100644 --- a/app/Ninja/Datatables/AccountGatewayDatatable.php +++ b/app/Ninja/Datatables/AccountGatewayDatatable.php @@ -22,17 +22,19 @@ class AccountGatewayDatatable extends EntityDatatable [ 'gateway', function ($model) { + $accountGateway = $this->getAccountGateway($model->id); if ($model->deleted_at) { return $model->name; } elseif ($model->gateway_id == GATEWAY_CUSTOM) { - $accountGateway = $this->getAccountGateway($model->id); $name = $accountGateway->getConfigField('name') . ' [' . trans('texts.custom') . ']'; - return link_to("gateways/{$model->public_id}/edit", $name)->toHtml(); } elseif ($model->gateway_id != GATEWAY_WEPAY) { - return link_to("gateways/{$model->public_id}/edit", $model->name)->toHtml(); + $name = $model->name; + if ($accountGateway->isTestMode()) { + $name .= sprintf(' [%s]', trans('texts.test')); + } + return link_to("gateways/{$model->public_id}/edit", $name)->toHtml(); } else { - $accountGateway = $this->getAccountGateway($model->id); $config = $accountGateway->getConfig(); $endpoint = WEPAY_ENVIRONMENT == WEPAY_STAGE ? 'https://stage.wepay.com/' : 'https://www.wepay.com/'; $wepayAccountId = $config->accountId; diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index e5b566621cde..eaa01c6ac59e 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -2744,6 +2744,7 @@ $LANG = array( 'warning_local_refund' => 'The refund will be recorded in the app but will NOT be processed by the payment gateway.', 'email_address_changed' => 'Email address has been changed', 'email_address_changed_message' => 'The email address for your account has been changed from :old_email to :new_email.', + 'test' => 'Test', );