mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 00:17:20 +02:00
Add test to confirm fee validation when creating/checking a premium domain during EAP
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=185002798
This commit is contained in:
parent
4b4492f2a2
commit
eb82566785
6 changed files with 155 additions and 3 deletions
|
@ -55,7 +55,7 @@ public final class DomainPricingLogic {
|
||||||
@Inject
|
@Inject
|
||||||
DomainPricingLogic() {}
|
DomainPricingLogic() {}
|
||||||
|
|
||||||
/** Returns a new create price for the Pricer. */
|
/** Returns a new create price for the pricer. */
|
||||||
public FeesAndCredits getCreatePrice(
|
public FeesAndCredits getCreatePrice(
|
||||||
Registry registry, String domainName, DateTime date, int years) throws EppException {
|
Registry registry, String domainName, DateTime date, int years) throws EppException {
|
||||||
CurrencyUnit currency = registry.getCurrency();
|
CurrencyUnit currency = registry.getCurrency();
|
||||||
|
@ -84,8 +84,6 @@ public final class DomainPricingLogic {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: (b/33000134) clean up the rest of the pricing calls.
|
|
||||||
|
|
||||||
/** Returns a new renew price for the pricer. */
|
/** Returns a new renew price for the pricer. */
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public FeesAndCredits getRenewPrice(
|
public FeesAndCredits getRenewPrice(
|
||||||
|
|
|
@ -546,6 +546,26 @@ public class DomainCheckFlowTest
|
||||||
runFlowAssertResponse(loadFile("domain_check_fee_premium_response_v06.xml"));
|
runFlowAssertResponse(loadFile("domain_check_fee_premium_response_v06.xml"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFeeExtension_premium_eap_v06() throws Exception {
|
||||||
|
createTld("example");
|
||||||
|
setEppInput("domain_check_fee_premium_v06.xml");
|
||||||
|
clock.setTo(DateTime.parse("2010-01-01T10:00:00Z"));
|
||||||
|
persistResource(
|
||||||
|
Registry.get("example")
|
||||||
|
.asBuilder()
|
||||||
|
.setEapFeeSchedule(
|
||||||
|
new ImmutableSortedMap.Builder<DateTime, Money>(Ordering.natural())
|
||||||
|
.put(START_OF_TIME, Money.of(USD, 0))
|
||||||
|
.put(clock.nowUtc().minusDays(1), Money.of(USD, 100))
|
||||||
|
.put(clock.nowUtc().plusDays(1), Money.of(USD, 50))
|
||||||
|
.put(clock.nowUtc().plusDays(2), Money.of(USD, 0))
|
||||||
|
.build())
|
||||||
|
.build());
|
||||||
|
|
||||||
|
runFlowAssertResponse(loadFile("domain_check_fee_premium_eap_response_v06.xml"));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFeeExtension_premiumLabels_v11_create() throws Exception {
|
public void testFeeExtension_premiumLabels_v11_create() throws Exception {
|
||||||
createTld("example");
|
createTld("example");
|
||||||
|
|
|
@ -730,6 +730,27 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
||||||
doSuccessfulTest("example", "domain_create_response_premium.xml");
|
doSuccessfulTest("example", "domain_create_response_premium.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSuccess_premiumAndEap() throws Exception {
|
||||||
|
createTld("example");
|
||||||
|
persistResource(Registry.get("example").asBuilder().setPremiumPriceAckRequired(true).build());
|
||||||
|
setEppInput("domain_create_premium_eap.xml");
|
||||||
|
persistContactsAndHosts("net");
|
||||||
|
persistResource(
|
||||||
|
Registry.get("example")
|
||||||
|
.asBuilder()
|
||||||
|
.setEapFeeSchedule(
|
||||||
|
ImmutableSortedMap.of(
|
||||||
|
START_OF_TIME,
|
||||||
|
Money.of(USD, 0),
|
||||||
|
clock.nowUtc().minusDays(1),
|
||||||
|
Money.of(USD, 100),
|
||||||
|
clock.nowUtc().plusDays(1),
|
||||||
|
Money.of(USD, 0)))
|
||||||
|
.build());
|
||||||
|
doSuccessfulTest("example", "domain_create_response_premium_eap.xml");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test fix for a bug where we were looking at the length of the unicode string but indexing into
|
* Test fix for a bug where we were looking at the length of the unicode string but indexing into
|
||||||
* the punycode string. In rare cases (3 and 4 letter labels) this would cause us to think there
|
* the punycode string. In rare cases (3 and 4 letter labels) this would cause us to think there
|
||||||
|
|
57
javatests/google/registry/flows/domain/testdata/domain_check_fee_premium_eap_response_v06.xml
vendored
Normal file
57
javatests/google/registry/flows/domain/testdata/domain_check_fee_premium_eap_response_v06.xml
vendored
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||||
|
<response>
|
||||||
|
<result code="1000">
|
||||||
|
<msg>Command completed successfully</msg>
|
||||||
|
</result>
|
||||||
|
<resData>
|
||||||
|
<domain:chkData xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||||
|
<domain:cd>
|
||||||
|
<domain:name avail="1">rich.example</domain:name>
|
||||||
|
</domain:cd>
|
||||||
|
</domain:chkData>
|
||||||
|
</resData>
|
||||||
|
<extension>
|
||||||
|
<fee:chkData xmlns:fee="urn:ietf:params:xml:ns:fee-0.6">
|
||||||
|
<fee:cd xmlns:fee="urn:ietf:params:xml:ns:fee-0.6">
|
||||||
|
<fee:name>rich.example</fee:name>
|
||||||
|
<fee:currency>USD</fee:currency>
|
||||||
|
<fee:command>create</fee:command>
|
||||||
|
<fee:period unit="y">1</fee:period>
|
||||||
|
<fee:fee description="create">100.00</fee:fee>
|
||||||
|
<fee:fee description="Early Access Period, fee expires: 2010-01-02T10:00:00.000Z">100.00
|
||||||
|
</fee:fee>
|
||||||
|
<fee:class>premium</fee:class>
|
||||||
|
</fee:cd>
|
||||||
|
<fee:cd xmlns:fee="urn:ietf:params:xml:ns:fee-0.6">
|
||||||
|
<fee:name>rich.example</fee:name>
|
||||||
|
<fee:currency>USD</fee:currency>
|
||||||
|
<fee:command>renew</fee:command>
|
||||||
|
<fee:period unit="y">1</fee:period>
|
||||||
|
<fee:fee description="renew">100.00</fee:fee>
|
||||||
|
<fee:class>premium</fee:class>
|
||||||
|
</fee:cd>
|
||||||
|
<fee:cd xmlns:fee="urn:ietf:params:xml:ns:fee-0.6">
|
||||||
|
<fee:name>rich.example</fee:name>
|
||||||
|
<fee:currency>USD</fee:currency>
|
||||||
|
<fee:command>transfer</fee:command>
|
||||||
|
<fee:period unit="y">1</fee:period>
|
||||||
|
<fee:fee description="renew">100.00</fee:fee>
|
||||||
|
<fee:class>premium</fee:class>
|
||||||
|
</fee:cd>
|
||||||
|
<fee:cd xmlns:fee="urn:ietf:params:xml:ns:fee-0.6">
|
||||||
|
<fee:name>rich.example</fee:name>
|
||||||
|
<fee:currency>USD</fee:currency>
|
||||||
|
<fee:command>restore</fee:command>
|
||||||
|
<fee:period unit="y">1</fee:period>
|
||||||
|
<fee:fee description="renew">100.00</fee:fee>
|
||||||
|
<fee:fee description="restore">17.00</fee:fee>
|
||||||
|
<fee:class>premium</fee:class>
|
||||||
|
</fee:cd>
|
||||||
|
</fee:chkData>
|
||||||
|
</extension>
|
||||||
|
<trID>
|
||||||
|
<clTRID>ABC-12345</clTRID>
|
||||||
|
<svTRID>server-trid</svTRID>
|
||||||
|
</trID>
|
||||||
|
</response>
|
||||||
|
</epp>
|
29
javatests/google/registry/flows/domain/testdata/domain_create_premium_eap.xml
vendored
Normal file
29
javatests/google/registry/flows/domain/testdata/domain_create_premium_eap.xml
vendored
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||||
|
<command>
|
||||||
|
<create>
|
||||||
|
<domain:create
|
||||||
|
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||||
|
<domain:name>rich.example</domain:name>
|
||||||
|
<domain:period unit="y">2</domain:period>
|
||||||
|
<domain:ns>
|
||||||
|
<domain:hostObj>ns1.example.net</domain:hostObj>
|
||||||
|
<domain:hostObj>ns2.example.net</domain:hostObj>
|
||||||
|
</domain:ns>
|
||||||
|
<domain:registrant>jd1234</domain:registrant>
|
||||||
|
<domain:contact type="admin">sh8013</domain:contact>
|
||||||
|
<domain:contact type="tech">sh8013</domain:contact>
|
||||||
|
<domain:authInfo>
|
||||||
|
<domain:pw>2fooBAR</domain:pw>
|
||||||
|
</domain:authInfo>
|
||||||
|
</domain:create>
|
||||||
|
</create>
|
||||||
|
<extension>
|
||||||
|
<fee:create xmlns:fee="urn:ietf:params:xml:ns:fee-0.6">
|
||||||
|
<fee:currency>USD</fee:currency>
|
||||||
|
<fee:fee>200.00</fee:fee>
|
||||||
|
<fee:fee description="Early Access Period">100.00</fee:fee>
|
||||||
|
</fee:create>
|
||||||
|
</extension>
|
||||||
|
<clTRID>ABC-12345</clTRID>
|
||||||
|
</command>
|
||||||
|
</epp>
|
27
javatests/google/registry/flows/domain/testdata/domain_create_response_premium_eap.xml
vendored
Normal file
27
javatests/google/registry/flows/domain/testdata/domain_create_response_premium_eap.xml
vendored
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||||
|
<response>
|
||||||
|
<result code="1000">
|
||||||
|
<msg>Command completed successfully</msg>
|
||||||
|
</result>
|
||||||
|
<resData>
|
||||||
|
<domain:creData
|
||||||
|
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||||
|
<domain:name>rich.example</domain:name>
|
||||||
|
<domain:crDate>1999-04-03T22:00:00.0Z</domain:crDate>
|
||||||
|
<domain:exDate>2001-04-03T22:00:00.0Z</domain:exDate>
|
||||||
|
</domain:creData>
|
||||||
|
</resData>
|
||||||
|
<extension>
|
||||||
|
<fee:creData xmlns:fee="urn:ietf:params:xml:ns:fee-0.6">
|
||||||
|
<fee:currency>USD</fee:currency>
|
||||||
|
<fee:fee description="create">200.00</fee:fee>
|
||||||
|
<fee:fee description="Early Access Period, fee expires: 1999-04-04T22:00:00.000Z">100.00
|
||||||
|
</fee:fee>
|
||||||
|
</fee:creData>
|
||||||
|
</extension>
|
||||||
|
<trID>
|
||||||
|
<clTRID>ABC-12345</clTRID>
|
||||||
|
<svTRID>server-trid</svTRID>
|
||||||
|
</trID>
|
||||||
|
</response>
|
||||||
|
</epp>
|
Loading…
Add table
Add a link
Reference in a new issue