ruckus / quickeebooks

ABANDONED !!!! Quickbooks + Ruby using the Quickbooks Online v2 Data Services REST API
MIT License
79 stars 67 forks source link

I Want to pull customer and sub-customers seperately and store them in seperate database tables? #102

Open przbadu opened 11 years ago

przbadu commented 11 years ago

Hi,

I have a customer model as well as sub-customer model.

I have two buttons named "sync customer" and "sync sub-customer". When a user click on "sync-customer " button I want to sync ONLY CUSTOMER from QBO to my customer model.

Similarly, "sync sub-customer" will sync ONLY SUB-CUSTOMER from QBO to my sub-customer model.

For now, whenever I am syncing customer from "sync customer" button it is pulling customer and sub-customers both in my same customer model.

@customers =    customer_service.list.entries
 @customers.each do |customer|
    customer.name 
 end
end

How to differentiate between them?

ruckus commented 11 years ago

I've never worked with sub-Customers so I don't know if they have special properties (?).

According to the Online Customer docs:

https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/v2/0500_quickbooks_windows/0600_object_reference/customer

There should be a CustomerTypeName property with a colon-delimited list. However, I just created a test sub-Customer in QB Online and when I fetch it using Quickeebooks I don't see that property. So I don't know how to determine if a customer is a sub-customer unless you have your own application logic/flag to determine that.

I see there is a:

    <CustomField xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="BooleanTypeCustomField">
        <DefinitionId>Bill With Parent</DefinitionId>
        <Value>true</Value>
    </CustomField>

property set. But one can still set that to false even if it IS a sub-Customer - so thats not definitive.