From fd86ffdb8f569e16997fd409801e56350d2d5de0 Mon Sep 17 00:00:00 2001 From: Michael Volo Date: Tue, 28 Nov 2023 15:19:04 -0600 Subject: [PATCH] create or update a lead instead of trying to time creation (#1211) * create or update a lead instead of trying to time creation * no need to check if lead is blank, since we are updating * stop (trying) to create leads for students * update specs * update params for activate student * better handling on existing lead * update specs * update salesforce gem * remove specs for student lead creation * update cassettes for admin * update openstax_salesforce gem * modify how logic works if school not found * try to match self reported schools * clean up lead creation/update script * only create logs for changes * slightly modify lead capture * update openstax_salesforce and rerecord cassettes * update cassette --- Gemfile | 2 +- Gemfile.lock | 92 +++++++------ app/controllers/admin/users_controller.rb | 2 +- app/handlers/newflow/confirm_oauth_info.rb | 2 +- .../educator_signup/complete_profile.rb | 21 +-- .../educator_signup/sheerid_webhook.rb | 7 +- .../student_signup/verify_email_by_pin.rb | 2 +- app/handlers/verify_email_by_code.rb | 2 +- app/models/user.rb | 2 +- ...rb => create_or_update_salesforce_lead.rb} | 83 ++++++----- .../student_signup/activate_student.rb | 11 +- app/routines/update_user_contact_info.rb | 32 +++-- ...can_be_set_if_the_Contact_exists_in_SF.yml | 126 ++++++++++------- ...et_if_the_Contact_does_not_exist_in_SF.yml | 38 ++++-- ...annot_be_set_if_the_ID_is_of_malformed.yml | 40 ++++-- .../sf_setup.yml | 18 +-- .../sf_setup.yml | 14 +- .../works_on_the_happy_path.yml | 129 ++++++++++++++++++ ...reates_a_lead_which_can_be_found_by_ID.yml | 101 -------------- .../on_success/lead_has_no_errors.yml | 53 ------- .../on_success/sets_the_lead_id.yml | 53 ------- .../on_success/sets_the_lead_source.yml | 53 ------- .../stores_the_application_source.yml | 101 -------------- .../updates_the_salesforce_lead_id.yml | 53 ------- .../on_success/user_has_no_errors.yml | 53 ------- .../works_on_the_happy_path.yml | 66 --------- .../sf_setup.yml | 18 +-- ...ks_the_user-s_EmailAddress_as_verified.yml | 56 -------- ...e_user_email_owner_state_to_activated_.yml | 56 -------- .../Newflow_VerifyEmailByCode/sf_setup.yml | 23 ++-- ...fied_within_number_of_days_in_Settings.yml | 58 -------- .../newflow/student_signup/sf_setup.yml | 55 -------- ...r_login_signup_with_social_network_spec.rb | 2 +- .../newflow/confirm_oauth_info_spec.rb | 38 +----- .../verify_email_by_pin_spec.rb | 15 +- ... create_or_update_salesforce_lead_spec.rb} | 4 +- .../student_signup/activate_student_spec.rb | 26 ++-- .../routines/update_user_contact_info_spec.rb | 23 ---- 38 files changed, 447 insertions(+), 1083 deletions(-) rename app/routines/newflow/{create_salesforce_lead.rb => create_or_update_salesforce_lead.rb} (63%) rename spec/cassettes/{Newflow_CreateSalesforceLead => Newflow_CreateOrUpdateSalesforceLead}/sf_setup.yml (77%) create mode 100644 spec/cassettes/Newflow_CreateOrUpdateSalesforceLead/works_on_the_happy_path.yml delete mode 100644 spec/cassettes/Newflow_CreateSalesforceLead/on_success/creates_a_lead_which_can_be_found_by_ID.yml delete mode 100644 spec/cassettes/Newflow_CreateSalesforceLead/on_success/lead_has_no_errors.yml delete mode 100644 spec/cassettes/Newflow_CreateSalesforceLead/on_success/sets_the_lead_id.yml delete mode 100644 spec/cassettes/Newflow_CreateSalesforceLead/on_success/sets_the_lead_source.yml delete mode 100644 spec/cassettes/Newflow_CreateSalesforceLead/on_success/stores_the_application_source.yml delete mode 100644 spec/cassettes/Newflow_CreateSalesforceLead/on_success/updates_the_salesforce_lead_id.yml delete mode 100644 spec/cassettes/Newflow_CreateSalesforceLead/on_success/user_has_no_errors.yml delete mode 100644 spec/cassettes/Newflow_CreateSalesforceLead/works_on_the_happy_path.yml rename spec/cassettes/{UpdateUserContactInfo => Newflow_StudentSignup}/sf_setup.yml (64%) delete mode 100644 spec/cassettes/Newflow_StudentSignup_VerifyEmailByPin/when_success/marks_the_user-s_EmailAddress_as_verified.yml delete mode 100644 spec/cassettes/Newflow_StudentSignup_VerifyEmailByPin/when_success/sets_the_user_email_owner_state_to_activated_.yml delete mode 100644 spec/cassettes/UpdateUserContactInfo/users_with_contact_modified_within_number_of_days_in_Settings.yml delete mode 100644 spec/cassettes/handlers/newflow/student_signup/sf_setup.yml rename spec/routines/newflow/{create_salesforce_lead_spec.rb => create_or_update_salesforce_lead_spec.rb} (87%) delete mode 100644 spec/routines/update_user_contact_info_spec.rb diff --git a/Gemfile b/Gemfile index d984d8c0e8..e8826424b4 100644 --- a/Gemfile +++ b/Gemfile @@ -143,7 +143,7 @@ gem 'will_paginate' gem 'chronic' # Salesforce -gem 'openstax_salesforce', git: 'https://github.com/openstax/openstax_salesforce.git', ref: 'b250271c38a06ce2957d20919f028099f69cf752' +gem 'openstax_salesforce' # Allows 'ap' alternative to 'pp', used in a mailer gem 'awesome_print' diff --git a/Gemfile.lock b/Gemfile.lock index 72068515c2..71585b8542 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -13,16 +13,6 @@ GIT railties (>= 3.1) sass-rails -GIT - remote: https://github.com/openstax/openstax_salesforce.git - revision: b250271c38a06ce2957d20919f028099f69cf752 - ref: b250271c38a06ce2957d20919f028099f69cf752 - specs: - openstax_salesforce (6.3.0) - openstax_active_force - rails (>= 5.0, < 7.0) - restforce - GIT remote: https://github.com/openstax/path_prefixer.git revision: 8298c40ec38f132fc23ea946b2b20e855fe73a49 @@ -68,10 +58,10 @@ GEM erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - active_attr (0.15.4) - actionpack (>= 3.0.2, < 7.1) - activemodel (>= 3.0.2, < 7.1) - activesupport (>= 3.0.2, < 7.1) + active_attr (0.16.0) + actionpack (>= 3.0.2, < 7.2) + activemodel (>= 3.0.2, < 7.2) + activesupport (>= 3.0.2, < 7.2) activejob (5.2.4.4) activesupport (= 5.2.4.4) globalid (>= 0.3.6) @@ -208,6 +198,7 @@ GEM css_parser (1.4.5) addressable database_cleaner (1.8.5) + date (3.3.4) db-query-matchers (0.6.0) debase (0.2.4.1) debase-ruby_core_source (>= 0.10.2) @@ -316,7 +307,7 @@ GEM formatador (0.2.5) get_process_mem (0.2.7) ffi (~> 1.0) - globalid (1.0.1) + globalid (1.1.0) activesupport (>= 5.0) guard (2.14.0) formatador (>= 0.2.4) @@ -338,7 +329,7 @@ GEM guard-compat (~> 1.1) rspec (>= 2.99.0, < 4.0) hashdiff (1.0.1) - hashie (4.1.0) + hashie (5.0.0) highline (2.0.2) htmlentities (4.3.4) http_accept_language (2.1.1) @@ -370,7 +361,7 @@ GEM activesupport (>= 4.2) aes_key_wrap bindata - jwt (2.2.3) + jwt (2.7.1) keyword_search (1.5.0) knockoutjs-rails (3.5.0) railties (>= 3.1, < 6) @@ -397,12 +388,15 @@ GEM activesupport (>= 4) railties (>= 4) request_store (~> 1.0) - loofah (2.20.0) + loofah (2.22.0) crass (~> 1.0.2) - nokogiri (>= 1.5.9) + nokogiri (>= 1.12.0) lumberjack (1.0.10) - mail (2.7.1) + mail (2.8.1) mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp marcel (0.3.3) mimemagic (~> 0.3.2) maruku (0.7.3) @@ -413,23 +407,32 @@ GEM mimemagic (0.3.10) nokogiri (~> 1) rake - mini_mime (1.1.2) - mini_portile2 (2.8.4) + mini_mime (1.1.5) + mini_portile2 (2.8.5) mini_racer (0.6.2) libv8-node (~> 16.10.0.0) - minitest (5.18.0) + minitest (5.20.0) msgpack (1.5.2) multi_json (1.15.0) multi_xml (0.6.0) - multipart-post (2.1.1) + multipart-post (2.3.0) nenv (0.3.0) - nio4r (2.5.9) - nokogiri (1.15.4) + net-imap (0.4.6) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.4.0) + net-protocol + nio4r (2.6.1) + nokogiri (1.15.5) mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.15.4-x86_64-darwin) + nokogiri (1.15.5-x86_64-darwin) racc (~> 1.4) - nokogiri (1.15.4-x86_64-linux) + nokogiri (1.15.5-x86_64-linux) racc (~> 1.4) notiffany (0.1.0) nenv (~> 0.1) @@ -484,6 +487,10 @@ GEM rails (>= 3.0) openstax_rescue_from (4.2.0) rails (>= 3.1, < 7.0) + openstax_salesforce (7.6.1) + openstax_active_force + rails (>= 5.0, < 7.0) + restforce openstax_utilities (5.0.0) aws-sdk-autoscaling faraday @@ -516,8 +523,8 @@ GEM puma_worker_killer (0.3.1) get_process_mem (~> 0.2) puma (>= 2.7) - racc (1.7.1) - rack (2.2.7) + racc (1.7.3) + rack (2.2.8) rack-contrib (2.3.0) rack (~> 2.0) rack-cors (1.1.1) @@ -541,16 +548,18 @@ GEM actionpack (>= 5.0.1.x) actionview (>= 5.0.1.x) activesupport (>= 5.0.1.x) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest nokogiri (>= 1.6) rails-erd (1.5.2) activerecord (>= 3.2) activesupport (>= 3.2) choice (~> 0.2.0) ruby-graphviz (~> 1.2) - rails-html-sanitizer (1.5.0) - loofah (~> 2.19, >= 2.19.1) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) rails-i18n (5.1.3) i18n (>= 0.7, < 2) railties (>= 5.0, < 6) @@ -568,7 +577,7 @@ GEM rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) rainbow (3.0.0) - rake (13.0.6) + rake (13.1.0) rb-fsevent (0.11.0) rb-inotify (0.10.1) ffi (~> 1.0) @@ -603,8 +612,8 @@ GEM responders (3.0.1) actionpack (>= 5.0) railties (>= 5.0) - restforce (5.2.3) - faraday (>= 0.9.0, < 1.9.0) + restforce (5.3.1) + faraday (>= 0.9.0, <= 1.10.0) faraday_middleware (>= 0.8.8, <= 2.0) hashie (>= 1.2.0, < 6.0) jwt (>= 1.5.6) @@ -702,7 +711,7 @@ GEM sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.4.0) + sprockets-rails (3.4.2) actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) @@ -711,10 +720,11 @@ GEM test_xml (0.1.8) diffy (~> 3.0) nokogiri (>= 1.3.2) - thor (1.2.1) + thor (1.3.0) thread_safe (0.3.6) tilt (2.0.10) timecop (0.8.1) + timeout (0.4.1) transaction_isolation (1.0.5) activerecord (>= 3.0.11) transaction_retry (1.0.3) @@ -741,7 +751,7 @@ GEM crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) websocket (1.2.9) - websocket-driver (0.7.5) + websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) whenever (0.9.7) @@ -828,7 +838,7 @@ DEPENDENCIES openstax_healthcheck openstax_path_prefixer! openstax_rescue_from - openstax_salesforce! + openstax_salesforce openstax_utilities p3p parallel_tests diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index d282845cc3..53a7d1306e 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -62,7 +62,7 @@ def mark_users_updated end def force_update_lead - Newflow::CreateSalesforceLead.call(user: get_user) + Newflow::CreateOrUpdateSalesforceLead.call(user: get_user) end protected diff --git a/app/handlers/newflow/confirm_oauth_info.rb b/app/handlers/newflow/confirm_oauth_info.rb index 06aa5bea3f..18f78e2572 100644 --- a/app/handlers/newflow/confirm_oauth_info.rb +++ b/app/handlers/newflow/confirm_oauth_info.rb @@ -50,7 +50,7 @@ def handle transfer_errors_from(@user, {type: :verbatim}, :fail_if_errors) agree_to_terms(@user) if options[:contracts_required] && signup_params.terms_accepted - run(StudentSignup::ActivateStudent, @user) + run(StudentSignup::ActivateStudent, user: @user) outputs.user = @user end diff --git a/app/handlers/newflow/educator_signup/complete_profile.rb b/app/handlers/newflow/educator_signup/complete_profile.rb index 435dabca6c..cc27deccd1 100644 --- a/app/handlers/newflow/educator_signup/complete_profile.rb +++ b/app/handlers/newflow/educator_signup/complete_profile.rb @@ -97,27 +97,20 @@ def handle # so let's add it - validation happens before this in check_params run(CreateEmailForUser, email: signup_params.school_issued_email, user: @user, is_school_issued: true) end + + if user.school.nil? && !signup_params.school_name.blank? + user.school = School.fuzzy_search name + user.save + end end transfer_errors_from(@user, {type: :verbatim}, :fail_if_errors) + CreateOrUpdateSalesforceLead.perform_later(user: @user) + #output the user to the lev handler outputs.user = @user - if !user.is_educator_pending_cs_verification && !user.sheer_id_webhook_received - # User used SheerID or needs CS verification - we create their lead in SheeridWebhook, not here.. and might not be instant - SecurityLog.create!( - user: user, - event_type: :lead_creation_awaiting_sheerid_webhook, - ) - return - end - # otherwise, we already heard from SheerID, so let's create the lead. - # We check in SheeridWebhook to see if they completed their profile before creating lead - - # Now we create the lead for the user... because we returned above if they did... again SheeridWebhook - CreateSalesforceLead.perform_later(user: @user) - end private ################# diff --git a/app/handlers/newflow/educator_signup/sheerid_webhook.rb b/app/handlers/newflow/educator_signup/sheerid_webhook.rb index 13b0cd80ae..3511638e2d 100644 --- a/app/handlers/newflow/educator_signup/sheerid_webhook.rb +++ b/app/handlers/newflow/educator_signup/sheerid_webhook.rb @@ -136,11 +136,8 @@ def handle(verification_id=nil) event_data: { verification: verification_details_from_sheerid.inspect }) end - # if we got the webhook back after the user submitted the profile, they didn't get a lead built yet - # We just make sure they don't have a lead or contact id yet - if user.salesforce_lead_id.blank? && user.salesforce_contact_id.blank? && user.is_profile_complete - CreateSalesforceLead.perform_later(user: user) - end + CreateOrUpdateSalesforceLead.perform_later(user: user) + SecurityLog.create!(user: user, event_type: :sheerid_webhook_processed) outputs.verification_id = verification_id diff --git a/app/handlers/newflow/student_signup/verify_email_by_pin.rb b/app/handlers/newflow/student_signup/verify_email_by_pin.rb index 390f4a1f3f..d5d9b43265 100644 --- a/app/handlers/newflow/student_signup/verify_email_by_pin.rb +++ b/app/handlers/newflow/student_signup/verify_email_by_pin.rb @@ -23,7 +23,7 @@ def handle private ################# def activate_user(claiming_user) - run(ActivateStudent, claiming_user) + run(ActivateStudent, user: claiming_user) end end diff --git a/app/handlers/verify_email_by_code.rb b/app/handlers/verify_email_by_code.rb index 81290673c1..b3ad4b2260 100644 --- a/app/handlers/verify_email_by_code.rb +++ b/app/handlers/verify_email_by_code.rb @@ -17,7 +17,7 @@ def handle user = outputs.contact_info.user if user.student? - run(Newflow::StudentSignup::ActivateStudent, user) + run(Newflow::StudentSignup::ActivateStudent, user: user) else run(Newflow::EducatorSignup::ActivateEducator, user: user) end diff --git a/app/models/user.rb b/app/models/user.rb index 321b8cee21..6691bdb29b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -169,7 +169,7 @@ def lead end def contact - OpenStax::Salesforce::Remote::Contact.find_by(id: salesforce_contact_id) + OpenStax::Salesforce::Remote::Contact.find(salesforce_contact_id) end def most_accurate_school_name diff --git a/app/routines/newflow/create_salesforce_lead.rb b/app/routines/newflow/create_or_update_salesforce_lead.rb similarity index 63% rename from app/routines/newflow/create_salesforce_lead.rb rename to app/routines/newflow/create_or_update_salesforce_lead.rb index fb162f7666..fe6ed84b7d 100644 --- a/app/routines/newflow/create_salesforce_lead.rb +++ b/app/routines/newflow/create_or_update_salesforce_lead.rb @@ -1,5 +1,5 @@ module Newflow - class CreateSalesforceLead + class CreateOrUpdateSalesforceLead lev_routine active_job_enqueue_options: { queue: :salesforce } @@ -26,6 +26,12 @@ def exec(user:) ) sf_school_id = user.school&.salesforce_id + # no school attached to user? Set to Find Me A Home + unless sf_school_id + sf_school_id = OpenStax::Salesforce::Remote::School.find_by(name: 'Find Me A Home').id + user.school = School.find_by(salesforce_id: sf_school_id) + user.save + end if user.role == 'student' sf_role = 'Student' @@ -39,36 +45,43 @@ def exec(user:) adoption_json = build_book_adoption_json_for_salesforce(user) end - lead = OpenStax::Salesforce::Remote::Lead.new( - first_name: user.first_name, - last_name: user.last_name, - phone: user.phone_number, - email: user.best_email_address_for_salesforce, - source: LEAD_SOURCE, - application_source: DEFAULT_REFERRING_APP_NAME, - role: sf_role, - position: sf_position, - title: user.other_role_name, - who_chooses_books: user.who_chooses_books, - subject_interest: user.which_books, - num_students: user.how_many_students, - adoption_status: ADOPTION_STATUS_FROM_USER[user.using_openstax_how], - adoption_json: adoption_json, - os_accounts_id: user.id, - accounts_uuid: user.uuid, - school: user.most_accurate_school_name, - city: user.most_accurate_school_city, - country: user.most_accurate_school_country, - verification_status: user.faculty_status == User::NO_FACULTY_INFO ? nil : user.faculty_status, - b_r_i_marketing: user.is_b_r_i_user?, - title_1_school: user.title_1_school?, - newsletter: user.receive_newsletter?, - newsletter_opt_in: user.receive_newsletter?, - sheerid_school_name: user.sheerid_reported_school, - instant_verification: user.is_sheerid_verified, - account_id: sf_school_id, - school_id: sf_school_id - ) + # The user has not finished signing up + user.faculty_status = User::INCOMPLETE_SIGNUP unless user.is_profile_complete? + + + if user.salesforce_lead_id + lead = OpenStax::Salesforce::Remote::Lead.find_by(email: user.best_email_address_for_salesforce) + else + lead = OpenStax::Salesforce::Remote::Lead.new(email: user.best_email_address_for_salesforce) + end + + lead.first_name = user.first_name + lead.last_name = user.last_name + lead.phone = user.phone_number + lead.source = LEAD_SOURCE + lead.application_source = DEFAULT_REFERRING_APP_NAME + lead.role = sf_role + lead.position = sf_position + lead.title = user.other_role_name + lead.who_chooses_books = user.who_chooses_books + lead.subject_interest = user.which_books + lead.num_students = user.how_many_students + lead.adoption_status = ADOPTION_STATUS_FROM_USER[user.using_openstax_how] + lead.adoption_json = adoption_json + lead.os_accounts_id = user.id + lead.accounts_uuid = user.uuid + lead.school = user.most_accurate_school_name + lead.city = user.most_accurate_school_city + lead.country = user.most_accurate_school_country + lead.verification_status = user.faculty_status == User::NO_FACULTY_INFO ? nil : user.faculty_status + lead.b_r_i_marketing = user.is_b_r_i_user? + lead.title_1_school = user.title_1_school? + lead.newsletter = user.receive_newsletter? + lead.newsletter_opt_in = user.receive_newsletter? + lead.self_reported_school = user.self_reported_school + lead.sheerid_school_name = user.sheerid_reported_school + lead.account_id = sf_school_id + lead.school_id = sf_school_id state = user.most_accurate_school_state unless state.blank? @@ -89,20 +102,20 @@ def exec(user:) event_data: { lead_data: lead } ) - outputs.lead = lead - outputs.user = user - if lead.save store_salesforce_lead_id(user, lead.id) transfer_errors_from(user, {type: :verbatim}, :fail_if_errors) + + outputs.lead = lead else handle_lead_errors(lead, user) end + + outputs.user = user end def store_salesforce_lead_id(user, lead_id) fatal_error(code: :lead_id_is_blank, message: :lead_id_is_blank.to_s.titleize) if lead_id.blank? - fatal_error(code: :lead_id_is_already_set, message: :lead_id_is_already_set.to_s.titleize) if user.salesforce_lead_id.present? user.salesforce_lead_id = lead_id diff --git a/app/routines/newflow/student_signup/activate_student.rb b/app/routines/newflow/student_signup/activate_student.rb index c1b44da2db..c86ef4364d 100644 --- a/app/routines/newflow/student_signup/activate_student.rb +++ b/app/routines/newflow/student_signup/activate_student.rb @@ -8,19 +8,10 @@ class ActivateStudent protected ############### - def authorized? - true - end - - def exec(user) + def exec(user:) return if user.activated? user.update!(state: User::ACTIVATED) - if user.receive_newsletter? - #TODO: make a prospect instead? - CreateSalesforceLead.perform_later(user: user) - SecurityLog.create!(user: user, event_type: :created_salesforce_lead) - end SecurityLog.create!(user: user, event_type: :user_became_activated) end diff --git a/app/routines/update_user_contact_info.rb b/app/routines/update_user_contact_info.rb index 02accd2d69..bf26625228 100644 --- a/app/routines/update_user_contact_info.rb +++ b/app/routines/update_user_contact_info.rb @@ -46,11 +46,13 @@ def call user.salesforce_contact_id = sf_contact.id - SecurityLog.create!( - user: user, - event_type: :user_contact_id_updated_from_salesforce, - event_data: { contact_id: sf_contact.id } - ) + if user.salesforce_contact_id.changed? + SecurityLog.create!( + user: user, + event_type: :user_contact_id_updated_from_salesforce, + event_data: { contact_id: sf_contact.id } + ) + end old_fv_status = user.faculty_status user.faculty_status = case sf_contact.faculty_verified @@ -73,6 +75,15 @@ def call sf_contact.faculty_verified}'' on contact #{sf_contact.id}") end + if user.faculty_status_changed? + users_fv_status_changed += 1 + SecurityLog.create!( + user: user, + event_type: :salesforce_updated_faculty_status, + event_data: { user_id: user.id, salesforce_contact_id: sf_contact.id, old_status: old_fv_status, new_status: user.faculty_status } + ) + end + user.school_type = case sf_contact.school_type when *COLLEGE_TYPES :college @@ -115,20 +126,11 @@ def call event_data: { school_id: sf_school.id } ) users_without_cached_school += 1 - log("User #{user.id} has a school that is in SF but not cached yet #{sf_school.id}") + Sentry.capture_message("User #{user.id} has a school that is in SF but not cached yet #{sf_school.id}") else user.school = school end - if user.faculty_status_changed? - users_fv_status_changed += 1 - SecurityLog.create!( - user: user, - event_type: :salesforce_updated_faculty_status, - event_data: { user_id: user.id, salesforce_contact_id: sf_contact.id, old_status:old_fv_status, new_status: user.faculty_status } - ) - end - user.save! && users_updated += 1 if user.changed? end log("Completed updating #{users_updated} users.") diff --git a/spec/cassettes/Change_Salesforce_contact_manually/can_be_set_if_the_Contact_exists_in_SF.yml b/spec/cassettes/Change_Salesforce_contact_manually/can_be_set_if_the_Contact_exists_in_SF.yml index e435e11ffc..b54ece03ec 100644 --- a/spec/cassettes/Change_Salesforce_contact_manually/can_be_set_if_the_Contact_exists_in_SF.yml +++ b/spec/cassettes/Change_Salesforce_contact_manually/can_be_set_if_the_Contact_exists_in_SF.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: "/services/data/v51.0/query?q=SELECT%20Id,%20Name,%20BillingCity,%20BillingState,%20BillingCountry,%20Type,%20School_Location__c,%20SheerID_School_Name__c,%20K_I_P__c,%20child_of_kip__c%20FROM%20Account%20WHERE%20(RecordType.Name%20=%20%27School%27)%20AND%20(Name%20IN%20(%27JP%20University%27))" + uri: "/services/data/v51.0/query?q=SELECT%20Id,%20Name,%20BillingCity,%20BillingState,%20BillingCountry,%20Type,%20School_Location__c,%20SheerID_School_Name__c,%20K_I_P__c,%20child_of_kip__c,%20Total_School_Enrollment__c%20FROM%20Account%20WHERE%20(RecordType.Name%20=%20%27School%27%20OR%20RecordType.Name%20=%20%27School%20District%27)%20AND%20(Name%20IN%20(%27RSpec%20University%27))" body: encoding: US-ASCII string: '' @@ -21,40 +21,52 @@ http_interactions: message: OK headers: Date: - - Mon, 24 Jan 2022 13:55:41 GMT + - Mon, 27 Nov 2023 16:18:03 GMT + Content-Type: + - application/json;charset=UTF-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive Set-Cookie: - - BrowserId=UbeNkn0dEeyWOUuoD6vnqg; domain=.salesforce.com; path=/; expires=Tue, - 24-Jan-2023 13:55:42 GMT; Max-Age=31536000 - - CookieConsentPolicy=0:1; path=/; expires=Tue, 24-Jan-2023 13:55:42 GMT; Max-Age=31536000 - - LSKey-c$CookieConsentPolicy=0:1; path=/; expires=Tue, 24-Jan-2023 13:55:42 + - BrowserId=imOXQ41AEe6XW6cG93Tdkw; domain=.salesforce.com; path=/; expires=Tue, + 26-Nov-2024 16:18:03 GMT; Max-Age=31536000 + - CookieConsentPolicy=0:1; path=/; expires=Tue, 26-Nov-2024 16:18:03 GMT; Max-Age=31536000 + - LSKey-c$CookieConsentPolicy=0:1; path=/; expires=Tue, 26-Nov-2024 16:18:03 GMT; Max-Age=31536000 Strict-Transport-Security: - max-age=63072000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block X-Robots-Tag: - none Cache-Control: - no-cache,must-revalidate,max-age=0,no-store,private Sforce-Limit-Info: - - api-usage=1599/5000000 - Content-Type: - - application/json;charset=UTF-8 + - api-usage=35216/5000000 Vary: - Accept-Encoding - Transfer-Encoding: - - chunked + Server: + - sfdcedge + X-Sfdc-Request-Id: + - d856c234a625b439ee0d27f6571fa1a3 + X-Sfdc-Edge-Cache: + - MISS body: encoding: ASCII-8BIT - string: '{"totalSize":1,"done":true,"records":[{"attributes":{"type":"Account","url":"/services/data/v51.0/sobjects/Account/0014C00000etq0uQAA"},"Id":"0014C00000etq0uQAA","Name":"JP + string: '{"totalSize":1,"done":true,"records":[{"attributes":{"type":"Account","url":"/services/data/v51.0/sobjects/Account/0010400001ayViVAAU"},"Id":"0010400001ayViVAAU","Name":"RSpec University","BillingCity":null,"BillingState":null,"BillingCountry":"United - States","Type":null,"School_Location__c":"Domestic","SheerID_School_Name__c":null,"K_I_P__c":false,"child_of_kip__c":false}]}' - http_version: - recorded_at: Mon, 24 Jan 2022 13:55:13 GMT + States","Type":null,"School_Location__c":"Domestic","SheerID_School_Name__c":null,"K_I_P__c":false,"child_of_kip__c":false,"Total_School_Enrollment__c":null}]}' + http_version: + recorded_at: Mon, 27 Nov 2023 16:18:03 GMT - request: method: post uri: "/services/data/v51.0/sobjects/Contact" body: encoding: UTF-8 - string: '{"FirstName":"Lillian","LastName":"Zulauf","AccountId":"0014C00000etq0uQAA"}' + string: '{"FirstName":"Claudette","LastName":"Adams","Email":"vance@example.org","AccountId":"0010400001ayViVAAU"}' headers: User-Agent: - Faraday v1.0.1 @@ -72,37 +84,47 @@ http_interactions: message: Created headers: Date: - - Mon, 24 Jan 2022 13:55:42 GMT + - Mon, 27 Nov 2023 16:18:05 GMT + Content-Type: + - application/json;charset=UTF-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive Set-Cookie: - - BrowserId=Ug9xgH0dEeyk3wN9Bwamng; domain=.salesforce.com; path=/; expires=Tue, - 24-Jan-2023 13:55:42 GMT; Max-Age=31536000 - - CookieConsentPolicy=0:1; path=/; expires=Tue, 24-Jan-2023 13:55:42 GMT; Max-Age=31536000 - - LSKey-c$CookieConsentPolicy=0:1; path=/; expires=Tue, 24-Jan-2023 13:55:42 + - BrowserId=ipypWo1AEe68DhWGX-mu8A; domain=.salesforce.com; path=/; expires=Tue, + 26-Nov-2024 16:18:03 GMT; Max-Age=31536000 + - CookieConsentPolicy=0:1; path=/; expires=Tue, 26-Nov-2024 16:18:03 GMT; Max-Age=31536000 + - LSKey-c$CookieConsentPolicy=0:1; path=/; expires=Tue, 26-Nov-2024 16:18:03 GMT; Max-Age=31536000 Strict-Transport-Security: - max-age=63072000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block X-Robots-Tag: - none Cache-Control: - no-cache,must-revalidate,max-age=0,no-store,private Sforce-Limit-Info: - - api-usage=1599/5000000 + - api-usage=35215/5000000 Location: - - "/services/data/v51.0/sobjects/Contact/0034C00000XQzmjQAD" - Content-Type: - - application/json;charset=UTF-8 + - "/services/data/v51.0/sobjects/Contact/0030400000gHxGfAAK" Vary: - Accept-Encoding - Transfer-Encoding: - - chunked + Server: + - sfdcedge + X-Sfdc-Request-Id: + - e42e2ad525f02a38b805c3e911685a3a body: encoding: ASCII-8BIT - string: '{"id":"0034C00000XQzmjQAD","success":true,"errors":[]}' - http_version: - recorded_at: Mon, 24 Jan 2022 13:55:17 GMT + string: '{"id":"0030400000gHxGfAAK","success":true,"errors":[]}' + http_version: + recorded_at: Mon, 27 Nov 2023 16:18:05 GMT - request: method: get - uri: "/services/data/v51.0/query?q=SELECT%20Id,%20Name,%20FirstName,%20LastName,%20Email,%20Email_alt__c,%20Faculty_Confirmed_Date__c,%20FV_Status__c,%20LastModifiedDate,%20AccountId,%20School_Type__c,%20SendFacultyVerificationTo__c,%20All_Emails__c,%20Confirmed_Emails__c,%20Adoption_Status__c,%20Grant_Tutor_Access__c,%20BRI_Marketing__c,%20Title_1_school__c,%20Accounts_UUID__c,%20LeadSource%20FROM%20Contact%20WHERE%20(Id%20=%20%270034C00000XQzmjQAD%27)%20LIMIT%201" + uri: "/services/data/v51.0/query?q=SELECT%20Id,%20Name,%20FirstName,%20LastName,%20Email,%20Email_alt__c,%20Faculty_Confirmed_Date__c,%20FV_Status__c,%20LastModifiedDate,%20AccountId,%20School_Type__c,%20SendFacultyVerificationTo__c,%20All_Emails__c,%20Adoption_Status__c,%20Grant_Tutor_Access__c,%20Title_1_school__c,%20Accounts_UUID__c,%20LeadSource,%20Signup_Date__c,%20Renewal_Eligible__c%20FROM%20Contact%20WHERE%20(Id%20=%20%270030400000gHxGfAAK%27)%20LIMIT%201" body: encoding: US-ASCII string: '' @@ -121,32 +143,44 @@ http_interactions: message: OK headers: Date: - - Mon, 24 Jan 2022 13:55:46 GMT + - Mon, 27 Nov 2023 16:18:06 GMT + Content-Type: + - application/json;charset=UTF-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive Set-Cookie: - - BrowserId=VFk6YX0dEeyj1KHMMeYh7g; domain=.salesforce.com; path=/; expires=Tue, - 24-Jan-2023 13:55:46 GMT; Max-Age=31536000 - - CookieConsentPolicy=0:1; path=/; expires=Tue, 24-Jan-2023 13:55:46 GMT; Max-Age=31536000 - - LSKey-c$CookieConsentPolicy=0:1; path=/; expires=Tue, 24-Jan-2023 13:55:46 + - BrowserId=jATEso1AEe66LFegd-phRw; domain=.salesforce.com; path=/; expires=Tue, + 26-Nov-2024 16:18:06 GMT; Max-Age=31536000 + - CookieConsentPolicy=0:1; path=/; expires=Tue, 26-Nov-2024 16:18:06 GMT; Max-Age=31536000 + - LSKey-c$CookieConsentPolicy=0:1; path=/; expires=Tue, 26-Nov-2024 16:18:06 GMT; Max-Age=31536000 Strict-Transport-Security: - max-age=63072000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block X-Robots-Tag: - none Cache-Control: - no-cache,must-revalidate,max-age=0,no-store,private Sforce-Limit-Info: - - api-usage=1599/5000000 - Content-Type: - - application/json;charset=UTF-8 + - api-usage=35215/5000000 Vary: - Accept-Encoding - Transfer-Encoding: - - chunked + Server: + - sfdcedge + X-Sfdc-Request-Id: + - f4560b1fb8579301761ebdc80997efc9 + X-Sfdc-Edge-Cache: + - MISS body: encoding: ASCII-8BIT - string: '{"totalSize":1,"done":true,"records":[{"attributes":{"type":"Contact","url":"/services/data/v51.0/sobjects/Contact/0034C00000XQzmjQAD"},"Id":"0034C00000XQzmjQAD","Name":"Lillian - Zulauf","FirstName":"Lillian","LastName":"Zulauf","Email":null,"Email_alt__c":null,"Faculty_Confirmed_Date__c":null,"FV_Status__c":null,"LastModifiedDate":"2022-01-24T13:55:45.000+0000","AccountId":"0014C00000etq0uQAA","School_Type__c":null,"SendFacultyVerificationTo__c":null,"All_Emails__c":null,"Confirmed_Emails__c":null,"Adoption_Status__c":"Not - Adopter","Grant_Tutor_Access__c":false,"BRI_Marketing__c":false,"Title_1_school__c":false,"Accounts_UUID__c":null,"LeadSource":null}]}' - http_version: - recorded_at: Mon, 24 Jan 2022 13:55:18 GMT + string: '{"totalSize":1,"done":true,"records":[{"attributes":{"type":"Contact","url":"/services/data/v51.0/sobjects/Contact/0030400000gHxGfAAK"},"Id":"0030400000gHxGfAAK","Name":"Claudette + Adams","FirstName":"Claudette","LastName":"Adams","Email":"vance@example.org","Email_alt__c":null,"Faculty_Confirmed_Date__c":null,"FV_Status__c":null,"LastModifiedDate":"2023-11-27T16:18:05.000+0000","AccountId":"0010400001ayViVAAU","School_Type__c":null,"SendFacultyVerificationTo__c":null,"All_Emails__c":"vance@example.org","Adoption_Status__c":"Not + Adopter","Grant_Tutor_Access__c":false,"Title_1_school__c":false,"Accounts_UUID__c":null,"LeadSource":null,"Signup_Date__c":null,"Renewal_Eligible__c":false}]}' + http_version: + recorded_at: Mon, 27 Nov 2023 16:18:06 GMT recorded_with: VCR 3.0.3 diff --git a/spec/cassettes/Change_Salesforce_contact_manually/cannot_be_set_if_the_Contact_does_not_exist_in_SF.yml b/spec/cassettes/Change_Salesforce_contact_manually/cannot_be_set_if_the_Contact_does_not_exist_in_SF.yml index 613689bab0..8e49defe33 100644 --- a/spec/cassettes/Change_Salesforce_contact_manually/cannot_be_set_if_the_Contact_does_not_exist_in_SF.yml +++ b/spec/cassettes/Change_Salesforce_contact_manually/cannot_be_set_if_the_Contact_does_not_exist_in_SF.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: "/services/data/v51.0/query?q=SELECT%20Id,%20Name,%20FirstName,%20LastName,%20Email,%20Email_alt__c,%20Faculty_Confirmed_Date__c,%20FV_Status__c,%20LastModifiedDate,%20AccountId,%20School_Type__c,%20SendFacultyVerificationTo__c,%20All_Emails__c,%20Confirmed_Emails__c,%20Adoption_Status__c,%20Grant_Tutor_Access__c,%20BRI_Marketing__c,%20Title_1_school__c,%20Accounts_UUID__c,%20LeadSource%20FROM%20Contact%20WHERE%20(Id%20=%20%270010v000002Wo0qAAC%27)%20LIMIT%201" + uri: "/services/data/v51.0/query?q=SELECT%20Id,%20Name,%20FirstName,%20LastName,%20Email,%20Email_alt__c,%20Faculty_Confirmed_Date__c,%20FV_Status__c,%20LastModifiedDate,%20AccountId,%20School_Type__c,%20SendFacultyVerificationTo__c,%20All_Emails__c,%20Adoption_Status__c,%20Grant_Tutor_Access__c,%20Title_1_school__c,%20Accounts_UUID__c,%20LeadSource,%20Signup_Date__c,%20Renewal_Eligible__c%20FROM%20Contact%20WHERE%20(Id%20=%20%270010v000002Wo0qAAC%27)%20LIMIT%201" body: encoding: US-ASCII string: '' @@ -21,30 +21,42 @@ http_interactions: message: OK headers: Date: - - Mon, 24 Jan 2022 13:55:39 GMT + - Mon, 27 Nov 2023 16:18:02 GMT + Content-Type: + - application/json;charset=UTF-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive Set-Cookie: - - BrowserId=UHPqAX0dEeyF7B1qyYogEw; domain=.salesforce.com; path=/; expires=Tue, - 24-Jan-2023 13:55:39 GMT; Max-Age=31536000 - - CookieConsentPolicy=0:1; path=/; expires=Tue, 24-Jan-2023 13:55:39 GMT; Max-Age=31536000 - - LSKey-c$CookieConsentPolicy=0:1; path=/; expires=Tue, 24-Jan-2023 13:55:39 + - BrowserId=ibUIBY1AEe6Khe8IdOYHzw; domain=.salesforce.com; path=/; expires=Tue, + 26-Nov-2024 16:18:02 GMT; Max-Age=31536000 + - CookieConsentPolicy=0:1; path=/; expires=Tue, 26-Nov-2024 16:18:02 GMT; Max-Age=31536000 + - LSKey-c$CookieConsentPolicy=0:1; path=/; expires=Tue, 26-Nov-2024 16:18:02 GMT; Max-Age=31536000 Strict-Transport-Security: - max-age=63072000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block X-Robots-Tag: - none Cache-Control: - no-cache,must-revalidate,max-age=0,no-store,private Sforce-Limit-Info: - - api-usage=1598/5000000 - Content-Type: - - application/json;charset=UTF-8 + - api-usage=35215/5000000 Vary: - Accept-Encoding - Transfer-Encoding: - - chunked + Server: + - sfdcedge + X-Sfdc-Request-Id: + - 4e668b119139b49cf808b0be3412f81a + X-Sfdc-Edge-Cache: + - MISS body: encoding: ASCII-8BIT string: '{"totalSize":0,"done":true,"records":[]}' - http_version: - recorded_at: Mon, 24 Jan 2022 13:55:12 GMT + http_version: + recorded_at: Mon, 27 Nov 2023 16:18:02 GMT recorded_with: VCR 3.0.3 diff --git a/spec/cassettes/Change_Salesforce_contact_manually/cannot_be_set_if_the_ID_is_of_malformed.yml b/spec/cassettes/Change_Salesforce_contact_manually/cannot_be_set_if_the_ID_is_of_malformed.yml index b7cefd73cd..5cc47d71fa 100644 --- a/spec/cassettes/Change_Salesforce_contact_manually/cannot_be_set_if_the_ID_is_of_malformed.yml +++ b/spec/cassettes/Change_Salesforce_contact_manually/cannot_be_set_if_the_ID_is_of_malformed.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: "/services/data/v51.0/query?q=SELECT%20Id,%20Name,%20FirstName,%20LastName,%20Email,%20Email_alt__c,%20Faculty_Confirmed_Date__c,%20FV_Status__c,%20LastModifiedDate,%20AccountId,%20School_Type__c,%20SendFacultyVerificationTo__c,%20All_Emails__c,%20Confirmed_Emails__c,%20Adoption_Status__c,%20Grant_Tutor_Access__c,%20BRI_Marketing__c,%20Title_1_school__c,%20Accounts_UUID__c,%20LeadSource%20FROM%20Contact%20WHERE%20(Id%20=%20%27somethingwonky%27)%20LIMIT%201" + uri: "/services/data/v51.0/query?q=SELECT%20Id,%20Name,%20FirstName,%20LastName,%20Email,%20Email_alt__c,%20Faculty_Confirmed_Date__c,%20FV_Status__c,%20LastModifiedDate,%20AccountId,%20School_Type__c,%20SendFacultyVerificationTo__c,%20All_Emails__c,%20Adoption_Status__c,%20Grant_Tutor_Access__c,%20Title_1_school__c,%20Accounts_UUID__c,%20LeadSource,%20Signup_Date__c,%20Renewal_Eligible__c%20FROM%20Contact%20WHERE%20(Id%20=%20%27somethingwonky%27)%20LIMIT%201" body: encoding: US-ASCII string: '' @@ -21,30 +21,40 @@ http_interactions: message: Bad Request headers: Date: - - Mon, 24 Jan 2022 13:55:41 GMT + - Mon, 27 Nov 2023 16:18:01 GMT + Content-Type: + - application/json;charset=UTF-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive Set-Cookie: - - BrowserId=US_AEX0dEeyOoSHSbsZOUA; domain=.salesforce.com; path=/; expires=Tue, - 24-Jan-2023 13:55:41 GMT; Max-Age=31536000 - - CookieConsentPolicy=0:1; path=/; expires=Tue, 24-Jan-2023 13:55:41 GMT; Max-Age=31536000 - - LSKey-c$CookieConsentPolicy=0:1; path=/; expires=Tue, 24-Jan-2023 13:55:41 + - BrowserId=iUJwro1AEe6XW6cG93Tdkw; domain=.salesforce.com; path=/; expires=Tue, + 26-Nov-2024 16:18:01 GMT; Max-Age=31536000 + - CookieConsentPolicy=0:1; path=/; expires=Tue, 26-Nov-2024 16:18:01 GMT; Max-Age=31536000 + - LSKey-c$CookieConsentPolicy=0:1; path=/; expires=Tue, 26-Nov-2024 16:18:01 GMT; Max-Age=31536000 Strict-Transport-Security: - max-age=63072000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block X-Robots-Tag: - none Cache-Control: - no-cache,must-revalidate,max-age=0,no-store,private Sforce-Limit-Info: - - api-usage=1599/5000000 - Content-Type: - - application/json;charset=UTF-8 - Transfer-Encoding: - - chunked + - api-usage=35215/5000000 + Server: + - sfdcedge + X-Sfdc-Request-Id: + - a6a1f4e2ee854bed5e12af40f1013a70 body: encoding: UTF-8 - string: '[{"message":"\nLeadSource FROM Contact WHERE (Id = ''somethingwonky'') - LIMIT 1\n ^\nERROR at Row:1:Column:341\ninvalid + string: '[{"message":"\nRenewal_Eligible__c FROM Contact WHERE (Id = ''somethingwonky'') + LIMIT 1\n ^\nERROR at Row:1:Column:339\ninvalid ID field: somethingwonky","errorCode":"INVALID_QUERY_FILTER_OPERATOR"}]' - http_version: - recorded_at: Mon, 24 Jan 2022 13:55:12 GMT + http_version: + recorded_at: Mon, 27 Nov 2023 16:18:01 GMT recorded_with: VCR 3.0.3 diff --git a/spec/cassettes/Change_Salesforce_contact_manually/sf_setup.yml b/spec/cassettes/Change_Salesforce_contact_manually/sf_setup.yml index df5310459d..98e83dd46e 100644 --- a/spec/cassettes/Change_Salesforce_contact_manually/sf_setup.yml +++ b/spec/cassettes/Change_Salesforce_contact_manually/sf_setup.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: post - uri: https://test.salesforce.com/services/oauth2/token + uri: https:///services/oauth2/token body: encoding: US-ASCII string: grant_type=password&client_id=&client_secret=&username=&password= @@ -21,12 +21,12 @@ http_interactions: message: OK headers: Date: - - Mon, 24 Jan 2022 13:55:36 GMT + - Mon, 27 Nov 2023 16:17:59 GMT Set-Cookie: - - BrowserId=TqI2630dEey2wDWXhDx85A; domain=.salesforce.com; path=/; expires=Tue, - 24-Jan-2023 13:55:36 GMT; Max-Age=31536000 - - CookieConsentPolicy=0:0; path=/; expires=Tue, 24-Jan-2023 13:55:36 GMT; Max-Age=31536000 - - LSKey-c$CookieConsentPolicy=0:0; path=/; expires=Tue, 24-Jan-2023 13:55:36 + - BrowserId=h_4JT41AEe6SFKXp9rZhKw; domain=.salesforce.com; path=/; expires=Tue, + 26-Nov-2024 16:17:59 GMT; Max-Age=31536000 + - CookieConsentPolicy=0:0; path=/; expires=Tue, 26-Nov-2024 16:17:59 GMT; Max-Age=31536000 + - LSKey-c$CookieConsentPolicy=0:0; path=/; expires=Tue, 26-Nov-2024 16:17:59 GMT; Max-Age=31536000 Strict-Transport-Security: - max-age=63072000; includeSubDomains @@ -48,7 +48,7 @@ http_interactions: - chunked body: encoding: ASCII-8BIT - string: '{"access_token":"","instance_url":"","id":"","token_type":"Bearer","issued_at":"1643032537201","signature":""}' - http_version: - recorded_at: Mon, 24 Jan 2022 13:55:09 GMT + string: '{"access_token":"","instance_url":"","id":"https:///id/00D040000003rgWEAQ/005U0000005MXdmIAG","token_type":"Bearer","issued_at":"1701101880122","signature":""}' + http_version: + recorded_at: Mon, 27 Nov 2023 16:18:00 GMT recorded_with: VCR 3.0.3 diff --git a/spec/cassettes/Newflow_CreateSalesforceLead/sf_setup.yml b/spec/cassettes/Newflow_CreateOrUpdateSalesforceLead/sf_setup.yml similarity index 77% rename from spec/cassettes/Newflow_CreateSalesforceLead/sf_setup.yml rename to spec/cassettes/Newflow_CreateOrUpdateSalesforceLead/sf_setup.yml index b55ccafbb7..71cc23895e 100644 --- a/spec/cassettes/Newflow_CreateSalesforceLead/sf_setup.yml +++ b/spec/cassettes/Newflow_CreateOrUpdateSalesforceLead/sf_setup.yml @@ -21,12 +21,12 @@ http_interactions: message: OK headers: Date: - - Mon, 30 Oct 2023 19:37:51 GMT + - Mon, 27 Nov 2023 16:10:02 GMT Set-Cookie: - - BrowserId=0BGi1XdbEe6DIEORwVWHfA; domain=.salesforce.com; path=/; expires=Tue, - 29-Oct-2024 19:37:51 GMT; Max-Age=31536000 - - CookieConsentPolicy=0:0; path=/; expires=Tue, 29-Oct-2024 19:37:51 GMT; Max-Age=31536000 - - LSKey-c$CookieConsentPolicy=0:0; path=/; expires=Tue, 29-Oct-2024 19:37:51 + - BrowserId=a7167o0_Ee6uW5WJZ0ssuA; domain=.salesforce.com; path=/; expires=Tue, + 26-Nov-2024 16:10:02 GMT; Max-Age=31536000 + - CookieConsentPolicy=0:0; path=/; expires=Tue, 26-Nov-2024 16:10:02 GMT; Max-Age=31536000 + - LSKey-c$CookieConsentPolicy=0:0; path=/; expires=Tue, 26-Nov-2024 16:10:02 GMT; Max-Age=31536000 Strict-Transport-Security: - max-age=63072000; includeSubDomains @@ -48,7 +48,7 @@ http_interactions: - chunked body: encoding: ASCII-8BIT - string: '{"access_token":"","instance_url":"","id":"https:///id/00D040000003rgWEAQ/005U0000005MXdmIAG","token_type":"Bearer","issued_at":"1698694671993","signature":""}' + string: '{"access_token":"","instance_url":"","id":"https:///id/00D040000003rgWEAQ/005U0000005MXdmIAG","token_type":"Bearer","issued_at":"1701101403184","signature":""}' http_version: - recorded_at: Mon, 30 Oct 2023 19:37:51 GMT + recorded_at: Mon, 27 Nov 2023 16:10:03 GMT recorded_with: VCR 3.0.3 diff --git a/spec/cassettes/Newflow_CreateOrUpdateSalesforceLead/works_on_the_happy_path.yml b/spec/cassettes/Newflow_CreateOrUpdateSalesforceLead/works_on_the_happy_path.yml new file mode 100644 index 0000000000..4c5adffc51 --- /dev/null +++ b/spec/cassettes/Newflow_CreateOrUpdateSalesforceLead/works_on_the_happy_path.yml @@ -0,0 +1,129 @@ +--- +http_interactions: +- request: + method: get + uri: "/services/data/v51.0/query?q=SELECT%20Id,%20Name,%20BillingCity,%20BillingState,%20BillingCountry,%20Type,%20School_Location__c,%20SheerID_School_Name__c,%20K_I_P__c,%20child_of_kip__c,%20Total_School_Enrollment__c%20FROM%20Account%20WHERE%20(RecordType.Name%20=%20%27School%27%20OR%20RecordType.Name%20=%20%27School%20District%27)%20AND%20(Name%20=%20%27Find%20Me%20A%20Home%27)%20LIMIT%201" + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Faraday v1.0.1 + Authorization: + - OAuth + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 27 Nov 2023 16:10:04 GMT + Content-Type: + - application/json;charset=UTF-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Set-Cookie: + - BrowserId=bI9KI40_Ee6XW6cG93Tdkw; domain=.salesforce.com; path=/; expires=Tue, + 26-Nov-2024 16:10:03 GMT; Max-Age=31536000 + - CookieConsentPolicy=0:1; path=/; expires=Tue, 26-Nov-2024 16:10:03 GMT; Max-Age=31536000 + - LSKey-c$CookieConsentPolicy=0:1; path=/; expires=Tue, 26-Nov-2024 16:10:03 + GMT; Max-Age=31536000 + Strict-Transport-Security: + - max-age=63072000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + X-Robots-Tag: + - none + Cache-Control: + - no-cache,must-revalidate,max-age=0,no-store,private + Sforce-Limit-Info: + - api-usage=35213/5000000 + Vary: + - Accept-Encoding + Server: + - sfdcedge + X-Sfdc-Request-Id: + - 6e37ba88ec8cb0b95296ecd34e62aab7 + X-Sfdc-Edge-Cache: + - MISS + body: + encoding: ASCII-8BIT + string: '{"totalSize":1,"done":true,"records":[{"attributes":{"type":"Account","url":"/services/data/v51.0/sobjects/Account/0016f00002iPs9mAAC"},"Id":"0016f00002iPs9mAAC","Name":"Find + Me A Home","BillingCity":"Abu Dhabi","BillingState":null,"BillingCountry":"United + Arab Emirates","Type":"Other","School_Location__c":"Foreign","SheerID_School_Name__c":null,"K_I_P__c":false,"child_of_kip__c":false,"Total_School_Enrollment__c":null}]}' + http_version: + recorded_at: Mon, 27 Nov 2023 16:10:03 GMT +- request: + method: post + uri: "/services/data/v51.0/sobjects/Lead" + body: + encoding: UTF-8 + string: '{"FirstName":"Max","LastName":"Liebermann","Subject_Interest__c":"AP + Macro Econ","Company":"Test University","Country":"United States","Phone":"+17133484799","LeadSource":"Account + Creation","Newsletter__c":false,"Newsletter_Opt_In__c":false,"Adoption_Status__c":"Confirmed + Adoption Won","Number_of_Students__c":"35","Accounts_ID__c":1,"Accounts_UUID__c":"f4c74c7d-bdf0-4aaf-8084-a92999a598c0","Application_Source__c":"Accounts","Role__c":"Instructor","Position__c":"instructor","who_chooses_books__c":"instructor","FV_Status__c":"pending_faculty","BRI_Marketing__c":false,"Title_1_school__c":false,"Self_Reported_School__c":"Test + University","Account_ID__c":"0016f00002iPs9mAAC","School__c":"0016f00002iPs9mAAC"}' + headers: + User-Agent: + - Faraday v1.0.1 + Content-Type: + - application/json + Authorization: + - OAuth + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 201 + message: Created + headers: + Date: + - Mon, 27 Nov 2023 16:10:25 GMT + Content-Type: + - application/json;charset=UTF-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Set-Cookie: + - BrowserId=bRCvy40_Ee68DhWGX-mu8A; domain=.salesforce.com; path=/; expires=Tue, + 26-Nov-2024 16:10:04 GMT; Max-Age=31536000 + - CookieConsentPolicy=0:1; path=/; expires=Tue, 26-Nov-2024 16:10:04 GMT; Max-Age=31536000 + - LSKey-c$CookieConsentPolicy=0:1; path=/; expires=Tue, 26-Nov-2024 16:10:04 + GMT; Max-Age=31536000 + Strict-Transport-Security: + - max-age=63072000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + X-Robots-Tag: + - none + Cache-Control: + - no-cache,must-revalidate,max-age=0,no-store,private + Sforce-Limit-Info: + - api-usage=35213/5000000 + Location: + - "/services/data/v51.0/sobjects/Lead/00Q04000006Hc9rEAC" + Vary: + - Accept-Encoding + Server: + - sfdcedge + X-Sfdc-Request-Id: + - 1fef55b4b99a09f20d45b3e8420168b3 + body: + encoding: ASCII-8BIT + string: '{"id":"00Q04000006Hc9rEAC","success":true,"errors":[]}' + http_version: + recorded_at: Mon, 27 Nov 2023 16:10:25 GMT +recorded_with: VCR 3.0.3 diff --git a/spec/cassettes/Newflow_CreateSalesforceLead/on_success/creates_a_lead_which_can_be_found_by_ID.yml b/spec/cassettes/Newflow_CreateSalesforceLead/on_success/creates_a_lead_which_can_be_found_by_ID.yml deleted file mode 100644 index 0676875fb1..0000000000 --- a/spec/cassettes/Newflow_CreateSalesforceLead/on_success/creates_a_lead_which_can_be_found_by_ID.yml +++ /dev/null @@ -1,101 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: "/services/data/v51.0/sobjects/Lead" - body: - encoding: UTF-8 - string: '{"FirstName":"Corey","LastName":"Purdy","Company":"unknown to Accounts","Country":"United - States","Email":"f@f.com","LeadSource":"OSC Faculty","Newsletter__c":false,"Newsletter_Opt_In__c":false,"OS_Accounts_ID__c":41,"accounts_uuid_c__c":"ab7db513-afab-40c8-8c3e-314328d24c85","Application_Source__c":"Tutor - Signup","Role__c":"instructor","FV_Status__c":"pending_faculty","FV_Final__c":true,"Needs_CS_Review__c":false,"BRI_Marketing__c":false,"Title_1_school__c":false}' - headers: - User-Agent: - - Faraday v1.0.1 - Content-Type: - - application/json - Authorization: - - OAuth - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - response: - status: - code: 201 - message: Created - headers: - Date: - - Wed, 07 Apr 2021 17:26:22 GMT - Strict-Transport-Security: - - max-age=31536002; includeSubDomains - X-Robots-Tag: - - none - Cache-Control: - - no-cache,must-revalidate,max-age=0,no-store,private - Set-Cookie: - - BrowserId=X6RlCZfGEeu-I-HiDsUFAA; domain=.salesforce.com; path=/; expires=Thu, - 07-Apr-2022 17:26:22 GMT; Max-Age=31536000 - Sforce-Limit-Info: - - api-usage=1096/5000000 - Location: - - "/services/data/v51.0/sobjects/Lead/00Q0v000007UFETEA4" - Content-Type: - - application/json;charset=UTF-8 - Vary: - - Accept-Encoding - Transfer-Encoding: - - chunked - body: - encoding: ASCII-8BIT - string: '{"id":"00Q0v000007UFETEA4","success":true,"errors":[]}' - http_version: - recorded_at: Wed, 07 Apr 2021 17:34:35 GMT -- request: - method: get - uri: "/services/data/v51.0/query?q=SELECT%20Id,%20Name,%20FirstName,%20LastName,%20Salutation,%20Subject__c,%20Company,%20City,%20State,%20StateCode,%20Country,%20Phone,%20Website,%20Status,%20Email,%20LeadSource,%20Newsletter__c,%20Newsletter_Opt_In__c,%20Adoption_Status__c,%20Number_of_Students__c,%20OS_Accounts_ID__c,%20accounts_uuid_c__c,%20Application_Source__c,%20Role__c,%20other_role_name__c,%20who_chooses_books__c,%20FV_Status__c,%20FV_Final__c,%20Needs_CS_Review__c,%20BRI_Marketing__c,%20Title_1_school__c,%20SheerID_School_Name__c,%20Account_ID__c,%20School__c%20FROM%20Lead%20WHERE%20(Id%20=%20%2700Q0v000007UFETEA4%27)%20LIMIT%201" - body: - encoding: US-ASCII - string: '' - headers: - User-Agent: - - Faraday v0.17.4 - Authorization: - - OAuth - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - response: - status: - code: 200 - message: OK - headers: - Date: - - Wed, 07 Apr 2021 17:26:24 GMT - Strict-Transport-Security: - - max-age=31536002; includeSubDomains - X-Robots-Tag: - - none - Cache-Control: - - no-cache,must-revalidate,max-age=0,no-store,private - Set-Cookie: - - BrowserId=YF7bnZfGEeuVI3epysi5Cw; domain=.salesforce.com; path=/; expires=Thu, - 07-Apr-2022 17:26:24 GMT; Max-Age=31536000 - Sforce-Limit-Info: - - api-usage=1094/5000000 - Content-Type: - - application/json;charset=UTF-8 - Vary: - - Accept-Encoding - Transfer-Encoding: - - chunked - body: - encoding: ASCII-8BIT - string: '{"totalSize":1,"done":true,"records":[{"attributes":{"type":"Lead","url":"/services/data/v37.0/sobjects/Lead/00Q0v000007UFETEA4"},"Id":"00Q0v000007UFETEA4","Name":"Corey - Purdy","FirstName":"Corey","LastName":"Purdy","Salutation":null,"Subject__c":null,"Company":"unknown - to Accounts","City":null,"State":null,"StateCode":null,"Country":"United States","Phone":null,"Website":null,"Status":"Convert","Email":"f@f.com","LeadSource":"OSC - Faculty","Newsletter__c":false,"Newsletter_Opt_In__c":false,"Adoption_Status__c":null,"Number_of_Students__c":null,"OS_Accounts_ID__c":"41","accounts_uuid_c__c":"ab7db513-afab-40c8-8c3e-314328d24c85","Application_Source__c":"Tutor - Signup","Role__c":"Instructor","other_role_name__c":null,"who_chooses_books__c":null,"FV_Status__c":"pending_faculty","FV_Final__c":true,"Needs_CS_Review__c":true,"BRI_Marketing__c":false,"Title_1_school__c":false,"SheerID_School_Name__c":null,"Account_ID__c":null,"School__c":null}]}' - http_version: - recorded_at: Wed, 07 Apr 2021 17:34:35 GMT -recorded_with: VCR 3.0.3 diff --git a/spec/cassettes/Newflow_CreateSalesforceLead/on_success/lead_has_no_errors.yml b/spec/cassettes/Newflow_CreateSalesforceLead/on_success/lead_has_no_errors.yml deleted file mode 100644 index bc027d62a0..0000000000 --- a/spec/cassettes/Newflow_CreateSalesforceLead/on_success/lead_has_no_errors.yml +++ /dev/null @@ -1,53 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: "/services/data/v51.0/sobjects/Lead" - body: - encoding: UTF-8 - string: '{"FirstName":"Thanh","LastName":"Green","Company":"unknown to Accounts","Country":"United - States","Email":"f@f.com","LeadSource":"OSC Faculty","Newsletter__c":false,"Newsletter_Opt_In__c":false,"OS_Accounts_ID__c":40,"accounts_uuid_c__c":"e4116871-1fbc-4223-964c-c448bf22cb5c","Application_Source__c":"Tutor - Signup","Role__c":"instructor","FV_Status__c":"pending_faculty","FV_Final__c":true,"Needs_CS_Review__c":false,"BRI_Marketing__c":false,"Title_1_school__c":false}' - headers: - User-Agent: - - Faraday v1.0.1 - Content-Type: - - application/json - Authorization: - - OAuth - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - response: - status: - code: 201 - message: Created - headers: - Date: - - Wed, 07 Apr 2021 17:26:21 GMT - Strict-Transport-Security: - - max-age=31536002; includeSubDomains - X-Robots-Tag: - - none - Cache-Control: - - no-cache,must-revalidate,max-age=0,no-store,private - Set-Cookie: - - BrowserId=Xu7Q5pfGEeuwD7VAfM7TGQ; domain=.salesforce.com; path=/; expires=Thu, - 07-Apr-2022 17:26:21 GMT; Max-Age=31536000 - Sforce-Limit-Info: - - api-usage=1093/5000000 - Location: - - "/services/data/v51.0/sobjects/Lead/00Q0v000007UFEOEA4" - Content-Type: - - application/json;charset=UTF-8 - Vary: - - Accept-Encoding - Transfer-Encoding: - - chunked - body: - encoding: ASCII-8BIT - string: '{"id":"00Q0v000007UFEOEA4","success":true,"errors":[]}' - http_version: - recorded_at: Wed, 07 Apr 2021 17:34:35 GMT -recorded_with: VCR 3.0.3 diff --git a/spec/cassettes/Newflow_CreateSalesforceLead/on_success/sets_the_lead_id.yml b/spec/cassettes/Newflow_CreateSalesforceLead/on_success/sets_the_lead_id.yml deleted file mode 100644 index 973dbc871b..0000000000 --- a/spec/cassettes/Newflow_CreateSalesforceLead/on_success/sets_the_lead_id.yml +++ /dev/null @@ -1,53 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: "/services/data/v51.0/sobjects/Lead" - body: - encoding: UTF-8 - string: '{"FirstName":"Tona","LastName":"Klocko","Company":"unknown to Accounts","Country":"United - States","Email":"f@f.com","LeadSource":"OSC Faculty","Newsletter__c":false,"Newsletter_Opt_In__c":false,"OS_Accounts_ID__c":38,"accounts_uuid_c__c":"d4974e18-b264-459f-aa54-41b6a3d57c68","Application_Source__c":"Tutor - Signup","Role__c":"instructor","FV_Status__c":"pending_faculty","FV_Final__c":true,"Needs_CS_Review__c":false,"BRI_Marketing__c":false,"Title_1_school__c":false}' - headers: - User-Agent: - - Faraday v1.0.1 - Content-Type: - - application/json - Authorization: - - OAuth - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - response: - status: - code: 201 - message: Created - headers: - Date: - - Wed, 07 Apr 2021 17:26:18 GMT - Strict-Transport-Security: - - max-age=31536002; includeSubDomains - X-Robots-Tag: - - none - Cache-Control: - - no-cache,must-revalidate,max-age=0,no-store,private - Set-Cookie: - - BrowserId=XTGQMJfGEeuVI3epysi5Cw; domain=.salesforce.com; path=/; expires=Thu, - 07-Apr-2022 17:26:18 GMT; Max-Age=31536000 - Sforce-Limit-Info: - - api-usage=1093/5000000 - Location: - - "/services/data/v51.0/sobjects/Lead/00Q0v000007UFEEEA4" - Content-Type: - - application/json;charset=UTF-8 - Vary: - - Accept-Encoding - Transfer-Encoding: - - chunked - body: - encoding: ASCII-8BIT - string: '{"id":"00Q0v000007UFEEEA4","success":true,"errors":[]}' - http_version: - recorded_at: Wed, 07 Apr 2021 17:34:35 GMT -recorded_with: VCR 3.0.3 diff --git a/spec/cassettes/Newflow_CreateSalesforceLead/on_success/sets_the_lead_source.yml b/spec/cassettes/Newflow_CreateSalesforceLead/on_success/sets_the_lead_source.yml deleted file mode 100644 index 1cd177751a..0000000000 --- a/spec/cassettes/Newflow_CreateSalesforceLead/on_success/sets_the_lead_source.yml +++ /dev/null @@ -1,53 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: "/services/data/v51.0/sobjects/Lead" - body: - encoding: UTF-8 - string: '{"FirstName":"Esmeralda","LastName":"Schuppe","Company":"unknown to - Accounts","Country":"United States","Email":"f@f.com","LeadSource":"OSC Faculty","Newsletter__c":false,"Newsletter_Opt_In__c":false,"OS_Accounts_ID__c":42,"accounts_uuid_c__c":"8fd7ff04-2381-4c97-b82b-683b2340b9d8","Application_Source__c":"Tutor - Signup","Role__c":"instructor","FV_Status__c":"pending_faculty","FV_Final__c":true,"Needs_CS_Review__c":false,"BRI_Marketing__c":false,"Title_1_school__c":false}' - headers: - User-Agent: - - Faraday v1.0.1 - Content-Type: - - application/json - Authorization: - - OAuth - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - response: - status: - code: 201 - message: Created - headers: - Date: - - Wed, 07 Apr 2021 17:26:24 GMT - Strict-Transport-Security: - - max-age=31536002; includeSubDomains - X-Robots-Tag: - - none - Cache-Control: - - no-cache,must-revalidate,max-age=0,no-store,private - Set-Cookie: - - BrowserId=YI_WgJfGEeuJmr-dn1jxAA; domain=.salesforce.com; path=/; expires=Thu, - 07-Apr-2022 17:26:24 GMT; Max-Age=31536000 - Sforce-Limit-Info: - - api-usage=1092/5000000 - Location: - - "/services/data/v51.0/sobjects/Lead/00Q0v000007UFEYEA4" - Content-Type: - - application/json;charset=UTF-8 - Vary: - - Accept-Encoding - Transfer-Encoding: - - chunked - body: - encoding: ASCII-8BIT - string: '{"id":"00Q0v000007UFEYEA4","success":true,"errors":[]}' - http_version: - recorded_at: Wed, 07 Apr 2021 17:34:35 GMT -recorded_with: VCR 3.0.3 diff --git a/spec/cassettes/Newflow_CreateSalesforceLead/on_success/stores_the_application_source.yml b/spec/cassettes/Newflow_CreateSalesforceLead/on_success/stores_the_application_source.yml deleted file mode 100644 index 887da7d55b..0000000000 --- a/spec/cassettes/Newflow_CreateSalesforceLead/on_success/stores_the_application_source.yml +++ /dev/null @@ -1,101 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: "/services/data/v51.0/sobjects/Lead" - body: - encoding: UTF-8 - string: '{"FirstName":"Retha","LastName":"Grant","Company":"unknown to Accounts","Country":"United - States","Email":"f@f.com","LeadSource":"OSC Faculty","Newsletter__c":false,"Newsletter_Opt_In__c":false,"OS_Accounts_ID__c":36,"accounts_uuid_c__c":"68ecd361-6298-42b7-adb1-9bad69004335","Application_Source__c":"Tutor - Signup","Role__c":"instructor","FV_Status__c":"pending_faculty","FV_Final__c":true,"Needs_CS_Review__c":false,"BRI_Marketing__c":false,"Title_1_school__c":false}' - headers: - User-Agent: - - Faraday v1.0.1 - Content-Type: - - application/json - Authorization: - - OAuth - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - response: - status: - code: 201 - message: Created - headers: - Date: - - Wed, 07 Apr 2021 17:26:15 GMT - Strict-Transport-Security: - - max-age=31536002; includeSubDomains - X-Robots-Tag: - - none - Cache-Control: - - no-cache,must-revalidate,max-age=0,no-store,private - Set-Cookie: - - BrowserId=W1a1dpfGEeu0B0k93Zu7XA; domain=.salesforce.com; path=/; expires=Thu, - 07-Apr-2022 17:26:15 GMT; Max-Age=31536000 - Sforce-Limit-Info: - - api-usage=1093/5000000 - Location: - - "/services/data/v51.0/sobjects/Lead/00Q0v000007UFE9EAO" - Content-Type: - - application/json;charset=UTF-8 - Vary: - - Accept-Encoding - Transfer-Encoding: - - chunked - body: - encoding: ASCII-8BIT - string: '{"id":"00Q0v000007UFE9EAO","success":true,"errors":[]}' - http_version: - recorded_at: Wed, 07 Apr 2021 17:34:35 GMT -- request: - method: get - uri: "/services/data/v51.0/query?q=SELECT%20Id,%20Name,%20FirstName,%20LastName,%20Salutation,%20Subject__c,%20Company,%20City,%20State,%20StateCode,%20Country,%20Phone,%20Website,%20Status,%20Email,%20LeadSource,%20Newsletter__c,%20Newsletter_Opt_In__c,%20Adoption_Status__c,%20Number_of_Students__c,%20OS_Accounts_ID__c,%20accounts_uuid_c__c,%20Application_Source__c,%20Role__c,%20other_role_name__c,%20who_chooses_books__c,%20FV_Status__c,%20FV_Final__c,%20Needs_CS_Review__c,%20BRI_Marketing__c,%20Title_1_school__c,%20SheerID_School_Name__c,%20Account_ID__c,%20School__c%20FROM%20Lead%20WHERE%20(Id%20=%20%2700Q0v000007UFE9EAO%27)%20LIMIT%201" - body: - encoding: US-ASCII - string: '' - headers: - User-Agent: - - Faraday v0.17.4 - Authorization: - - OAuth - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - response: - status: - code: 200 - message: OK - headers: - Date: - - Wed, 07 Apr 2021 17:26:16 GMT - Strict-Transport-Security: - - max-age=31536002; includeSubDomains - X-Robots-Tag: - - none - Cache-Control: - - no-cache,must-revalidate,max-age=0,no-store,private - Set-Cookie: - - BrowserId=XA33YJfGEeusNMMAHpxQVA; domain=.salesforce.com; path=/; expires=Thu, - 07-Apr-2022 17:26:16 GMT; Max-Age=31536000 - Sforce-Limit-Info: - - api-usage=1095/5000000 - Content-Type: - - application/json;charset=UTF-8 - Vary: - - Accept-Encoding - Transfer-Encoding: - - chunked - body: - encoding: ASCII-8BIT - string: '{"totalSize":1,"done":true,"records":[{"attributes":{"type":"Lead","url":"/services/data/v37.0/sobjects/Lead/00Q0v000007UFE9EAO"},"Id":"00Q0v000007UFE9EAO","Name":"Retha - Grant","FirstName":"Retha","LastName":"Grant","Salutation":null,"Subject__c":null,"Company":"unknown - to Accounts","City":null,"State":null,"StateCode":null,"Country":"United States","Phone":null,"Website":null,"Status":"Convert","Email":"f@f.com","LeadSource":"OSC - Faculty","Newsletter__c":false,"Newsletter_Opt_In__c":false,"Adoption_Status__c":null,"Number_of_Students__c":null,"OS_Accounts_ID__c":"36","accounts_uuid_c__c":"68ecd361-6298-42b7-adb1-9bad69004335","Application_Source__c":"Tutor - Signup","Role__c":"Instructor","other_role_name__c":null,"who_chooses_books__c":null,"FV_Status__c":"pending_faculty","FV_Final__c":true,"Needs_CS_Review__c":true,"BRI_Marketing__c":false,"Title_1_school__c":false,"SheerID_School_Name__c":null,"Account_ID__c":null,"School__c":null}]}' - http_version: - recorded_at: Wed, 07 Apr 2021 17:34:35 GMT -recorded_with: VCR 3.0.3 diff --git a/spec/cassettes/Newflow_CreateSalesforceLead/on_success/updates_the_salesforce_lead_id.yml b/spec/cassettes/Newflow_CreateSalesforceLead/on_success/updates_the_salesforce_lead_id.yml deleted file mode 100644 index affc046bbc..0000000000 --- a/spec/cassettes/Newflow_CreateSalesforceLead/on_success/updates_the_salesforce_lead_id.yml +++ /dev/null @@ -1,53 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: "/services/data/v51.0/sobjects/Lead" - body: - encoding: UTF-8 - string: '{"FirstName":"Ma","LastName":"Stamm","Company":"unknown to Accounts","Country":"United - States","Email":"f@f.com","LeadSource":"OSC Faculty","Newsletter__c":false,"Newsletter_Opt_In__c":false,"OS_Accounts_ID__c":39,"accounts_uuid_c__c":"4949ab52-2b45-4e84-95af-3131eeb184c9","Application_Source__c":"Tutor - Signup","Role__c":"instructor","FV_Status__c":"pending_faculty","FV_Final__c":true,"Needs_CS_Review__c":false,"BRI_Marketing__c":false,"Title_1_school__c":false}' - headers: - User-Agent: - - Faraday v1.0.1 - Content-Type: - - application/json - Authorization: - - OAuth - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - response: - status: - code: 201 - message: Created - headers: - Date: - - Wed, 07 Apr 2021 17:26:20 GMT - Strict-Transport-Security: - - max-age=31536002; includeSubDomains - X-Robots-Tag: - - none - Cache-Control: - - no-cache,must-revalidate,max-age=0,no-store,private - Set-Cookie: - - BrowserId=XgMQ-JfGEeu-I-HiDsUFAA; domain=.salesforce.com; path=/; expires=Thu, - 07-Apr-2022 17:26:20 GMT; Max-Age=31536000 - Sforce-Limit-Info: - - api-usage=1095/5000000 - Location: - - "/services/data/v51.0/sobjects/Lead/00Q0v000007UFEJEA4" - Content-Type: - - application/json;charset=UTF-8 - Vary: - - Accept-Encoding - Transfer-Encoding: - - chunked - body: - encoding: ASCII-8BIT - string: '{"id":"00Q0v000007UFEJEA4","success":true,"errors":[]}' - http_version: - recorded_at: Wed, 07 Apr 2021 17:34:35 GMT -recorded_with: VCR 3.0.3 diff --git a/spec/cassettes/Newflow_CreateSalesforceLead/on_success/user_has_no_errors.yml b/spec/cassettes/Newflow_CreateSalesforceLead/on_success/user_has_no_errors.yml deleted file mode 100644 index 908355e87a..0000000000 --- a/spec/cassettes/Newflow_CreateSalesforceLead/on_success/user_has_no_errors.yml +++ /dev/null @@ -1,53 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: "/services/data/v51.0/sobjects/Lead" - body: - encoding: UTF-8 - string: '{"FirstName":"Benny","LastName":"Kub","Company":"unknown to Accounts","Country":"United - States","Email":"f@f.com","LeadSource":"OSC Faculty","Newsletter__c":false,"Newsletter_Opt_In__c":false,"OS_Accounts_ID__c":37,"accounts_uuid_c__c":"e0e87a3d-dd09-488f-b0ef-03a48364cf7c","Application_Source__c":"Tutor - Signup","Role__c":"instructor","FV_Status__c":"pending_faculty","FV_Final__c":true,"Needs_CS_Review__c":false,"BRI_Marketing__c":false,"Title_1_school__c":false}' - headers: - User-Agent: - - Faraday v1.0.1 - Content-Type: - - application/json - Authorization: - - OAuth - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - response: - status: - code: 201 - message: Created - headers: - Date: - - Wed, 07 Apr 2021 17:26:17 GMT - Strict-Transport-Security: - - max-age=31536002; includeSubDomains - X-Robots-Tag: - - none - Cache-Control: - - no-cache,must-revalidate,max-age=0,no-store,private - Set-Cookie: - - BrowserId=XDqF0JfGEeu-I-HiDsUFAA; domain=.salesforce.com; path=/; expires=Thu, - 07-Apr-2022 17:26:17 GMT; Max-Age=31536000 - Sforce-Limit-Info: - - api-usage=1094/5000000 - Location: - - "/services/data/v51.0/sobjects/Lead/00Q0v000007UFE0EAO" - Content-Type: - - application/json;charset=UTF-8 - Vary: - - Accept-Encoding - Transfer-Encoding: - - chunked - body: - encoding: ASCII-8BIT - string: '{"id":"00Q0v000007UFE0EAO","success":true,"errors":[]}' - http_version: - recorded_at: Wed, 07 Apr 2021 17:34:35 GMT -recorded_with: VCR 3.0.3 diff --git a/spec/cassettes/Newflow_CreateSalesforceLead/works_on_the_happy_path.yml b/spec/cassettes/Newflow_CreateSalesforceLead/works_on_the_happy_path.yml deleted file mode 100644 index e797e997f9..0000000000 --- a/spec/cassettes/Newflow_CreateSalesforceLead/works_on_the_happy_path.yml +++ /dev/null @@ -1,66 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: "/services/data/v51.0/sobjects/Lead" - body: - encoding: UTF-8 - string: '{"FirstName":"Max","LastName":"Liebermann","Company":"Test University","Country":"United - States","Phone":"+17133484799","LeadSource":"Account Creation","Newsletter__c":false,"Newsletter_Opt_In__c":false,"Adoption_Status__c":"Confirmed - Adoption Won","Number_of_Students__c":"35","Accounts_ID__c":1,"Accounts_UUID__c":"f9b81c7c-b57b-4c8f-b8c7-dc760b14ed21","Application_Source__c":"Accounts","Role__c":"Instructor","Position__c":"instructor","who_chooses_books__c":"instructor","FV_Status__c":"pending_faculty","BRI_Marketing__c":false,"Title_1_school__c":false}' - headers: - User-Agent: - - Faraday v1.0.1 - Content-Type: - - application/json - Authorization: - - OAuth - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - response: - status: - code: 201 - message: Created - headers: - Date: - - Mon, 30 Oct 2023 19:38:13 GMT - Content-Type: - - application/json;charset=UTF-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Set-Cookie: - - BrowserId=0OvWbndbEe68IzGd4tbGQQ; domain=.salesforce.com; path=/; expires=Tue, - 29-Oct-2024 19:37:52 GMT; Max-Age=31536000 - - CookieConsentPolicy=0:1; path=/; expires=Tue, 29-Oct-2024 19:37:52 GMT; Max-Age=31536000 - - LSKey-c$CookieConsentPolicy=0:1; path=/; expires=Tue, 29-Oct-2024 19:37:52 - GMT; Max-Age=31536000 - Strict-Transport-Security: - - max-age=63072000; includeSubDomains - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - X-Robots-Tag: - - none - Cache-Control: - - no-cache,must-revalidate,max-age=0,no-store,private - Sforce-Limit-Info: - - api-usage=22/5000000 - Location: - - "/services/data/v51.0/sobjects/Lead/00Q04000006GrgJEAS" - Vary: - - Accept-Encoding - Server: - - sfdcedge - X-Sfdc-Request-Id: - - 07e99c888d917346e15aabd66b7aed91 - body: - encoding: ASCII-8BIT - string: '{"id":"00Q04000006GrgJEAS","success":true,"errors":[]}' - http_version: - recorded_at: Mon, 30 Oct 2023 19:38:13 GMT -recorded_with: VCR 3.0.3 diff --git a/spec/cassettes/UpdateUserContactInfo/sf_setup.yml b/spec/cassettes/Newflow_StudentSignup/sf_setup.yml similarity index 64% rename from spec/cassettes/UpdateUserContactInfo/sf_setup.yml rename to spec/cassettes/Newflow_StudentSignup/sf_setup.yml index 8c72666ab9..3254150437 100644 --- a/spec/cassettes/UpdateUserContactInfo/sf_setup.yml +++ b/spec/cassettes/Newflow_StudentSignup/sf_setup.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: post - uri: https://test.salesforce.com/services/oauth2/token + uri: https:///services/oauth2/token body: encoding: US-ASCII string: grant_type=password&client_id=&client_secret=&username=&password= @@ -21,12 +21,12 @@ http_interactions: message: OK headers: Date: - - Fri, 21 Jan 2022 21:47:49 GMT + - Tue, 14 Nov 2023 21:48:03 GMT Set-Cookie: - - BrowserId=xwUUtHsDEey8GHEpbim3uw; domain=.salesforce.com; path=/; expires=Sat, - 21-Jan-2023 21:47:49 GMT; Max-Age=31536000 - - CookieConsentPolicy=0:0; path=/; expires=Sat, 21-Jan-2023 21:47:49 GMT; Max-Age=31536000 - - LSKey-c$CookieConsentPolicy=0:0; path=/; expires=Sat, 21-Jan-2023 21:47:49 + - BrowserId=fQn7fIM3Ee6fUrvg8m2SAg; domain=.salesforce.com; path=/; expires=Wed, + 13-Nov-2024 21:48:03 GMT; Max-Age=31536000 + - CookieConsentPolicy=0:0; path=/; expires=Wed, 13-Nov-2024 21:48:03 GMT; Max-Age=31536000 + - LSKey-c$CookieConsentPolicy=0:0; path=/; expires=Wed, 13-Nov-2024 21:48:03 GMT; Max-Age=31536000 Strict-Transport-Security: - max-age=63072000; includeSubDomains @@ -48,7 +48,7 @@ http_interactions: - chunked body: encoding: ASCII-8BIT - string: '{"access_token":"","instance_url":"","id":"","token_type":"Bearer","issued_at":"1642801669914","signature":""}' - http_version: - recorded_at: Fri, 21 Jan 2022 21:47:50 GMT + string: '{"access_token":"","instance_url":"","id":"https:///id/00D040000003rgWEAQ/005U0000005MXdmIAG","token_type":"Bearer","issued_at":"1699998485027","signature":""}' + http_version: + recorded_at: Tue, 14 Nov 2023 21:48:04 GMT recorded_with: VCR 3.0.3 diff --git a/spec/cassettes/Newflow_StudentSignup_VerifyEmailByPin/when_success/marks_the_user-s_EmailAddress_as_verified.yml b/spec/cassettes/Newflow_StudentSignup_VerifyEmailByPin/when_success/marks_the_user-s_EmailAddress_as_verified.yml deleted file mode 100644 index 4d316e8abc..0000000000 --- a/spec/cassettes/Newflow_StudentSignup_VerifyEmailByPin/when_success/marks_the_user-s_EmailAddress_as_verified.yml +++ /dev/null @@ -1,56 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: "/services/data/v51.0/sobjects/Lead" - body: - encoding: UTF-8 - string: '{"FirstName":"Elsie","LastName":"Larson","Company":"unknown","Country":"United - States","Email":"test@openstax.org","LeadSource":"Account Creation","Newsletter__c":true,"Newsletter_Opt_In__c":true,"Accounts_ID__c":1,"Accounts_UUID__c":"aad409c2-bdf6-4693-954f-d0edfe5fde11","Application_Source__c":"Accounts","Role__c":"student","BRI_Marketing__c":false,"Title_1_school__c":false}' - headers: - User-Agent: - - Faraday v1.0.1 - Content-Type: - - application/json - Authorization: - - OAuth - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - response: - status: - code: 201 - message: Created - headers: - Date: - - Tue, 21 Sep 2021 19:39:04 GMT - Set-Cookie: - - BrowserId=lFV2lBsTEeyTRx8_0KSSdQ; domain=.salesforce.com; path=/; expires=Wed, - 21-Sep-2022 19:39:04 GMT; Max-Age=31536000 - - CookieConsentPolicy=0:1; domain=openstax--dev.my.salesforce.com; path=/; expires=Wed, - 21-Sep-2022 19:39:04 GMT; Max-Age=31536000 - - LSKey-c$CookieConsentPolicy=0:1; domain=openstax--dev.my.salesforce.com; path=/; - expires=Wed, 21-Sep-2022 19:39:04 GMT; Max-Age=31536000 - Strict-Transport-Security: - - max-age=31536000; includeSubDomains - X-Robots-Tag: - - none - Cache-Control: - - no-cache,must-revalidate,max-age=0,no-store,private - Sforce-Limit-Info: - - api-usage=4115/5000000 - Location: - - "/services/data/v51.0/sobjects/Lead/00Q4C000009lq51UAA" - Content-Type: - - application/json;charset=UTF-8 - Vary: - - Accept-Encoding - Transfer-Encoding: - - chunked - body: - encoding: ASCII-8BIT - string: '{"id":"00Q4C000009lq51UAA","success":true,"errors":[]}' - http_version: - recorded_at: Tue, 21 Sep 2021 19:39:06 GMT -recorded_with: VCR 3.0.3 diff --git a/spec/cassettes/Newflow_StudentSignup_VerifyEmailByPin/when_success/sets_the_user_email_owner_state_to_activated_.yml b/spec/cassettes/Newflow_StudentSignup_VerifyEmailByPin/when_success/sets_the_user_email_owner_state_to_activated_.yml deleted file mode 100644 index 8ba7efec33..0000000000 --- a/spec/cassettes/Newflow_StudentSignup_VerifyEmailByPin/when_success/sets_the_user_email_owner_state_to_activated_.yml +++ /dev/null @@ -1,56 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: "/services/data/v51.0/sobjects/Lead" - body: - encoding: UTF-8 - string: '{"FirstName":"Perry","LastName":"Wintheiser","Company":"unknown","Country":"United - States","Email":"test@openstax.org","LeadSource":"Account Creation","Newsletter__c":true,"Newsletter_Opt_In__c":true,"Accounts_ID__c":2,"Accounts_UUID__c":"2554001d-1de6-4860-82f6-abfe11128552","Application_Source__c":"Accounts","Role__c":"student","BRI_Marketing__c":false,"Title_1_school__c":false}' - headers: - User-Agent: - - Faraday v1.0.1 - Content-Type: - - application/json - Authorization: - - OAuth - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - response: - status: - code: 201 - message: Created - headers: - Date: - - Tue, 21 Sep 2021 19:39:07 GMT - Set-Cookie: - - BrowserId=lckDqRsTEeyTRx8_0KSSdQ; domain=.salesforce.com; path=/; expires=Wed, - 21-Sep-2022 19:39:07 GMT; Max-Age=31536000 - - CookieConsentPolicy=0:1; domain=openstax--dev.my.salesforce.com; path=/; expires=Wed, - 21-Sep-2022 19:39:07 GMT; Max-Age=31536000 - - LSKey-c$CookieConsentPolicy=0:1; domain=openstax--dev.my.salesforce.com; path=/; - expires=Wed, 21-Sep-2022 19:39:07 GMT; Max-Age=31536000 - Strict-Transport-Security: - - max-age=31536000; includeSubDomains - X-Robots-Tag: - - none - Cache-Control: - - no-cache,must-revalidate,max-age=0,no-store,private - Sforce-Limit-Info: - - api-usage=4118/5000000 - Location: - - "/services/data/v51.0/sobjects/Lead/00Q4C000009lq56UAA" - Content-Type: - - application/json;charset=UTF-8 - Vary: - - Accept-Encoding - Transfer-Encoding: - - chunked - body: - encoding: ASCII-8BIT - string: '{"id":"00Q4C000009lq56UAA","success":true,"errors":[]}' - http_version: - recorded_at: Tue, 21 Sep 2021 19:39:09 GMT -recorded_with: VCR 3.0.3 diff --git a/spec/cassettes/Newflow_VerifyEmailByCode/sf_setup.yml b/spec/cassettes/Newflow_VerifyEmailByCode/sf_setup.yml index 03566c419a..c058ca1651 100644 --- a/spec/cassettes/Newflow_VerifyEmailByCode/sf_setup.yml +++ b/spec/cassettes/Newflow_VerifyEmailByCode/sf_setup.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: post - uri: https://test.salesforce.com/services/oauth2/token + uri: https:///services/oauth2/token body: encoding: US-ASCII string: grant_type=password&client_id=&client_secret=&username=&password= @@ -21,16 +21,15 @@ http_interactions: message: OK headers: Date: - - Tue, 21 Sep 2021 20:15:40 GMT + - Wed, 15 Nov 2023 16:14:59 GMT Set-Cookie: - - BrowserId=sVDLtxsYEeyiEqHkrR4rcw; domain=.salesforce.com; path=/; expires=Wed, - 21-Sep-2022 20:15:40 GMT; Max-Age=31536000 - - CookieConsentPolicy=0:0; domain=test.salesforce.com; path=/; expires=Wed, - 21-Sep-2022 20:15:40 GMT; Max-Age=31536000 - - LSKey-c$CookieConsentPolicy=0:0; domain=test.salesforce.com; path=/; expires=Wed, - 21-Sep-2022 20:15:40 GMT; Max-Age=31536000 + - BrowserId=H-5da4PSEe6uFMnuBFn0Jg; domain=.salesforce.com; path=/; expires=Thu, + 14-Nov-2024 16:14:59 GMT; Max-Age=31536000 + - CookieConsentPolicy=0:0; path=/; expires=Thu, 14-Nov-2024 16:14:59 GMT; Max-Age=31536000 + - LSKey-c$CookieConsentPolicy=0:0; path=/; expires=Thu, 14-Nov-2024 16:14:59 + GMT; Max-Age=31536000 Strict-Transport-Security: - - max-age=31536000; includeSubDomains + - max-age=63072000; includeSubDomains X-Content-Type-Options: - nosniff X-Xss-Protection: @@ -49,7 +48,7 @@ http_interactions: - chunked body: encoding: ASCII-8BIT - string: '{"access_token":"","instance_url":"","id":"","token_type":"Bearer","issued_at":"1632255341315","signature":""}' - http_version: - recorded_at: Tue, 21 Sep 2021 20:15:41 GMT + string: '{"access_token":"","instance_url":"","id":"https:///id/00D040000003rgWEAQ/005U0000005MXdmIAG","token_type":"Bearer","issued_at":"1700064900732","signature":""}' + http_version: + recorded_at: Wed, 15 Nov 2023 16:15:00 GMT recorded_with: VCR 3.0.3 diff --git a/spec/cassettes/UpdateUserContactInfo/users_with_contact_modified_within_number_of_days_in_Settings.yml b/spec/cassettes/UpdateUserContactInfo/users_with_contact_modified_within_number_of_days_in_Settings.yml deleted file mode 100644 index 89e1fc206e..0000000000 --- a/spec/cassettes/UpdateUserContactInfo/users_with_contact_modified_within_number_of_days_in_Settings.yml +++ /dev/null @@ -1,58 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: "/services/data/v51.0/query?q=SELECT%20Id,%20Email,%20Email_alt__c,%20FV_Status__c,%20School_Type__c,%20Adoption_Status__c,%20Grant_Tutor_Access__c,%20Accounts_UUID__c,%20Account.Id,%20Account.Name,%20Account.BillingCity,%20Account.BillingState,%20Account.BillingCountry,%20Account.Type,%20Account.School_Location__c,%20Account.SheerID_School_Name__c,%20Account.K_I_P__c,%20Account.child_of_kip__c%20FROM%20Contact%20WHERE%20(Accounts_UUID__c%20!=%20null)%20AND%20(LastModifiedDate%20%3E=%202022-01-14T00:00:00Z)" - body: - encoding: US-ASCII - string: '' - headers: - User-Agent: - - Faraday v1.0.1 - Authorization: - - OAuth - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - response: - status: - code: 200 - message: OK - headers: - Date: - - Fri, 21 Jan 2022 21:47:50 GMT - Set-Cookie: - - BrowserId=x-vLvXsDEeyf_lspu3mJhw; domain=.salesforce.com; path=/; expires=Sat, - 21-Jan-2023 21:47:51 GMT; Max-Age=31536000 - - CookieConsentPolicy=0:1; path=/; expires=Sat, 21-Jan-2023 21:47:51 GMT; Max-Age=31536000 - - LSKey-c$CookieConsentPolicy=0:1; path=/; expires=Sat, 21-Jan-2023 21:47:51 - GMT; Max-Age=31536000 - Strict-Transport-Security: - - max-age=63072000; includeSubDomains - X-Robots-Tag: - - none - Cache-Control: - - no-cache,must-revalidate,max-age=0,no-store,private - Sforce-Limit-Info: - - api-usage=8047/5000000 - Content-Type: - - application/json;charset=UTF-8 - Vary: - - Accept-Encoding - Transfer-Encoding: - - chunked - body: - encoding: ASCII-8BIT - string: '{"totalSize":2,"done":true,"records":[{"attributes":{"type":"Contact","url":"/services/data/v51.0/sobjects/Contact/0034C00000XQDaCQAX"},"Id":"0034C00000XQDaCQAX","Email":"ecw1+cs@rice.edu","Email_alt__c":null,"FV_Status__c":"pending_faculty","School_Type__c":"College/University - (4)","Adoption_Status__c":"Not Adopter","Grant_Tutor_Access__c":false,"Accounts_UUID__c":"1a48905c-b67a-440a-9b3a-60368c3a4bf7","Account":{"attributes":{"type":"Account","url":"/services/data/v51.0/sobjects/Account/0014C00000dkLkoQAE"},"Id":"0014C00000dkLkoQAE","Name":"Rice - University","BillingCity":"Houston","BillingState":"Texas","BillingCountry":"United - States","Type":"College/University (4)","School_Location__c":"Domestic","SheerID_School_Name__c":"Rice - University (Houston, TX)","K_I_P__c":false,"child_of_kip__c":false}},{"attributes":{"type":"Contact","url":"/services/data/v51.0/sobjects/Contact/0034C00000X5gJRQAZ"},"Id":"0034C00000X5gJRQAZ","Email":"be12+409@rice.edu","Email_alt__c":null,"FV_Status__c":"confirmed_faculty","School_Type__c":"College/University - (4)","Adoption_Status__c":"Not Adopter","Grant_Tutor_Access__c":false,"Accounts_UUID__c":"a336f40a-de7d-4a84-8d6b-c2c3ea2f7a7e","Account":{"attributes":{"type":"Account","url":"/services/data/v51.0/sobjects/Account/0014C00000dkKQAQA2"},"Id":"0014C00000dkKQAQA2","Name":"Test - University","BillingCity":null,"BillingState":null,"BillingCountry":"United - States","Type":"College/University (4)","School_Location__c":"Domestic","SheerID_School_Name__c":"Test - University","K_I_P__c":false,"child_of_kip__c":false}}]}' - http_version: - recorded_at: Fri, 21 Jan 2022 21:47:51 GMT -recorded_with: VCR 3.0.3 diff --git a/spec/cassettes/handlers/newflow/student_signup/sf_setup.yml b/spec/cassettes/handlers/newflow/student_signup/sf_setup.yml deleted file mode 100644 index 88c9c775ac..0000000000 --- a/spec/cassettes/handlers/newflow/student_signup/sf_setup.yml +++ /dev/null @@ -1,55 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://test.salesforce.com/services/oauth2/token - body: - encoding: US-ASCII - string: grant_type=password&client_id=&client_secret=&username=&password= - headers: - User-Agent: - - Faraday v1.0.1 - Content-Type: - - application/x-www-form-urlencoded - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - response: - status: - code: 200 - message: OK - headers: - Date: - - Tue, 21 Sep 2021 19:39:03 GMT - Set-Cookie: - - BrowserId=k2uLtBsTEeyIMaljh7M8Pg; domain=.salesforce.com; path=/; expires=Wed, - 21-Sep-2022 19:39:03 GMT; Max-Age=31536000 - - CookieConsentPolicy=0:0; domain=test.salesforce.com; path=/; expires=Wed, - 21-Sep-2022 19:39:03 GMT; Max-Age=31536000 - - LSKey-c$CookieConsentPolicy=0:0; domain=test.salesforce.com; path=/; expires=Wed, - 21-Sep-2022 19:39:03 GMT; Max-Age=31536000 - Strict-Transport-Security: - - max-age=31536000; includeSubDomains - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - Cache-Control: - - no-cache,must-revalidate,max-age=0,no-store,private - Expires: - - Thu, 01 Jan 1970 00:00:00 GMT - X-Readonlymode: - - 'false' - Content-Type: - - application/json;charset=UTF-8 - Vary: - - Accept-Encoding - Transfer-Encoding: - - chunked - body: - encoding: ASCII-8BIT - string: '{"access_token":"","instance_url":"","id":"","token_type":"Bearer","issued_at":"1632253143861","signature":""}' - http_version: - recorded_at: Tue, 21 Sep 2021 19:39:03 GMT -recorded_with: VCR 3.0.3 diff --git a/spec/features/newflow/user_login_signup_with_social_network_spec.rb b/spec/features/newflow/user_login_signup_with_social_network_spec.rb index 7b60110260..171d3bff81 100644 --- a/spec/features/newflow/user_login_signup_with_social_network_spec.rb +++ b/spec/features/newflow/user_login_signup_with_social_network_spec.rb @@ -5,7 +5,7 @@ turn_on_student_feature_flag turn_on_educator_feature_flag load('db/seeds.rb') - allow_any_instance_of(Newflow::CreateSalesforceLead).to receive(:exec) + allow_any_instance_of(Newflow::CreateOrUpdateSalesforceLead).to receive(:exec) end let(:email) { 'user@example.com' } diff --git a/spec/handlers/newflow/confirm_oauth_info_spec.rb b/spec/handlers/newflow/confirm_oauth_info_spec.rb index 3b90458e72..66b23760b4 100644 --- a/spec/handlers/newflow/confirm_oauth_info_spec.rb +++ b/spec/handlers/newflow/confirm_oauth_info_spec.rb @@ -4,7 +4,6 @@ module Newflow RSpec.describe ConfirmOauthInfo, type: :handler do before do disable_sfdc_client - allow(Settings::Salesforce).to receive(:push_leads_enabled) { true } end let(:params) do @@ -27,19 +26,7 @@ module Newflow FactoryBot.create(:email_address, value: params[:signup][:email], user: user) end - it 'adds the user as a "lead" to salesforce' do - expect_any_instance_of(CreateSalesforceLead).to receive(:exec) - described_class.call(params: params, user: User.last) - end - - it 'signs up user for the newsletter when checked' do - expect_any_instance_of(CreateSalesforceLead).to receive(:exec) - described_class.call(params: params, contracts_required: true, user: User.last) - end - - it 'does NOT sign up user for the newsletter when NOT checked' do - expect_any_instance_of(CreateSalesforceLead).not_to receive(:exec) - params[:signup][:newsletter] = false + it 'works as expected' do described_class.call(params: params, contracts_required: true, user: User.last) end end @@ -49,32 +36,11 @@ module Newflow FactoryBot.create(:user, state: 'unverified') end - xit 'creates an email address for the user' do + it 'creates an email address for the user' do expect { described_class.call(params: params, user: User.last) }.to(change(EmailAddress, :count)) end - - it 'adds the user as a "lead" to salesforce' do - expect_any_instance_of(CreateSalesforceLead).to receive(:exec) - described_class.call(params: params, user: User.last) - end - - it 'signs up user for the newsletter when checked' do - expect_any_instance_of(CreateSalesforceLead).to receive(:exec) - described_class.call(params: params, contracts_required: true, user: User.last) - end - - context 'when newsletter is not checked' do - before do - params[:signup][:newsletter] = false - end - - it 'does not sign up user for the newsletter' do - expect_any_instance_of(CreateSalesforceLead).not_to receive(:exec) - described_class.call(params: params, contracts_required: true, user: User.last) - end - end end end end diff --git a/spec/handlers/newflow/student_signup/verify_email_by_pin_spec.rb b/spec/handlers/newflow/student_signup/verify_email_by_pin_spec.rb index 77e56b52b6..dec15142dc 100644 --- a/spec/handlers/newflow/student_signup/verify_email_by_pin_spec.rb +++ b/spec/handlers/newflow/student_signup/verify_email_by_pin_spec.rb @@ -3,15 +3,10 @@ module Newflow module StudentSignup - describe VerifyEmailByPin, type: :handler, vcr: VCR_OPTS do - before(:all) do - VCR.use_cassette('handlers/newflow/student_signup/sf_setup', VCR_OPTS) do - @proxy = SalesforceProxy.new - @proxy.setup_cassette - end - end - + describe VerifyEmailByPin, type: :handler do context 'when success' do + before { disable_sfdc_client } + let(:user) do FactoryBot.create(:user, state: 'unverified', source_application: source_app, receive_newsletter: true) end @@ -21,7 +16,7 @@ module StudentSignup end let(:email) do - FactoryBot.create(:email_address, user: user, value: 'test@openstax.org') + FactoryBot.create(:email_address, user: user) end let(:params) do @@ -33,7 +28,7 @@ module StudentSignup end it 'runs ActivateStudent' do - expect_any_instance_of(ActivateStudent).to receive(:exec) + expect_any_instance_of(ActivateStudent).to receive(:exec).with(hash_including(user: user)) described_class.call(params: params, email_address: email) end diff --git a/spec/routines/newflow/create_salesforce_lead_spec.rb b/spec/routines/newflow/create_or_update_salesforce_lead_spec.rb similarity index 87% rename from spec/routines/newflow/create_salesforce_lead_spec.rb rename to spec/routines/newflow/create_or_update_salesforce_lead_spec.rb index d747dbc133..1952635f7d 100644 --- a/spec/routines/newflow/create_salesforce_lead_spec.rb +++ b/spec/routines/newflow/create_or_update_salesforce_lead_spec.rb @@ -2,10 +2,10 @@ require 'vcr_helper' module Newflow - RSpec.describe CreateSalesforceLead, type: :routine, vcr: VCR_OPTS do + RSpec.describe CreateOrUpdateSalesforceLead, type: :routine, vcr: VCR_OPTS do before(:all) do - VCR.use_cassette('Newflow_CreateSalesforceLead/sf_setup', VCR_OPTS) do + VCR.use_cassette('Newflow_CreateOrUpdateSalesforceLead/sf_setup', VCR_OPTS) do @proxy = SalesforceProxy.new @proxy.setup_cassette end diff --git a/spec/routines/newflow/student_signup/activate_student_spec.rb b/spec/routines/newflow/student_signup/activate_student_spec.rb index 0045f9d81b..799ed7b523 100644 --- a/spec/routines/newflow/student_signup/activate_student_spec.rb +++ b/spec/routines/newflow/student_signup/activate_student_spec.rb @@ -2,30 +2,24 @@ module Newflow module StudentSignup - describe ActivateStudent, type: :routine do + describe ActivateStudent, type: :routine do context 'when success' do before do disable_sfdc_client - allow(Settings::Salesforce).to receive(:push_leads_enabled).and_return(true) end + let(:source_app) { FactoryBot.create(:doorkeeper_application) } let(:user) do - FactoryBot.create(:user, state: 'unverified', role: 'student', receive_newsletter: true) + FactoryBot.create( + :user, state: 'unverified', role: 'student', + receive_newsletter: true, source_application: source_app + ) end - it 'does NOT sign up user for the newsletter when NOT checked' do - user.update(receive_newsletter: false) - expect_any_instance_of(Newflow::CreateSalesforceLead).not_to receive(:exec) - described_class.call(user) - end - - it 'pushes up to Salesforce the source application' do - source_app = FactoryBot.create(:doorkeeper_application) - user.update(source_application_id: source_app.id) - - expect_any_instance_of(Newflow::CreateSalesforceLead).to receive(:exec) - - described_class.call(user) + it 'marks the user as activated' do + expect(user.state).not_to eq(User::ACTIVATED) + described_class.call(user: user) + expect(user.state).to eq(User::ACTIVATED) end end end diff --git a/spec/routines/update_user_contact_info_spec.rb b/spec/routines/update_user_contact_info_spec.rb deleted file mode 100644 index 0257b8dd14..0000000000 --- a/spec/routines/update_user_contact_info_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -require 'rails_helper' -require 'vcr_helper' - -RSpec.describe UpdateUserContactInfo, type: :routine, vcr: VCR_OPTS do - before(:all) do - VCR.use_cassette('UpdateUserContactInfo/sf_setup', VCR_OPTS ) do - @proxy = SalesforceProxy.new - @proxy.setup_cassette - end - end - - let!(:user) { FactoryBot.create :user, role: User::INSTRUCTOR_ROLE, faculty_status: User::PENDING_FACULTY, uuid: '1a48905c-b67a-440a-9b3a-60368c3a4bf7' } - - it "users with contact modified within number of days in Settings" do - expected_date = DateTime.strptime("2022-01-14", '%Y-%m-%d') - expect(DateTime).to receive(:strptime).and_return(expected_date) - - expect(user.salesforce_contact_id).to eq nil - UpdateUserContactInfo.call - user.reload - expect(user.salesforce_contact_id).to eq '0034C00000XQDaCQAX' - end -end \ No newline at end of file