Success! The confirmation email to activate your bank account has been successfully re-sent. Expect it to arrive in your inbox within a few minutes. If you can't find it, be sure to check your spam folder.
Why do we require this confirmation? It proves that you have access to both your <%= Houdini.general.name %> account and your email account, preventing anybody from changing your organization's bank account if you leave your CommitChange account signed in on a shared computer.
-
If you still have trouble finding the confirmation email, please contact <%= Houdini.support_email %>.
+
If you still have trouble finding the confirmation email, please contact <%= Houdini.hoster.support_email %>.
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 %>
- Terms and Privacy
-<% if Houdini.terms_and_privacy&.terms_url %>
+<% if Houdini.hoster.terms_and_privacy&.terms_url %>
<% end %>
-<% if Houdini.terms_and_privacy&.privacy_url %>
+<% if Houdini.hoster.terms_and_privacy&.privacy_url %>
<% 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