Ejemplo n.º 1
0
  @Override
  public BankAccountDTO checkSolvability(float amount, Integer bankAccountId) {

    BankAccountDTO bankAccountDTO =
        PaymentMapper.convert(bankDao.getBankAccountById(bankAccountId));
    if (bankAccountDTO.getBalance() <= amount) {
      return null;
    } else {
      LOGGER.info("$$$ Solvability OK $$$ ");
      return bankAccountDTO;
    }
  }
Ejemplo n.º 2
0
  @Override
  public BankCardDTO getBankCardByOwner(Integer userId) {

    LOGGER.info(" $$$ Params to check bank card by userId  ==> " + userId + " $$$ ");
    BankCardDTO bankCardDto = null;
    EBankCard bankCard = bankDao.getBankCardByOwner(userId);
    if (bankCard == null) {
      LOGGER.info("$$$ No bank card found $$$ ");
      return null;
    } else {
      bankCardDto = PaymentMapper.convert(bankCard);
      return bankCardDto;
    }
  }
Ejemplo n.º 3
0
 @Override
 public String doPayment(BankAccountDTO bankAccount, float amount, Integer idBookingInProgress) {
   LOGGER.info(" $$$ Do Payment web service $$$ ");
   if (bankAccount != null) {
     LOGGER.info(" $$$ Bank account OK -- start credit operation : " + amount + " $$$ ");
     double balance = bankAccount.getBalance();
     double newbalance = balance - amount;
     bankAccount.setBalance(newbalance);
     EBankAccount ba = PaymentMapper.convert(bankAccount);
     bankDao.updateBankAccount(ba);
     // TODO delete BP only if Payment is OK
     bookingProgressDao.delete(idBookingInProgress);
     return "OK";
   } else {
     return "KO";
   }
 }
Ejemplo n.º 4
0
 @Override
 public BankAccountDTO checkBankCardLinkedBankAccount(Integer bankCardId) {
   EBankAccount ba = bankDao.getBankAccountByBankCard(bankCardId);
   LOGGER.info(" $$$ Bank account linked = " + ba.getIdBankAccount() + " $$$ ");
   return PaymentMapper.convert(bankDao.getBankAccountByBankCard(bankCardId));
 }
Ejemplo n.º 5
0
 @Override
 public UserPaymentDTO login(String login) {
   EUser user = userDao.loadUserByUsername(login);
   UserPaymentDTO u = PaymentMapper.convert(user);
   return u;
 }