Store a reference to an allocation token in the OneTime billing event

We will need to be able to find all redemptions associated with a particular token and this will allow us to do that.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=245292865
This commit is contained in:
gbrodman 2019-04-25 13:09:18 -07:00 committed by jianglai
parent d02a01ba66
commit a0f9e3b3dd
5 changed files with 121 additions and 48 deletions

View file

@ -295,6 +295,7 @@ public class DomainCreateFlow implements TransactionalFlow {
years,
feesAndCredits,
historyEntry,
allocationToken,
now);
// Create a new autorenew billing event and poll message starting at the expiration time.
BillingEvent.Recurring autorenewBillingEvent =
@ -477,6 +478,7 @@ public class DomainCreateFlow implements TransactionalFlow {
int years,
FeesAndCredits feesAndCredits,
HistoryEntry historyEntry,
Optional<AllocationToken> allocationToken,
DateTime now) {
ImmutableSet.Builder<Flag> flagsBuilder = new ImmutableSet.Builder<>();
// Sunrise and anchor tenancy are orthogonal tags and thus both can be present together.
@ -497,6 +499,7 @@ public class DomainCreateFlow implements TransactionalFlow {
.setPeriodYears(years)
.setCost(feesAndCredits.getCreateCost())
.setEventTime(now)
.setAllocationToken(allocationToken.map(Key::create).orElse(null))
.setBillingTime(
now.plus(
isAnchorTenant