Add ability to expand TimeOfYear into instances

Utilizing this function in the recurring billing event [], in order to abstract a lot of the expansion logic out of the MR itself.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121579246
This commit is contained in:
ctingue 2016-05-05 08:01:27 -07:00 committed by Justine Tunney
parent 16cfd76ac9
commit b435e20cbe
3 changed files with 81 additions and 10 deletions

View file

@ -138,7 +138,7 @@ public class DomainDeleteFlow extends ResourceSyncDeleteFlow<DomainResource, Bui
if (gracePeriod.getType() == GracePeriodStatus.AUTO_RENEW) {
TimeOfYear recurrenceTimeOfYear =
checkNotNull(gracePeriod.getRecurringBillingEvent()).get().getRecurrenceTimeOfYear();
DateTime autoRenewTime = recurrenceTimeOfYear.beforeOrAt(now);
DateTime autoRenewTime = recurrenceTimeOfYear.getLastInstanceBeforeOrAt(now);
cost = Registry.get(existingResource.getTld())
.getDomainRenewCost(targetId, 1, autoRenewTime);
} else {