mirror of
https://github.com/google/nomulus
synced 2025-12-23 06:15:42 +00:00
Allow for no fee extension with free premium domains (#2660)
This isn't a situation we'll encounter often, but if the client has an allocation token that's valid for premium domains that gives a 0 cost, we shouldn't require them to include the fee extension when creating the domain. We already don't require it for standard domains.
This commit is contained in:
@@ -64,7 +64,7 @@ public class FeesAndCredits extends ImmutableObject implements Buildable {
|
||||
}
|
||||
|
||||
public boolean hasAnyPremiumFees() {
|
||||
return fees.stream().anyMatch(BaseFee::isPremium);
|
||||
return fees.stream().anyMatch(fee -> fee.isPremium() && !fee.hasZeroCost());
|
||||
}
|
||||
|
||||
/** Returns the create cost for the event. */
|
||||
|
||||
@@ -1741,6 +1741,27 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
.marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_token_premiumDomainZeroPrice_noFeeExtension() throws Exception {
|
||||
createTld("example");
|
||||
persistContactsAndHosts();
|
||||
persistResource(
|
||||
new AllocationToken.Builder()
|
||||
.setToken("abc123")
|
||||
.setTokenType(SINGLE_USE)
|
||||
.setDiscountFraction(1)
|
||||
.setDiscountPremiums(true)
|
||||
.setDomainName("rich.example")
|
||||
.build());
|
||||
setEppInput(
|
||||
"domain_create_allocationtoken.xml",
|
||||
ImmutableMap.of("YEARS", "1", "DOMAIN", "rich.example"));
|
||||
// The response should be the standard successful create response, but with 1 year instead of 2
|
||||
runFlowAssertResponse(
|
||||
loadFile("domain_create_response.xml", ImmutableMap.of("DOMAIN", "rich.example"))
|
||||
.replace("2001", "2000"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFailure_promotionNotActive() {
|
||||
persistContactsAndHosts();
|
||||
|
||||
Reference in New Issue
Block a user