Peacemaker.Propagator (Peacemaker v3.3.5-rc.7) View Source

Propagator is responsible for propagating updated values to all external services that is concerned with the field.

It could be argued since we only have change_email/2 in this module, that we could store this in Peacemaker.Account. However, there is a dire need to refactor the Peacemaker.Account module. we should seperate this out.

Link to this section Summary

Functions

Changes the email of a WealthFit account

Link to this section Types

Link to this type

change_email_request()

View Source

Specs

change_email_request() :: %{current_email: String.t(), new_email: String.t()}

Specs

updated_services() :: [
  %{
    maropost: any(),
    infusionsoft: any(),
    goto: any(),
    wealthfit_account: any(),
    limelight: any()
  }
]

Link to this section Functions

Specs

change_email(change_email_request()) :: %{
  wealthfit_account: Peacemaker.Account.t(),
  maropost: any(),
  goto: any(),
  infusionsoft: any(),
  limelight: any()
}

Changes the email of a WealthFit account

This method also changes the email field on the following services:

WealthFit Account: The related %Peacemaker.Account{}

Maropost: Ensures that Customers who purchased webinar and replay links retrieve their material.

GotoMeeting: Ensures that any Webinars the customer was enrolled in follows the updated email.

Infusionsoft: ONLY for FB Starter Program members. Updates the email in CTHome's Infusionsoft

LimeLight: Updates the email in LimeLight

Benchmarking

Ran some quick timing test using the function here to see if we should async these tasks.

Async

    Benchmark.measure(fn -> Peacemaker.Propagator.change_email(%{current_email: "kawika@wealthfit.com", new_email: "kawikak@wealthfit.com"}) end)
    [warn] No CTHomes account found for kawika@wealthfit.com
    1.997203 # Time to update when no email is found
    Benchmark.measure(fn -> Peacemaker.Propagator.change_email(%{current_email: "kawikak@wealthfit.com", new_email: "kawika@wealthfit.com"}) end)
    7.803427 # Time to update when email is found

Sync

    Benchmark.measure(fn -> Peacemaker.Propagator.change_email(%{current_email: "kawikak@wealthfit.com", new_email: "kawika@wealthfit.com"}) end)
    [warn] No CTHomes account found for kawikak@wealthfit.com
    2.809598 # Time to update when no email is found
    Benchmark.measure(fn -> Peacemaker.Propagator.change_email(%{current_email: "kawika@wealthfit.com", new_email: "kawikak@wealthfit.com"}) end)
    16.404416 # Time to update when email is found