paygate-ruby 0.1.8 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/paygate-ruby.rb CHANGED
@@ -1,48 +1,3 @@
1
- require "paygate/version"
2
-
3
- require 'paygate/configuration'
4
- require 'paygate/aes'
5
- require 'paygate/aes_ctr'
6
-
7
- require 'paygate/member'
8
- require 'paygate/response'
9
- require 'paygate/transaction'
10
- require 'paygate/profile'
11
-
12
- require 'paygate/helpers/form_helper' if defined? ActionView
13
-
14
- module Paygate
15
- class Engine < ::Rails::Engine; 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
1
+ # frozen_string_literal: true
2
+
3
+ require 'paygate'
data/lib/paygate.rb ADDED
@@ -0,0 +1,43 @@
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
+ INTL_BRANDS_MAP = CONFIG[:intl_brands].freeze
21
+ KOREA_BIN_NUMBERS = CONFIG[:korea_bin_numbers].freeze
22
+ DEFAULT_CURRENCY = 'WON'
23
+ DEFAULT_LOCALE = 'US'
24
+
25
+ def mapped_currency(currency)
26
+ currency = currency&.to_s
27
+ return DEFAULT_CURRENCY if currency.nil?
28
+
29
+ currency.to_s == 'KRW' ? 'WON' : currency.to_s
30
+ end
31
+
32
+ def mapped_locale(locale)
33
+ LOCALES_MAP[locale&.to_s] || DEFAULT_LOCALE
34
+ end
35
+
36
+ def configuration
37
+ @configuration ||= Configuration.new
38
+ end
39
+
40
+ def configure
41
+ yield(configuration)
42
+ end
43
+ end
@@ -1,86 +1,86 @@
1
- window.Paygate = (function() {
2
- function Paygate() {}
3
-
4
- Paygate.fieldsMap = {
5
- mid: 'mid',
6
- locale: 'langcode',
7
- charset: 'charset',
8
- title: 'goodname',
9
- currency: 'goodcurrency',
10
- amount: 'unitprice',
11
- meta1: 'goodoption1',
12
- meta2: 'goodoption2',
13
- meta3: 'goodoption3',
14
- meta4: 'goodoption4',
15
- meta5: 'goodoption5',
16
- payMethod: 'paymethod',
17
- customerName: 'receipttoname',
18
- customerEmail: 'receipttoemail',
19
- cardNumber: 'cardnumber',
20
- expiryYear: 'cardexpireyear',
21
- expiryMonth: 'cardexpiremonth',
22
- cvv: 'cardsecretnumber',
23
- cardAuthCode: 'cardauthcode',
24
- responseCode: 'replycode',
25
- responseMessage: 'replyMsg',
26
- tid: 'tid',
27
- profileNo: 'profile_no',
28
- hashResult: 'hashresult'
29
- };
30
-
31
- Paygate.openPayApiForm = function() {
32
- return document.querySelector('form[name=PGIOForm]');
33
- };
34
-
35
- Paygate.openPayApiScreen = function() {
36
- return document.querySelector('#PGIOscreen');
37
- };
38
-
39
- Paygate.openPayApiFields = function() {
40
- var formChildren = Array.from(this.openPayApiForm().children);
41
- return formChildren.filter(function(el) {
42
- return el.tagName === 'INPUT';
43
- });
44
- }
45
-
46
- Paygate.findInputByName = function(name) {
47
- var mappedName = this.fieldsMap[name];
48
- return this.openPayApiFields().filter(function(el) {
49
- return el.name === mappedName;
50
- })[0];
51
- };
52
-
53
- Paygate.cardAuthCode = function() {
54
- return this.findInputByName('cardAuthCode').value;
55
- };
56
-
57
- Paygate.responseCode = function() {
58
- return this.findInputByName('responseCode').value;
59
- };
60
-
61
- Paygate.responseMessage = function() {
62
- return this.findInputByName('responseMessage').value;
63
- };
64
-
65
- Paygate.tid = function() {
66
- return this.findInputByName('tid').value;
67
- };
68
-
69
- Paygate.profileNo = function() {
70
- return this.findInputByName('profileNo').value;
71
- };
72
-
73
- Paygate.hashResult = function() {
74
- return this.findInputByName('hashResult').value;
75
- };
76
-
77
- Paygate.fillInput = function(field, value) {
78
- this.findInputByName(field).value = value;
79
- };
80
-
81
- Paygate.submitForm = function() {
82
- doTransaction(document.PGIOForm);
83
- };
84
-
85
- return Paygate;
86
- })();
1
+ window.Paygate = (function() {
2
+ function Paygate() {}
3
+
4
+ Paygate.fieldsMap = {
5
+ mid: 'mid',
6
+ locale: 'langcode',
7
+ charset: 'charset',
8
+ title: 'goodname',
9
+ currency: 'goodcurrency',
10
+ amount: 'unitprice',
11
+ meta1: 'goodoption1',
12
+ meta2: 'goodoption2',
13
+ meta3: 'goodoption3',
14
+ meta4: 'goodoption4',
15
+ meta5: 'goodoption5',
16
+ payMethod: 'paymethod',
17
+ customerName: 'receipttoname',
18
+ customerEmail: 'receipttoemail',
19
+ cardNumber: 'cardnumber',
20
+ expiryYear: 'cardexpireyear',
21
+ expiryMonth: 'cardexpiremonth',
22
+ cvv: 'cardsecretnumber',
23
+ cardAuthCode: 'cardauthcode',
24
+ responseCode: 'replycode',
25
+ responseMessage: 'replyMsg',
26
+ tid: 'tid',
27
+ profileNo: 'profile_no',
28
+ hashResult: 'hashresult'
29
+ };
30
+
31
+ Paygate.openPayApiForm = function() {
32
+ return document.querySelector('form[name=PGIOForm]');
33
+ };
34
+
35
+ Paygate.openPayApiScreen = function() {
36
+ return document.querySelector('#PGIOscreen');
37
+ };
38
+
39
+ Paygate.openPayApiFields = function() {
40
+ var formChildren = Array.from(this.openPayApiForm().children);
41
+ return formChildren.filter(function(el) {
42
+ return el.tagName === 'INPUT';
43
+ });
44
+ }
45
+
46
+ Paygate.findInputByName = function(name) {
47
+ var mappedName = this.fieldsMap[name];
48
+ return this.openPayApiFields().filter(function(el) {
49
+ return el.name === mappedName;
50
+ })[0];
51
+ };
52
+
53
+ Paygate.cardAuthCode = function() {
54
+ return this.findInputByName('cardAuthCode').value;
55
+ };
56
+
57
+ Paygate.responseCode = function() {
58
+ return this.findInputByName('responseCode').value;
59
+ };
60
+
61
+ Paygate.responseMessage = function() {
62
+ return this.findInputByName('responseMessage').value;
63
+ };
64
+
65
+ Paygate.tid = function() {
66
+ return this.findInputByName('tid').value;
67
+ };
68
+
69
+ Paygate.profileNo = function() {
70
+ return this.findInputByName('profileNo').value;
71
+ };
72
+
73
+ Paygate.hashResult = function() {
74
+ return this.findInputByName('hashResult').value;
75
+ };
76
+
77
+ Paygate.fillInput = function(field, value) {
78
+ this.findInputByName(field).value = value;
79
+ };
80
+
81
+ Paygate.submitForm = function() {
82
+ doTransaction(document.PGIOForm);
83
+ };
84
+
85
+ return Paygate;
86
+ })();
metadata CHANGED
@@ -1,78 +1,46 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paygate-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - jagdeepsingh
8
- autorequire:
9
- bindir: exe
8
+ autorequire:
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-11 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: '1.15'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.15'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '10.0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '10.0'
41
- description:
11
+ date: 2023-04-26 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
42
14
  email:
