Really enable payment page in sandbox

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120372049
This commit is contained in:
jart 2016-04-20 13:51:14 -07:00 committed by Justine Tunney
parent 4e6c8ec6fe
commit 9c8e23ea57
2 changed files with 2 additions and 19 deletions

View file

@ -23,7 +23,6 @@ import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.domain.registry.braintree.BraintreeRegistrarSyncer; import com.google.domain.registry.braintree.BraintreeRegistrarSyncer;
import com.google.domain.registry.config.ConfigModule.Config; import com.google.domain.registry.config.ConfigModule.Config;
import com.google.domain.registry.config.RegistryEnvironment;
import com.google.domain.registry.model.registrar.Registrar; import com.google.domain.registry.model.registrar.Registrar;
import com.google.domain.registry.request.Action; import com.google.domain.registry.request.Action;
import com.google.domain.registry.request.JsonActionRunner; import com.google.domain.registry.request.JsonActionRunner;
@ -80,7 +79,6 @@ public final class RegistrarPaymentSetupAction implements Runnable, JsonAction {
@Inject BraintreeRegistrarSyncer customerSyncer; @Inject BraintreeRegistrarSyncer customerSyncer;
@Inject JsonActionRunner jsonActionRunner; @Inject JsonActionRunner jsonActionRunner;
@Inject Registrar registrar; @Inject Registrar registrar;
@Inject RegistryEnvironment environment;
@Inject @Config("brainframe") String brainframe; @Inject @Config("brainframe") String brainframe;
@Inject @Config("braintreeMerchantAccountIds") ImmutableMap<CurrencyUnit, String> accountIds; @Inject @Config("braintreeMerchantAccountIds") ImmutableMap<CurrencyUnit, String> accountIds;
@Inject RegistrarPaymentSetupAction() {} @Inject RegistrarPaymentSetupAction() {}
@ -96,12 +94,8 @@ public final class RegistrarPaymentSetupAction implements Runnable, JsonAction {
return JsonResponseHelper.create(ERROR, "JSON request object must be empty"); return JsonResponseHelper.create(ERROR, "JSON request object must be empty");
} }
// payment.js is hard-coded to display a specific SOY error template when encountering the // payment.js is hard-coded to display a specific SOY error template for certain error messages.
// following error messages. if (registrar.getBillingMethod() != Registrar.BillingMethod.BRAINTREE) {
if (environment == RegistryEnvironment.SANDBOX) {
// Prevent registrar customers from accidentally remitting payment via OT&E environment.
return JsonResponseHelper.create(ERROR, "sandbox");
} else if (registrar.getBillingMethod() != Registrar.BillingMethod.BRAINTREE) {
// Registrar needs to contact support to have their billing bit flipped. // Registrar needs to contact support to have their billing bit flipped.
return JsonResponseHelper.create(ERROR, "not-using-cc-billing"); return JsonResponseHelper.create(ERROR, "not-using-cc-billing");
} }

View file

@ -22,7 +22,6 @@ import static org.mockito.Mockito.when;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.domain.registry.braintree.BraintreeRegistrarSyncer; import com.google.domain.registry.braintree.BraintreeRegistrarSyncer;
import com.google.domain.registry.config.RegistryEnvironment;
import com.google.domain.registry.model.registrar.Registrar; import com.google.domain.registry.model.registrar.Registrar;
import com.google.domain.registry.testing.AppEngineRule; import com.google.domain.registry.testing.AppEngineRule;
@ -98,16 +97,6 @@ public class RegistrarPaymentSetupActionTest {
"results", asList()); "results", asList());
} }
@Test
public void testSandboxEnvironment_returnsError() throws Exception {
action.environment = RegistryEnvironment.SANDBOX;
assertThat(action.handleJsonRequest(ImmutableMap.<String, Object>of()))
.containsExactly(
"status", "ERROR",
"message", "sandbox",
"results", asList());
}
@Test @Test
public void testNotOnCreditCardBillingTerms_showsErrorPage() throws Exception { public void testNotOnCreditCardBillingTerms_showsErrorPage() throws Exception {
action.registrar = action.registrar =