mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Simplify the fee extensions.
I added shared base classes to all of the Fee extension types that make it possible to fully ignore the version in the flows. (You ask for a FeeCreateCommandExtension, for example, and you get one without having to worry about which). This is an improvement over the old code that asked you to provide a list of possible fee extensions and then ask for the first one in preference order. As part of this I was able to make the Fee implementation a bit simpler as well. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=137992390
This commit is contained in:
parent
2dd703ef3a
commit
8256120b3a
66 changed files with 786 additions and 954 deletions
|
@ -30,7 +30,6 @@ import static google.registry.flows.domain.DomainFlowUtils.validateFeeChallenge;
|
|||
import static google.registry.flows.domain.DomainFlowUtils.verifyPremiumNameIsNotBlocked;
|
||||
import static google.registry.flows.domain.DomainFlowUtils.verifyUnitIsYears;
|
||||
import static google.registry.model.domain.DomainResource.extendRegistrationWithCap;
|
||||
import static google.registry.model.domain.fee.Fee.FEE_TRANSFER_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER;
|
||||
import static google.registry.model.eppoutput.Result.Code.SUCCESS_WITH_ACTION_PENDING;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.pricing.PricingEngineProxy.getDomainRenewCost;
|
||||
|
@ -56,7 +55,7 @@ import google.registry.model.domain.DomainResource;
|
|||
import google.registry.model.domain.Period;
|
||||
import google.registry.model.domain.fee.BaseFee.FeeType;
|
||||
import google.registry.model.domain.fee.Fee;
|
||||
import google.registry.model.domain.fee.FeeTransformCommandExtension;
|
||||
import google.registry.model.domain.fee.FeeTransferCommandExtension;
|
||||
import google.registry.model.domain.fee.FeeTransformResponseExtension;
|
||||
import google.registry.model.domain.flags.FlagsTransferCommandExtension;
|
||||
import google.registry.model.domain.metadata.MetadataExtension;
|
||||
|
@ -130,8 +129,10 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
|
|||
|
||||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
extensionManager.register(FlagsTransferCommandExtension.class, MetadataExtension.class);
|
||||
extensionManager.registerAsGroup(FEE_TRANSFER_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER);
|
||||
extensionManager.register(
|
||||
FeeTransferCommandExtension.class,
|
||||
FlagsTransferCommandExtension.class,
|
||||
MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateClientIsLoggedIn(gainingClientId);
|
||||
Period period = ((Transfer) resourceCommand).getPeriod();
|
||||
|
@ -144,8 +145,8 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
|
|||
// The cost of the renewal implied by a transfer.
|
||||
Money renewCost = getDomainRenewCost(targetId, now, years);
|
||||
// An optional extension from the client specifying what they think the transfer should cost.
|
||||
FeeTransformCommandExtension feeTransfer = eppInput.getFirstExtensionOfClasses(
|
||||
FEE_TRANSFER_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER);
|
||||
FeeTransferCommandExtension feeTransfer =
|
||||
eppInput.getSingleExtension(FeeTransferCommandExtension.class);
|
||||
validateFeeChallenge(targetId, tld, now, feeTransfer, renewCost);
|
||||
HistoryEntry historyEntry = buildHistory(period, existingDomain, now);
|
||||
DateTime automaticTransferTime = now.plus(registry.getAutomaticTransferLength());
|
||||
|
@ -405,7 +406,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
|
|||
}
|
||||
|
||||
private ImmutableList<FeeTransformResponseExtension> createResponseExtensions(Money renewCost,
|
||||
FeeTransformCommandExtension feeTransfer) {
|
||||
FeeTransferCommandExtension feeTransfer) {
|
||||
return feeTransfer == null
|
||||
? null
|
||||
: ImmutableList.of(feeTransfer.createResponseBuilder()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue