paygate-ruby 0.1.11 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/paygate-ruby.rb CHANGED
@@ -1,48 +1,3 @@
1
- require 'yaml'
2
- require 'paygate/version'
3
- require 'paygate/configuration'
4
- require 'paygate/aes'
5
- require 'paygate/aes_ctr'
6
- require 'paygate/member'
7
- require 'paygate/response'
8
- require 'paygate/transaction'
9
- require 'paygate/profile'
10
- require 'paygate/helpers/form_helper' if defined?(ActionView)
1
+ # frozen_string_literal: true
11
2
 
12
- module Paygate
13
- if defined?(Rails)
14
- class Engine < ::Rails::Engine; end
15
- end
16
-
17
- CONFIG = YAML.load(File.read(File.expand_path('../data/config.yml', File.dirname(__FILE__)))).freeze
18
- LOCALES_MAP = CONFIG[:locales].freeze
19
- INTL_BRANDS_MAP = CONFIG[:intl][:brands].freeze
20
- KOREA_BIN_NUMBERS = CONFIG[:korea][:bin_numbers].freeze
21
-
22
- DEFAULT_CURRENCY = 'WON'.freeze
23
- DEFAULT_LOCALE = 'US'.freeze
24
-
25
- def mapped_currency(currency)
26
- return DEFAULT_CURRENCY unless currency.present?
27
-
28
- currency.to_s == 'KRW' ? 'WON' : currency.to_s
29
- end
30
- module_function :mapped_currency
31
-
32
- def mapped_locale(locale)
33
- locale.present? ? LOCALES_MAP[locale.to_s] : DEFAULT_LOCALE
34
- end
35
- module_function :mapped_locale
36
-
37
- class << self
38
- attr_writer :configuration
39
- end
40
-
41
- def self.configuration
42
- @configuration ||= Configuration.new
43
- end
44
-
45
- def self.configure
46
- yield configuration
47
- end
48
- end
3
+ require 'paygate'
data/lib/paygate.rb ADDED
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'yaml'
4
+ require 'paygate/version'
5
+ require 'paygate/configuration'
6
+ require 'paygate/aes'
7
+ require 'paygate/aes_ctr'
8
+ require 'paygate/member'
9
+ require 'paygate/response'
10
+ require 'paygate/transaction'
11
+ require 'paygate/profile'
12
+ require 'paygate/action_view/form_helper' if defined?(ActionView)
13
+
14
+ module Paygate
15
+ extend self
16
+
17
+ CONFIG = YAML.safe_load(File.read(File.expand_path('../data/config.yml', __dir__)),
18
+ permitted_classes: [Symbol]).freeze
19
+ LOCALES_MAP = CONFIG[:locales].freeze
20
+ LOCALES_MAP.each { |k, v| k.freeze; v.freeze } # rubocop:disable Style/Semicolon
21
+ INTL_BRANDS_MAP = CONFIG[:intl_brands].freeze
22
+ INTL_BRANDS_MAP.each_value(&:freeze)
23
+ KOREA_BIN_NUMBERS = CONFIG[:korea_bin_numbers].freeze
24
+ KOREA_BIN_NUMBERS.each(&:freeze)
25
+ DEFAULT_CURRENCY = 'WON'
26
+ DEFAULT_LOCALE = 'US'
27
+
28
+ def mapped_currency(currency)
29
+ currency = currency&.to_s
30
+ return DEFAULT_CURRENCY if currency.nil?
31
+
32
+ currency.to_s == 'KRW' ? 'WON' : currency.to_s
33
+ end
34
+
35
+ def mapped_locale(locale)
36
+ LOCALES_MAP[locale&.to_s] || DEFAULT_LOCALE
37
+ end
38
+
39
+ def configuration
40
+ @configuration ||= Configuration.new
41
+ end
42
+
43
+ def configure
44
+ yield(configuration)
45
+ end
46
+ end
metadata CHANGED
@@ -1,57 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paygate-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - jagdeepsingh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-13 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rspec
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
11
+ date: 2023-04-26 00:00:00.000000000 Z
12
+ dependencies: []
55
13
  description:
56
14
  email:
57
15
  - jagdeepsingh.125k@gmail.com
@@ -63,25 +21,25 @@ files:
63
21
  - LICENSE.txt
64
22
  - README.md
65
23
  - Rakefile
66
- - data/card_bin_20191001.xlsx
24
+ - data/cdbn.20230401.unl.xlsx
67
25
  - data/config.yml
68
26
  - lib/paygate-ruby.rb
27
+ - lib/paygate.rb
28
+ - lib/paygate/action_view/form_helper.rb
69
29
  - lib/paygate/aes.rb
70
30
  - lib/paygate/aes_ctr.rb
71
31
  - lib/paygate/configuration.rb
72
- - lib/paygate/helpers/form_helper.rb
73
32
  - lib/paygate/member.rb
74
33
  - lib/paygate/profile.rb
75
34
  - lib/paygate/response.rb
76
35
  - lib/paygate/transaction.rb
77
36
  - lib/paygate/version.rb
78
- - spec/integration/paygate_spec.rb
79
- - spec/spec_helper.rb
80
37
  - vendor/assets/javascripts/paygate.js
81
38
  homepage:
82
39
  licenses:
83
40
  - MIT
84
- metadata: {}
41
+ metadata:
42
+ rubygems_mfa_required: 'true'
85
43
  post_install_message:
86
44
  rdoc_options: []
87
45
  require_paths:
