Change registrar console login code in preparation for removing requireLogin

We are going to remove the requireLogin attribute from the action attribute, because it is specific to the UserService API. This is used by four actions:

ConsoleUIAction
RegistrarSettingsAction
RegistrarPaymentSetupAction
RegistrarPaymentAction

Instead, these four actions will now check the login status directly.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=159562335
This commit is contained in:
mountford 2017-06-20 08:16:43 -07:00 committed by Ben McIlwain
parent 17697388b8
commit 2b7f78db98
17 changed files with 151 additions and 112 deletions

View file

@ -37,6 +37,7 @@ import google.registry.request.JsonActionRunner;
import google.registry.request.JsonActionRunner.JsonAction;
import google.registry.request.auth.Auth;
import google.registry.request.auth.AuthLevel;
import google.registry.request.auth.AuthResult;
import google.registry.security.JsonResponseHelper;
import google.registry.ui.forms.FormField;
import google.registry.ui.forms.FormFieldException;
@ -46,6 +47,7 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;
import org.joda.money.CurrencyUnit;
import org.joda.money.IllegalCurrencyException;
import org.joda.money.Money;
@ -148,9 +150,11 @@ public final class RegistrarPaymentAction implements Runnable, JsonAction {
.required()
.build();
@Inject HttpServletRequest request;
@Inject BraintreeGateway braintreeGateway;
@Inject JsonActionRunner jsonActionRunner;
@Inject Registrar registrar;
@Inject AuthResult authResult;
@Inject SessionUtils sessionUtils;
@Inject @Config("braintreeMerchantAccountIds") ImmutableMap<CurrencyUnit, String> accountIds;
@Inject RegistrarPaymentAction() {}
@ -161,6 +165,7 @@ public final class RegistrarPaymentAction implements Runnable, JsonAction {
@Override
public Map<String, Object> handleJsonRequest(Map<String, ?> json) {
Registrar registrar = sessionUtils.getRegistrarForAuthResult(request, authResult);
logger.infofmt("Processing payment: %s", json);
String paymentMethodNonce;
Money amount;