Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DefaultDeliveryTypes is overridden when updating Customer #28

Closed
mikael-karlsson opened this issue May 5, 2017 · 2 comments
Closed
Assignees
Labels

Comments

@mikael-karlsson
Copy link

When following the instructions here for updating a Customer, the Customers DefaultDeliveryTypes are all set to EMAIL.

This seems to be the issue, with DefaultDeliveryTypes being set in the constructor for the Customer class.

This clashes with the statement that only the properties that you provide will be updated.

@xeterixon
Copy link

Seems like a bug or an error in the documentation.
There seems to be a somewhat of a hack-ish way around, though.
If you, when updating the customer, set DefaultDeliveryTypes to null, the previous values seems to stick. Something like:
var customer = new Customer{/*Add the properties to update*/, DefaultDeliveryTypes=null}

You may notice that I used a fair amount of "seems" in the statements above. Take that as an indication that I didn't test it that much and setting a property that is allocated in the constructor to null "feels" wrong...

I guess that the safest way to do it is to fetch the existing customer, update what ever you want to update and send the object back.

@mikael-karlsson
Copy link
Author

Thanks for the answer. I tested the things you suggest myself, and as far as I can tell, it works. Mainly, I wanted to highlight the issue, even though I am not sure about the best way to go about resolving it in a more permanent way.

@davidulvmoen davidulvmoen self-assigned this Oct 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants