Show if gateway is using test mode

This commit is contained in:
Hillel Coren 2018-02-20 14:36:36 +02:00
parent 1d1d785174
commit c2c2b1ef07
3 changed files with 16 additions and 4 deletions

View File

@ -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', '')); 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');
}
}
} }

View File

@ -22,17 +22,19 @@ class AccountGatewayDatatable extends EntityDatatable
[ [
'gateway', 'gateway',
function ($model) { function ($model) {
$accountGateway = $this->getAccountGateway($model->id);
if ($model->deleted_at) { if ($model->deleted_at) {
return $model->name; return $model->name;
} elseif ($model->gateway_id == GATEWAY_CUSTOM) { } elseif ($model->gateway_id == GATEWAY_CUSTOM) {
$accountGateway = $this->getAccountGateway($model->id);
$name = $accountGateway->getConfigField('name') . ' [' . trans('texts.custom') . ']'; $name = $accountGateway->getConfigField('name') . ' [' . trans('texts.custom') . ']';
return link_to("gateways/{$model->public_id}/edit", $name)->toHtml(); return link_to("gateways/{$model->public_id}/edit", $name)->toHtml();
} elseif ($model->gateway_id != GATEWAY_WEPAY) { } 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 { } else {
$accountGateway = $this->getAccountGateway($model->id);
$config = $accountGateway->getConfig(); $config = $accountGateway->getConfig();
$endpoint = WEPAY_ENVIRONMENT == WEPAY_STAGE ? 'https://stage.wepay.com/' : 'https://www.wepay.com/'; $endpoint = WEPAY_ENVIRONMENT == WEPAY_STAGE ? 'https://stage.wepay.com/' : 'https://www.wepay.com/';
$wepayAccountId = $config->accountId; $wepayAccountId = $config->accountId;

View File

@ -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.', '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' => 'Email address has been changed',
'email_address_changed_message' => 'The email address for your account has been changed from :old_email to :new_email.', 'email_address_changed_message' => 'The email address for your account has been changed from :old_email to :new_email.',
'test' => 'Test',
); );