fawry 1.1.1 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 34dc9f1782c59c274ae83ab7cb5bf7542c02df23f12d3343c0bacc06d0385acf
4
- data.tar.gz: 1e902699e6671b59e4d83ab246c6811fe4472c2b370843ce2b614e5e74811e80
3
+ metadata.gz: de7321464f0d145904cb1b356fc8b0659f7258e5693c4c3a32e6ae3276198a5e
4
+ data.tar.gz: c7bc36bbe23c12fbe7b7ea0b5397cfbf9a5bf696440806a1a7200e61fd10e4c1
5
5
  SHA512:
6
- metadata.gz: e18d4c44a20192fafd829aae6b9726bdbef550f1f5a32fc28865d61bf7336f93d86c2eec07605eea53d29990ef45eabfd175c29e3e8425ca230d4f0ccd195d63
7
- data.tar.gz: 4eed6906aa47aa7e45d7b18fecf2ff2878aca3939e49f071f0e0ce16ffbc2278e0b204261cd03dbe5009f5c5c97bec7b08cc57f8faae52880229e57225fd9ecb
6
+ metadata.gz: 9ff0c0665c07f5b0abd0b68ece79e6ab934c8c91e2387571986ad652af08e31cae9e8e0a3674aa180b9badbbb7833df24a6e64c8da5f9383ab97299454de4090
7
+ data.tar.gz: c1a8cdeef0c8fe57010ef68491e95ba88d99c5f990a123829afe03e78c7704a4184c101cd72ed145747d71972e085cf1ace26617feff0b42d781eb4af56d3ff6
@@ -0,0 +1,35 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ matrix:
22
+ ruby-version: ['2.6', '2.7', '3.0']
23
+
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+ - name: Set up Ruby
27
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
28
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
29
+ # uses: ruby/setup-ruby@v1
30
+ uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
31
+ with:
32
+ ruby-version: ${{ matrix.ruby-version }}
33
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
34
+ - name: Run tests
35
+ run: bundle exec rake
data/.rubocop.yml CHANGED
@@ -1,8 +1,9 @@
1
1
  AllCops:
2
+ NewCops: enable
2
3
  TargetRubyVersion: 2.6
3
4
  Metrics/LineLength:
4
5
  Max: 120
5
6
  Metrics/BlockLength:
6
- ExcludedMethods: ['describe', 'context']
7
+ IgnoredMethods: ['describe', 'context']
7
8
  Style/Documentation:
8
- Enabled: false
9
+ Enabled: false
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fawry (1.1.1)
4
+ fawry (1.2.1)
5
5
  dry-validation (~> 1.3, >= 1.3.1)
6
6
  faraday (~> 0.17.0)
7
7
 
@@ -10,11 +10,11 @@ GEM
10
10
  specs:
11
11
  addressable (2.7.0)
12
12
  public_suffix (>= 2.0.2, < 5.0)
13
- ast (2.4.0)
13
+ ast (2.4.2)
14
14
  byebug (11.0.1)
15
15
  concurrent-ruby (1.1.7)
16
- crack (0.4.3)
17
- safe_yaml (~> 1.0.0)
16
+ crack (0.4.5)
17
+ rexml
18
18
  diff-lcs (1.3)
19
19
  dry-configurable (0.11.6)
20
20
  concurrent-ruby (~> 1.0)
@@ -54,17 +54,18 @@ GEM
54
54
  dry-equalizer (~> 0.2)
55
55
  dry-initializer (~> 3.0)
56
56
  dry-schema (~> 1.5, >= 1.5.2)
57
- faraday (0.17.1)
57
+ faraday (0.17.4)
58
58
  multipart-post (>= 1.2, < 3)
59
- hashdiff (1.0.0)
60
- jaro_winkler (1.5.4)
59
+ hashdiff (1.0.1)
61
60
  multipart-post (2.1.1)
