credit_gateway 0.1.0 → 0.1.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: 150f31aa7963afc5536a3bdda9ccfefeddfa2ee87bb7f298e44b11a3ad7e22cf
4
- data.tar.gz: b435194d43382b6be9a41a3aa01bf8242adb296ac27865e127237feab5795611
3
+ metadata.gz: 7dcf55c224cd6f61d8d4564ef05ab738341518dea922f618a1dc6ee669c1fb99
4
+ data.tar.gz: 32f0197981622fe82d4593acbabe70d9b6cbb2d2717f42d8dfcd277378b1200d
5
5
  SHA512:
6
- metadata.gz: 3a0d08ff82831dfa6296b55c36e3407f2b5d098bc90fa58028683d36c1a66c06f1a0488835a0a2ca38d2fe47c26a1252e4e91c4d6c3b95ff4dae47a09d9d9309
7
- data.tar.gz: 95b6d7519efb3e5669408f6663f586502016f465ece144e759aab69b4d972470826e53c1b7c3b6ea1946b70c9b059d8e6e01c2af77f3cab32cbf83794268ab63
6
+ metadata.gz: 66c31c9ab399bd9e229844770cf6ecbd12f1d73a6b2b5e93cecb03d511247c2992d5ec64e0553140872f98b81f36af3bb7ff4dbd9e96416c9339128e6cc29a25
7
+ data.tar.gz: 051e11dd9e18f719c8e75e58936dd2df954036200e645780022ded24a5f22ef8cd3f09472fc224c493fb3acaf6859275501cfd80c5a27f43f93cbe7adf44705c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- credit_gateway (0.1.0)
4
+ credit_gateway (0.1.1)
5
5
  faraday
6
6
  faraday_middleware
7
7
  faraday_middleware-multi_json
@@ -17,10 +17,17 @@ GEM
17
17
  rexml
18
18
  diff-lcs (1.4.4)
19
19
  dotenv (2.7.6)
20
- faraday (0.17.4)
20
+ faraday (1.4.1)
21
+ faraday-excon (~> 1.1)
22
+ faraday-net_http (~> 1.0)
23
+ faraday-net_http_persistent (~> 1.1)
21
24
  multipart-post (>= 1.2, < 3)
22
- faraday_middleware (0.14.0)
23
- faraday (>= 0.7.4, < 1.0)
25
+ ruby2_keywords (>= 0.0.4)
26
+ faraday-excon (1.1.0)
27
+ faraday-net_http (1.0.1)
28
+ faraday-net_http_persistent (1.1.0)
29
+ faraday_middleware (1.0.0)
30
+ faraday (~> 1.0)
24
31
  faraday_middleware-multi_json (0.0.6)
25
32
  faraday_middleware
26
33
  multi_json
@@ -47,6 +54,7 @@ GEM
47
54
  diff-lcs (>= 1.2.0, < 2.0)
48
55
  rspec-support (~> 3.10.0)
49
56
  rspec-support (3.10.2)
57
+ ruby2_keywords (0.0.4)
50
58
  vcr (6.0.0)
51
59
  webmock (3.12.1)
52
60
  addressable (>= 2.3.6)
@@ -4,6 +4,7 @@ require 'faraday'
4
4
  require 'faraday_middleware/multi_json'
5
5
  require 'credit_gateway/configuration'
6
6
  require 'credit_gateway/faraday_auth'
7
+ require 'credit_gateway/errors'
7
8
 
8
9
  module CreditGateway
9
10
  class Client
@@ -47,7 +48,11 @@ module CreditGateway
47
48
 
48
49
  case response.status
49
50
  when 400
50
- raise InvalidRequestError, response.body
51
+ if response.body.dig(:Errors, 0, :ErrorCode) == 'Company.NotFound'
52
+ raise CompanyNotFoundError, response.body.dig(:Errors, 0, :ErrorMessage)
53
+ else
54
+ raise InvalidRequestError, response.body
55
+ end
51
56
  when 401
52
57
  raise UnauthorizedError, response.body
53
58
  when 404
@@ -3,11 +3,11 @@
3
3
  module CreditGateway
4
4
  class Configuration
5
5
  BASE_URLS = {
6
- production: '',
6
+ production: 'https://api.connector.crifrealtime.com',
7
7
  sandbox: 'https://apiuat.connector.crifrealtime.com'
8
8
  }.freeze
9
9
  AUTH_URLS = {
10
- production: '',
10
+ production: 'https://auth.connector.crifrealtime.com',
11
11
  sandbox: 'https://uatauth.connector.crifrealtime.com'
12
12
  }.freeze
13
13
 
@@ -8,4 +8,6 @@ module CreditGateway
8
8
  class InvalidRequestError < StandardError; end
9
9
 
10
10
  class NotFoundError < StandardError; end
11
+
12
+ class CompanyNotFoundError < InvalidRequestError; end
11
13
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CreditGateway
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: credit_gateway
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Finpoint
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-14 00:00:00.000000000 Z
11
+ date: 2021-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday