Comments (6)
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.
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.
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.
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.
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.
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)
- Now, How can I get menu_proxy_code_id? HOT 3
- I Want to pull customer and sub-customers seperately and store them in seperate database tables? HOT 1
- Support for Estimate service HOT 5
- How to grep SalesTerm values from QBO to our application HOT 5
- Search customer by Email HOT 3
- What all things are required to shift from QBO (online) v2 to v3? HOT 1
- IntuitRequestException: cvc-datatype-valid.1.2.1 HOT 1
- How to validate that the token is not expired HOT 9
- InvoiceHeader.status HOT 1
- Issue with Item creation HOT 3
- SubAccounts HOT 2
- no way to create the <ItemRef> required to create an invoice
- License missing from gemspec HOT 2
- Update Invoice in Windows edition HOT 3
- Quickbooks Desktop, new customer needs domain="NG" not "QB" HOT 3
- DateTime filter results in Unparseable date error
- Email Address for Windows::Model::Employee HOT 5
- Way to push jobs in quickbook using Online models?? HOT 2
- Bluedot Menu displaying "We are sorry but we cannot load the menu right now"? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quickeebooks.