Inject a DomainPricingLogic into ExpandRecurringBillingEventsAction (#1648)

* Inject a DomainPricingLogic into ExpandRecurringBillingEventsAction

This will be used in other PRs to set the renewal price correctly based on the
renewal price behavior of the BillingRecurrence event.

Note that, in order for this to work, a not-null constraint has been lifted on
the EPP flow state when the DomainPricingCustomLogic is being constructed, as
the pricing here will occur in a backend action outside the context of any EPP
flow.
This commit is contained in:
Ben McIlwain
2022-05-27 11:46:36 -04:00
committed by GitHub
parent 56d1ea71fe
commit 82a50862c4
10 changed files with 71 additions and 30 deletions
@@ -17,6 +17,7 @@ package google.registry.flows.custom;
import google.registry.flows.FlowMetadata;
import google.registry.flows.SessionMetadata;
import google.registry.model.eppinput.EppInput;
import java.util.Optional;
/** A custom logic factory for testing. */
public class TestCustomLogicFactory extends CustomLogicFactory {
@@ -29,7 +30,10 @@ public class TestCustomLogicFactory extends CustomLogicFactory {
@Override
public DomainPricingCustomLogic forDomainPricing(
EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) {
return new TestDomainPricingCustomLogic(eppInput, sessionMetadata, flowMetadata);
Optional<EppInput> eppInput,
Optional<SessionMetadata> sessionMetadata,
Optional<FlowMetadata> flowMetadata) {
return new TestDomainPricingCustomLogic(
eppInput.orElse(null), sessionMetadata.orElse(null), flowMetadata.orElse(null));
}
}
@@ -36,7 +36,7 @@ public class TestDomainCreateFlowCustomLogic extends DomainCreateFlowCustomLogic
new PollMessage.OneTime.Builder()
.setParent(parameters.historyEntry())
.setEventTime(tm().getTransactionTime())
.setRegistrarId(getSessionMetadata().getRegistrarId())
.setRegistrarId(getSessionMetadata().get().getRegistrarId())
.setMsg("Custom logic was triggered")
.build();
return EntityChanges.newBuilder()