fintecture 0.3.1 → 0.5.0

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: 77acbcb37a04dbcc33de02eb25b0d32757f90d4a749f7b60272aab916aac137d
4
- data.tar.gz: 9482370705358c0918d1508818c23b09982ad74d9acb9a6be2f16a034f5964ff
3
+ metadata.gz: 380ee5e078235f8c550e02cd80251b1d75a75a5cf9d3214fe3002fc64a8b45bb
4
+ data.tar.gz: fe2cb7a9cf8ae4bdc4ad9277bec47464ca2c5bd78fed48e76e586a2898b468bc
5
5
  SHA512:
6
- metadata.gz: 011ebea6e4a4d403443d9d37173aebefec6fa60b8e85a6a87a0930c7cf3c1006c99a52fec50aa0b3603cf5d2764a0524a5718ace73aec5c3b86cce0baf19aa63
7
- data.tar.gz: baa24c77cfa0c08e17730012f3647d994c0a0e52f415fe4f483a76e04b84fa6b654f59fdad37384eb38f12339bb57677c1acebdbe7336ca5381ec0fe2646c89d
6
+ metadata.gz: 53e538a15c2e0d543584cd6b82f63a10162f36565cdff4acea3cbc432826692e0ff7cbb89ddbf125a0c026ac6602d8126262f914977bc6de0381fe53738d4a73
7
+ data.tar.gz: f4ff6bae4d2b8fb0b38b05f28da8c991bf55eb9da97bf5b694499588b3433dc80fa3b6ecb0107a78948c6eccaf2fec78fe704cc40cf542869243336a9af856c3
data/CODE_OF_CONDUCT.md CHANGED
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
55
55
  ## Enforcement
56
56
 
57
57
  Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at alvaro.fernandez@nazaries.com. All
58
+ reported by contacting the project team at contact@fintecture.com. All
59
59
  complaints will be reviewed and investigated and will result in a response that
60
60
  is deemed necessary and appropriate to the circumstances. The project team is
61
61
  obligated to maintain confidentiality with regard to the reporter of an incident.
data/Gemfile.lock CHANGED
@@ -1,59 +1,59 @@
1
- PATH
2
- remote: .
3
- specs:
4
- fintecture (0.3.1)
5
- faraday
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- diff-lcs (1.3)
11
- faraday (1.8.0)
12
- faraday-em_http (~> 1.0)
13
- faraday-em_synchrony (~> 1.0)
14
- faraday-excon (~> 1.1)
15
- faraday-httpclient (~> 1.0.1)
16
- faraday-net_http (~> 1.0)
17
- faraday-net_http_persistent (~> 1.1)
18
- faraday-patron (~> 1.0)
19
- faraday-rack (~> 1.0)
20
- multipart-post (>= 1.2, < 3)
21
- ruby2_keywords (>= 0.0.4)
22
- faraday-em_http (1.0.0)
23
- faraday-em_synchrony (1.0.0)
24
- faraday-excon (1.1.0)
25
- faraday-httpclient (1.0.1)
26
- faraday-net_http (1.0.1)
27
- faraday-net_http_persistent (1.2.0)
28
- faraday-patron (1.0.0)
29
- faraday-rack (1.0.0)
30
- multipart-post (2.1.1)
31
- rake (10.5.0)
32
- rspec (3.9.0)
33
- rspec-core (~> 3.9.0)
34
- rspec-expectations (~> 3.9.0)
35
- rspec-mocks (~> 3.9.0)
36
- rspec-core (3.9.0)
37
- rspec-support (~> 3.9.0)
38
- rspec-expectations (3.9.0)
39
- diff-lcs (>= 1.2.0, < 2.0)
40
- rspec-support (~> 3.9.0)
41
- rspec-mocks (3.9.0)
42
- diff-lcs (>= 1.2.0, < 2.0)
43
- rspec-support (~> 3.9.0)
44
- rspec-support (3.9.0)
45
- ruby2_keywords (0.0.5)
46
-
47
- PLATFORMS
48
- ruby
49
- x64-mingw32
50
-
51
- DEPENDENCIES
52
- bundler (~> 2.0)
53
- faraday
54
- fintecture!
55
- rake (~> 10.0)
56
- rspec (~> 3.0)
57
-
58
- BUNDLED WITH
59
- 2.2.22
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ fintecture (0.5.0)
5
+ faraday
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ diff-lcs (1.3)
11
+ faraday (1.8.0)
12
+ faraday-em_http (~> 1.0)
13
+ faraday-em_synchrony (~> 1.0)
14
+ faraday-excon (~> 1.1)
15
+ faraday-httpclient (~> 1.0.1)
16
+ faraday-net_http (~> 1.0)
17
+ faraday-net_http_persistent (~> 1.1)
18
+ faraday-patron (~> 1.0)
19
+ faraday-rack (~> 1.0)
20
+ multipart-post (>= 1.2, < 3)
21
+ ruby2_keywords (>= 0.0.4)
22
+ faraday-em_http (1.0.0)
23
+ faraday-em_synchrony (1.0.0)
24
+ faraday-excon (1.1.0)
25
+ faraday-httpclient (1.0.1)
26
+ faraday-net_http (1.0.1)
27
+ faraday-net_http_persistent (1.2.0)
28
+ faraday-patron (1.0.0)
29
+ faraday-rack (1.0.0)
30
+ multipart-post (2.1.1)
31
+ rake (13.0.6)
32
+ rspec (3.9.0)
33
+ rspec-core (~> 3.9.0)
34
+ rspec-expectations (~> 3.9.0)
35
+ rspec-mocks (~> 3.9.0)
36
+ rspec-core (3.9.0)
37
+ rspec-support (~> 3.9.0)
38
+ rspec-expectations (3.9.0)
39
+ diff-lcs (>= 1.2.0, < 2.0)
40
+ rspec-support (~> 3.9.0)
41
+ rspec-mocks (3.9.0)
42
+ diff-lcs (>= 1.2.0, < 2.0)
43
+ rspec-support (~> 3.9.0)
44
+ rspec-support (3.9.0)
45
+ ruby2_keywords (0.0.5)
46
+
47
+ PLATFORMS
48
+ ruby
49
+ x64-mingw32
50
+
51
+ DEPENDENCIES
52
+ bundler (~> 2.0)
53
+ faraday
54
+ fintecture!
55
+ rake (~> 13.0)
56
+ rspec (~> 3.0)
57
+
58
+ BUNDLED WITH
59
+ 2.2.22
data/README.md CHANGED
@@ -121,11 +121,12 @@ Documentation => https://docs.fintecture.com/v2/#post-post-post-refund
121
121
  - An exemple of response in the right column in "Request Body" section
