GoodDollar/GoodServer

(Bug) ongage email change fails

Closed this issue · 10 comments

sirpy commented

search in logs for Request failed with status code 404
some failed because email is the same just different case, thats ok, already fixed.
other email changes failed

  • why did they fail?
  • what happens if new email already exists in a different contact? how do we handle this? does it merge?

@sirpy

why did they fail?

PUT /api/contacts/change_email had to be used, instead of POST.

@sirpy fields source_utm medium_utm had been added

@sirpy. Regarding point 2 - if try to set email from the other existing contact it fails:

image.png

Se we need to process this case separately

  • check by_email for new email existense
  • if exists - delete existing contact

tested, pushed to PROD

sirpy commented

@johnsmith-gooddollar we need to take care of other accounts with the crmId you deleted.
so that means that if another account exists already, then we should either

  1. simply modify the user crmId to the existing one and deleting his current crmId
  2. or search in our database for the user with the deleted crmId and switch it to the current user crmId

@sirpy in this case crmId will be shared between two users. is it ok ? Is this field unique in mongo DB ?
Will update today

sirpy commented

yes users should share same crmId. no it is not defined unique

@sirpy done, tested on QA, hotfixed to prod