Class: SolidusBolt::BoltConfiguration
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- SolidusBolt::BoltConfiguration
- Defined in:
- app/models/solidus_bolt/bolt_configuration.rb
Constant Summary collapse
- PRODUCTION_REGISTER_URL =
'https://merchant.bolt.com/register?platform=solidus'
- SANDBOX_REGISTER_URL =
'https://merchant-sandbox.bolt.com/register?platform=solidus'
- EVENTS =
%w[all payment credit capture void auth pending rejected_irreversible rejected_reversible no_op failed_payment newsletter_subscription risk_insights credit_card_deleted].freeze
Class Method Summary collapse
Instance Method Summary collapse
- #account_js ⇒ Object
- #division_public_id ⇒ Object
- #embed_js ⇒ Object
- #environment_url ⇒ Object
- #merchant_public_id ⇒ Object
Class Method Details
.can_create? ⇒ Boolean
30 31 32 |
# File 'app/models/solidus_bolt/bolt_configuration.rb', line 30 def self.can_create? count.zero? end |
.config_empty? ⇒ Boolean
34 35 36 37 38 39 40 |
# File 'app/models/solidus_bolt/bolt_configuration.rb', line 34 def self.config_empty? whitelist = %w[id created_at updated_at environment] fetch.attributes.all? do |attr, val| whitelist.include?(attr) || val.blank? end end |
.fetch ⇒ Object
26 27 28 |
# File 'app/models/solidus_bolt/bolt_configuration.rb', line 26 def self.fetch first_or_create end |
Instance Method Details
#account_js ⇒ Object
57 58 59 60 61 62 63 |
# File 'app/models/solidus_bolt/bolt_configuration.rb', line 57 def account_js case BoltConfiguration.environments[environment] when 0 then 'https://connect.bolt.com/account.js' else 'https://connect-sandbox.bolt.com/account.js' end end |
#division_public_id ⇒ Object
22 23 24 |
# File 'app/models/solidus_bolt/bolt_configuration.rb', line 22 def division_public_id publishable_key&.split('.')&.second end |
#embed_js ⇒ Object
50 51 52 53 54 55 |
# File 'app/models/solidus_bolt/bolt_configuration.rb', line 50 def case BoltConfiguration.environments[environment] when 0 then 'https://connect.bolt.com/embed.js' else 'https://connect-sandbox.bolt.com/embed.js' end end |
#environment_url ⇒ Object
42 43 44 45 46 47 48 |
# File 'app/models/solidus_bolt/bolt_configuration.rb', line 42 def environment_url case BoltConfiguration.environments[environment] when 0 then 'https://api.bolt.com' when 1 then 'https://api-sandbox.bolt.com' when 2 then 'https://api-staging.bolt.com' end end |
#merchant_public_id ⇒ Object
18 19 20 |
# File 'app/models/solidus_bolt/bolt_configuration.rb', line 18 def merchant_public_id publishable_key&.split('.')&.first end |