/**
  * Query subscription by name.
  *
  * @param name the name
  * @return the subscription
  * @throws Exception the exception
  */
 public Subscription querySubscriptionByName(String name) throws Exception {
   ZuoraServiceStub.Query query = new ZuoraServiceStub.Query();
   query.setQueryString("SELECT Id,AccountId,Name FROM Subscription where Name = '" + name + "'");
   ZuoraServiceStub.QueryResponse qResponse = stub.query(query, null, this.header);
   ZuoraServiceStub.QueryResult qResult = qResponse.getResult();
   Subscription sub = (Subscription) qResult.getRecords()[0];
   return sub;
 }
 /**
  * Gets the account by name.
  *
  * @param accountName the account name
  * @return the account by name
  * @throws Exception the exception
  */
 public Account getAccountByName(String accountName) throws Exception {
   ZuoraServiceStub.Query query = new ZuoraServiceStub.Query();
   query.setQueryString(
       "SELECT id, name, accountnumber FROM account WHERE name = '" + accountName + "'");
   ZuoraServiceStub.QueryResponse qResponse = stub.query(query, null, this.header);
   ZuoraServiceStub.QueryResult qResult = qResponse.getResult();
   Account rec = (Account) qResult.getRecords()[0];
   return rec;
 }
  /**
   * Gets the charge by accounting code.
   *
   * @param accountingCode the accounting code
   * @return the charge by accounting code
   * @throws Exception the exception
   */
  public ProductRatePlanCharge getChargeByAccountingCode(String accountingCode) throws Exception {

    ZuoraServiceStub.Query query = new ZuoraServiceStub.Query();
    query.setQueryString(
        "select Id, ProductRatePlanId from ProductRatePlanCharge where AccountingCode = '"
            + accountingCode
            + "'");
    ZuoraServiceStub.QueryResponse qResponse = stub.query(query, null, this.header);
    ZuoraServiceStub.QueryResult qResult = qResponse.getResult();
    ProductRatePlanCharge rec = (ProductRatePlanCharge) qResult.getRecords()[0];
    return rec;
  }