Module: Paygate

Extended by:
Paygate
Included in:
Paygate
Defined in:
lib/paygate.rb,
lib/paygate/aes.rb,
lib/paygate/member.rb,
lib/paygate/aes_ctr.rb,
lib/paygate/profile.rb,
lib/paygate/version.rb,
lib/paygate/response.rb,
lib/paygate/transaction.rb,
lib/paygate/rails/engine.rb,
lib/paygate/configuration.rb,
lib/paygate/rails/form_helper.rb

Defined Under Namespace

Modules: Rails Classes: Aes, AesCtr, Configuration, Member, Profile, Response, Transaction

Constant Summary collapse

CONFIG =
YAML.safe_load(File.read(File.expand_path('../data/config.yml', __dir__)),
permitted_classes: [Symbol]).freeze
DEFAULT_CURRENCY =
'WON'
DEFAULT_LOCALE =
'US'
VERSION =
'0.2.3'

Instance Method Summary collapse

Instance Method Details

#configurationObject



40
41
42
# File 'lib/paygate.rb', line 40

def configuration
  @configuration ||= Configuration.new
end

#configure {|configuration| ... } ⇒ Object

Yields:



44
45
46
# File 'lib/paygate.rb', line 44

def configure
  yield(configuration)
end

#mapped_currency(currency) ⇒ Object



29
30
31
32
33
34
# File 'lib/paygate.rb', line 29

def mapped_currency(currency)
  currency = currency&.to_s
  return DEFAULT_CURRENCY if currency.nil?

  currency.to_s == 'KRW' ? 'WON' : currency.to_s
end

#mapped_locale(locale) ⇒ Object



36
37
38
# File 'lib/paygate.rb', line 36

def mapped_locale(locale)
  LOCALES_MAP[locale&.to_s] || DEFAULT_LOCALE
end