コード例 #1
0
 protected String getInternationalMsisdnFormat(String msisdn) {
   PhoneNumber pn = new PhoneNumber(msisdn);
   return pn.getInternationalFormat();
 }
コード例 #2
0
  private void sendMoneyNext() {
    LOG.debug("#SendMoneyPage.sendMoneyNext()");

    if (getTxnText().length() > Integer.valueOf(Constants.MAX_LENGTH_SEND_MONEY_TXN_TEXT)) {
      error(getLocalizer().getString("sendMoney.text.length.error", this));
      return;
    }

    PhoneNumber pn = new PhoneNumber(getRecipient(), getConfiguration().getCountryCode());

    com.sybase365.mobiliser.util.tools.wicketutils.security.Customer loggedInCustomer =
        getMobiliserWebSession().getLoggedInCustomer();

    convertAmount();
    TransactionBean tab = new TransactionBean();
    VatAmount vatAmnt = new VatAmount();
    SVA sva = null;
    try {
      WalletEntry wallet = getSvaPI(getMobiliserWebSession().getLoggedInCustomer().getCustomerId());
      if (PortalUtils.exists(wallet)) sva = wallet.getSva();
      if (PortalUtils.exists(sva)) {
        vatAmnt.setCurrency(
            PortalUtils.exists(sva.getCurrency())
                ? sva.getCurrency()
                : getConfiguration().getCurrency());
      } else {
        vatAmnt.setCurrency(getConfiguration().getCurrency());
      }

    } catch (Exception e1) {
      LOG.error("# Error while getting SVA's payment instrument", e1);
    }

    vatAmnt.setValue(amount);

    tab.setAmount(vatAmnt);
    tab.setAutoCapture(true);
    tab.setUsecase(Integer.valueOf(Constants.USE_CASE_SEND_MONEY));
    tab.setText(txnText);

    TransactionParticipant payer = new TransactionParticipant();
    Identifier payerId = new Identifier();
    payerId.setType(Constants.IDENT_TYPE_CUST_ID);
    payerId.setValue(String.valueOf(loggedInCustomer.getCustomerId()));
    payer.setIdentifier(payerId);
    tab.setPayer(payer);

    TransactionParticipant payee = new TransactionParticipant();
    Identifier payeeId = new Identifier();
    payeeId.setType(Constants.IDENT_TYPE_MSISDN);
    payeeId.setValue(pn.getInternationalFormat());
    payee.setIdentifier(payeeId);
    tab.setPayee(payee);
    tab.setModule(Constants.MODULE_SEND_MONEY);

    Customer payeeCustomer =
        getCustomerByIdentification(Constants.IDENT_TYPE_MSISDN, pn.getInternationalFormat());

    try {
      if (PortalUtils.exists(payeeCustomer)) {
        if (handleTransaction(tab)) setResponsePage(new SendMoneyFriendConfirmPage(tab, false));
      } else {
        if (startVoucher(tab)) setResponsePage(new SendMoneyFriendConfirmPage(tab, true));
      }
    } catch (Exception e) {
      LOG.error("# An error occurred during Preauthorization", e);
      error(getLocalizer().getString("preauthorization.error", this));
      return;
    }
  }