From 47940d89779bca6d55e4f0aa8790aaf8baeeeaa9 Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Mon, 19 Apr 2021 18:25:46 -0500 Subject: [PATCH] Move info about the hoster into its own module --- .../controllers/user/authorization.rb | 2 +- app/mailers/admin_mailer.rb | 2 +- app/mailers/base_mailer.rb | 2 +- app/mailers/generic_mailer.rb | 4 +-- app/models/import_request.rb | 4 +-- .../failed_notice.html.erb | 2 +- .../cancellation.html.erb | 2 +- .../federated_creation_followup.html.erb | 2 +- app/views/components/_footer_sub.html.erb | 4 +-- app/views/emails/_sig.html.erb | 2 +- .../event_mailer/creation_followup.html.erb | 2 +- ...t_payments_completed_notification.html.erb | 2 +- ...port_payments_failed_notification.html.erb | 2 +- ..._donations_completed_notification.html.erb | 2 +- ...ing_donations_failed_notification.html.erb | 2 +- ...rter_notes_completed_notification.html.erb | 2 +- ...pporter_notes_failed_notification.html.erb | 2 +- .../import_completed_notification.html.erb | 2 +- app/views/layouts/_apified_footer.html.erb | 4 +-- app/views/layouts/_side_nav.html.erb | 2 +- app/views/layouts/_user_menu.html.erb | 2 +- .../supporter_fundraiser.html.erb | 2 +- .../failed_verification_notice.html.erb | 2 +- .../invoice_payment_notification.html.erb | 2 +- .../new_bank_account_notification.html.erb | 2 +- .../pending_payout_notification.html.erb | 2 +- .../successful_payout_notification.html.erb | 4 +-- app/views/nonprofit_mailer/welcome.html.erb | 2 +- .../bank_accounts/cancellation.html.erb | 2 +- .../dashboard/_todo_messages.html.erb | 2 +- .../payments/_details_table.html.erb | 2 +- app/views/nonprofits/payouts/_todos.html.erb | 2 +- app/views/settings/_pricing.html.erb | 2 +- app/views/static/terms_and_privacy.html.erb | 4 +-- config/application.rb | 5 ++- config/houdini_config.rb | 9 ++++++ config/initializers/devise.rb | 2 +- config/initializers/stripe.rb | 2 +- docs/event_definitions/Hoster.ts | 16 ++++++++++ gems/bess/lib/houdini.rb | 10 ++++-- gems/bess/lib/houdini/engine.rb | 25 ++++++--------- gems/bess/lib/houdini/engine_initializers.rb | 16 ++++++++++ .../lib/houdini/engine_initializers/hoster.rb | 26 +++++++++++++++ .../lib/houdini/engine_initializers/intl.rb | 32 +++++++++++++++++++ gems/bess/lib/houdini/hoster.rb | 32 +++++++++++++++++++ lib/fetch/fetch_nonprofit_email.rb | 4 +-- lib/format/format/name.rb | 2 +- lib/tasks/scheduler.rake | 3 +- spec/lib/fetch/fetch_nonprofit_email_spec.rb | 4 +-- spec/lib/format/name_spec.rb | 2 +- spec/mailers/admin_spec.rb | 8 ++--- 51 files changed, 205 insertions(+), 73 deletions(-) create mode 100755 config/houdini_config.rb create mode 100644 docs/event_definitions/Hoster.ts create mode 100644 gems/bess/lib/houdini/engine_initializers.rb create mode 100644 gems/bess/lib/houdini/engine_initializers/hoster.rb create mode 100644 gems/bess/lib/houdini/engine_initializers/intl.rb create mode 100644 gems/bess/lib/houdini/hoster.rb diff --git a/app/controllers/concerns/controllers/user/authorization.rb b/app/controllers/concerns/controllers/user/authorization.rb index 60a35d17..0c98b076 100644 --- a/app/controllers/concerns/controllers/user/authorization.rb +++ b/app/controllers/concerns/controllers/user/authorization.rb @@ -32,7 +32,7 @@ module Controllers::User::Authorization store_location if current_user flash[:notice] = - "It looks like you're not allowed to access that page. If this seems like a mistake, please contact #{Houdini.support_email}" + "It looks like you're not allowed to access that page. If this seems like a mistake, please contact #{Houdini.hoster.support_email}" redirect_to root_path else msg ||= 'We need to sign you in before you can do that.' diff --git a/app/mailers/admin_mailer.rb b/app/mailers/admin_mailer.rb index 84939f5c..f5bee7bb 100644 --- a/app/mailers/admin_mailer.rb +++ b/app/mailers/admin_mailer.rb @@ -11,6 +11,6 @@ class AdminMailer < BaseMailer def notify_failed_gift(donation, campaign_gift_option) @campaign_gift_option = campaign_gift_option @donation = donation - mail subject: "Tried to associate donation #{donation.id} with campaign gift option #{campaign_gift_option.id} which is out of stock", to: Houdini.support_email, from: Houdini.support_email + mail subject: "Tried to associate donation #{donation.id} with campaign gift option #{campaign_gift_option.id} which is out of stock", to: Houdini.hoster.support_email, from: Houdini.hoster.support_email end end diff --git a/app/mailers/base_mailer.rb b/app/mailers/base_mailer.rb index a3ba45df..f646e750 100644 --- a/app/mailers/base_mailer.rb +++ b/app/mailers/base_mailer.rb @@ -7,6 +7,6 @@ class BaseMailer < ActionMailer::Base include Devise::Controllers::UrlHelpers include ApplicationHelper helper ApplicationHelper - default from: Houdini.support_email + default from: Houdini.hoster.support_email layout 'email' end diff --git a/app/mailers/generic_mailer.rb b/app/mailers/generic_mailer.rb index 090408aa..3279adea 100644 --- a/app/mailers/generic_mailer.rb +++ b/app/mailers/generic_mailer.rb @@ -7,12 +7,12 @@ class GenericMailer < BaseMailer @from_email = from_email @from_name = from_name @message = message - mail(to: to_email, from: "#{from_name} <#{Houdini.support_email}>", reply_to: from_email, subject: subject.to_s) + mail(to: to_email, from: "#{from_name} <#{Houdini.hoster.support_email}>", reply_to: from_email, subject: subject.to_s) end # For sending a system notice to super admins def admin_notice(options) - @from_email = Houdini.support_email + @from_email = Houdini.hoster.support_email @from_name = 'CC Bot' @message = options[:body] emails = QueryUsers.super_admin_emails diff --git a/app/models/import_request.rb b/app/models/import_request.rb index 72f746cf..537a1ac0 100644 --- a/app/models/import_request.rb +++ b/app/models/import_request.rb @@ -14,10 +14,10 @@ class ImportRequest < ApplicationRecord rescue Exception => e body = "Import failed. Error: #{e}" GenericMailer.generic_mail( - Houdini.support_email, Houdini.support_email, # FROM + Houdini.hoster.support_email, Houdini.hoster.support_email, # FROM body, 'Import error', # SUBJECT - Houdini.support_email, Houdini.support_email # TO + Houdini.hoster.support_email, Houdini.hoster.support_email # TO ).deliver end end diff --git a/app/views/billing_subscription_mailer/failed_notice.html.erb b/app/views/billing_subscription_mailer/failed_notice.html.erb index 31e70dcf..6fa7bab7 100644 --- a/app/views/billing_subscription_mailer/failed_notice.html.erb +++ b/app/views/billing_subscription_mailer/failed_notice.html.erb @@ -16,7 +16,7 @@ Unfortunately, the credit card we currently have on file (<%= @card.name %>, exp

-If you have any questions or concerns, please feel free to call us (888) 204-8792 or to email <%= Houdini.support_email %> and we'll respond promptly to help. +If you have any questions or concerns, please feel free to call us (888) 204-8792 or to email <%= Houdini.hoster.support_email %> and we'll respond promptly to help.



diff --git a/app/views/billing_subscriptions/cancellation.html.erb b/app/views/billing_subscriptions/cancellation.html.erb index f34ccdd2..3e647ec2 100644 --- a/app/views/billing_subscriptions/cancellation.html.erb +++ b/app/views/billing_subscriptions/cancellation.html.erb @@ -9,7 +9,7 @@

By cancelling your subscription, we will move you onto the 2.0% tier and your card will no longer get charged.

-

Contact <%= Houdini.support_email %> if you need any help with exports or migrations.

+

Contact <%= Houdini.hoster.support_email %> if you need any help with exports or migrations.

diff --git a/app/views/campaign_mailer/federated_creation_followup.html.erb b/app/views/campaign_mailer/federated_creation_followup.html.erb index 1bc4201e..80b4ddb7 100644 --- a/app/views/campaign_mailer/federated_creation_followup.html.erb +++ b/app/views/campaign_mailer/federated_creation_followup.html.erb @@ -48,7 +48,7 @@ link_to_campaign: content_tag(:strong,

<%= t('campaign_mailer.if_you_need_help_email_support', email_support: content_tag(:strong, - Houdini.support_email) + Houdini.hoster.support_email) )%>

<%= render 'emails/sig' %> diff --git a/app/views/components/_footer_sub.html.erb b/app/views/components/_footer_sub.html.erb index b88eff84..7e31e9ab 100644 --- a/app/views/components/_footer_sub.html.erb +++ b/app/views/components/_footer_sub.html.erb @@ -13,9 +13,9 @@ <% if current_user %> - <% if Houdini.terms_and_privacy&.help_url %><%= link_to("Help", Houdini.terms_and_privacy.help_url) %><% end %> + <% if Houdini.hoster.terms_and_privacy&.help_url %><%= link_to("Help", Houdini.terms_and_privacy.help_url) %><% end %> <% else %> - <% if Houdini.terms_and_privacy&.about_url %><%= link_to("About", Houdini.terms_and_privacy.about_url) %><% end %> + <% if Houdini.hoster.terms_and_privacy&.about_url %><%= link_to("About", Houdini.terms_and_privacy.about_url) %><% end %> <% end %> diff --git a/app/views/emails/_sig.html.erb b/app/views/emails/_sig.html.erb index be20f46d..4c09ea6d 100644 --- a/app/views/emails/_sig.html.erb +++ b/app/views/emails/_sig.html.erb @@ -5,5 +5,5 @@

All the best,

The CommitChange Team
-<%= Houdini.support_email %> +<%= Houdini.hoster.support_email %>

diff --git a/app/views/event_mailer/creation_followup.html.erb b/app/views/event_mailer/creation_followup.html.erb index 00ad1b07..9ec2fe55 100644 --- a/app/views/event_mailer/creation_followup.html.erb +++ b/app/views/event_mailer/creation_followup.html.erb @@ -18,6 +18,6 @@

Note: You can still share an unpublished event, but it will not show up on your nonprofit profile page or on your event listing page.


-

If you need some help getting your event up and running, don't hesitate to contact <%= Houdini.support_email %>.

+

If you need some help getting your event up and running, don't hesitate to contact <%= Houdini.hoster.support_email %>.

<%= render 'emails/sig' %> diff --git a/app/views/export_mailer/export_payments_completed_notification.html.erb b/app/views/export_mailer/export_payments_completed_notification.html.erb index 7cfcbf1f..6214d911 100644 --- a/app/views/export_mailer/export_payments_completed_notification.html.erb +++ b/app/views/export_mailer/export_payments_completed_notification.html.erb @@ -6,6 +6,6 @@

Note: your generated CSV file will be automatically deleted from our servers after seven days. Don't worry; you can always visit your payments panel and export a new CSV file.

-

If you have any questions about this export, please contact <%= Houdini.support_email %>.

+

If you have any questions about this export, please contact <%= Houdini.hoster.support_email %>.

<%= render 'emails/sig' %> diff --git a/app/views/export_mailer/export_payments_failed_notification.html.erb b/app/views/export_mailer/export_payments_failed_notification.html.erb index a537b91b..42e5fb49 100644 --- a/app/views/export_mailer/export_payments_failed_notification.html.erb +++ b/app/views/export_mailer/export_payments_failed_notification.html.erb @@ -2,7 +2,7 @@ # Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE -%>

Your export from <%= Format::Date.simple @export.created_at %> did not succeed due to a technical error.

While CommitChange engineers have been notified, don't hesitate to contact - <%= Houdini.support_email %> with the following information:

