public LoanWrapper(final LoanDescriptor original) { super(original); this.loan = original.item(); }
public LoanWrapper(final LoanDescriptor original) { super(original); this.loan = original.item(); }
@Override public long identify(final LoanDescriptor descriptor) { return descriptor.item().getId(); }
@Override public long identify(final LoanDescriptor descriptor) { return descriptor.item().getId(); }
public InvestmentRejectedEventImpl(final RecommendedLoan recommendation, final String confirmationProviderId) { this.loan = recommendation.descriptor().item(); this.recommendation = recommendation.amount(); this.confirmationProviderId = confirmationProviderId; }
private static SessionState<LoanDescriptor> newSessionState(final Tenant tenant, final Collection<LoanDescriptor> marketplace, final String key) { return new SessionState<>(tenant, marketplace, d -> d.item().getId(), key); }
public InvestmentDelegatedEventImpl(final RecommendedLoan recommendation, final String confirmationProviderId) { this.loan = recommendation.descriptor().item(); this.recommendation = recommendation.amount(); this.confirmationProviderId = confirmationProviderId; }
public InvestmentSkippedEventImpl(final RecommendedLoan recommendation) { this.loan = recommendation.descriptor().item(); this.recommendation = recommendation.amount(); }
public InvestmentRejectedEventImpl(final RecommendedLoan recommendation, final String confirmationProviderId) { this.loan = recommendation.descriptor().item(); this.recommendation = recommendation.amount(); this.confirmationProviderId = confirmationProviderId; }
private static SessionState<LoanDescriptor> newSessionState(final Tenant tenant, final Collection<LoanDescriptor> marketplace, final String key) { return new SessionState<>(tenant, marketplace, d -> d.item().getId(), key); }
public InvestmentDelegatedEventImpl(final RecommendedLoan recommendation, final String confirmationProviderId) { this.loan = recommendation.descriptor().item(); this.recommendation = recommendation.amount(); this.confirmationProviderId = confirmationProviderId; }
static Investment convertToInvestment(final RecommendedLoan r) { final int amount = r.amount().intValue(); return Investment.fresh(r.descriptor().item(), amount); }
private Either<InvestmentFailure, BigDecimal> delegateOrReject(final RecommendedLoan r) { LOGGER.debug("Asking to confirm investment: {}.", r); final boolean delegationSucceeded = this.provider.requestConfirmation(this.requestId, r.descriptor().item().getId(), r.amount().intValue()); if (delegationSucceeded) { LOGGER.debug("Investment confirmed delegated, not investing: {}.", r); return Either.left(InvestmentFailure.DELEGATED); } else { LOGGER.debug("Investment not confirmed delegated, not investing: {}.", r); return Either.left(InvestmentFailure.REJECTED); } }
private Either<InvestmentFailure, BigDecimal> delegateOrReject(final RecommendedLoan r) { LOGGER.debug("Asking to confirm investment: {}.", r); final boolean delegationSucceeded = this.provider.requestConfirmation(this.requestId, r.descriptor().item().getId(), r.amount().intValue()); if (delegationSucceeded) { LOGGER.debug("Investment confirmed delegated, not investing: {}.", r); return Either.left(InvestmentFailure.DELEGATED); } else { LOGGER.debug("Investment not confirmed delegated, not investing: {}.", r); return Either.left(InvestmentFailure.REJECTED); } }
private static InvestmentStrategy mockStrategy(final int loanToRecommend, final int recommend) { return (l, p, r) -> l.stream() .filter(i -> i.item().getId() == loanToRecommend) .flatMap(i -> i.recommend(BigDecimal.valueOf(recommend)).map(Stream::of).orElse(Stream.empty())); }
private boolean successfulInvestment(final RecommendedLoan recommendation, final BigDecimal amount) { final int confirmedAmount = amount.intValue(); final MarketplaceLoan l = recommendation.descriptor().item(); final Investment i = Investment.fresh(l, confirmedAmount); markSuccessfulInvestment(i); discard(recommendation.descriptor()); // never show again tenant.fire(investmentMadeLazy(() -> investmentMade(i, l, tenant.getPortfolio().getOverview()))); return true; }
private boolean successfulInvestment(final RecommendedLoan recommendation, final BigDecimal amount) { final int confirmedAmount = amount.intValue(); final MarketplaceLoan l = recommendation.descriptor().item(); final Investment i = Investment.fresh(l, confirmedAmount); markSuccessfulInvestment(i); discard(recommendation.descriptor()); // never show again tenant.fire(investmentMadeLazy(() -> investmentMade(i, l, tenant.getPortfolio().getOverview()))); return true; }
@Test void constructorForCaptchaLess() { final Loan mockedLoan = LoanDescriptorTest.mockLoan(Rating.AAAAA); final LoanDescriptor ld = new LoanDescriptor(mockedLoan); assertSoftly(softly -> { softly.assertThat(ld.item()).isSameAs(mockedLoan); softly.assertThat(ld.getLoanCaptchaProtectionEndDateTime()).isEmpty(); }); }
@Disabled("Looks like CAPTCHA is disabled for now. Let's wait and see if it comes back.") @Test void constructorForCaptcha() { final Loan mockedLoan = LoanDescriptorTest.mockLoan(); final LoanDescriptor ld = new LoanDescriptor(mockedLoan); assertSoftly(softly -> { softly.assertThat(ld.item()).isSameAs(mockedLoan); softly.assertThat(ld.getLoanCaptchaProtectionEndDateTime()) .isPresent() .contains(mockedLoan.getDatePublished().plus(Settings.INSTANCE.getCaptchaDelay())); }); }