private void performCashIn() { String terminalId = formatMsisdn(basePage.getMobiliserWebSession().getBtpnLoggedInCustomer().getUsername()); try { final DebitPostingRequest request = basePage.getNewMobiliserRequest(DebitPostingRequest.class); request.setRepeat(Boolean.FALSE); request.setConversationId(cashInBean.getConvId()); request.setFinal(true); request.setProcessingCode(cashInBean.getProc_code()); request.setTransactionDateTime(cashInBean.getTransactionDatetime()); request.setMerchantType("6012"); request.setMerchantId("BTPN"); request.setTerminalId(terminalId); request.setAcquirerId("213"); DebitPostingResponse response = debitClient.posting(request); if (basePage.evaluateConsumerPortalMobiliserResponse(response)) { List<DebitTransactionType> cashInTransaction = response.getTransaction(); for (DebitTransactionType txnBean : cashInTransaction) { cashInBean.setDisplayName(txnBean.getCreditAccount().getHolderName()); cashInBean.setAccountBalance( Long.valueOf(txnBean.getCreditAccount().getBalance().getValue())); cashInBean.setAccountName(txnBean.getCreditAccount().getHolderName()); cashInBean.setAccountNumber(txnBean.getCreditAccount().getNumber()); cashInBean.setAccountType(txnBean.getCreditAccount().getType()); setResponsePage(new AgentPortalCustomCashInSuccessPage(cashInBean)); } } else { handleSpecificErrorMessage(response.getStatus().getCode()); } } catch (Exception ex) { log.error("#An error occurred while calling performAgentCashIn service", ex); error(getLocalizer().getString("error.exception", this)); } }
private String formatMsisdn(String msisdn) { return new PhoneNumber(msisdn, basePage.getAgentPortalPrefsConfig().getDefaultCountryCode()) .getInternationalFormat(); }