Skip to content
This repository has been archived by the owner on Nov 10, 2017. It is now read-only.

Modify customer address validation to allow no address on Windows flavor #91

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

theinventor
Copy link
Contributor

At first I just removed the validation, but I think something should be there - since sending an empty address does fail.

You are able to send nothing at all, customer.addresses = nil seems to work;

    <Add xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" RequestId="95bd8691b4b6d8a8e20d4a1eea28349c" xmlns="http://www.intuit.com/sb/cdm/v2">
        <ExternalRealmId>762087535</ExternalRealmId>
        <Object xsi:type="Customer"> 
            <TypeOf>Person</TypeOf> 
            <Name>Steve Klabnick</Name> 
            <Phone> 
                <DeviceType>LandLine</DeviceType> 
                <FreeFormNumber>6678881212</FreeFormNumber> 
                <Default>true</Default> 
                <Tag>Business</Tag> 
            </Phone> 
            <Email> 
                <Address>[email protected]</Address> 
                <Default>true</Default> 
                <Tag>Business</Tag> 
            </Email> 
            <DBAName /> 
        </Object>
    </Add>

    <RestResponse xmlns="http://www.intuit.com/sb/cdm/v2">
        <Success RequestId="95bd8691b4b6d8a8e20d4a1eea28349c">
            <PartyRoleRef>
                <Id idDomain="NG">929334</Id>
                <SyncToken>1</SyncToken>
                <LastUpdatedTime>2013-08-26T04:14:30Z</LastUpdatedTime>
                <PartyReferenceId idDomain="NG">1008617</PartyReferenceId>
            </PartyRoleRef>
            <RequestName>CustomerAdd</RequestName>
            <ProcessedTime>2013-08-26T04:14:30Z</ProcessedTime>
        </Success>
    </RestResponse>

I have no idea how to communicate this in a short validation error :)

@ruckus
Copy link
Owner

ruckus commented Aug 26, 2013

First, thanks for digging into this.

I'm surprised not sending an Address works as Intuit indicates its a required field.

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

under Business Rules: "The customer address field is mandatory."

But I'm also confused by your note at the top. You say "sending an empty address does fail" but then also "You are able to send nothing at all". Do you mean that excluding certain parts of the Address are OK? Can you please clarify?

Thanks again

@theinventor
Copy link
Contributor Author

For example, sending a nil street, city, state, but having the address tag in there, which a builds up the XML element with a lot of empty fields will fail.

If you don't send any element at all, it works - I saw this eluded to on stackoverflow

Troy Anderson

On Aug 26, 2013, at 10:00 AM, Cody Caughlan [email protected] wrote:

First, thanks for digging into this.

I'm surprised not sending an Address works as Intuit indicates its a required field.

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

under Business Rules: "The customer address field is mandatory."

But I'm also confused by your note at the top. You say "sending an empty address does fail" but then also "You are able to send nothing at all". Do you mean that excluding certain parts of the Address are OK? Can you please clarify?

Thanks again


Reply to this email directly or view it on GitHub.

@ruckus
Copy link
Owner

ruckus commented Aug 26, 2013

Ah ok, so sending a request with an actual "Address" element but which contains a set of empty values for Street, City, etc. will fail. But also sending a request with no "Address" at all will succeed.

So it seems like the validation rule is basically, in plain english, "If you give me an address then it needs to have non-blank values for all my children attributes (Street, City, State, Zip, etc)".

On Aug 26, 2013, at 10:41 AM, Troy Anderson [email protected] wrote:

For example, sending a nil street, city, state, but having the address tag in there, which a builds up the XML element with a lot of empty fields will fail.

If you don't send any element at all, it works - I saw this eluded to on stackoverflow

Troy Anderson

On Aug 26, 2013, at 10:00 AM, Cody Caughlan [email protected] wrote:

First, thanks for digging into this.

I'm surprised not sending an Address works as Intuit indicates its a required field.

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

under Business Rules: "The customer address field is mandatory."

But I'm also confused by your note at the top. You say "sending an empty address does fail" but then also "You are able to send nothing at all". Do you mean that excluding certain parts of the Address are OK? Can you please clarify?

Thanks again


Reply to this email directly or view it on GitHub.

Reply to this email directly or view it on GitHub.

@theinventor
Copy link
Contributor Author

I actually don't know the rule though, I can do some more testing to reverse engineer it - I have a feeling if you leave out the street, but fill in the rest, it will work. and if you fill in the street and leave out the rest, it probably works.

I got a few validation errors on the address when I was testing, but I didn't explore enough to understand their rules.

I'm using it as-is for now, but I'll just be disabling that validation in my production app until this is firmed up and in another version release.

It's hard to tell my users it requires an address, when Quickbooks proper does not :(

On Aug 26, 2013, at 11:20 AM, Cody Caughlan [email protected] wrote:

Ah ok, so sending a request with an actual "Address" element but which contains a set of empty values for Street, City, etc. will fail. But also sending a request with no "Address" at all will succeed.

So it seems like the validation rule is basically, in plain english, "If you give me an address then it needs to have non-blank values for all my children attributes (Street, City, State, Zip, etc)".

On Aug 26, 2013, at 10:41 AM, Troy Anderson [email protected] wrote:

For example, sending a nil street, city, state, but having the address tag in there, which a builds up the XML element with a lot of empty fields will fail.

If you don't send any element at all, it works - I saw this eluded to on stackoverflow

Troy Anderson

On Aug 26, 2013, at 10:00 AM, Cody Caughlan [email protected] wrote:

First, thanks for digging into this.

I'm surprised not sending an Address works as Intuit indicates its a required field.

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

under Business Rules: "The customer address field is mandatory."

But I'm also confused by your note at the top. You say "sending an empty address does fail" but then also "You are able to send nothing at all". Do you mean that excluding certain parts of the Address are OK? Can you please clarify?

Thanks again


Reply to this email directly or view it on GitHub.

Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub.

minimul added a commit to minimul/quickeebooks that referenced this pull request Jan 13, 2014
(no 'Addresses' XML node in POST request). If
an address is provided it must NOT be empty. See discussion here
ruckus#91
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants