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

GlobalCollect: Don't overwrite contactDetails #2915

Conversation

curiousepic
Copy link
Contributor

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

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
@curiousepic curiousepic requested a review from a team July 5, 2018 19:08
post['order']['contactDetails'] = {
'emailAddress' => options[:email]
}
post['order']['contactDetails']['emailAddress'] = options[:email] if options[:email]
Copy link
Contributor

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.

Copy link
Contributor Author

@curiousepic curiousepic Jul 5, 2018

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?

Copy link
Contributor

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]
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants