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 +4 -4
- data/CODE_OF_CONDUCT.md +1 -1
- data/Gemfile.lock +59 -59
- data/README.md +7 -3
- data/exemples/pis.rb +1 -1
- data/fintecture.gemspec +1 -1
- data/lib/fintecture/api/pis/refund.rb +5 -5
- data/lib/fintecture/api/pis/settlements.rb +6 -4
- data/lib/fintecture/exceptions.rb +6 -3
- data/lib/fintecture/pis_client.rb +4 -4
- data/lib/fintecture/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 380ee5e078235f8c550e02cd80251b1d75a75a5cf9d3214fe3002fc64a8b45bb
|
4
|
+
data.tar.gz: fe2cb7a9cf8ae4bdc4ad9277bec47464ca2c5bd78fed48e76e586a2898b468bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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.
|
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 (
|
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 (~>
|
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', '~>
|
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:
|
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
|
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
|
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
|
data/lib/fintecture/version.rb
CHANGED
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.
|
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:
|
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: '
|
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: '
|
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.
|
146
|
+
rubygems_version: 3.1.4
|
147
147
|
signing_key:
|
148
148
|
specification_version: 4
|
149
149
|
summary: Short summary
|