use of org.killbill.billing.entitlement.plugin.api.EntitlementPluginApi in project killbill by killbill.
the class EntitlementPluginExecution method executePluginPriorCalls.
private PriorEntitlementResult executePluginPriorCalls(final EntitlementContext entitlementContextArg) throws EntitlementPluginApiException {
// Return as soon as the first plugin aborts, or the last result for the last plugin
PriorEntitlementResult prevResult = null;
EntitlementContext currentContext = entitlementContextArg;
for (final String pluginName : pluginRegistry.getAllServices()) {
final EntitlementPluginApi plugin = pluginRegistry.getServiceForName(pluginName);
if (plugin == null) {
// First call to plugin, we log warn, if plugin is not registered
log.warn("Skipping unknown entitlement control plugin {} when fetching results", pluginName);
continue;
}
prevResult = plugin.priorCall(currentContext, currentContext.getPluginProperties());
if (prevResult != null && prevResult.isAborted()) {
break;
}
currentContext = new DefaultEntitlementContext(currentContext, prevResult);
}
return prevResult;
}
Aggregations