public function actions()
{
$actions = [[uctrans('texts.resend_confirmation_email'), function ($model) {
return $model->resendConfirmationUrl;
}, function ($model) {
return !$model->deleted_at && $model->gateway_id == GATEWAY_WEPAY && !empty($model->resendConfirmationUrl);
}], [uctrans('texts.edit_gateway'), function ($model) {
return URL::to("gateways/{$model->public_id}/edit");
}, function ($model) {
return !$model->deleted_at;
}], [uctrans('texts.finish_setup'), function ($model) {
return $model->setupUrl;
}, function ($model) {
return !$model->deleted_at && $model->gateway_id == GATEWAY_WEPAY && !empty($model->setupUrl);
}], [uctrans('texts.manage_account'), function ($model) {
$accountGateway = $this->getAccountGateway($model->id);
$endpoint = WEPAY_ENVIRONMENT == WEPAY_STAGE ? 'https://stage.wepay.com/' : 'https://www.wepay.com/';
return ['url' => $endpoint . 'account/' . $accountGateway->getConfig()->accountId, 'attributes' => 'target="_blank"'];
}, function ($model) {
return !$model->deleted_at && $model->gateway_id == GATEWAY_WEPAY;
}], [uctrans('texts.terms_of_service'), function ($model) {
return 'https://go.wepay.com/terms-of-service-us';
}, function ($model) {
return $model->gateway_id == GATEWAY_WEPAY;
}]];
foreach (Cache::get('gatewayTypes') as $gatewayType) {
$actions[] = [trans('texts.set_limits', ['gateway_type' => $gatewayType->name]), function () use($gatewayType) {
$accountGatewaySettings = AccountGatewaySettings::scope()->where('account_gateway_settings.gateway_type_id', '=', $gatewayType->id)->first();
$min = $accountGatewaySettings && $accountGatewaySettings->min_limit !== null ? $accountGatewaySettings->min_limit : 'null';
$max = $accountGatewaySettings && $accountGatewaySettings->max_limit !== null ? $accountGatewaySettings->max_limit : 'null';
return "javascript:showLimitsModal('{$gatewayType->name}', {$gatewayType->id}, {$min}, {$max})";
}, function ($model) use($gatewayType) {
// Only show this action if the given gateway supports this gateway type
if ($model->gateway_id == GATEWAY_CUSTOM) {
return $gatewayType->id == GATEWAY_TYPE_CUSTOM;
} else {
$accountGateway = $this->getAccountGateway($model->id);
$paymentDriver = $accountGateway->paymentDriver();
$gatewayTypes = $paymentDriver->gatewayTypes();
return in_array($gatewayType->id, $gatewayTypes);
}
}];
}
return $actions;
}