private void inheritParentPI() { // inherit parent PI's if customer has privilege try { List<String> privileges = mobBasePage.getDefaultPrivileges( customer.getCustomerTypeId(), customer.getRiskCategoryId()); if (PortalUtils.exists(privileges) && privileges.contains(Constants.PRIV_AUTO_INHERIT_PIS)) { List<WalletEntry> weList = mobBasePage.getWalletEntryList(customer.getParentId(), null, null); if (PortalUtils.exists(weList)) { for (WalletEntry we : weList) { LOG.debug( "# add sva[" + we.getPaymentInstrumentId() + "] to the wallet of customer[" + customer.getId() + "]"); mobBasePage.createAgentWalletEntry( customer.getId(), we.getPaymentInstrumentId(), we.getAlias()); } } } } catch (Exception e) { error(getLocalizer().getString("ERROR.CREATE_AGENT_FAILURE", this)); LOG.error("# An error occurred while creating new customer's wallet Entry", e); } }
private void saveAgentLimitSettings() { try { if (customer.getLimitClass() != null) { customer = mobBasePage.createAgentLimitSetting(customer); } } catch (Exception e) { LOG.error( "# An error occurred whilte updating Limit setting data, with agent Id {}", customer.getId(), e); error(getLocalizer().getString("ERROR.CHANGE_AGENT_SETTINGS", this)); } }
protected void approveCustomer(boolean bApprove) { ContinuePendingCustomerResponse response = null; try { ContinuePendingCustomerRequest request = mobBasePage.getNewMobiliserRequest(ContinuePendingCustomerRequest.class); request.setTaskId(getCustomer().getTaskId()); request.setApprove(bApprove); response = mobBasePage.wsCustomerClient.continuePendingCustomer(request); if (!mobBasePage.evaluateMobiliserResponse(response)) { if (bApprove) { LOG.warn("# An error occurred while approving customer"); } else { LOG.warn("# An error occurred while rejecting customer"); } return; } } catch (Exception e) { if (bApprove) { LOG.error("# An error occurred while approving customer"); error(getLocalizer().getString("customer.approval.error", mobBasePage)); } else { LOG.error("# An error occurred while rejecting customer"); error(getLocalizer().getString("customer.rejection.error", mobBasePage)); } } // Create SVA for customer after approval if (bApprove) { boolean isSvaCreated = false; try { // the customer object at this point does not contain // customer id value from DB so set the id obtained from // response customer.setId(response.getCustomerId()); isSvaCreated = mobBasePage.createSvaWalletWithPI(customer); } catch (Exception e1) { LOG.error( "# An error occured while creating SVA for customer[" + customer.getId() + "]", e1); } finally { if (!isSvaCreated && PortalUtils.exists(response) && PortalUtils.exists(response.getCustomerId())) { try { mobBasePage.deleteCustomer(customer.getId()); } catch (Exception e1) { LOG.error( "# An error occured while deleting the customer[" + customer.getId() + "]", e1); } } } // DPP agent related processing Integer custType = customer.getCustomerTypeId(); if (custType == Constants.CUSTOMER_ROLE_MONEY_MERCHANT || custType == Constants.CUSTOMER_ROLE_MONEY_MERCHANT_AGENT || custType == Constants.CUSTOMER_ROLE_MONEY_MERCHANT_DEALER) { inheritParentPI(); // createBalanceAlerts(); // saveAgentLimitSettings(); } } // End of SVA Creation and DPP agent processing if (bApprove) { LOG.info("Customer approved successfully"); mobBasePage .getMobiliserWebSession() .info(getLocalizer().getString("customer.approved.successfull", mobBasePage)); } else { LOG.info("Customer rejected successfully"); mobBasePage .getMobiliserWebSession() .info(getLocalizer().getString("customer.rejected.successfull", mobBasePage)); } setResponsePage(ApproveCustomersPage.class); }