62
- parallel (1.18.0)
63
- parser (2.6.5.0)
64
- ast (~> 2.4.0)
65
- public_suffix (4.0.1)
61
+ parallel (1.20.1)
62
+ parser (3.0.0.0)
63
+ ast (~> 2.4.1)
64
+ public_suffix (4.0.6)
66
65
  rainbow (3.0.0)
67
66
  rake (13.0.1)
67
+ regexp_parser (2.1.1)
68
+ rexml (3.2.4)
68
69
  rspec (3.9.0)
69
70
  rspec-core (~> 3.9.0)
70
71
  rspec-expectations (~> 3.9.0)
@@ -80,17 +81,20 @@ GEM
80
81
  rspec-support (3.9.0)
81
82
  rspec_junit_formatter (0.4.1)
82
83
  rspec-core (>= 2, < 4, != 2.12.0)
83
- rubocop (0.76.0)
84
- jaro_winkler (~> 1.5.1)
84
+ rubocop (1.11.0)
85
85
  parallel (~> 1.10)
86
- parser (>= 2.6)
86
+ parser (>= 3.0.0.0)
87
87
  rainbow (>= 2.2.2, < 4.0)
88
+ regexp_parser (>= 1.8, < 3.0)
89
+ rexml
90
+ rubocop-ast (>= 1.2.0, < 2.0)
88
91
  ruby-progressbar (~> 1.7)
89
- unicode-display_width (>= 1.4.0, < 1.7)
90
- ruby-progressbar (1.10.1)
91
- safe_yaml (1.0.5)
92
- unicode-display_width (1.6.0)
93
- webmock (3.7.6)
92
+ unicode-display_width (>= 1.4.0, < 3.0)
93
+ rubocop-ast (1.4.1)
94
+ parser (>= 2.7.1.5)
95
+ ruby-progressbar (1.11.0)
96
+ unicode-display_width (2.0.0)
97
+ webmock (3.12.1)
94
98
  addressable (>= 2.3.6)
95
99
  crack (>= 0.3.2)
96
100
  hashdiff (>= 0.4.0, < 2.0.0)
@@ -100,13 +104,13 @@ PLATFORMS
100
104
 
101
105
  DEPENDENCIES
102
106
  bundler (~> 2.0)
103
- byebug (~> 11.0, >= 11.0.1)
107
+ byebug (~> 11.0)
104
108
  fawry!
105
109
  rake (~> 13.0)
106
110
  rspec (~> 3.0)
107
111
  rspec_junit_formatter
108
- rubocop (~> 0.76.0)
109
- webmock (~> 3.7, >= 3.7.6)
112
+ rubocop (~> 1.11)
113
+ webmock (~> 3.12)
110
114
 
111
115
  BUNDLED WITH
112
- 2.1.4
116
+ 2.2.3
data/Rakefile CHANGED
@@ -2,10 +2,17 @@
2
2
 
3
3
  require 'bundler/gem_tasks'
4
4
  require 'rspec/core/rake_task'
5
+ require 'rubocop/rake_task'
5
6
 
6
7
  RSpec::Core::RakeTask.new(:spec)
8
+ RuboCop::RakeTask.new(:rubocop)
7
9
 
8
- task default: :spec
10
+ task default: :rspec_rubocop
11
+
12
+ task :rspec_rubocop do
13
+ Rake::Task['rubocop'].invoke
14
+ Rake::Task['spec'].invoke
15
+ end
9
16
 
10
17
  desc 'Start a console session with Fawry gem loaded'
11
18
  task :console do
data/fawry.gemspec CHANGED
@@ -7,14 +7,14 @@ require 'fawry/version'
7
7
  Gem::Specification.new do |spec|
8
8
  spec.name = 'fawry'
9
9
  spec.version = Fawry::VERSION
10
- spec.authors = ['Amr Bakry']
11
- spec.email = ['amrrbakry17@gmail.com']
10
+ spec.authors = ['Amr El Bakry']
11
+ spec.email = ['amrr@hey.com']
12
12
 
