mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 00:17:20 +02:00
Make EppInput.getSingleExtension() return Optional, not @Nullable
This makes it harder to use it incorrectly by accident. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=181795813
This commit is contained in:
parent
fbdb148540
commit
315e6d57bf
21 changed files with 290 additions and 239 deletions
|
@ -134,7 +134,7 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
|
|||
DomainResource existingDomain = loadAndVerifyExistence(DomainResource.class, targetId, now);
|
||||
FeesAndCredits feesAndCredits =
|
||||
pricingLogic.getRestorePrice(Registry.get(existingDomain.getTld()), targetId, now);
|
||||
FeeUpdateCommandExtension feeUpdate =
|
||||
Optional<FeeUpdateCommandExtension> feeUpdate =
|
||||
eppInput.getSingleExtension(FeeUpdateCommandExtension.class);
|
||||
verifyRestoreAllowed(command, existingDomain, feeUpdate, feesAndCredits, now);
|
||||
HistoryEntry historyEntry = buildHistoryEntry(existingDomain, now);
|
||||
|
@ -186,7 +186,7 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
|
|||
private void verifyRestoreAllowed(
|
||||
Update command,
|
||||
DomainResource existingDomain,
|
||||
FeeUpdateCommandExtension feeUpdate,
|
||||
Optional<FeeUpdateCommandExtension> feeUpdate,
|
||||
FeesAndCredits feesAndCredits,
|
||||
DateTime now) throws EppException {
|
||||
verifyOptionalAuthInfo(authInfo, existingDomain);
|
||||
|
@ -261,15 +261,19 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
|
|||
}
|
||||
|
||||
private static ImmutableList<FeeTransformResponseExtension> createResponseExtensions(
|
||||
Money restoreCost, Money renewCost, FeeUpdateCommandExtension feeUpdate) {
|
||||
return (feeUpdate == null)
|
||||
? ImmutableList.of()
|
||||
: ImmutableList.of(feeUpdate.createResponseBuilder()
|
||||
.setCurrency(restoreCost.getCurrencyUnit())
|
||||
.setFees(ImmutableList.of(
|
||||
Fee.create(restoreCost.getAmount(), FeeType.RESTORE),
|
||||
Fee.create(renewCost.getAmount(), FeeType.RENEW)))
|
||||
.build());
|
||||
Money restoreCost, Money renewCost, Optional<FeeUpdateCommandExtension> feeUpdate) {
|
||||
return feeUpdate.isPresent()
|
||||
? ImmutableList.of(
|
||||
feeUpdate
|
||||
.get()
|
||||
.createResponseBuilder()
|
||||
.setCurrency(restoreCost.getCurrencyUnit())
|
||||
.setFees(
|
||||
ImmutableList.of(
|
||||
Fee.create(restoreCost.getAmount(), FeeType.RESTORE),
|
||||
Fee.create(renewCost.getAmount(), FeeType.RENEW)))
|
||||
.build())
|
||||
: ImmutableList.of();
|
||||
}
|
||||
|
||||
/** Restore command cannot have other changes specified. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue