Skip to content

Commit

Permalink
Change domain-create fee response for tiered promos (#2491)
Browse files Browse the repository at this point in the history
As requested, for registrars participating in these tiered pricing
promos that wish to receive this type of response, we make the following
changes:

1. The pre-promotional (i.e. base tier) price is returned as the
   standard domain-create fee when running a domain check.
2. The promotional (i.e. correct) price is returned as a special custom
   command class with a name of "STANDARD PROMO" when running a domain
   check
3. Domain creates will return the non-promotional (i.e. incorrect) price
   rather than the actual promotional price.

This PR does only number 3. See PR #2489 for the others.
  • Loading branch information
gbrodman committed Jul 12, 2024
1 parent 04a4431 commit c23eed6
Show file tree
Hide file tree
Showing 2 changed files with 139 additions and 267 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.net.InternetDomainName;
import google.registry.config.RegistryConfig;
import google.registry.flows.EppException;
import google.registry.flows.EppException.CommandUseErrorException;
import google.registry.flows.EppException.ParameterValuePolicyErrorException;
Expand Down Expand Up @@ -438,11 +439,22 @@ public EppResponse run() throws EppException {
.build());
persistEntityChanges(entityChanges);

// If the registrar is participating in tiered pricing promos, return the standard price in the
// response (even if the actual charged price is less)
boolean shouldShowDefaultPrice =
defaultTokenUsed
&& RegistryConfig.getTieredPricingPromotionRegistrarIds().contains(registrarId);
FeesAndCredits responseFeesAndCredits =
shouldShowDefaultPrice
? pricingLogic.getCreatePrice(
tld, targetId, now, years, isAnchorTenant, isSunriseCreate, Optional.empty())
: feesAndCredits;

BeforeResponseReturnData responseData =
flowCustomLogic.beforeResponse(
BeforeResponseParameters.newBuilder()
.setResData(DomainCreateData.create(targetId, now, registrationExpirationTime))
.setResponseExtensions(createResponseExtensions(feeCreate, feesAndCredits))
.setResponseExtensions(createResponseExtensions(feeCreate, responseFeesAndCredits))
.build());
return responseBuilder
.setResData(responseData.resData())
Expand Down
Loading

0 comments on commit c23eed6

Please sign in to comment.