-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fixing branded checkout donorDetails #1077
Conversation
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.
@wrandall22 might want to look at this also, but it looks good to me. Great writeup about the cause of the error!
Yes, I was going to wait until Bill approves it as Give currently has a code-freeze, and I want to ensure no further issues are caused. |
…reran, it would add back the data.
The only other thing I'm wondering is about users who might go through branded checkout twice in the same browser session. I think before (prior to the EP upgrade), the donormatches link would not exist due to a logout call at the beginning of the process of branded checkout, but in this code, the session storage is not cleared. Maybe we can clear it in the same place that the logout call is made for branded checkout? |
No on the initial signout, we remove the |
At this point I think the code looks good, but waiting to hear from product owner about whether we should wait to deploy until after peak giving. |
That sounds good. |
Did you get a chance to test this in staging? |
Yes, I have a branded checkout on my local, pulling in the staging branded checkout JS. I tested to make sure the names were coming through and that session storage |
Checked again in staging before pushing to Prod |
Updated staging manually |
Description
Helpscout: https://secure.helpscout.net/conversation/2439584263/1061424?folderId=7769710
On Unto a client noticed that when we're passing donorDetails to the branded checkout, the values are not being set.
(You set the donorDetails, by adding a
window.donorDetails
object with the values you want the branded-checkout to add to the form. I've put an example of how to do this below.)I tested this on my local. The branded checkout grabbed the
window.donorDetails
object, but was not using its values. Upon further investigating, I found the<contact-info>
component was only using the data from thewindow.donorDetails
object if it was the initial load of the form.The function
loadDonorDetails
worked out if it was the initial load by seeing if 2 properties were missing from a request to the cortex API,donorDetails.links.rel
anddonorDetails.links.donormatchesform
.If
rel
anddonormatchesform
were missing, it would use the window.donorDetails data.My best guess is that over the last 4 years (When this code was first added), there was a change to the API, to always return
rel
anddonormatchesform
, resulting in thewindow.donorDetails
data no longer be used.Example:
More info here: https://github.com/CruGlobal/give-web#branded-checkout-config
Changes
As we don't want to undo the work on PR-745 #745, I had to ensure
overrideDonorDetails
only overwrites thethis.donorDetails
on the form's first loadand after that only overwrites when donorDetails properties are empty.assign
to merge thethis.donorDetails
returned from the API andoverrideDonorDetails
. Then set session dataafterInitialLoad
to prevent any edited fields from being overwritten if the component gets rendered again.afterInitialLoad
is set andoverrideDonorDetails
is defined, mergethis.donorDetails
returned from the API andoverrideDonorDetails
, favouringthis.donorDetails
to prevent unwanted overwrites