Coder Social home page Coder Social logo

Comments (6)

ruckus avatar ruckus commented on August 28, 2024

You can call valid? on a Customer record to check for validity:

> c = Quickeebooks::Windows::Model::Customer.new
> c.valid?
=> false
> c.errors
 => #<ActiveModel::Errors:0x007fed283dc710 @base=#<Quickeebooks::Windows::Model::Customer:0x007fed283e4460 @validation_context=nil, @errors=#<ActiveModel::Errors:0x007fed283dc710 ...>>, @messages={:name=>["is too short (minimum is 1 characters)"], :addresses=>["Must provide at least one address for this Customer."]}>

But in the case of your 2nd error you might want to do your own URL format validation.

As for your 3rd error, I have no idea where that is coming from. Can you please give me more information on the source of that error? Nonetheless its definitely coming from Intuit as they are on the JVM.

from quickeebooks.

przbadu avatar przbadu commented on August 28, 2024

Actually third exception is comming whenever I am trying to push sub-customer to quickbooks. Here, jobsites is used for indicating sub-customer My code looks like:

#push jobsite into quickbook as job
  def push_jobsite_to_quickbook(jobsites)
    #push data to quickbook
    oauth_client = OAuth::AccessToken.new($qb_oauth_consumer, current_company.access_token, current_company.access_secret)

    jobsite_service = Quickeebooks::Online::Service::Job.new
    jobsite_service.access_token = oauth_client
    jobsite_service.realm_id = current_company.realm_id


    jobsite = Quickeebooks::Online::Model::Job.new

    # find quickbook_customer_id
    # this is parent customer id
    @parent_customer = current_company.customers.find(@jobsite.customer_id)

    # parent customer information
    sub_customer = Quickeebooks::Online::Model::Id.new
    sub_customer.value = @parent_customer.quickbook_customer_id #push parent customer_id 
    jobsite.customer_name = @parent_customer.company_name    # parent customer name

    jobsite.customer_id = sub_customer
    # end of parent customer information

    # push sub-customer information
    jobsite.name = @jobsite.name

    address = Quickeebooks::Online::Model::Address.new
    address.city = @jobsite.city
    address.country_sub_division_code = @jobsite.state
    address.postal_code = @jobsite.zip
    jobsite.addresses = [address]

    jobsite_service.create(jobsite)
  end

Now I am calling this action in create action and getting :

java.lang.NumberFormatException: For input string: ""

It was pushing sub-customer data properly in the quickbook but suddenly It is generating above exceptions from 5/6 days.

from quickeebooks.

ruckus avatar ruckus commented on August 28, 2024

I'd like to see the XML this generates - here is how to do that: right before your create() call at the very end do something like this:

Rails.logger.info(jobsite.to_xml.to_s)

And reply back with the XML output.

On Sep 21, 2013, at 4:15 AM, Pushpa Raj Badu [email protected] wrote:

Actually third exception is comming whenever I am trying to push sub-customer to quickbooks. Here, jobsites is used for indicating sub-customer My code looks like:

#push jobsite into quickbook as job
def push_jobsite_to_quickbook(jobsites)
#push data to quickbook
oauth_client = OAuth::AccessToken.new($qb_oauth_consumer, current_company.access_token, current_company.access_secret)

jobsite_service = Quickeebooks::Online::Service::Job.new
jobsite_service.access_token = oauth_client
jobsite_service.realm_id = current_company.realm_id


jobsite = Quickeebooks::Online::Model::Job.new

# find quickbook_customer_id
# this is parent customer id
@parent_customer = current_company.customers.find(@jobsite.customer_id)

# parent customer information
sub_customer = Quickeebooks::Online::Model::Id.new
sub_customer.value = @parent_customer.quickbook_customer_id #push parent customer_id 
jobsite.customer_name = @parent_customer.company_name    # parent customer name

jobsite.customer_id = sub_customer
# end of parent customer information

# push sub-customer information
jobsite.name = @jobsite.name

address = Quickeebooks::Online::Model::Address.new
address.city = @jobsite.city
address.country_sub_division_code = @jobsite.state
address.postal_code = @jobsite.zip
jobsite.addresses = [address]

jobsite_service.create(jobsite)

end

Now I am calling this action in create action and getting :

java.lang.NumberFormatException: For input string: ""

It was pushing sub-customer data properly in the quickbook but suddenly It is generating above exceptions from 5/6 days.


Reply to this email directly or view it on GitHub.

from quickeebooks.

przbadu avatar przbadu commented on August 28, 2024

Hello,

I have tried a lot but now third problem is working fine.

c = Quickeebooks::Windows::Model::Customer.new
> c.valid?
=> false
> c.errors
 => #<ActiveModel::Errors:0x007fed283dc710 @base=#<Quickeebooks::Windows::Model::Customer:0x007fed283e4460 @validation_context=nil, @errors=#<ActiveModel::Errors:0x007fed283dc710 ...>>, @messages={:name=>["is too short (minimum is 1 characters)"], :addresses=>["Must provide at least one address for this Customer."]}>

you have suggest me this for responding with error message, but first thing, I am using Quickbook Online version and it is generating NoMethodError:

NoMethodError: undefined method `valid?' for #<Quickeebooks::Online::Service::Customer:0xa426148>

from quickeebooks.

przbadu avatar przbadu commented on August 28, 2024

Hello,

I have tried a lot but now third problem i.e.

java.lang.NumberFormatException: For input string: ""

not generating.

But,

c = Quickeebooks::Windows::Model::Customer.new
> c.valid?
=> false
> c.errors
 => #<ActiveModel::Errors:0x007fed283dc710 @base=#<Quickeebooks::Windows::Model::Customer:0x007fed283e4460 @validation_context=nil, @errors=#<ActiveModel::Errors:0x007fed283dc710 ...>>, @messages={:name=>["is too short (minimum is 1 characters)"], :addresses=>["Must provide at least one address for this Customer."]}>

you have suggest me aboce code for responding with error message [if any], but first thing, I am using Quickbook Online version and it is generating NoMethodError:

NoMethodError: undefined method `valid?' for #<Quickeebooks::Online::Service::Customer:0xa426148>

I think valid? function is defined in desktop version only.

from quickeebooks.

ruckus avatar ruckus commented on August 28, 2024

If you're using QB Online then why are you instantiating a QB Windows object?

c = Quickeebooks::Windows::Model::Customer.new

You should be generating a QB Online Customer object?

c = Quickeebooks::Online::Model::Customer.new

NoMethodError: undefined method `valid?' for #Quickeebooks::Online::Service::Customer:0xa426148

valid? is an instance method on an an instance of a Customer model object - not a Service object.

E.g.

c = Quickeebooks::Online::Model::Customer.new
c.valid?
=> false
c.errors
=> ... complains about name being too short...

On Sep 30, 2013, at 10:31 PM, Pushpa Raj Badu [email protected] wrote:

Hello,

I have tried a lot but now third problem is working fine.

c = Quickeebooks::Windows::Model::Customer.new

c.valid?
=> false
c.errors

=> #<ActiveModel::Errors:0x007fed283dc710 @base=#<Quickeebooks::Windows::Model::Customer:0x007fed283e4460 @validation_context=nil, @errors=#<ActiveModel::Errors:0x007fed283dc710 ...>>, @messages={:name=>["is too short (minimum is 1 characters)"], :addresses=>["Must provide at least one address for this Customer."]}>
you have suggest me this for responding with error message, but first thing, I am using Quickbook Online version and it is generating NoMethodError:

NoMethodError: undefined method `valid?' for #Quickeebooks::Online::Service::Customer:0xa426148

Reply to this email directly or view it on GitHub.

from quickeebooks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.