13
13
  spec.summary = "A library to interface with Fawry's payment gateway API (charge, refund, payment status,
14
14
  service callback)."
15
15
  spec.homepage = 'https://github.com/amrrbakry/fawry'
16
16
  spec.license = 'MIT'
17
- spec.required_ruby_version = '~> 2.6'
17
+ spec.required_ruby_version = '>= 2.6'
18
18
 
19
19
  spec.metadata['homepage_uri'] = 'https://github.com/amrrbakry/fawry'
20
20
  spec.metadata['source_code_uri'] = 'https://github.com/amrrbakry/fawry'
@@ -32,10 +32,10 @@ Gem::Specification.new do |spec|
32
32
  spec.add_dependency 'faraday', '~> 0.17.0'
33
33
 
34
34
  spec.add_development_dependency 'bundler', '~> 2.0'
35
- spec.add_development_dependency 'byebug', '~> 11.0', '>= 11.0.1'
35
+ spec.add_development_dependency 'byebug', '~> 11.0'
36
36
  spec.add_development_dependency 'rake', '~> 13.0'
37
37
  spec.add_development_dependency 'rspec', '~> 3.0'
38
38
  spec.add_development_dependency 'rspec_junit_formatter'
39
- spec.add_development_dependency 'rubocop', '~> 0.76.0'
40
- spec.add_development_dependency 'webmock', '~> 3.7', '>= 3.7.6'
39
+ spec.add_development_dependency 'rubocop', '~> 1.11'
40
+ spec.add_development_dependency 'webmock', '~> 3.12'
41
41
  end
@@ -45,12 +45,12 @@ module Fawry
45
45
 
46
46
  def connection
47
47
  @connection ||= Faraday.new(url: FAWRY_BASE_URL, headers: { 'Content-Type': 'application/json',
48
- 'Accept': 'application/json' })
48
+ Accept: 'application/json' })
49
49
  end
50
50
 
51
51
  def sandbox_connection
52
52
  @sandbox_connection ||= Faraday.new(url: FAWRY_SANDBOX_BASE_URL, headers: { 'Content-Type': 'application/json',
53
- 'Accept': 'application/json' })
53
+ Accept: 'application/json' })
54
54
  end
55
55
 
56
56
  # Fawry does not understand encoded params
data/lib/fawry/errors.rb CHANGED
@@ -2,5 +2,6 @@
2
2
 
3
3
  module Fawry
4
4
  class InvalidFawryRequestError < StandardError; end
5
+
5
6
  class InvalidSignatureError < StandardError; end
6
7
  end
@@ -18,7 +18,6 @@ module Fawry
18
18
 
19
19
  # rubocop:disable Metrics/MethodLength
20
20
  # rubocop:disable Metrics/AbcSize
21
- # rubocop:disable Metrics/CyclomaticComplexity
22
21
  def build_request
23
22
  case action
24
23
  when 'charge'
@@ -46,7 +45,6 @@ module Fawry
46
45
  validate_delete_token_params!
47
46
  @request = build_delete_token_request
48
47
  end
49
- # rubocop:enable Metrics/CyclomaticComplexity
50
48
  # rubocop:enable Metrics/AbcSize
51
49
  # rubocop:enable Metrics/MethodLength
52
50
  end
@@ -27,7 +27,6 @@ module Fawry
27
27
  @create_card_token_request ||= params
28
28
  end
29
29
 
30
- # rubocop:disable Metrics/AbcSize
31
30
  def create_card_token_request_transformed_params
32
31
  {
33
32
  merchantCode: fawry_merchant_code,
@@ -41,8 +40,6 @@ module Fawry
41
40
  }.compact
42
41
  end
43
42
 
44
- # rubocop:enable Metrics/AbcSize
45
-
46
43
  def fawry_merchant_code
47
44
  ENV.fetch('FAWRY_MERCHANT_CODE') { create_card_token_request[:merchant_code] }
48
45
  end
data/lib/fawry/utils.rb CHANGED
@@ -17,7 +17,7 @@ module Fawry
17
17
  # fawry_res.status_code => 200
