mirror of
https://github.com/google/nomulus.git
synced 2025-08-04 17:01:51 +02:00
Add payment page link to Registrar Console
The payment page has also been updated to refuse to show itself if the registrar is not set to credit card billing terms. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=117983313
This commit is contained in:
parent
b6b13333dd
commit
89fa3caaba
14 changed files with 73 additions and 12 deletions
|
@ -140,6 +140,7 @@ public enum Fixture {
|
|||
persistResource(
|
||||
Registrar.loadByClientId("TheRegistrar").asBuilder()
|
||||
.setAllowedTlds(ImmutableSet.of("example", "xn--q9jyb4c"))
|
||||
.setBillingMethod(Registrar.BillingMethod.BRAINTREE)
|
||||
.build());
|
||||
}
|
||||
};
|
||||
|
|
|
@ -50,7 +50,8 @@ function setUp() {
|
|||
username: 'blah',
|
||||
logoutUrl: 'omg',
|
||||
isAdmin: true,
|
||||
clientId: test.testClientId
|
||||
clientId: test.testClientId,
|
||||
showPaymentLink: false
|
||||
});
|
||||
registry.registrar.ConsoleTestUtil.setup(test);
|
||||
var regNavlist = $('reg-navlist');
|
||||
|
|
|
@ -49,7 +49,8 @@ function setUp() {
|
|||
username: 'blah',
|
||||
logoutUrl: 'omg',
|
||||
isAdmin: true,
|
||||
clientId: test.testClientId
|
||||
clientId: test.testClientId,
|
||||
showPaymentLink: false
|
||||
});
|
||||
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
|
||||
registry.registrar.ConsoleTestUtil.setup(test);
|
||||
|
|
|
@ -40,7 +40,8 @@ function setUp() {
|
|||
username: 'blah',
|
||||
logoutUrl: 'omg',
|
||||
isAdmin: true,
|
||||
clientId: 'daddy'
|
||||
clientId: 'daddy',
|
||||
showPaymentLink: false
|
||||
});
|
||||
registry.registrar.ConsoleTestUtil.setup(test);
|
||||
}
|
||||
|
|
|
@ -46,7 +46,8 @@ function setUp() {
|
|||
username: 'jart',
|
||||
logoutUrl: 'https://justinetunney.com',
|
||||
isAdmin: true,
|
||||
clientId: 'ignore'
|
||||
clientId: 'ignore',
|
||||
showPaymentLink: false
|
||||
});
|
||||
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
|
||||
|
||||
|
|
|
@ -46,7 +46,8 @@ function setUp() {
|
|||
username: 'jart',
|
||||
logoutUrl: 'https://example.com',
|
||||
isAdmin: true,
|
||||
clientId: 'ignore'
|
||||
clientId: 'ignore',
|
||||
showPaymentLink: false
|
||||
});
|
||||
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
|
||||
|
||||
|
|
|
@ -54,7 +54,8 @@ function setUp() {
|
|||
logoutUrl: 'https://example.com',
|
||||
isAdmin: true,
|
||||
xsrfToken: test.testXsrfToken,
|
||||
clientId: test.testClientId
|
||||
clientId: test.testClientId,
|
||||
showPaymentLink: false
|
||||
});
|
||||
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
|
||||
registry.registrar.ConsoleTestUtil.setup(test);
|
||||
|
|
|
@ -48,7 +48,8 @@ function setUp() {
|
|||
username: 'blah',
|
||||
logoutUrl: 'omg',
|
||||
isAdmin: true,
|
||||
clientId: test.testClientId
|
||||
clientId: test.testClientId,
|
||||
showPaymentLink: false
|
||||
});
|
||||
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
|
||||
registry.registrar.ConsoleTestUtil.setup(test);
|
||||
|
|
|
@ -20,12 +20,15 @@ import static org.mockito.Mockito.when;
|
|||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.domain.registry.config.RegistryEnvironment;
|
||||
import com.google.domain.registry.model.registrar.Registrar;
|
||||
import com.google.domain.registry.testing.AppEngineRule;
|
||||
|
||||
import com.braintreegateway.BraintreeGateway;
|
||||
import com.braintreegateway.ClientTokenGateway;
|
||||
|
||||
import org.joda.money.CurrencyUnit;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
|
@ -35,6 +38,11 @@ import org.mockito.runners.MockitoJUnitRunner;
|
|||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class RegistrarPaymentSetupActionTest {
|
||||
|
||||
@Rule
|
||||
public final AppEngineRule appEngine = AppEngineRule.builder()
|
||||
.withDatastore()
|
||||
.build();
|
||||
|
||||
@Mock
|
||||
private BraintreeGateway braintreeGateway;
|
||||
|
||||
|
@ -46,6 +54,10 @@ public class RegistrarPaymentSetupActionTest {
|
|||
@Before
|
||||
public void before() throws Exception {
|
||||
action.braintreeGateway = braintreeGateway;
|
||||
action.registrar =
|
||||
Registrar.loadByClientId("TheRegistrar").asBuilder()
|
||||
.setBillingMethod(Registrar.BillingMethod.BRAINTREE)
|
||||
.build();
|
||||
when(braintreeGateway.clientToken()).thenReturn(clientTokenGateway);
|
||||
}
|
||||
|
||||
|
@ -87,4 +99,17 @@ public class RegistrarPaymentSetupActionTest {
|
|||
"message", "sandbox",
|
||||
"results", asList());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNotOnCreditCardBillingTerms_showsErrorPage() throws Exception {
|
||||
action.registrar =
|
||||
Registrar.loadByClientId("TheRegistrar").asBuilder()
|
||||
.setBillingMethod(Registrar.BillingMethod.EXTERNAL)
|
||||
.build();
|
||||
assertThat(action.handleJsonRequest(ImmutableMap.<String, Object>of()))
|
||||
.containsExactly(
|
||||
"status", "ERROR",
|
||||
"message", "not-using-cc-billing",
|
||||
"results", asList());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue