public static Transaction CreateBankcardTransaction() {
    try {
      Configuration configFile =
          new PropertiesConfiguration("com/ipcommerce/CWS/Resources/cws.properties");

      CardData cardData = new CardData();
      IndustryType industry =
          IndustryType.fromValue(configFile.getString("TXN_DATA_INDUSTRY_TYPE"));

      if (industry == IndustryType.RETAIL) {
        cardData.setCardType(TypeCardType.VISA);
        cardData.setExpire("1012");
        cardData.setPAN("5454545454545454");
        cardData.setTrack1Data("B4111111111111111^IPCOMMERCE/TESTCARD^10121010454500415000010");
      }
      if (industry == IndustryType.RESTAURANT) {
        cardData.setCardType(TypeCardType.VISA);
        cardData.setExpire("1012");
        cardData.setPAN("5454545454545454");
        cardData.setTrack1Data("B4111111111111111^IPCOMMERCE/TESTCARD^10121010454500415000010");
      }
      if (industry == IndustryType.MOTO) {
        cardData.setCardholderName("John Doe");
        cardData.setCardType(TypeCardType.MASTER_CARD);
        cardData.setExpire("1012");
        cardData.setPAN("5454545454545454");
        // tenderData.CardSecurityData = new CardSecurityData();
        // tenderData.CardSecurityData.CVData = "111";
        // tenderData.CardSecurityData.CVDataProvided = CVDataProvided.Provided;
      }
      if (industry == IndustryType.ECOMMERCE) {
        cardData.setCardholderName("John Doe");
        cardData.setCardType(TypeCardType.MASTER_CARD);
        cardData.setExpire("1012");
        cardData.setPAN("5454545454545454");
        // tenderData.CardSecurityData = new CardSecurityData();
        // tenderData.CardSecurityData.CVData = "111";
        // tenderData.CardSecurityData.CVDataProvided = CVDataProvided.Provided;
      }

      /*
       * Note: not all processors support the new Alternative Merchant Data object
       * 		 See else statement below for alternate format of Soft Descriptors
       */
      AlternativeMerchantData altMerchData = new AlternativeMerchantData();
      TransactionReportingData reportingData = new TransactionReportingData();
      if (Boolean.valueOf(configFile.getString("TXN_DATA_SOFT_DESCRIPTORS"))) {
        altMerchData.setName("AltMerchName");
        altMerchData.setMerchantId("122234");
        altMerchData.setDescription("Blue Bottle");
        altMerchData.setCustomerServiceInternet("*****@*****.**");
        altMerchData.setCustomerServicePhone("303 5551212");
        com.ipcommerce.schemas.cws.v2_0.transactions.AddressInfo address =
            new com.ipcommerce.schemas.cws.v2_0.transactions.AddressInfo();
        address.setStreet1("123 Test Street");
        address.setCity("Denver");
        address.setStateProvince("CO");
        address.setPostalCode("80202");
        address.setCountryCode(
            com.ipcommerce.schemas.cws.v2_0.transactions.TypeISOCountryCodeA3.USA);
        altMerchData.setAddress(address);
      }
      /*
       * Note: older processors support this way of Soft Descriptors/Alternative Merchant Data
       * 		 the combination of your top level MerchantProfile->MerchantName with MerchantProfile->CustomerServiceInternet
       * 		 combined with the ReportingData->Description will make the soft descriptor format
       */
      else {
        reportingData.setDescription("AltMerchName");
      }

      BankcardInterchangeData interchangeData = new BankcardInterchangeData();
      if (Boolean.valueOf(configFile.getString("PRO_INTERCHANGE_DATA"))) {
        interchangeData.setBillPayment(
            BillPayment
                .RECURRING); // Any time BillPayInd is set to either "DeferredBilling",
                             // "Installment", "SinglePayment" or "Recurring", CustomerPresent
                             // should be set to "BillPayment"
        interchangeData.setRequestCommercialCard(RequestCommercialCard.NOT_SET);
        interchangeData.setExistingDebt(ExistingDebt.NOT_EXISTING_DEBT);
        interchangeData.setTotalNumberOfInstallments(1); // Used for Installment Payments
        interchangeData.setCurrentInstallmentNumber(
            1); // Send 1 for the first payment and any number greater than 1 for the remaining
                // payments.
        interchangeData.setRequestACI(
            com.ipcommerce.schemas.cws.v2_0.transactions.bankcard.RequestACI.NOT_SET);
        interchangeData.setRequestAdvice(
            com.ipcommerce.schemas.cws.v2_0.transactions.bankcard.RequestAdvice.NOT_SET);
      } else {
        interchangeData.setBillPayment(BillPayment.NOT_SET);
        interchangeData.setRequestCommercialCard(RequestCommercialCard.NOT_SET);
        interchangeData.setExistingDebt(ExistingDebt.NOT_SET);
        interchangeData.setTotalNumberOfInstallments(0);
        interchangeData.setCurrentInstallmentNumber(0);
        interchangeData.setRequestACI(
            com.ipcommerce.schemas.cws.v2_0.transactions.bankcard.RequestACI.NOT_SET);
        interchangeData.setRequestAdvice(
            com.ipcommerce.schemas.cws.v2_0.transactions.bankcard.RequestAdvice.NOT_SET);
      }

      BankcardTenderData tenderData = new BankcardTenderData();
      tenderData.setCardData(cardData);

      if (Boolean.valueOf(configFile.getString("PRO_INCLUDE_LEVEL_2_OR_LEVEL_3_DATA"))) {
        BankcardTransactionPro txn = new BankcardTransactionPro();
        txn.setTenderData(tenderData);
        txn.setReportingData(reportingData);
        txn.setInterchangeData(interchangeData);

        BankcardTransactionDataPro transactionData = new BankcardTransactionDataPro();
        transactionData.setAlternativeMerchantData(altMerchData);
        transactionData.setAmount(new BigDecimal(10.00).setScale(2, RoundingMode.HALF_EVEN));
        transactionData.setCashBackAmount(new BigDecimal(0.00).setScale(2, RoundingMode.HALF_EVEN));
        transactionData.setTipAmount(new BigDecimal(0.00).setScale(2, RoundingMode.HALF_EVEN));
        transactionData.setFeeAmount(new BigDecimal(0.00).setScale(2, RoundingMode.HALF_EVEN));
        transactionData.setAccountType(AccountType.NOT_SET);
        transactionData.setCustomerPresent(
            com.ipcommerce.schemas.cws.v2_0.transactions.bankcard.CustomerPresent.fromValue(
                configFile.getString("TXN_DATA_CUSTOMER_PRESENT")));
        transactionData.setEmployeeId("12"); // Used for Regail, Restaurant, MOTO
        transactionData.setEntryMode(
            com.ipcommerce.schemas.cws.v2_0.transactions.EntryMode.fromValue(
                configFile.getString("TXN_DATA_ENTRY_MODE")));
        transactionData.setGoodsType(
            GoodsType.DIGITAL_GOODS); // DigitalGoods - PhysicalGoods - Used only for Ecommerce
        // transactionData.setAccountType(AccountType.CheckingAccount); // SavingsAccount,
        // CheckingAccount - used only for PINDebit
        transactionData.setCurrencyCode(
            com.ipcommerce.schemas.cws.v2_0.transactions.TypeISOCurrencyCodeA3.USD);
        transactionData.setSignatureCaptured(false); // Required
        transactionData.setIsQuasiCash(false); // Optional
        transactionData.setIsPartialShipment(false); // Optional	
        transactionData.setPartialApprovalCapable(PartialApprovalSupportType.NOT_SET);
        // TODO Fix this so the format is in 2012-10-23T14:38:59.730-06:00
        Calendar cal = Calendar.getInstance();
        // String sdf = new SimpleDateFormat("yyyy-MM-ddThh:mm:ss").format(cal.getTime());
        transactionData.setTransactionDateTime("2012-10-23T14:38:59.730-06:00");
        transactionData.setOrderNumber("12345");
        transactionData.setLaneId("1");

        // Level 2 Data
        Level2Data l2d = new Level2Data();
        l2d.setBaseAmount(new BigDecimal(9.00).setScale(2, RoundingMode.HALF_EVEN));
        l2d.setOrderNumber("12345");
        l2d.setDestinationPostal("80211");
        l2d.setOrderDate(cal);
        l2d.setDescription("level2Description");
        Tax tax = new Tax();
        tax.setAmount(new BigDecimal(1.00).setScale(2, RoundingMode.HALF_EVEN));
        TaxExempt te = new TaxExempt();
        te.setIsTaxExempt(IsTaxExempt.NOT_EXEMPT_TAX_INFO_NOT_PROVIDED);

        transactionData.setLevel2Data(l2d);
        txn.setTransactionData(transactionData);
        return txn;
      } else {
        BankcardTransaction txn = new BankcardTransaction();
        txn.setTenderData(tenderData);
        txn.setReportingData(reportingData);

        BankcardTransactionData transactionData = new BankcardTransactionData();
        transactionData.setAlternativeMerchantData(altMerchData);
        transactionData.setAmount(new BigDecimal(10.00).setScale(2, RoundingMode.HALF_EVEN));
        transactionData.setCashBackAmount(new BigDecimal(0.00).setScale(2, RoundingMode.HALF_EVEN));
        transactionData.setTipAmount(new BigDecimal(0.00).setScale(2, RoundingMode.HALF_EVEN));
        transactionData.setFeeAmount(new BigDecimal(0.00).setScale(2, RoundingMode.HALF_EVEN));
        transactionData.setAccountType(AccountType.NOT_SET);
        transactionData.setCustomerPresent(
            com.ipcommerce.schemas.cws.v2_0.transactions.bankcard.CustomerPresent.fromValue(
                configFile.getString("TXN_DATA_CUSTOMER_PRESENT")));
        transactionData.setEmployeeId("12"); // Used for Regail, Restaurant, MOTO
        transactionData.setEntryMode(
            com.ipcommerce.schemas.cws.v2_0.transactions.EntryMode.fromValue(
                configFile.getString("TXN_DATA_ENTRY_MODE")));
        transactionData.setGoodsType(
            GoodsType.DIGITAL_GOODS); // DigitalGoods - PhysicalGoods - Used only for Ecommerce
        // transactionData.setAccountType(AccountType.CheckingAccount); // SavingsAccount,
        // CheckingAccount - used only for PINDebit
        transactionData.setCurrencyCode(
            com.ipcommerce.schemas.cws.v2_0.transactions.TypeISOCurrencyCodeA3.USD);
        transactionData.setSignatureCaptured(false); // Required
        transactionData.setIsQuasiCash(false); // Optional
        transactionData.setIsPartialShipment(false); // Optional
        transactionData.setPartialApprovalCapable(PartialApprovalSupportType.NOT_SET);
        Calendar cal = Calendar.getInstance();
        // String sdf = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss a").format(cal.getTime());
        transactionData.setTransactionDateTime("2012-10-23T14:38:59.730-06:00");
        transactionData.setOrderNumber("12345");
        transactionData.setLaneId("1");

        txn.setTransactionData(transactionData);
        return txn;
      }
    } catch (org.apache.commons.configuration.ConfigurationException e) {
      System.out.println("ConfigurationException: " + e.getMessage());
    }
    return null;
  }
  public static List<MerchantProfile> CreateMerchantProfiles() {
    try {
      Configuration configFile =
          new PropertiesConfiguration("com/ipcommerce/CWS/Resources/cws.properties");

      MerchantProfile merchProfile = new MerchantProfile();
      merchProfile.setProfileId(configFile.getString("MERCHANT_PROFILE_ID"));
      Calendar cal = Calendar.getInstance();
      merchProfile.setLastUpdated(cal);

      MerchantProfileMerchantData merchData = new MerchantProfileMerchantData();
      merchData.setCustomerServiceInternet(configFile.getString("CUSTOMER_SERVICE_INTERNET"));
      merchData.setCustomerServicePhone(configFile.getString("CUSTOMER_SERVICE_PHONE"));
      merchData.setLanguage(TypeISOLanguageCodeA3.fromValue(configFile.getString("LANGUAGE")));
      merchData.setMerchantId(configFile.getString("MERCHANT_ID"));
      merchData.setName(configFile.getString("MERCHANT_NAME"));
      merchData.setPhone(configFile.getString("MERCHANT_PHONE"));

      BankcardMerchantData bcMerchData = new BankcardMerchantData();
      bcMerchData.setABANumber("128965");
      bcMerchData.setAgentChain("1289");
      bcMerchData.setAgentBank("1289");
      bcMerchData.setAcquirerBIN("1248");
      bcMerchData.setLocation("108");
      bcMerchData.setPrintCustomerServicePhone(false);
      bcMerchData.setReimbursementAttribute("X");
      bcMerchData.setSettlementAgent("0001");
      bcMerchData.setSharingGroup("0001");
      bcMerchData.setStoreId("0001");
      bcMerchData.setSecondaryTerminalId("751");
      bcMerchData.setTimeZoneDifferential("750");
      bcMerchData.setIndustryType(IndustryType.fromValue(configFile.getString("INDUSTRY_TYPE")));
      bcMerchData.setSIC("4599"); // Required, Standard Industry Code
      bcMerchData.setClientNumber("1234"); // Optional - Required for Chase
      bcMerchData.setAggregator(
          Boolean.valueOf(configFile.getString("PRO_INCLUDE_ALTERNATIVE_MERCHANT_DATA")));
      bcMerchData.setTerminalId("001");

      AddressInfo address = new AddressInfo();
      address.setStreet1(configFile.getString("MERCH_STREET_1"));
      if (configFile.getString("MERCH_STREET_2") != null)
        address.setStreet2(configFile.getString("MERCH_STREET_2"));
      address.setCity(configFile.getString("MERCH_CITY"));
      address.setStateProvince(
          TypeStateProvince.fromValue(configFile.getString("MERCH_STATE_PROVINCE")));
      address.setPostalCode(configFile.getString("MERCH_POSTAL_CODE"));
      address.setCountryCode(
          TypeISOCountryCodeA3.fromValue(configFile.getString("MERCH_COUNTRY_CODE")));

      BankcardTransactionDataDefaults bcTxnDataDefaults = new BankcardTransactionDataDefaults();
      bcTxnDataDefaults.setCurrencyCode(
          TypeISOCurrencyCodeA3.fromValue(configFile.getString("CURRENCY_CODE")));
      bcTxnDataDefaults.setCustomerPresent(
          CustomerPresent.fromValue(configFile.getString("CUSTOMER_PRESENT")));
      bcTxnDataDefaults.setRequestACI(RequestACI.fromValue(configFile.getString("REQUEST_ACI")));
      bcTxnDataDefaults.setEntryMode(EntryMode.fromValue(configFile.getString("ENTRY_MODE")));
      bcTxnDataDefaults.setRequestAdvice(RequestAdvice.NOT_CAPABLE); // [NotSet,NotCapable,Capable]

      MerchantProfileTransactionData merchTxnData = new MerchantProfileTransactionData();
      merchTxnData.setBankcardTransactionDataDefaults(bcTxnDataDefaults);
      merchProfile.setTransactionData(merchTxnData);
      merchData.setBankcardMerchantData(bcMerchData);
      merchData.setAddress(address);
      merchProfile.setMerchantData(merchData);

      List<MerchantProfile> merchantProfiles = new ArrayList<MerchantProfile>();
      merchantProfiles.add(merchProfile);
      return merchantProfiles;
    } catch (org.apache.commons.configuration.ConfigurationException e) {
      System.out.println("ConfigurationException: " + e.getMessage());
    }
    return null;
  }