18
18
  # fawry_res.reference_number => 1234567
19
19
  def enrich_object(fawry_params)
20
- fawry_params.keys.each do |key|
20
+ fawry_params.each_key do |key|
21
21
  method_name = key.to_s.split(/(?=[A-Z])/).map(&:downcase).join('_') # statusCode => status_code
22
22
  instance_variable_set("@#{method_name}", fawry_params[key])
23
23
  method_body = proc { instance_variable_get("@#{method_name}") }
data/lib/fawry/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Fawry
4
- VERSION = '1.1.1'
4
+ VERSION = '1.2.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fawry
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
- - Amr Bakry
7
+ - Amr El Bakry
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-07 00:00:00.000000000 Z
11
+ date: 2021-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-validation
@@ -65,9 +65,6 @@ dependencies:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
67
  version: '11.0'
68
- - - ">="
69
- - !ruby/object:Gem::Version
70
- version: 11.0.1
71
68
  type: :development
72
69
  prerelease: false
73
70
  version_requirements: !ruby/object:Gem::Requirement
@@ -75,9 +72,6 @@ dependencies:
75
72
  - - "~>"
76
73
  - !ruby/object:Gem::Version
77
74
  version: '11.0'
78
- - - ">="
79
- - !ruby/object:Gem::Version
80
- version: 11.0.1
81
75
  - !ruby/object:Gem::Dependency
82
76
  name: rake
83
77
  requirement: !ruby/object:Gem::Requirement
@@ -126,42 +120,37 @@ dependencies:
126
120
  requirements:
127
121
  - - "~>"
128
122
  - !ruby/object:Gem::Version
129
- version: 0.76.0
123
+ version: '1.11'
130
124
  type: :development
131
125
  prerelease: false
132
126
  version_requirements: !ruby/object:Gem::Requirement
133
127
  requirements:
134
128
  - - "~>"
135
129
  - !ruby/object:Gem::Version
136
- version: 0.76.0
130
+ version: '1.11'
137
131
  - !ruby/object:Gem::Dependency
138
132
  name: webmock
139
133
  requirement: !ruby/object:Gem::Requirement
140
134
  requirements:
141
135
  - - "~>"
142
136
  - !ruby/object:Gem::Version
143
- version: '3.7'
144
- - - ">="
145
- - !ruby/object:Gem::Version
146
- version: 3.7.6
137
+ version: '3.12'
147
138
  type: :development
148
139
  prerelease: false
149
140
  version_requirements: !ruby/object:Gem::Requirement
150
141
  requirements:
151
142
  - - "~>"
152
143
  - !ruby/object:Gem::Version
153
- version: '3.7'
154
- - - ">="
155
- - !ruby/object:Gem::Version
156
- version: 3.7.6
144
+ version: '3.12'
157
145
  description:
158
146
  email:
159
- - amrrbakry17@gmail.com
147
+ - amrr@hey.com
160
148
  executables: []
161
149
  extensions: []
162
150
  extra_rdoc_files: []
163
151
  files:
164
152
  - ".circleci/config.yml"
153
+ - ".github/workflows/ruby.yml"
165
154
  - ".gitignore"
166
155
  - ".rspec"
167
156
  - ".rubocop.yml"
@@ -207,7 +196,7 @@ require_paths:
207
196
  - lib
208
197
  required_ruby_version: !ruby/object:Gem::Requirement
209
198
  requirements:
210
- - - "~>"
199
+ - - ">="
211
200
  - !ruby/object:Gem::Version
212
201
  version: '2.6'
213
202
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -216,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
216
205
  - !ruby/object:Gem::Version
217
206
  version: '0'
218
207
  requirements: []
219
- rubygems_version: 3.0.8
208
+ rubygems_version: 3.0.9
220
209
  signing_key:
221
210
  specification_version: 4
222
211
  summary: A library to interface with Fawry's payment gateway API (charge, refund,