@@ -90,17 +48,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
48
  requirements:
91
49
  - - ">="
92
50
  - !ruby/object:Gem::Version
93
- version: '0'
51
+ version: 2.6.0
94
52
  required_rubygems_version: !ruby/object:Gem::Requirement
95
53
  requirements:
96
54
  - - ">="
97
55
  - !ruby/object:Gem::Version
98
56
  version: '0'
99
57
  requirements: []
100
- rubygems_version: 3.2.3
58
+ rubygems_version: 3.4.4
101
59
  signing_key:
102
60
  specification_version: 4
103
61
  summary: Ruby wrapper for PayGate Korea payment gateway
104
- test_files:
105
- - spec/integration/paygate_spec.rb
106
- - spec/spec_helper.rb
62
+ test_files: []
Binary file
@@ -1,155 +0,0 @@
1
- module Paygate
2
- module FormHelper
3
- FORM_TEXT_FIELDS = {
4
- mid: {
5
- placeholder: 'Member ID'
6
- },
7
-
8
- locale: {
9
- name: 'langcode',
10
- default: 'KR',
11
- placeholder: 'Language'
12
- },
13
-
14
- charset: {
15
- default: 'UTF-8',
16
- placeholder: 'Charset'
17
- },
18
-
19
- title: {
20
- name: 'goodname',
21
- placeholder: 'Title'
22
- },
23
-
24
- currency: {
25
- name: 'goodcurrency',
26
- default: 'WON',
27
- placeholder: 'Currency'
28
- },
29
-
30
- amount: {
31
- name: 'unitprice',
32
- placeholder: 'Amount'
33
- },
34
-
35
- meta1: {
36
- name: 'goodoption1',
37
- placeholder: 'Good Option 1'
38
- },
39
-
40
- meta2: {
41
- name: 'goodoption2',
42
- placeholder: 'Good Option 2'
43
- },
44
-
45
- meta3: {
46
- name: 'goodoption3',
47
- placeholder: 'Good Option 3'
48
- },
49
-
50
- meta4: {
51
- name: 'goodoption4',
52
- placeholder: 'Good Option 4'
53
- },
54
-
55
- meta5: {
56
- name: 'goodoption5',
57
- placeholder: 'Good Option 5'
58
- },
59
-
60
- pay_method: {
61
- name: 'paymethod',
62
- default: 'card',
63
- placeholder: 'Pay Method'
64
- },
65
-
66
- customer_name: {
67
- name: 'receipttoname',
68
- placeholder: 'Customer Name'
69
- },
70
-
71
- customer_email: {
72
- name: 'receipttoemail',
73
- placeholder: 'Customer Email'
74
- },
75
-
76
- card_number: {
77
- name: 'cardnumber',
78
- placeholder: 'Card Number'
79
- },
80
-
81
- expiry_year: {
82
- name: 'cardexpireyear',
83
- placeholder: 'Expiry Year'
84
- },
85
-
86
- expiry_month: {
87
- name: 'cardexpiremonth',
88
- placeholder: 'Expiry Month'
89
- },
90
-
91
- cvv: {
92
- name: 'cardsecretnumber',
93
- placeholder: 'CVV'
94
- },
95
-
96
- card_auth_code: {
97
- name: 'cardauthcode',
98
- placeholder: 'Card Auth Code'
99
- },
100
-
101
- response_code: {
102
- name: 'replycode',
103
- placeholder: 'Response Code'
104
- },
105
-
106
- response_message: {
107
- name: 'replyMsg',
108
- placeholder: 'Response Message'
109
- },
110
-
111
- tid: {
112
- placeholder: 'TID'
113
- },
114
-
115
- profile_no: {
116
- placeholder: 'Profile No'
117
- },
118
-
119
- hash_result: {
120
- name: 'hashresult',
121
- placeholder: 'Hash Result'
122
- }
123
- }
124
-
125
- def paygate_open_pay_api_js_url
126
- (Paygate.configuration.mode == :live) ?
127
- 'https://api.paygate.net/ajax/common/OpenPayAPI.js'.freeze :
128
- 'https://stgapi.paygate.net/ajax/common/OpenPayAPI.js'.freeze
129
- end
130
-
131
- def paygate_open_pay_api_form(options = {})
132
- form_tag({}, name: 'PGIOForm') do
133
- fields = []
134
-
135
- FORM_TEXT_FIELDS.each do |key, opts|
136
- arg_opts = options[key] || {}
137
- fields << text_field_tag(
138
- key,
139
- arg_opts[:value] || opts[:default],
140
- name: opts[:name] || key.to_s,
141
- placeholder: arg_opts[:placeholder] || opts[:placeholder]
142
- ).html_safe
143
- end
144
-
145
- fields.join.html_safe
146
- end.html_safe
147
- end
148
-
149
- def paygate_open_pay_api_screen
150
- content_tag(:div, nil, id: 'PGIOscreen')
151
- end
152
- end
153
- end
154
-
155
- ActionView::Base.send :include, Paygate::FormHelper
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../spec_helper'
4
-
5
- RSpec.describe 'basic' do
6
- it 'can load gem' do
7
- expect(true).to eq true
8
- end
9
- end
data/spec/spec_helper.rb DELETED
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- $LOAD_PATH.unshift File.dirname(__FILE__)
4
-
5
- require 'paygate-ruby'
6
-
7
- RSpec.configure do |config|
8
- config.mock_with :rspec
9
- config.order = 'random'
10
- end