122
122
 
123
123
  ```ruby
124
- # refund (session_id, amount = nil)
124
+ # refund (session_id, amount = nil, user_id = nil))
125
125
  # session_id: string
126
126
  # amount: number
127
+ # user_id: string
127
128
 
128
- response = pis_client.refund "7f47d3675f5d4964bc416b43af63b06e", 5.75
129
+ response = pis_client.refund "7f47d3675f5d4964bc416b43af63b06e", 5.75, "8886aaa4-527d-4253-8951-a07d8bf4cf52"
129
130
  ```
130
131
  If the amount is not specified, refund the total
131
132
 
@@ -150,12 +151,15 @@ Documentation => https://docs.fintecture.com/v2/#get-get-get-settlements
150
151
  - An exemple of response in the right column in "Request Body" section
151
152
 
152
153
  ```ruby
153
- # settlements (settlement_id = nil)
154
+ # settlements (settlement_id = nil, include_payments = false)
154
155
  # settlement_id: string
156
+ # include_payments: boolean
155
157
 
156
158
  response = pis_client.settlements
157
159
  OR
158
160
  response = pis_client.settlements "127335fdeb073e0eb2313ba0bd71ad44"
161
+ OR
162
+ response = pis_client.settlements "127335fdeb073e0eb2313ba0bd71ad44", true
159
163
  ```
160
164
 
161
165
  ## AIS
data/exemples/pis.rb CHANGED
@@ -145,4 +145,4 @@ puts pis_client.initiate payload_initiate, 'cmcifrpp', 'https://www.google.fr',
145
145
  puts pis_client.refund '7f47d3675f5d4964bc416b43af63b06e', 1
146
146
  # ------------ settlements ------------
147
147
  pis_client.settlements
148
- pis_client.settlements '127335fdeb073e0eb2313ba0bd71ad44'
148
+ pis_client.settlements '127335fdeb073e0eb2313ba0bd71ad44', true
data/fintecture.gemspec CHANGED
@@ -38,7 +38,7 @@ Gem::Specification.new do |spec|
38
38
  spec.require_paths = ['lib']
39
39
 
40
40
  spec.add_development_dependency 'bundler', '~> 2.0'
41
- spec.add_development_dependency 'rake', '~> 10.0'
41
+ spec.add_development_dependency 'rake', '~> 13.0'
42
42
  spec.add_development_dependency 'rspec', '~> 3.0'
43
43
  spec.add_dependency 'faraday'
44
44
  end
@@ -9,11 +9,11 @@ module Fintecture
9
9
  class Refund
10
10
  class << self
11
11
  # ------------ PUBLIC METHOD ------------