43
15
  - jagdeepsingh.125k@gmail.com
44
16
  executables: []
45
17
  extensions: []
46
18
  extra_rdoc_files: []
47
19
  files:
48
- - ".gitignore"
49
20
  - CHANGELOG.md
50
- - CODE_OF_CONDUCT.md
51
- - Gemfile
52
21
  - LICENSE.txt
53
22
  - README.md
54
23
  - Rakefile
55
- - bin/console
56
- - bin/setup
57
- - data/card_bin_20191001.xlsx
24
+ - data/cdbn.20230401.unl.xlsx
58
25
  - data/config.yml
59
26
  - lib/paygate-ruby.rb
27
+ - lib/paygate.rb
28
+ - lib/paygate/action_view/form_helper.rb
60
29
  - lib/paygate/aes.rb
61
30
  - lib/paygate/aes_ctr.rb
62
31
  - lib/paygate/configuration.rb
63
- - lib/paygate/helpers/form_helper.rb
64
32
  - lib/paygate/member.rb
65
33
  - lib/paygate/profile.rb
66
34
  - lib/paygate/response.rb
67
35
  - lib/paygate/transaction.rb
68
36
  - lib/paygate/version.rb
69
- - paygate-ruby.gemspec
70
37
  - vendor/assets/javascripts/paygate.js
71
- homepage:
38
+ homepage:
72
39
  licenses:
73
40
  - MIT
74
- metadata: {}
75
- post_install_message:
41
+ metadata:
42
+ rubygems_mfa_required: 'true'
43
+ post_install_message:
76
44
  rdoc_options: []
77
45
  require_paths:
78
46
  - lib
@@ -80,15 +48,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
80
48
  requirements:
81
49
  - - ">="
82
50
  - !ruby/object:Gem::Version
83
- version: '0'
51
+ version: 2.6.0
84
52
  required_rubygems_version: !ruby/object:Gem::Requirement
85
53
  requirements:
86
54
  - - ">="
87
55
  - !ruby/object:Gem::Version
88
56
  version: '0'
89
57
  requirements: []
90
- rubygems_version: 3.0.3
91
- signing_key:
58
+ rubygems_version: 3.4.4
59
+ signing_key:
92
60
  specification_version: 4
93
- summary: Ruby wrapper for PayGate payment gateway
61
+ summary: Ruby wrapper for PayGate Korea payment gateway
94
62
  test_files: []
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
data/CODE_OF_CONDUCT.md DELETED
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at jagdeep.singh@vinsol.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in paygate-ruby.gemspec
4
- gemspec
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "paygate"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
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
data/paygate-ruby.gemspec DELETED
@@ -1,24 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path("../lib", __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "paygate/version"
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "paygate-ruby"
8
- spec.version = Paygate::VERSION
9
- spec.authors = ["jagdeepsingh"]
10
- spec.email = ["jagdeepsingh.125k@gmail.com"]
11
-
12
- spec.summary = 'Ruby wrapper for PayGate payment gateway'
13
- spec.license = "MIT"
14
-
15
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
16
- f.match(%r{^(test|spec|features)/})
17
- end
18
- spec.bindir = "exe"
19
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
- spec.require_paths = ["lib"]
21
-
22
- spec.add_development_dependency "bundler", "~> 1.15"
23
- spec.add_development_dependency "rake", "~> 10.0"
24
- end