+ <%= Houdini.hoster.support_email %> with the following information:

  • Export ID: <%= @export.id %>
  • diff --git a/app/views/export_mailer/export_recurring_donations_completed_notification.html.erb b/app/views/export_mailer/export_recurring_donations_completed_notification.html.erb index 5e57ef9a..c1a9b853 100644 --- a/app/views/export_mailer/export_recurring_donations_completed_notification.html.erb +++ b/app/views/export_mailer/export_recurring_donations_completed_notification.html.erb @@ -6,6 +6,6 @@

    Note: your generated CSV file will be automatically deleted from our servers after seven days. Don't worry; you can always visit your recurring donations panel and export a new CSV file.

    -

    If you have any questions about this export, please contact <%= Houdini.support_email %>.

    +

    If you have any questions about this export, please contact <%= Houdini.hoster.support_email %>.

    <%= render 'emails/sig' %> diff --git a/app/views/export_mailer/export_recurring_donations_failed_notification.html.erb b/app/views/export_mailer/export_recurring_donations_failed_notification.html.erb index a537b91b..42e5fb49 100644 --- a/app/views/export_mailer/export_recurring_donations_failed_notification.html.erb +++ b/app/views/export_mailer/export_recurring_donations_failed_notification.html.erb @@ -2,7 +2,7 @@ # Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE -%>

    Your export from <%= Format::Date.simple @export.created_at %> did not succeed due to a technical error.

    While CommitChange engineers have been notified, don't hesitate to contact - <%= Houdini.support_email %> with the following information:

    + <%= Houdini.hoster.support_email %> with the following information:

    • Export ID: <%= @export.id %>
    • diff --git a/app/views/export_mailer/export_supporter_notes_completed_notification.html.erb b/app/views/export_mailer/export_supporter_notes_completed_notification.html.erb index ec823fa8..eeee4b59 100644 --- a/app/views/export_mailer/export_supporter_notes_completed_notification.html.erb +++ b/app/views/export_mailer/export_supporter_notes_completed_notification.html.erb @@ -4,6 +4,6 @@

      Note: your generated CSV file will be automatically deleted from our servers after seven days. Don't worry; you can always visit your recurring donations panel and export a new CSV file.

      -

      If you have any questions about this export, please contact <%= Houdini.support_email %>.

      +

      If you have any questions about this export, please contact <%= Houdini.hoster.support_email %>.

      <%= render 'emails/sig' %> \ No newline at end of file diff --git a/app/views/export_mailer/export_supporter_notes_failed_notification.html.erb b/app/views/export_mailer/export_supporter_notes_failed_notification.html.erb index 81d166d3..7ca38ccc 100644 --- a/app/views/export_mailer/export_supporter_notes_failed_notification.html.erb +++ b/app/views/export_mailer/export_supporter_notes_failed_notification.html.erb @@ -1,6 +1,6 @@

      Your export from <%= Format::Date.simple @export.created_at %> did not succeed due to a technical error.

      While CommitChange engineers have been notified, don't hesitate to contact - <%= Houdini.support_email %> with the following information:

      + <%= Houdini.hoster.support_email %> with the following information:

      • Export ID: <%= @export.id %>
      • diff --git a/app/views/import_mailer/import_completed_notification.html.erb b/app/views/import_mailer/import_completed_notification.html.erb index 30561d3a..51566dc4 100644 --- a/app/views/import_mailer/import_completed_notification.html.erb +++ b/app/views/import_mailer/import_completed_notification.html.erb @@ -6,7 +6,7 @@

        To view your new payments data, visit: payment history.

        -

        If you have any questions about this import, please contact <%= Houdini.support_email %>.

        +

        If you have any questions about this import, please contact <%= Houdini.hoster.support_email %>.

        <%= render 'emails/sig' %> diff --git a/app/views/layouts/_apified_footer.html.erb b/app/views/layouts/_apified_footer.html.erb index b5a4c500..30066d4c 100644 --- a/app/views/layouts/_apified_footer.html.erb +++ b/app/views/layouts/_apified_footer.html.erb @@ -4,8 +4,8 @@ <% if @theme == 'minimal' %>
        - © <%= Time.current.year %> <%= Houdini.general.name %> - <% if Houdini.terms_and_privacy&.about_url %><%= link_to("About", Houdini.terms_and_privacy.about_url) %><% end %> + © <%= Time.current.year %> <%= Houdini.hoster.legal_name %> + <% if Houdini.hoster.terms_and_privacy&.about_url %><%= link_to("About", Houdini.terms_and_privacy.about_url) %><% end %> <%= link_to( t("footer.terms_and_privacy"), :static_terms_and_privacy) %>
        diff --git a/app/views/layouts/_side_nav.html.erb b/app/views/layouts/_side_nav.html.erb index 1568f3e2..c4902136 100644 --- a/app/views/layouts/_side_nav.html.erb +++ b/app/views/layouts/_side_nav.html.erb @@ -26,7 +26,7 @@ <% unless current_role?([:nonprofit_admin,:nonprofit_associate]) %>
        - <% if Houdini.terms_and_privacy&.help_url %> + <% if Houdini.hoster.terms_and_privacy&.help_url %> Help diff --git a/app/views/layouts/_user_menu.html.erb b/app/views/layouts/_user_menu.html.erb index 303cf38b..f87fae7a 100644 --- a/app/views/layouts/_user_menu.html.erb +++ b/app/views/layouts/_user_menu.html.erb @@ -20,7 +20,7 @@ <% if current_role?([:nonprofit_admin,:nonprofit_associate]) %> - <% if Houdini.terms_and_privacy&.help_url %> + <% if Houdini.hoster.terms_and_privacy&.help_url %> Help diff --git a/app/views/nonprofit_admin_mailer/supporter_fundraiser.html.erb b/app/views/nonprofit_admin_mailer/supporter_fundraiser.html.erb index 73f51057..5c684366 100644 --- a/app/views/nonprofit_admin_mailer/supporter_fundraiser.html.erb +++ b/app/views/nonprofit_admin_mailer/supporter_fundraiser.html.erb @@ -8,6 +8,6 @@

        If you would like to get in touch with your supporter, you can email them at <%= @profile.user.email %>.


        -

        If you need help or have any questions, don't hesitate to contact us at <%= Houdini.support_email %>.

        +

        If you need help or have any questions, don't hesitate to contact us at <%= Houdini.hoster.support_email %>.

        <%= render 'emails/sig' %> diff --git a/app/views/nonprofit_mailer/failed_verification_notice.html.erb b/app/views/nonprofit_mailer/failed_verification_notice.html.erb index 38bdea6e..69cb9ea3 100644 --- a/app/views/nonprofit_mailer/failed_verification_notice.html.erb +++ b/app/views/nonprofit_mailer/failed_verification_notice.html.erb @@ -11,7 +11,7 @@

        Visit your payouts page to get everything sorted out.

        -

        As always, if you have any questions, please send us a note at <%= Houdini.support_email %>

        +

        As always, if you have any questions, please send us a note at <%= Houdini.hoster.support_email %>

        <%= render 'emails/sig' %> diff --git a/app/views/nonprofit_mailer/invoice_payment_notification.html.erb b/app/views/nonprofit_mailer/invoice_payment_notification.html.erb index abc6121d..810a162d 100644 --- a/app/views/nonprofit_mailer/invoice_payment_notification.html.erb +++ b/app/views/nonprofit_mailer/invoice_payment_notification.html.erb @@ -39,7 +39,7 @@ Your invoice for the month of <%= @month_name %> has been paid and the receipt i CommitChange Inc.
        Oakland, CA
        EIN 46-3123854 -
        <%= Houdini.support_email %> +
        <%= Houdini.hoster.support_email %> diff --git a/app/views/nonprofit_mailer/new_bank_account_notification.html.erb b/app/views/nonprofit_mailer/new_bank_account_notification.html.erb index 44ddd7c8..8bbccf0a 100644 --- a/app/views/nonprofit_mailer/new_bank_account_notification.html.erb +++ b/app/views/nonprofit_mailer/new_bank_account_notification.html.erb @@ -12,6 +12,6 @@

        Confirm Change

        -

        If you think something is wrong with this change, please contact <%= Houdini.support_email %>.

        +

        If you think something is wrong with this change, please contact <%= Houdini.hoster.support_email %>.

        <%= render 'emails/sig' %> diff --git a/app/views/nonprofit_mailer/pending_payout_notification.html.erb b/app/views/nonprofit_mailer/pending_payout_notification.html.erb index 16831040..fd3131ef 100644 --- a/app/views/nonprofit_mailer/pending_payout_notification.html.erb +++ b/app/views/nonprofit_mailer/pending_payout_notification.html.erb @@ -8,7 +8,7 @@

        If the above looks correct, we don't need any futher actions. The transfer will complete within 1-3 business days.


        -

        If anything looks incorrect, please contact <%= Houdini.support_email %>.

        +

        If anything looks incorrect, please contact <%= Houdini.hoster.support_email %>.

        <%= render 'emails/sig' %> diff --git a/app/views/nonprofit_mailer/successful_payout_notification.html.erb b/app/views/nonprofit_mailer/successful_payout_notification.html.erb index a3d90bc0..a5afa450 100644 --- a/app/views/nonprofit_mailer/successful_payout_notification.html.erb +++ b/app/views/nonprofit_mailer/successful_payout_notification.html.erb @@ -4,11 +4,11 @@ <%= render 'payout_table', payout: @payout %> -

        Look for the deposit with in the above net amount with <%= Houdini.support_email %> in the statement.

        +

        Look for the deposit with in the above net amount with <%= Houdini.hoster.support_email %> in the statement.

        <%= link_to 'Visit this link', nonprofits_payouts_url(@nonprofit) %> to view your detailed payout history.


        -

        If anything looks incorrect, please contact <%= Houdini.support_email %>.

        +

        If anything looks incorrect, please contact <%= Houdini.hoster.support_email %>.

        <%= render 'emails/sig' %> diff --git a/app/views/nonprofit_mailer/welcome.html.erb b/app/views/nonprofit_mailer/welcome.html.erb index 952400b1..4e6d9465 100644 --- a/app/views/nonprofit_mailer/welcome.html.erb +++ b/app/views/nonprofit_mailer/welcome.html.erb @@ -32,7 +32,7 @@ Here are a few things you can do right away to get up and running:

      -If you need help or have any questions, our support team is just a phone call or email away. You can contact us directly at <%= Houdini.support_email %> or 888-204-8792. +If you need help or have any questions, our support team is just a phone call or email away. You can contact us directly at <%= Houdini.hoster.support_email %> or 888-204-8792.

      <%= render 'emails/sig' %> diff --git a/app/views/nonprofits/bank_accounts/cancellation.html.erb b/app/views/nonprofits/bank_accounts/cancellation.html.erb index 39383fba..b9843b17 100644 --- a/app/views/nonprofits/bank_accounts/cancellation.html.erb +++ b/app/views/nonprofits/bank_accounts/cancellation.html.erb @@ -18,5 +18,5 @@

      The bank account for this nonprofit was never initially confirmed.

      <% end %> -

      If you think this was in error, please contact <%= mail_to '<%= Houdini.support_email %>' %> +

      If you think this was in error, please contact <%= mail_to '<%= Houdini.hoster.support_email %>' %> diff --git a/app/views/nonprofits/dashboard/_todo_messages.html.erb b/app/views/nonprofits/dashboard/_todo_messages.html.erb index 20579a37..a524c3f1 100644 --- a/app/views/nonprofits/dashboard/_todo_messages.html.erb +++ b/app/views/nonprofits/dashboard/_todo_messages.html.erb @@ -10,6 +10,6 @@ Once you've started completing these tasks, you'll see your dashboard come to life with helpful data and reminders. - <% if Houdini.terms_and_privacy&.help_url %> If you need help with any these tasks, visit our <%= link_to("Help Center", Houdini.terms_and_privacy.help_url) %>.<% end %> + <% if Houdini.hoster.terms_and_privacy&.help_url %> If you need help with any these tasks, visit our <%= link_to("Help Center", Houdini.terms_and_privacy.help_url) %>.<% end %>

      diff --git a/app/views/nonprofits/payments/_details_table.html.erb b/app/views/nonprofits/payments/_details_table.html.erb index d2764403..77bdaa4a 100644 --- a/app/views/nonprofits/payments/_details_table.html.erb +++ b/app/views/nonprofits/payments/_details_table.html.erb @@ -15,7 +15,7 @@

      - One of your supporters has disputed a charge (ie. made a charge-back), meaning they have called their bank and claimed that the charge was unauthorized. You need to collect evidence, via email, that the supporter intended to make the charge. Please contact <%= Houdini.support_email %> so we can help resolve this for you. + One of your supporters has disputed a charge (ie. made a charge-back), meaning they have called their bank and claimed that the charge was unauthorized. You need to collect evidence, via email, that the supporter intended to make the charge. Please contact <%= Houdini.hoster.support_email %> so we can help resolve this for you.

      diff --git a/app/views/nonprofits/payouts/_todos.html.erb b/app/views/nonprofits/payouts/_todos.html.erb index 0b93e8e2..fa3e519a 100644 --- a/app/views/nonprofits/payouts/_todos.html.erb +++ b/app/views/nonprofits/payouts/_todos.html.erb @@ -67,6 +67,6 @@ diff --git a/app/views/settings/_pricing.html.erb b/app/views/settings/_pricing.html.erb index 179f33a7..20ef41f4 100644 --- a/app/views/settings/_pricing.html.erb +++ b/app/views/settings/_pricing.html.erb @@ -37,7 +37,7 @@

      <% end %> -

      If you have any questions about your current plan, please contact <%= Houdini.support_email %>

      +

      If you have any questions about your current plan, please contact <%= Houdini.hoster.support_email %>

      diff --git a/app/views/static/terms_and_privacy.html.erb b/app/views/static/terms_and_privacy.html.erb index fc948d34..22ce2421 100644 --- a/app/views/static/terms_and_privacy.html.erb +++ b/app/views/static/terms_and_privacy.html.erb @@ -3,11 +3,11 @@ <% content_for :title, "Terms and Privacy" %>

      Terms and Privacy

      -<% if Houdini.terms_and_privacy&.terms_url %> +<% if Houdini.hoster.terms_and_privacy&.terms_url %>

      Terms of Use

      <% end %> -<% if Houdini.terms_and_privacy&.privacy_url %> +<% if Houdini.hoster.terms_and_privacy&.privacy_url %>

      Privacy Policy

      <% end %> diff --git a/config/application.rb b/config/application.rb index 1d66dc65..31fae522 100755 --- a/config/application.rb +++ b/config/application.rb @@ -23,7 +23,7 @@ require "rails/test_unit/railtie" # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) -# require File.expand_path('lib/htp') # Hamster Table Print + module Commitchange class Application < Rails::Application config.load_defaults '5.0' @@ -110,3 +110,6 @@ module Commitchange end end end + +# we want to add the houdini configuration +require_relative './houdini_config' \ No newline at end of file diff --git a/config/houdini_config.rb b/config/houdini_config.rb new file mode 100755 index 00000000..a80868ee --- /dev/null +++ b/config/houdini_config.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later +# Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE + +# customize Houdini configuration here. +Rails.application.configure do + config.houdini.hoster.legal_name = 'SET config.houdini.hoster.legal_name IN app/config/houdini_config.rb' +end diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index c0f31a38..e51fd2db 100755 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -8,7 +8,7 @@ Devise.setup do |config| # ==> Mailer Configuration # Configure the e-mail address which will be shown in Devise::Mailer, # note that it will be overwritten if you use your own mailer class with default "from" parameter. - config.mailer_sender = Houdini.support_email + config.mailer_sender = Houdini.hoster.support_email # Configure the class responsible to send e-mails. # config.mailer = "Devise::Mailer" diff --git a/config/initializers/stripe.rb b/config/initializers/stripe.rb index c457e5d9..6d53a558 100644 --- a/config/initializers/stripe.rb +++ b/config/initializers/stripe.rb @@ -6,4 +6,4 @@ require 'stripe' #Stripe.api_key = Houdini.payment_providers.stripe.stripe.private_key -Rails.application.config.houdini.support_email = "support@email.com" +#Rails.application.config.Houdini.hoster.support_email = "support@email.com" diff --git a/docs/event_definitions/Hoster.ts b/docs/event_definitions/Hoster.ts new file mode 100644 index 00000000..c1a62c1f --- /dev/null +++ b/docs/event_definitions/Hoster.ts @@ -0,0 +1,16 @@ +// License: LGPL-3.0-or-later + +/** + * Describes the hoster of this instance of Houdini + */ +export interface Hoster { + casual_name: string; + legal_name: string; + main_admin_email: string; + support_email: string; + terms_and_privacy:{ + about_url?: string; + help_url?: string; + privacy_url?: string; + }; +} \ No newline at end of file diff --git a/gems/bess/lib/houdini.rb b/gems/bess/lib/houdini.rb index 674735e6..694335dd 100644 --- a/gems/bess/lib/houdini.rb +++ b/gems/bess/lib/houdini.rb @@ -2,7 +2,6 @@ # License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later # Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE -require "houdini/engine" module Houdini extend ActiveSupport::Autoload @@ -14,6 +13,8 @@ module Houdini autoload :EventPublisher autoload :WebhookAdapter autoload :NonprofitCreation + autoload :Hoster + autoload :EngineInitializers mattr_accessor :intl, :maintenance, :ccs @@ -32,12 +33,15 @@ module Houdini mattr_accessor :show_state_field, default: true mattr_accessor :nonprofits_must_be_vetted, default: false - mattr_accessor :terms_and_privacy, default: {} mattr_accessor :button_host - mattr_accessor :support_email + mattr_accessor :hoster, default: Houdini::Hoster mattr_accessor :core_classes, default: {supporter: 'Supporter', nonprofit: 'Nonprofit'} mattr_accessor :event_publisher, default: Houdini::EventPublisher.new + end + +# need to have Houdini loaded first before we can add engine +require "houdini/engine" diff --git a/gems/bess/lib/houdini/engine.rb b/gems/bess/lib/houdini/engine.rb index 77766713..db3572f6 100644 --- a/gems/bess/lib/houdini/engine.rb +++ b/gems/bess/lib/houdini/engine.rb @@ -54,12 +54,7 @@ module Houdini config.houdini.show_state_field = true - config.houdini.intl = ActiveSupport::OrderedOptions.new - config.houdini.intl.language = :en - config.houdini.intl.available_locales = [:en, :de, :es, :fr, :it, :nl, :pl, :ro] - config.houdini.intl.all_countries = nil - config.houdini.intl.currencies = ["usd"] - config.houdini.intl.all_currencies = nil + config.houdini.nonprofits_must_be_vetted = false @@ -73,10 +68,10 @@ module Houdini config.houdini.listeners = [] - initializer 'houdini.set_configuration', before: 'factory_bot.set_fixture_replacement' do |app| + initializer 'houdini.set_configuration', before: 'houdini.finish_configuration' do |app| app.config.to_prepare do Houdini.core_classes = app.config.houdini.core_classes - Houdini.support_email = app.config.houdini.support_email || ActionMailer::Base.default[:from] + Houdini.button_host = app.config.houdini.button_host || ActionMailer::Base.default_url_options[:host] @@ -90,14 +85,6 @@ module Houdini options = app.config.houdini.ccs_options || {} Houdini.ccs = Houdini::Ccs.build(ccs, **options) - Houdini.terms_and_privacy = app.config.houdini.terms_and_privacy - - Houdini.intl = Houdini::Intl.new(app.config.houdini.intl.to_h) - Houdini.intl.all_countries ||= ISO3166::Country.all.map(&:alpha2) - Houdini.intl.all_currencies ||= Money::Currency.table - raise("The language #{Houdini.intl.language} is not listed \ -in the provided locales: #{Houdini.intl.available_locales.join(', ')}") if Houdini.intl.available_locales.map(&:to_s) - .none?{|l| l == Houdini.intl.language.to_s} Houdini.maintenance = Houdini::Maintenance.new(app.config.houdini.maintenance.to_h) @@ -114,5 +101,11 @@ in the provided locales: #{Houdini.intl.available_locales.join(', ')}") if Houdi Houdini.event_publisher.subscribe_all(app.config.houdini.listeners) end end + + initializer 'houdini.finish_configuration', before: 'factory_bot.set_fixture_replacement' do |app| + # nothing to do, we just want to make sure we have proper initializer order + end + + include Houdini::EngineInitializers end end diff --git a/gems/bess/lib/houdini/engine_initializers.rb b/gems/bess/lib/houdini/engine_initializers.rb new file mode 100644 index 00000000..374de2af --- /dev/null +++ b/gems/bess/lib/houdini/engine_initializers.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +# License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later +# Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE + +# loads all of the engine initializer modules for Houdini +module Houdini::EngineInitializers + extend ActiveSupport::Concern + extend ActiveSupport::Autoload + initializer_path = File.expand_path(File.join(File.dirname(__FILE__), 'engine_initializers')) + initializers = Dir.glob("#{initializer_path}/*").to_a + initializers.each do |file| + autoload File.basename(file, '.rb').camelize.to_sym + include "Houdini::EngineInitializers::#{File.basename(file, '.rb').camelize}".constantize + end +end diff --git a/gems/bess/lib/houdini/engine_initializers/hoster.rb b/gems/bess/lib/houdini/engine_initializers/hoster.rb new file mode 100644 index 00000000..461cdd9c --- /dev/null +++ b/gems/bess/lib/houdini/engine_initializers/hoster.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +# License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later +# Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE +module Houdini::EngineInitializers + # an engine initializer for information about the hoster + module Hoster + extend ActiveSupport::Concern + included do + initializer 'houdini.hoster.set_configs', + before: 'houdini.finish_configs' do |app| + app.config.to_prepare do + options = app.config.houdini.hoster + + options.support_email ||= ActionMailer::Base.default[:from] + options.main_admin_email ||= ActionMailer::Base.default[:from] + + options.each { |k, v| Houdini::Hoster.send("#{k}=", v) } + end + end + + config.houdini.hoster = ActiveSupport::OrderedOptions.new + config.houdini.hoster.terms_and_privacy = ActiveSupport::OrderedOptions.new + end + end +end diff --git a/gems/bess/lib/houdini/engine_initializers/intl.rb b/gems/bess/lib/houdini/engine_initializers/intl.rb new file mode 100644 index 00000000..4c8dc163 --- /dev/null +++ b/gems/bess/lib/houdini/engine_initializers/intl.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +# License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later +# Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE +module Houdini::EngineInitializers + # engine initializer for everything international + module Intl + extend ActiveSupport::Concern + included do + initializer 'houdini.intl.set_configs', + before: 'houdini.finish_configs' do |app| + app.config.to_prepare do + Houdini.intl = Houdini::Intl.new(app.config.houdini.intl.to_h) + Houdini.intl.all_countries ||= ISO3166::Country.all.map(&:alpha2) + Houdini.intl.all_currencies ||= Money::Currency.table + if Houdini.intl.available_locales.map(&:to_s) + .none? { |l| l == Houdini.intl.language.to_s } + raise("The language #{Houdini.intl.language} is not listed \ + in the provided locales: #{Houdini.intl.available_locales.join(', ')}") + end + end + end + + config.houdini.intl = ActiveSupport::OrderedOptions.new + config.houdini.intl.language = :en + config.houdini.intl.available_locales = %i[en de es fr it nl pl ro] + config.houdini.intl.all_countries = nil + config.houdini.intl.currencies = ['usd'] + config.houdini.intl.all_currencies = nil + end + end +end diff --git a/gems/bess/lib/houdini/hoster.rb b/gems/bess/lib/houdini/hoster.rb new file mode 100644 index 00000000..9f89139a --- /dev/null +++ b/gems/bess/lib/houdini/hoster.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +# License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later +# Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE +module Houdini::Hoster + # (required) - the legal name of the hoster + mattr_accessor :legal_name + + # (optional but STRONGLY RECOMMENDED) - the email used for receiving emails + # and notifications which deal with contacting the admin + mattr_accessor :main_admin_email + + mattr_writer :casual_name + + ## (optional, defaults to legal_name) - a more casual name of the website As an example + ## if your hoster was HoudiniCo LLC, you might use HoudiniCo or + ## CustomHoudiniInstance here. We use this for possessive nouns and similar. + def self.casual_name + @@casual_name || Houdini::Hoster.legal_name + end + + # has casual_name been set? + def self.casual_name? + @@casual_name.present? + end + + # (optional) - the email address for contacting support + mattr_accessor :support_email + + # terms_and_privacy + mattr_accessor :terms_and_privacy +end diff --git a/lib/fetch/fetch_nonprofit_email.rb b/lib/fetch/fetch_nonprofit_email.rb index 5a679a61..cd0d10e8 100644 --- a/lib/fetch/fetch_nonprofit_email.rb +++ b/lib/fetch/fetch_nonprofit_email.rb @@ -5,11 +5,11 @@ module FetchNonprofitEmail def self.with_charge(charge) nonprofit = charge.nonprofit - nonprofit.email.blank? ? Houdini.support_email : nonprofit.email + nonprofit.email.blank? ? Houdini.hoster.support_email : nonprofit.email end def self.with_donation(donation) nonprofit = donation.nonprofit - nonprofit.email.blank? ? Houdini.support_email : nonprofit.email + nonprofit.email.blank? ? Houdini.hoster.support_email : nonprofit.email end end diff --git a/lib/format/format/name.rb b/lib/format/format/name.rb index 1fd9b34b..50e264e5 100644 --- a/lib/format/format/name.rb +++ b/lib/format/format/name.rb @@ -14,7 +14,7 @@ module Format # Format a nonprofit name into an email header def self.email_from_np(np_name) - "\"#{np_name.delete(',').delete('"')}\" <#{Houdini.support_email}>" + "\"#{np_name.delete(',').delete('"')}\" <#{Houdini.hoster.support_email}>" end end end diff --git a/lib/tasks/scheduler.rake b/lib/tasks/scheduler.rake index 3563b68c..a972aec9 100644 --- a/lib/tasks/scheduler.rake +++ b/lib/tasks/scheduler.rake @@ -19,8 +19,9 @@ task :heroku_scheduled_job, [:name] => :environment do |_t, args| rescue Exception => e results += "Failure: #{e}\n" end + GenericMailer.admin_notice( - subject: "Scheduled job results on CommitChange for '#{job_name}'", + subject: "Scheduled job results on #{Houdini.hoster.casual_name} for '#{job_name}'", body: results.empty? ? 'No jobs to run today.' : results ).deliver_later end diff --git a/spec/lib/fetch/fetch_nonprofit_email_spec.rb b/spec/lib/fetch/fetch_nonprofit_email_spec.rb index 0544bf9e..0bf40a1d 100644 --- a/spec/lib/fetch/fetch_nonprofit_email_spec.rb +++ b/spec/lib/fetch/fetch_nonprofit_email_spec.rb @@ -15,12 +15,12 @@ describe FetchNonprofitEmail, pending: true do it 'returns support@commitchange.com if Nonprofit email is blank' do charge.nonprofit.email = '' - expect(FetchNonprofitEmail.with_charge(charge)).to eq(Houdini.support_email) + expect(FetchNonprofitEmail.with_charge(charge)).to eq(Houdini.hoster.support_email) end it 'returns support@commitchange.com if Nonprofit email is nil' do charge.nonprofit.email = nil - expect(FetchNonprofitEmail.with_charge(charge)).to eq(Houdini.support_email) + expect(FetchNonprofitEmail.with_charge(charge)).to eq(Houdini.hoster.support_email) end end end diff --git a/spec/lib/format/name_spec.rb b/spec/lib/format/name_spec.rb index e513d652..c5cc1ad1 100644 --- a/spec/lib/format/name_spec.rb +++ b/spec/lib/format/name_spec.rb @@ -8,7 +8,7 @@ require 'format/name' describe Format::Name do describe '.email_from_np' do before(:each) do - Houdini.support_email = 'support@email.com' + Houdini.hoster.support_email = 'support@email.com' end it 'gives the name, minus commas, with our email in brackets' do result = Format::Name.email_from_np('Test, X, Y') diff --git a/spec/mailers/admin_spec.rb b/spec/mailers/admin_spec.rb index 84e1a421..83c4585c 100644 --- a/spec/mailers/admin_spec.rb +++ b/spec/mailers/admin_spec.rb @@ -19,8 +19,8 @@ RSpec.describe AdminMailer, type: :mailer do it 'renders the headers for mail without desc' do expect(mail.subject).to eq("Tried to associate donation #{donation.id} with campaign gift option #{campaign_gift_option.id} which is out of stock") - expect(mail.to).to eq([Houdini.support_email]) - expect(mail.from).to eq([Houdini.support_email]) + expect(mail.to).to eq([Houdini.hoster.support_email]) + expect(mail.from).to eq([Houdini.hoster.support_email]) end it 'renders the body without desc' do @@ -29,8 +29,8 @@ RSpec.describe AdminMailer, type: :mailer do it 'renders the headers on mail with desc' do expect(mail_with_desc.subject).to eq("Tried to associate donation #{donation.id} with campaign gift option #{campaign_gift_option_with_desc.id} which is out of stock") - expect(mail_with_desc.to).to eq([Houdini.support_email]) - expect(mail_with_desc.from).to eq([Houdini.support_email]) + expect(mail_with_desc.to).to eq([Houdini.hoster.support_email]) + expect(mail_with_desc.from).to eq([Houdini.hoster.support_email]) end it 'renders the body with desc' do