use of com.github.robozonky.common.secrets.Credentials in project robozonky by RoboZonky.
the class OperatingMode method configure.
public Optional<InvestmentMode> configure(final CommandLine cli, final Authenticated auth) {
final SecretProvider secretProvider = auth.getSecretProvider();
final boolean isDryRun = cli.getTweaksFragment().isDryRunEnabled();
// initialize SessionInfo before the robot potentially sends the first notification
Events.initialize(new SessionInfo(secretProvider.getUsername(), cli.getName(), isDryRun));
// and now initialize the chosen mode of operation
return cli.getConfirmationFragment().getConfirmationCredentials().map(value -> new Credentials(value, secretProvider)).map(credentials -> this.getZonkyProxyBuilder(credentials, secretProvider)).orElse(Optional.of(new Investor.Builder())).map(builder -> {
if (isDryRun) {
LOGGER.info("RoboZonky is doing a dry run. It will not invest any real money.");
builder.asDryRun();
}
builder.asUser(secretProvider.getUsername());
return this.getInvestmentMode(cli, auth, builder);
}).orElse(Optional.empty());
}
Aggregations