Clean up BaseFeeResponse.setFee() and call sites

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=126229075
This commit is contained in:
ctingue 2016-06-29 13:53:55 -07:00 committed by Ben McIlwain
parent 01698059f6
commit 9f731ba4d0
2 changed files with 11 additions and 12 deletions

View file

@ -590,8 +590,9 @@ public class DomainFlowUtils {
if (isReserved(domain, isSunrise)) { // Don't return a create price for reserved names. if (isReserved(domain, isSunrise)) { // Don't return a create price for reserved names.
builder.setClass("reserved"); // Override whatever class we've set above. builder.setClass("reserved"); // Override whatever class we've set above.
} else { } else {
builder.setFee( builder.setFees(
Fee.create(prices.getCreateCost().multipliedBy(years).getAmount(), "create")); ImmutableList.of(
Fee.create(prices.getCreateCost().multipliedBy(years).getAmount(), "create")));
} }
break; break;
case RESTORE: case RESTORE:
@ -599,13 +600,16 @@ public class DomainFlowUtils {
throw new RestoresAreAlwaysForOneYearException(); throw new RestoresAreAlwaysForOneYearException();
} }
// Restores have a "renew" and a "restore" fee. // Restores have a "renew" and a "restore" fee.
builder.setFee( builder.setFees(
ImmutableList.of(
Fee.create(prices.getRenewCost().multipliedBy(years).getAmount(), "renew"), Fee.create(prices.getRenewCost().multipliedBy(years).getAmount(), "renew"),
Fee.create(registry.getStandardRestoreCost().getAmount(), "restore")); Fee.create(registry.getStandardRestoreCost().getAmount(), "restore")));
break; break;
default: default:
// Anything else (transfer|renew) will have a "renew" fee. // Anything else (transfer|renew) will have a "renew" fee.
builder.setFee(Fee.create(prices.getRenewCost().multipliedBy(years).getAmount(), "renew")); builder.setFees(
ImmutableList.of(
Fee.create(prices.getRenewCost().multipliedBy(years).getAmount(), "renew")));
} }
} }

View file

@ -78,13 +78,8 @@ public class BaseFeeResponse extends ImmutableObject {
return thisCastToDerived(); return thisCastToDerived();
} }
public B setFee(Fee... fee) { public B setFees(List<Fee> fees) {
// If there are no fees, set the field to null to suppress the 'fee' section in the xml. // If there are no fees, set the field to null to suppress the 'fee' section in the xml.
getInstance().fee = forceEmptyToNull(ImmutableList.copyOf(fee));
return thisCastToDerived();
}
public B setFee(List<Fee> fees) {
getInstance().fee = forceEmptyToNull(ImmutableList.copyOf(fees)); getInstance().fee = forceEmptyToNull(ImmutableList.copyOf(fees));
return thisCastToDerived(); return thisCastToDerived();
} }