intuit partner platform - IPP Add Account - The Account Isn't Valid -


i trying add bank account quickbooks online using ipp. code fails , says account isn't valid. here code:

            account account = new account();             account.desc = "desc";             account.name = "checking2";             account.type = accounttypeenum.revenue;             account.typespecified = true;             account.subtype = accountsubtypeenum.bank.tostring();             dataservices.add(account); 

do need add fields? receive errors account same name exists, however, not see it.

i don't see xml in log:

            oauthrequestvalidator oauthvalidator = new oauthrequestvalidator(accesstoken, accesstokensecret, configurationmanager.appsettings["consumerkey"].tostring(), configurationmanager.appsettings["consumersecret"].tostring());         servicecontext context = new servicecontext(oauthvalidator, accesstoken, companyid, intuitservicestype.qbo);         context.enableservicerequestslogging = true;         context.idslogger = new mycustomlogger();         dataservices = new dataservices(context);         return "ok";   public class mycustomlogger : ilogger { public mycustomlogger() { }  public string clearlog() {     try     {         string path = httpcontext.current.server.mappath("/qblog.txt");          if (file.exists(path))         {             file.delete(path);         }          return "ok";      }     catch (exception ex)     {         return ex.tostring();     } }  public void log(tracelevel idstracelevel, string messagetowrite) {     string level = idstracelevel.tostring();     writetolog(new errormessage(messageseverity.error, "qbfs", messagetowrite)); }  public string writetolog(errormessage message) {     if (!string.isnullorempty(message.message))     {         string path = httpcontext.current.server.mappath(httpcontext.current.request.applicationpath + "/qblog.txt");         filestream filestream = null;          //if file exists, append         if (file.exists(path))         {             filestream = new filestream(path, filemode.append);         }         else         {             filestream = new filestream(path, filemode.openorcreate);         }         streamwriter sw = new streamwriter(filestream);         try         {             sw.writeline(string.format("{0} : {1} {2} {3}", message.applicationname, message.severity, datetime.now, message.message));             return "ok";         }         //if there error, nothing. don't stop.         catch (exception ex)         {             return ex.tostring();         }                 {             sw.close();             filestream.close();         }      }      return "message null or empty"; } 

}

here xml request:

<?xml version="1.0" encoding="utf-8"?><q1:account xmlns="http://www.intuit.com/sb/cdm/qbo" xmlns:q1="http://www.intuit.com/sb/cdm/v2"><q1:name>checking</q1:name><q1:desc>desc</q1:desc><q1:subtype>bank</q1:subtype></q1:account> 

here response:

<?xml version="1.0" encoding="utf-8" standalone="yes"?><faultinfo xmlns="http://www.intuit.com/sb/cdm/baseexceptionmodel/xsd"><message>another account using name. please use different name.</message><errorcode>bad_request</errorcode><cause>-11202</cause></faultinfo> 

i needed specify opening , current balance true variables:

            ac = new account();             ac.desc = "desc";             ac.name = "testy";             ac.subtype = qboaccountdetailtypeenum.checking.tostring();             ac.openingbalancedate = datetime.now;             ac.openingbalancedatespecified = true;             ac.currentbalance = 0;             ac.currentbalancespecified = true;             dataservices.add(ac); 

my subtype incorrect. needed use qboaccountdetailtypeenum.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -