diff --git a/CHANGELOG.md b/CHANGELOG.md index 17fdf05..2f43c8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,13 +2,18 @@ ## Next +## 0.2.2 - 2023-04-26 + +- [PR#11](https://github.com/tablecheck/paygate-ruby/pull/12) Re-add Rails Engine (was dropped in version 0.2.0) ([johnnyshields](https://github.com/johnnyshields)) +- [PR#12](https://github.com/tablecheck/paygate-ruby/pull/12) Rename Paygate::ActionView::FormHelper to Paygate::Rails::FormHelper. ([johnnyshields](https://github.com/johnnyshields)) + ## 0.2.1 - 2023-04-26 - [PR#11](https://github.com/tablecheck/paygate-ruby/pull/11) Deep freeze constants. ([johnnyshields](https://github.com/johnnyshields)) ## 0.2.0 - 2023-04-26 -- [PR#9](https://github.com/tablecheck/paygate-ruby/pull/9) Rename Paygate::FormHelper to Paygate::Rails::FormHelper. ([johnnyshields](https://github.com/johnnyshields)) +- [PR#9](https://github.com/tablecheck/paygate-ruby/pull/9) Rename Paygate::FormHelper to Paygate::ActionView::FormHelper. ([johnnyshields](https://github.com/johnnyshields)) - [PR#9](https://github.com/tablecheck/paygate-ruby/pull/9) Do not include Paygate::FormHelper in ActionView::Base. ([johnnyshields](https://github.com/johnnyshields)) - [PR#9](https://github.com/tablecheck/paygate-ruby/pull/9) Update BIN list. Note BINs can now be a flexible number of digits. ([johnnyshields](https://github.com/johnnyshields)) - [PR#9](https://github.com/tablecheck/paygate-ruby/pull/9) Rename data config YAML keys. ([johnnyshields](https://github.com/johnnyshields)) diff --git a/lib/paygate.rb b/lib/paygate.rb index 410b191..76667ff 100644 --- a/lib/paygate.rb +++ b/lib/paygate.rb @@ -9,19 +9,20 @@ require 'paygate/response' require 'paygate/transaction' require 'paygate/profile' -require 'paygate/action_view/form_helper' if defined?(ActionView) + +if defined?(Rails) + require 'paygate/rails/engine' + require 'paygate/rails/form_helper' +end module Paygate extend self CONFIG = YAML.safe_load(File.read(File.expand_path('../data/config.yml', __dir__)), permitted_classes: [Symbol]).freeze - LOCALES_MAP = CONFIG[:locales].freeze - LOCALES_MAP.each { |k, v| k.freeze; v.freeze } # rubocop:disable Style/Semicolon - INTL_BRANDS_MAP = CONFIG[:intl_brands].freeze - INTL_BRANDS_MAP.each_value(&:freeze) - KOREA_BIN_NUMBERS = CONFIG[:korea_bin_numbers].freeze - KOREA_BIN_NUMBERS.each(&:freeze) + (LOCALES_MAP = CONFIG[:locales].freeze).each { |k, v| k.freeze; v.freeze } # rubocop:disable Style/Semicolon + (INTL_BRANDS_MAP = CONFIG[:intl_brands].freeze).each_value(&:freeze) + (KOREA_BIN_NUMBERS = CONFIG[:korea_bin_numbers].freeze).each(&:freeze) DEFAULT_CURRENCY = 'WON' DEFAULT_LOCALE = 'US' diff --git a/lib/paygate/rails/engine.rb b/lib/paygate/rails/engine.rb new file mode 100644 index 0000000..08d7769 --- /dev/null +++ b/lib/paygate/rails/engine.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +module Paygate + module Rails + class Engine < ::Rails::Engine + end + end +end diff --git a/lib/paygate/action_view/form_helper.rb b/lib/paygate/rails/form_helper.rb similarity index 96% rename from lib/paygate/action_view/form_helper.rb rename to lib/paygate/rails/form_helper.rb index 5e52081..3b31afe 100644 --- a/lib/paygate/action_view/form_helper.rb +++ b/lib/paygate/rails/form_helper.rb @@ -1,9 +1,9 @@ # frozen_string_literal: true module Paygate - module ActionView + module Rails module FormHelper - PAYGATE_FORM_TEXT_FIELDS = { + (PAYGATE_FORM_TEXT_FIELDS = { mid: { placeholder: 'Member ID' }, @@ -117,13 +117,13 @@ module FormHelper profile_no: { placeholder: 'Profile No' - }, + }.freeze, hash_result: { name: 'hashresult', placeholder: 'Hash Result' } - }.freeze + }.freeze).each_value(&:freeze) def paygate_open_pay_api_js_url if Paygate.configuration.mode == :live diff --git a/lib/paygate/version.rb b/lib/paygate/version.rb index 763e48c..7959a94 100644 --- a/lib/paygate/version.rb +++ b/lib/paygate/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Paygate - VERSION = '0.2.1' + VERSION = '0.2.2' end