Class: Pay::Merchant

Inherits:
ApplicationRecord show all
Defined in:
app/models/pay/merchant.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.pay_processor_for(name) ⇒ Object


11
12
13
# File 'app/models/pay/merchant.rb', line 11

def self.pay_processor_for(name)
  "Pay::#{name.to_s.classify}::Merchant".constantize
end

Instance Method Details

#onboarding_complete?Boolean

Returns:

  • (Boolean)

20
21
22
23
24
# File 'app/models/pay/merchant.rb', line 20

def onboarding_complete?
  ActiveModel::Type::Boolean.new.cast(
    (data.presence || {})["onboarding_complete"]
  )
end

#pay_processorObject


15
16
17
18
# File 'app/models/pay/merchant.rb', line 15

def pay_processor
  return if processor.blank?
  @pay_processor ||= self.class.pay_processor_for(processor).new(self)
end