-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
GlobalCollect: Don't overwrite contactDetails #2915
GlobalCollect: Don't overwrite contactDetails #2915
Conversation
Previously, if there was an address provided, it would overwrite the contactDeatails field which may have already had an email field added. Now we have a conditional for both email and phone number elements within contactDetails. Also updates the sandbox url to the current endpoint. Remote: 16 tests, 37 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed Unit: 17 tests, 79 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed
post['order']['contactDetails'] = { | ||
'emailAddress' => options[:email] | ||
} | ||
post['order']['contactDetails']['emailAddress'] = options[:email] if options[:email] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we know that post['order']['contactDetails']
will always be defined here? I'm wondering if it might be worth adding post['order']['contactDetails'] ||= {}
before this line. That might be redundant though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see where/why it would be defined before this point...? I guess I am generating an interstitial envelope and its own subfield at the same time, though... is that a nono?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, nestable_hash
makes this work, so ship it!
'emailAddress' => options[:email], | ||
'phoneNumber' => address[:phone] | ||
} | ||
post['customer']['contactDetails']['emailAddress'] = options[:email] if options[:email] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here; wondering if we need post['customer']['contactDetails'] ||= {}
to be safe.
Previously, if there was an address provided, it would overwrite the
contactDeatails field which may have already had an email field added.
Now we have a conditional for both email and phone number elements
within contactDetails.
Also updates the sandbox url to the current endpoint.
Remote:
16 tests, 37 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
Unit:
17 tests, 79 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed