Sha256: 805b05d7ede9d660147d01a0ee95aaf1d31b128690ed0c82f66bdae799a4af56

Contents?: true

Size: 491 Bytes

Versions: 1

Compression:

Stored size: 491 Bytes

Contents

class Plugins::Ecommerce::SiteService
  def initialize(site)
    @site = site
  end
  
  attr_reader :site
  
  def currency
    site.get_meta("_setting_ecommerce", {})[:current_unit] || 'USD'
  end
  
  def payment_method(type)
    payment_method = site.payment_methods.actives.detect do |payment_method|
      payment_method.get_option('type') == type
    end
    if payment_method.nil?
      raise ArgumentError, "Payment method #{type} is not found"
    end
    payment_method
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
camaleon_ecommerce-1.2 app/services/plugins/ecommerce/site_service.rb