@FXML
 private void perfromTransfer() {
   BigDecimal transferAmount = new BigDecimal(0);
   String dealer = "";
   try {
     String amount = amountTextField.getText();
     transferAmount = new BigDecimal(amount);
     dealer = recipientTextField.getText();
     if (amount.equals("")) throw new IllegalArgumentException("Must supply a transfer amount");
     if (!InputConstraints.validateMsisdn(dealer))
       throw new IllegalArgumentException("Dealer Id not in correct msisdn format");
     boolean sendSms = sendSmsBox.isSelected();
     FundTransferRequest fundTransferRequest = new FundTransferRequest();
     fundTransferRequest.setAmount(Integer.parseInt(amount));
     fundTransferRequest.setRecipientMsisdn(dealer);
     fundTransferRequest.setSendSms(sendSms);
     FundTransferResponse transferResponse =
         mainApp.getSmartloadInterface().performFundsTransfer(fundTransferRequest);
     SubmissionStatus submissionStatus =
         DataAccess.loadSubmissionStatus(transferResponse.getResponseCode().name());
     String status =
         transferResponse.getError() == null
             ? transferResponse.getResponseCode().name()
             : transferResponse.getError().getMessage();
     saveTransaction(submissionStatus, status, transferAmount, dealer);
     if (transferResponse.getResponseCode().equals(ResponseCode.SUCCESS)) {
       NumberFormat currency = NumberFormat.getCurrencyInstance();
       String message =
           "Successful Transfer of  "
               + currency.format(transferAmount)
               + " New balance "
               + currency.format(transferResponse.getCurrentDealerBalance());
       log.info(message + " new Dealer balance " + transferResponse.getNewDealerBalance());
       DialogFactory.createDialogInformation(DESCRIPTION, "Transfer successful", message);
       recipientTextField.setText("");
       amountTextField.setText("");
     } else {
       DialogFactory.createDialogError(
           "Transfer error",
           "Error performing transfer",
           transferResponse.getError().getMessage());
     }
     mainApp.refresh();
   } catch (Exception e) {
     DialogFactory.createDialogException("Transfer error", "Error performing transfer", e);
     SubmissionStatus submissionStatus =
         DataAccess.loadSubmissionStatus(ResponseCode.SYS_ERROR.name());
     saveTransaction(submissionStatus, e.getMessage(), transferAmount, dealer);
   }
 }
 private void saveTransaction(
     SubmissionStatus status, String error, BigDecimal amount, String dealerId) {
   Transaction transaction = new Transaction();
   NumberFormat currency = NumberFormat.getCurrencyInstance();
   transaction.setAmount(currency.format(amount));
   transaction.setDescription(DESCRIPTION);
   transaction.setDeviceId(dealerId);
   transaction.setSubmissionStatus(status);
   transaction.setStatusDate(new Date());
   transaction.setResponseMessage(error);
   transaction.setLastFileName("");
   transaction.setOrderRefNumber("");
   transaction.setTransactionStatus("Submitted");
   transaction.setDealer(mainApp.currentDealer);
   DataAccess.saveOrUpdateTransactionToDB(transaction);
 }
 public void setup() {
   dealerMsisdn.setText(RefPreferences.getDealerMsisdn());
   dealerBalance.setText(mainApp.getDealerBalance());
   Transaction trans = DataAccess.getlastTransaction(DESCRIPTION);
   if (trans != null) lastTransaction.setText(trans.getBasicDescription());
 }