Пример #1
0
  public static String InsertTransferReportProtocal(
      RequestPublicModel publicModel,
      String accountCode,
      double amount,
      String puroseCurrency,
      String transferType,
      String purposeDescription,
      String executionDate,
      DestaccountModel destAccount,
      String otpValue,
      String otpKeySession,
      String otpChannel,
      String currency,
      CheckTransferResponseModel checkTransfer) {
    String result = null;
    try {
      JSONObject jsonObj = new JSONObject();
      JSONObject insertTransferObj = new JSONObject();
      JSONObject destAccountObj = new JSONObject();
      insertTransferObj.put("serviceType", ServiceType.insertTransfer);
      insertTransferObj.put("bankName", publicModel.getBankName());
      insertTransferObj.put("enterpriseId", publicModel.getEnterpriseId());
      insertTransferObj.put("token", publicModel.getToken());
      insertTransferObj.put("customerCode", publicModel.getCustomerCode());
      insertTransferObj.put("channel", publicModel.getChannel());
      insertTransferObj.put("userAgent", publicModel.getUserAgent());
      insertTransferObj.put("sessionId", publicModel.getSessionId());
      insertTransferObj.put("currency", currency);
      if (Contants.isNewPaymentsUpdate) {
        insertTransferObj.put("transferCheck", true);
        insertTransferObj.put("transferId", checkTransfer.getTransferId());
      }

      insertTransferObj.put("accountCode", accountCode);
      insertTransferObj.put("transferType", transferType);
      insertTransferObj.put("amount", amount);
      insertTransferObj.put("executionDate", executionDate);
      insertTransferObj.put("purposeCurrency", puroseCurrency);
      insertTransferObj.put("purposeDescription", purposeDescription);
      insertTransferObj.put("otpValue", otpValue);
      insertTransferObj.put("otpKeySession", otpKeySession);
      insertTransferObj.put("otpChannel", otpChannel);

      destAccountObj.put("title", destAccount.getTitle());
      destAccountObj.put("state", destAccount.getState());
      destAccountObj.put("iban", destAccount.getIban());
      destAccountObj.put("bic", destAccount.getBic());

      insertTransferObj.put("destAccount", destAccountObj);
      jsonObj.put("InsertTransferRequest", insertTransferObj);
      result = jsonObj.toString();
    } catch (Exception e) {
      LogManager.e("InsertTransferReportProtocal is error " + e.getLocalizedMessage());
    }
    return result;
  }
Пример #2
0
  /**
   * @param publicModel
   * @return
   */
  public static String HelpItemReportProtocal(RequestPublicModel publicModel) {
    String result = null;
    try {
      JSONObject jsonObj = new JSONObject();
      JSONObject helpItemObj = new JSONObject();
      helpItemObj.put("serviceType", ServiceType.getHelpItems);
      helpItemObj.put("bankName", publicModel.getBankName());
      helpItemObj.put("enterpriseId", publicModel.getEnterpriseId());
      helpItemObj.put("customerCode", publicModel.getCustomerCode());
      helpItemObj.put("channel", publicModel.getChannel());
      helpItemObj.put("userAgent", publicModel.getUserAgent());

      jsonObj.put("GetHelpItemsRequest", helpItemObj);
      result = jsonObj.toString();
    } catch (Exception e) {
      LogManager.e("HelpItemReportProtocal is error" + e.getLocalizedMessage());
    }
    return result;
  }
Пример #3
0
  public static GetHelpItemResponseModel ParseHelpItemResponse(String json) {

    GetHelpItemResponseModel getHelpItemResponse = new GetHelpItemResponseModel();
    List<HelpItemListModel> helpItems = new ArrayList<HelpItemListModel>();

    if (json == null) {
      return null;
    }

    try {
      JSONObject jsonObj = new JSONObject(json);
      JSONObject helpItemResponse = jsonObj.getJSONObject("GetHelpItemsResponse");

      getHelpItemResponse.responsePublicModel.setResultCode(helpItemResponse.optInt("resultCode"));
      getHelpItemResponse.responsePublicModel.setResultDescription(
          helpItemResponse.optString("resultDescription"));
      if (getHelpItemResponse.responsePublicModel.getResultCode() != 0) {
        JSONObject eventManagementObj = helpItemResponse.getJSONObject("eventManagement");
        getHelpItemResponse.responsePublicModel.eventManagement.setErrorCode(
            eventManagementObj.optString("errorCode"));
        getHelpItemResponse.responsePublicModel.eventManagement.setErrorDescription(
            eventManagementObj.optString("errorDescription"));
        return getHelpItemResponse;
      }

      getHelpItemResponse.responsePublicModel.setTransactionId(
          helpItemResponse.optString("transactionId"));

      JSONArray helpItemArray = helpItemResponse.getJSONArray("helpItemsList");
      for (int i = 0; i < helpItemArray.length(); i++) {
        HelpItemListModel helpItem = new HelpItemListModel("");
        helpItem.setHelpItemId(helpItemArray.getJSONObject(i).optInt("helpItemId"));
        helpItem.setText(helpItemArray.getJSONObject(i).optString("text"));
        helpItem.setTitle(helpItemArray.getJSONObject(i).optString("title"));
        helpItems.add(helpItem);
      }
      getHelpItemResponse.setHelpItemList(helpItems);
    } catch (Exception e) {
      LogManager.e("ParseHelpItemResponse is error" + e.getLocalizedMessage());
    }
    return getHelpItemResponse;
  }
Пример #4
0
  public static ResponsePublicModel ParseInsertTransferResponse(String json) {
    ResponsePublicModel responsePublicModel = new ResponsePublicModel();
    EntryModel entryModel = new EntryModel();
    List<Object> fieldMap = new ArrayList<Object>();
    if (json == null) {
      return null;
    }

    try {
      JSONObject jsonObj = new JSONObject(json);
      JSONObject insertTransferObj = jsonObj.getJSONObject("InsertTransferResponse");

      responsePublicModel.setResultCode(insertTransferObj.getInt("resultCode"));
      responsePublicModel.setResultDescription(insertTransferObj.optString("resultDescription"));
      if (responsePublicModel.getResultCode() != 0) {
        JSONObject eventManagementObj = insertTransferObj.getJSONObject("eventManagement");
        responsePublicModel.eventManagement.setErrorCode(eventManagementObj.optString("errorCode"));
        responsePublicModel.eventManagement.setErrorDescription(
            eventManagementObj.optString("errorDescription"));
        return responsePublicModel;
      }

      responsePublicModel.setTransactionId(insertTransferObj.optString("transactionId"));

      JSONObject fieldMapObj = insertTransferObj.getJSONObject("fieldMap");
      JSONArray entryArray = fieldMapObj.getJSONArray("entry");
      for (int i = 0; i < entryArray.length(); i++) {
        entryModel.setKey(entryArray.getJSONObject(i).optString("key"));
        entryModel.setValue(entryArray.getJSONObject(i).optString("value"));
        fieldMap.add(entryModel);
      }
      responsePublicModel.setFieldMap(fieldMap);
    } catch (JSONException e) {
      LogManager.e("ParseLoginResponse is error " + e.getLocalizedMessage());
    }
    return responsePublicModel;
  }