예제 #1
0
  @Override
  public HashMap<String, List<Document>> getMoneyMotionRequestsLogs(Deposit deposit) {
    HashMap<String, List<Document>> logs = new LinkedHashMap<String, List<Document>>();
    logs.put("payinaccount", billingSystemUtils.getPayInAccountRequestsUndoneLog(deposit));
    logs.put("outcome", billingSystemUtils.getOutcomeUndoneLog(deposit));

    return logs;
  }
예제 #2
0
 @Override
 public DepositOutcomeDocument requestEarlyOutcome(Deposit deposit, BigDecimal sum)
     throws RedSaldoException {
   DepositOutcomeDocument depositOutcomeDocument =
       billingSystemUtils.doDepositEarlyOutcomeRequest(deposit.getId(), sum);
   return depositOutcomeDocument;
 }
예제 #3
0
  @Override
  public DepositPayInAccountDocument requestAdditionalMoneyPayIn(Deposit deposit, BigDecimal sum) {
    DepositPayInAccountDocument depositPayInAccountDocument =
        billingSystemUtils.doDepositAdditionalPayInAccountRequest(deposit.getId(), sum);

    return depositPayInAccountDocument;
  }
예제 #4
0
  @Override
  public void capitalize(Deposit deposit) throws DepositCapitalizationIllegalStateException {

    System.out.println(
        "capitalization of #"
            .concat(deposit.getId().toString())
            .concat(" next capitalization ")
            .concat(deposit.getNextCapitalization().toString()));

    BigDecimal saldo = billingSystemUtils.getDepositSaldo(deposit.getId());

    if (saldo.compareTo(BigDecimal.ZERO) < 1) {
      System.out.println("Нет денег - нет прибыли");
      throw new DepositCapitalizationIllegalStateException(
          "На счету нет денег. Капитализация невозможна");
    }

    if (deposit.getPercent() == null || deposit.getPercent().compareTo(BigDecimal.ZERO) < 1) {
      throw new DepositCapitalizationIllegalStateException(
          "Не задана процентная ставка. Каитализация невозможна");
    }

    DepositCalculation depositCalculationMonth =
        new DepositCalculation(saldo, 1, deposit.getDepositorFormType());
    depositCalculationMonth.percents = deposit.getPercent();

    BigDecimal sumToAdd =
        depositCalculationService.calculateSumInTheEnd(depositCalculationMonth).add(saldo.negate());

    billingSystemUtils.doDepositPayInMonthlyProfit(
        deposit.getId(), sumToAdd, deposit.getNextCapitalization());

    Calendar calendar = Calendar.getInstance();
    calendar.setTime(deposit.getNextCapitalization());
    calendar.add(Calendar.MONTH, 1);

    deposit.setNextCapitalization(calendar.getTime());

    entityManager.merge(deposit);
  }
예제 #5
0
 @Override
 public void cancelRequestToOutcomeByDocNumber(String code)
     throws DocumentAlreadyProcessingException, DocumentNotFoundException, RedSaldoException,
         IllegalDocumentStateException {
   billingSystemUtils.cancelRequestBeforeMoneyTransferByDocNumber(code);
 }