Пример #1
0
  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
  public void installmentToPayment(Installment installment) throws IabakoPackageForbiddenException {

    Installment installmentFromDB = (Installment) installmentService.getById(installment.getId());
    if (installmentFromDB == null) {
      log.warn("No installment found with id :" + installment.getId());
      return;
    }

    Payment payment = new Payment();
    payment.setDate(GenericTools.getDateFromString(installment.getDateString()));
    payment.setScheduleDate(GenericTools.getDateFromString(installment.getScheduleDateString()));
    payment.setAmount(installment.getAmount());
    payment.setSale(installment.getSale());
    payment.setComment(installment.getComment());
    payment.setPaymentMethod(installment.getPaymentMethod());
    payment.setRequestDetails(installment.getRequestDetails());
    payment.setRequestBeforeDateSent(installment.isRequestBeforeDateSent());
    payment.setRequestAfterDateSent(installment.isRequestAfterDateSent());

    installmentService.remove(installmentFromDB, true);
    paymentService.save(payment, true);

    trackingService.addTrackingToUserSession(
        TrackingType.installmentToPaymentReceived, installment.getSale());
  }
Пример #2
0
  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
  public void paymentToInstallment(Long idPayment) {

    Payment payment = (Payment) paymentService.getById(idPayment);
    if (payment == null) {
      log.warn("No payment found with id :" + idPayment);
      return;
    }
    Installment installment = new Installment();
    installment.setDate(
        payment.getScheduleDate() != null ? payment.getScheduleDate() : payment.getDate());
    installment.setAmount(payment.getAmount());
    installment.setSale(payment.getSale());
    installment.setComment(payment.getComment());
    installment.setRequestDetails(payment.getRequestDetails());
    installment.setRequestBeforeDateSent(payment.isRequestBeforeDateSent());
    installment.setRequestAfterDateSent(payment.isRequestAfterDateSent());

    paymentService.remove(payment, true);
    installmentService.save(installment, true);

    trackingService.addTrackingToUserSession(
        TrackingType.paymentReceivedToInstallment, payment.getSale());
  }