public ZonkyApiToken(final String accessToken, final String refreshToken, final int expiresIn) { this(accessToken, refreshToken, expiresIn, DateUtil.offsetNow(), REFRESH_TOKEN_STRING, SCOPE_APP_WEB_STRING); }
public StateCleaner() { this(DateUtil.offsetNow().minusMonths(3)); }
public StateCleaner() { this(DateUtil.offsetNow().minusMonths(3)); }
public LazyEventImpl(final Class<T> eventType, final Supplier<T> eventSupplier) { this.eventType = eventType; final OffsetDateTime conceivedOn = DateUtil.offsetNow(); this.supplier = Lazy.of(() -> { LOGGER.trace("Instantiating {}.", eventType); final T result = eventSupplier.get(); ((AbstractEventImpl)result).setConceivedOn(conceivedOn); // make the event aware of when it was requested LOGGER.trace("Instantiated to {}.", result); return result; }); }
public LazyEventImpl(final Class<T> eventType, final Supplier<T> eventSupplier) { this.eventType = eventType; final OffsetDateTime conceivedOn = DateUtil.offsetNow(); this.supplier = Lazy.of(() -> { LOGGER.trace("Instantiating {}.", eventType); final T result = eventSupplier.get(); ((AbstractEventImpl)result).setConceivedOn(conceivedOn); // make the event aware of when it was requested LOGGER.trace("Instantiated to {}.", result); return result; }); }
private static boolean isActionable(final LoanDescriptor loanDescriptor) { final OffsetDateTime now = DateUtil.offsetNow(); return loanDescriptor.getLoanCaptchaProtectionEndDateTime() .map(d -> d.isBefore(now)) .orElse(true); }
private Stream<OffsetDateTime> filterValidTimestamps(final Set<OffsetDateTime> timestamps) { final OffsetDateTime now = DateUtil.offsetNow(); return timestamps.stream().filter(timestamp -> timestamp.plus(period).isAfter(now)); }
private static boolean isActionable(final LoanDescriptor loanDescriptor) { final OffsetDateTime now = DateUtil.offsetNow(); return loanDescriptor.getLoanCaptchaProtectionEndDateTime() .map(d -> d.isBefore(now)) .orElse(true); }
public void increase() { final Set<OffsetDateTime> stamps = getTimestamps(); stamps.add(DateUtil.offsetNow()); store(sessionInfo, id, stamps); }
public void increase() { final Set<OffsetDateTime> stamps = getTimestamps(); stamps.add(DateUtil.offsetNow()); store(sessionInfo, id, stamps); }
private Either<InvestmentFailure, BigDecimal> investOrDelegateOnCaptcha(final RecommendedLoan r) { final Optional<OffsetDateTime> captchaEndDateTime = r.descriptor().getLoanCaptchaProtectionEndDateTime(); final boolean isCaptchaProtected = captchaEndDateTime.isPresent() && captchaEndDateTime.get().isAfter(DateUtil.offsetNow()); final boolean confirmationSupported = this.provider != null; if (!isCaptchaProtected) { return this.investLocallyFailingOnCaptcha(r); } else if (confirmationSupported) { return this.delegateOrReject(r); } LOGGER.warn("CAPTCHA protected, no support for delegation. Not investing: {}.", r); return Either.left(InvestmentFailure.REJECTED); }
@Override public Boolean call() { final String sectionName = instanceState.getSectionName(); final StateStorage backend = instanceState.getStorage(); actions.forEach(a -> a.accept(backend, sectionName)); backend.setValue(sectionName, Constants.LAST_UPDATED_KEY.getValue(), DateUtil.offsetNow().toString()); return backend.store(); } }
@Override public Boolean call() { final String sectionName = instanceState.getSectionName(); final StateStorage backend = instanceState.getStorage(); actions.forEach(a -> a.accept(backend, sectionName)); backend.setValue(sectionName, Constants.LAST_UPDATED_KEY.getValue(), DateUtil.offsetNow().toString()); return backend.store(); } }
public Transaction(final long id, final Loan loan, final BigDecimal amount, final TransactionCategory category, final TransactionOrientation orientation) { this.id = id; this.amount = amount; this.category = category; this.orientation = orientation; this.transactionDate = DateUtil.offsetNow(); this.customMessage = ""; this.loanId = loan.getId(); loan.getMyInvestment().ifPresent(i -> this.investmentId = i.getId()); this.loanName = loan.getName(); this.nickName = loan.getNickName(); this.discount = BigDecimal.ZERO; }
public Transaction(final long id, final Loan loan, final BigDecimal amount, final TransactionCategory category, final TransactionOrientation orientation) { this.id = id; this.amount = amount; this.category = category; this.orientation = orientation; this.transactionDate = DateUtil.offsetNow(); this.customMessage = ""; this.loanId = loan.getId(); loan.getMyInvestment().ifPresent(i -> this.investmentId = i.getId()); this.loanName = loan.getName(); this.nickName = loan.getNickName(); this.discount = BigDecimal.ZERO; }
static Investment fresh(final Participation participation, final Loan loan, final BigDecimal amount) { return Investment.fresh(loan, amount) .setId(participation.getInvestmentId()) .setRemainingMonths(participation.getRemainingInstalmentCount()) .setInvestmentDate(DateUtil.offsetNow()) .build(); }
static Investment fresh(final Participation participation, final Loan loan, final BigDecimal amount) { return Investment.fresh(loan, amount) .setId(participation.getInvestmentId()) .setRemainingMonths(participation.getRemainingInstalmentCount()) .setInvestmentDate(DateUtil.offsetNow()) .build(); }
public void setDelinquent(final SessionInfo sessionInfo, final Investment investment) { if (this.isDelinquent(sessionInfo, investment)) { return; } TenantState.of(sessionInfo) .in(DelinquencyTracker.class) .update(b -> b.put(toId(investment), DateUtil.offsetNow().toString())); }
public void setDelinquent(final SessionInfo sessionInfo, final Investment investment) { if (this.isDelinquent(sessionInfo, investment)) { return; } TenantState.of(sessionInfo) .in(DelinquencyTracker.class) .update(b -> b.put(toId(investment), DateUtil.offsetNow().toString())); }
@Test void replacesWithSynthetic() { SoftAssertions.assertSoftly(softly -> { softly.assertThat(DateUtil.now()).isEqualTo(INSTANT); softly.assertThat(DateUtil.localNow()).isEqualTo(LocalDateTime.ofInstant(INSTANT, Defaults.ZONE_ID)); softly.assertThat(DateUtil.offsetNow()).isEqualTo(OffsetDateTime.ofInstant(INSTANT, Defaults.ZONE_ID)); softly.assertThat(DateUtil.zonedNow()).isEqualTo(ZonedDateTime.ofInstant(INSTANT, Defaults.ZONE_ID)); }); }