braspag-rest 0.4.0 → 0.4.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
  SHA1:
3
- metadata.gz: 89b3ed1550da0757299919d7412d51cf612b1b39
4
- data.tar.gz: 20bad2c9cfafca7e576116341b8031f795658774
3
+ metadata.gz: 54d0afe4cefd06614c6ec739bb9829f3caee5f34
4
+ data.tar.gz: bb35f725856fede67ca255076ce1d43127260f49
5
5
  SHA512:
6
- metadata.gz: 89be64c59a2eb73aca6f17b205172ea22466ad7de08d945c51020d8717af632660a3de0625f79d08a76a933e0b8627536ce7566330ead1ab4447b6883ad8db9a
7
- data.tar.gz: cabc88ba6db3096e8a6223f8baef0a40b7a607d0ac4329f9df166caf805f5222ea58b0a5da9156197c92f3ae97a127f4361686306bf029dcfc161c7b4b851851
6
+ metadata.gz: 8a60b794f4f1d39b4dc7cca185811ece85b98fae23e4ce4944005ef5f87bd12a2a4404598c15299e56c3d93c9232819888fb1dede60766f6fa07b3577b0e860a
7
+ data.tar.gz: b90810a36e6f94b4cf5519e1ec7a3c0c3cd19384d11628437a49fded4bb84148310bc8a6bfffd5cc4fed08e9860b418aa8b75d9e631cf34c12339f7ba0bdec95
@@ -6,24 +6,32 @@ module BraspagRest
6
6
  CAPTURE_ENDPOINT = '/capture'
7
7
 
8
8
  def authorize(request_id, params)
9
+ config.logger.info("[BraspagRest][Authorize] endpoint: #{sale_url}, params: #{params.to_json}") if config.log_enabled?
10
+
9
11
  execute_braspag_request do
10
12
  RestClient.post(sale_url, params.to_json, default_headers.merge('RequestId' => request_id))
11
13
  end
12
14
  end
13
15
 
14
16
  def void(request_id, payment_id, amount)
17
+ config.logger.info("[BraspagRest][Void] endpoint: #{void_url(payment_id, amount)}") if config.log_enabled?
18
+
15
19
  execute_braspag_request do
16
20
  RestClient.put(void_url(payment_id, amount), nil, default_headers.merge('RequestId' => request_id))
17
21
  end
18
22
  end
19
23
 
20
24
  def get_sale(request_id, payment_id)
25
+ config.logger.info("[BraspagRest][GetSale] endpoint: #{search_sale_url(payment_id)}") if config.log_enabled?
26
+
21
27
  execute_braspag_request do
22
28
  RestClient.get(search_sale_url(payment_id), default_headers.merge('RequestId' => request_id))
23
29
  end
24
30
  end
25
31
 
26
32
  def capture(request_id, payment_id, amount)
33
+ config.logger.info("[BraspagRest][Capture] endpoint: #{capture_url(payment_id)}, amount: #{amount}") if config.log_enabled?
34
+
27
35
  execute_braspag_request do
28
36
  RestClient.put(capture_url(payment_id), { Amount: amount }.to_json, default_headers.merge('RequestId' => request_id))
29
37
  end
@@ -33,15 +41,18 @@ module BraspagRest
33
41
 
34
42
  def execute_braspag_request(&block)
35
43
  gateway_response = block.call
44
+
45
+ config.logger.info("[BraspagRest][Response] gateway_response: #{gateway_response.inspect}") if config.log_enabled?
46
+
36
47
  BraspagRest::Response.new(gateway_response)
37
48
  rescue RestClient::ResourceNotFound => e
38
- config.logger.error("[BraspagRest] #{e}") if config.log_enabled?
49
+ config.logger.error("[BraspagRest][Error] message: #{e.message}, status: #{e.http_code}, body: #{e.http_body.inspect}") if config.log_enabled?
39
50
  raise
40
51
  rescue RestClient::ExceptionWithResponse => e
41
- config.logger.warn("[BraspagRest] #{e}") if config.log_enabled?
52
+ config.logger.warn("[BraspagRest][Error] message: #{e.message}, status: #{e.http_code}, body: #{e.http_body.inspect}") if config.log_enabled?
42
53
  BraspagRest::Response.new(e.response)
43
54
  rescue RestClient::Exception => e
44
- config.logger.error("[BraspagRest] #{e}") if config.log_enabled?
55
+ config.logger.error("[BraspagRest][Error] message: #{e.message}, status: #{e.http_code}, body: #{e.http_body.inspect}") if config.log_enabled?
45
56
  raise
46
57
  end
47
58
 
@@ -7,7 +7,7 @@ module BraspagRest
7
7
  end
8
8
 
9
9
  def success?
10
- (200..207).include?(@gateway_response.code)
10
+ (200..207).include?(@gateway_response.code) rescue false
11
11
  end
12
12
 
13
13
  def parsed_body
@@ -1,3 +1,3 @@
1
1
  module BraspagRest
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
metadata CHANGED
@@ -1,111 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: braspag-rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dinda Dev Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-05 00:00:00.000000000 Z
11
+ date: 2015-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.8'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.8'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: hashie
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '3.4'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.4'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.10'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.10'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '10.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '10.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '3'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '3'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: pry
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: pry-nav
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  description: Gem to use Braspag gateway in his REST version
@@ -117,9 +117,9 @@ executables:
117
117
  extensions: []
118
118
  extra_rdoc_files: []
119
119
  files:
120
- - .gitignore
121
- - .rspec
122
- - .travis.yml
120
+ - ".gitignore"
121
+ - ".rspec"
122
+ - ".travis.yml"
123
123
  - Gemfile
124
124
  - LICENSE.txt
125
125
  - README.md
@@ -149,12 +149,12 @@ require_paths:
149
149
  - lib
150
150
  required_ruby_version: !ruby/object:Gem::Requirement
151
151
  requirements:
152
- - - '>='
152
+ - - ">="
153
153
  - !ruby/object:Gem::Version
154
154
  version: '0'
155
155
  required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - '>='
157
+ - - ">="
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0'
160
160
  requirements: []