12
- def generate(client, session_id, amount)
12
+ def generate(client, session_id, amount, user_id)
13
13
  @client = client
14
14
 
15
15
  # Build the request payload
16
- payload = _build_payload session_id, amount
16
+ payload = _build_payload session_id, amount, user_id
17
17
  # Do the _request request
18
18
  _request payload
19
19
  end
@@ -37,11 +37,12 @@ module Fintecture
37
37
  end
38
38
 
39
39
  # ------------ BUILD PAYLOAD ------------
40
- def _build_payload(session_id, amount)
40
+ def _build_payload(session_id, amount, user_id)
41
41
  # Return the payload
42
42
  {
43
43
  meta: {
44
- session_id: session_id
44
+ session_id: session_id,
45
+ user_id: user_id
45
46
  },
46
47
  data: {
47
48
  attributes: {
@@ -60,7 +61,6 @@ module Fintecture
60
61
  def _api_base_url
61
62
  Fintecture::Api::BaseUrl::FINTECTURE_API_URL[@client.environment.to_sym]
62
63
  end
63
-
64
64
  end
65
65
  end
66
66
  end
@@ -10,21 +10,23 @@ module Fintecture
10
10
  class Settlements
11
11
  class << self
12
12
  # ------------ PUBLIC METHOD ------------
13
- def get(client, settlement_id)
13
+ def get(client, settlement_id, include_payments)
14
14
  @client = client
15
15
 
16
16
  # Do the get_payments request
17
- _request settlement_id
17
+ _request settlement_id, include_payments
18
18
  end
19
19
 
20
20
  private
21
21
 
22
22
  # ------------ REQUEST ------------
23
- def _request(settlement_id)
23
+ def _request(settlement_id, include_payments)
24
24
  url = _endpoint
25
+ url += "/#{settlement_id}" if settlement_id
26
+ url += "?include=payments" if include_payments
25
27
 
26
28
  Fintecture::Faraday::Authentication::Connection.get(
27
- url: "#{url}/#{settlement_id}",
29
+ url: url,
28
30
  client: @client,
29
31
  custom_content_type: 'application/json',
30
32
  bearer: "Bearer #{@client.token}",
@@ -34,8 +34,9 @@ module Fintecture
34
34
  error_string += "\n code: #{code}"
35
35
  error_string += "\n id : #{log_id}"
36
36
 
37
- errors_array.each do |error|
38
- formated_error = error.map { |key, value| " #{key}: #{value}" }.join("\n")
37
+ errors_array.compact.each do |error|
38
+ formated_error = error
39
+ formated_error = error.map { |key, value| " #{key}: #{value}" }.join("\n") if error.is_a?(Hash)
39
40
  error_string += "\n\n#{formated_error}"
40
41
  end
41
42
  error_string += "\n\n"
@@ -55,7 +56,9 @@ module Fintecture
55
56
  error_string = "\nFintecture server errors : "
56
57
  error_string += "\n status: #{status} "
57
58
 
58
- formated_error = error.map { |key, value| " #{key}: #{value}" }.join("\n")
59
+ formated_error = error
60
+ formated_error = error.map { |key, value| " #{key}: #{value}" }.join("\n") if error.is_a?(Hash)
61
+
59
62
  error_string += "\n\n#{formated_error}"
60
63
 
61
64
  error_string += "\n\n"
@@ -67,14 +67,14 @@ module Fintecture
67
67
  JSON.parse res.body
68
68
  end
69
69
 
70
- def refund(session_id, amount = nil)
71
- res = Fintecture::Pis::Refund.generate self, session_id, amount
70
+ def refund(session_id, amount = nil, user_id = nil)
71
+ res = Fintecture::Pis::Refund.generate self, session_id, amount, user_id
72
72
 
73
73
  JSON.parse res.body
74
74
  end
75
75
 
76
- def settlements(settlement_id = nil)
77
- res = Fintecture::Pis::Settlements.get self, settlement_id
76
+ def settlements(settlement_id = nil, include_payments = false)
77
+ res = Fintecture::Pis::Settlements.get self, settlement_id, include_payments
78
78
 
79
79
  JSON.parse res.body
80
80
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Fintecture
4
- VERSION = '0.3.1'
4
+ VERSION = '0.5.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fintecture
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fintecture
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-05 00:00:00.000000000 Z
11
+ date: 2022-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '13.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '13.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -143,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  - !ruby/object:Gem::Version
144
144
  version: '0'
145
145
  requirements: []
146
- rubygems_version: 3.2.22
146
+ rubygems_version: 3.1.4
147
147
  signing_key:
148
148
  specification_version: 4
149
149
  summary: Short summary