GoodDollar / GoodServer

Backend to support the GoodDAPP
MIT License
13 stars 13 forks source link

Migrate Mautic API to Ongage API #351

Closed sirpy closed 2 years ago

sirpy commented 2 years ago

To Test

sirpy commented 2 years ago

@vldkh this would need to be test on QA. see list of things to test.

@johnsmith-gooddollar this should not be deployed to production until we updated our user db with the new ongage record ids

vldkh commented 2 years ago

@johnsmith-gooddollar 'Whitelisted' and 'firstClaim' params didn't set on Ongage https://app.zenhub.com/files/165812629/888ef709-b7ba-4c7c-bab4-61de33618c01/download

johnsmith-gooddollar commented 2 years ago

@vldkh

  1. where did you found this message ''Whitelisted' and 'firstClaim' params didn't set on Ongage' ?
  2. if it's something needs to be set up on the CRM side please give me creds or ask @sirpy to do it
  3. by the logic setWhitelisted sends only { whitelisted: 'true' }. True as the string not as the boolean value. This was implemented initially by @sirpy i've left this untouched
johnsmith-gooddollar commented 2 years ago

@vldkh yes, the user have crmId == null

{"whiteList":false,"topWallet":false},"isEmailConfirmed":true,"regMethod":"torus","torusProvider":"google","walletAddress":"0x73a3444055a2affdb530c5b5d532723a9efb7b4a6a6ef4df7b0e444b65ee9f29","createdDate":"2022-02-23T14:36:42.000Z","crmId":null}}]}

Does this account is newly created or it was existing ?

New one

I need to switch to the feed, will continue research tomorrow (will dedicate some time for this)

P.S. I checked the update script and it seems it doesnt adds existing users to ongage ? @sirpy could you please suggest, how do we migrate existing accounts ?

johnsmith-gooddollar commented 2 years ago

@vldkh It seems the account was created before OnGage release. I wasn't able to find any logs regarding createCRMRecord calls. Could you please create new acc from scratch and check FV on it

@sirpy where we could add ongage migration (e.g. check is record have crmId, call createCRMRecord if not exists) ? could i add it to scripts/dbUpdates ?

johnsmith-gooddollar commented 2 years ago

@vldkh thanks for the logs, will check tomorrow

johnsmith-gooddollar commented 2 years ago

found the issue. there's no complete v2 API, just 2 endpoints (v2/contacts and v2/change_status). i've set base URL to just '/api' and added v2 prefix for those particular calls now v2 is used for add contact so we have the correct response format v1 add conact had different format so we weren't able to parse it correctly and got crmId == null

vldkh commented 2 years ago

@johnsmith-gooddollar According to the Ongage: 1) the 'Whitelisted' works fine, after passing the FV 'Whitelisted' parameter set 'true' 2) the 'LastClaim' parameter didn't set on Ongage, need to check logs on the server

johnsmith-gooddollar commented 2 years ago

Having strange issue with validation. the data seems to be ok (i compared with set whitelisted field request) but we're getting 412 error I've adjusted request to use email as the key field on update too (if it's set)

Will continue research this evening or tomorrow

johnsmith-gooddollar commented 2 years ago

@vldkh is able to make quick test via mobile internet. waiting for the new logs