fintecture 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +17 -17
  3. data/.rspec +3 -3
  4. data/.travis.yml +7 -7
  5. data/CODE_OF_CONDUCT.md +74 -74
  6. data/Gemfile +8 -8
  7. data/Gemfile.lock +59 -59
  8. data/LICENSE.txt +674 -674
  9. data/README.md +407 -407
  10. data/Rakefile +8 -8
  11. data/bin/console +15 -15
  12. data/bin/setup +8 -8
  13. data/exemples/ais.rb +53 -53
  14. data/exemples/config_ais.json +7 -7
  15. data/exemples/config_pis.json +5 -5
  16. data/exemples/pis.rb +148 -148
  17. data/exemples/ressources.rb +23 -23
  18. data/fintecture.gemspec +44 -44
  19. data/lib/fintecture/ais_client.rb +94 -94
  20. data/lib/fintecture/api/ais/account_holders.rb +61 -61
  21. data/lib/fintecture/api/ais/accounts.rb +63 -63
  22. data/lib/fintecture/api/ais/authorize.rb +72 -72
  23. data/lib/fintecture/api/ais/authorize_decoupled.rb +68 -68
  24. data/lib/fintecture/api/ais/connect.rb +65 -65
  25. data/lib/fintecture/api/ais/delete_customer.rb +53 -53
  26. data/lib/fintecture/api/ais/transactions.rb +64 -64
  27. data/lib/fintecture/api/auth/authentication.rb +78 -78
  28. data/lib/fintecture/api/pis/connect.rb +77 -77
  29. data/lib/fintecture/api/pis/initiate.rb +52 -52
  30. data/lib/fintecture/api/pis/payments.rb +48 -48
  31. data/lib/fintecture/api/pis/refund.rb +67 -67
  32. data/lib/fintecture/api/pis/request_to_pay.rb +63 -63
  33. data/lib/fintecture/api/pis/settlements.rb +50 -50
  34. data/lib/fintecture/api/ressources/applications.rb +57 -57
  35. data/lib/fintecture/api/ressources/providers.rb +61 -61
  36. data/lib/fintecture/api/ressources/test_accounts.rb +60 -60
  37. data/lib/fintecture/base_url.rb +26 -26
  38. data/lib/fintecture/endpoints/ais.rb +17 -17
  39. data/lib/fintecture/endpoints/authentication.rb +13 -13
  40. data/lib/fintecture/endpoints/pis.rb +16 -16
  41. data/lib/fintecture/endpoints/ressources.rb +13 -13
  42. data/lib/fintecture/exceptions.rb +75 -72
  43. data/lib/fintecture/faraday/authentication/connection.rb +140 -140
  44. data/lib/fintecture/pis_client.rb +100 -100
  45. data/lib/fintecture/utils/constants.rb +11 -11
  46. data/lib/fintecture/utils/crypto.rb +75 -75
  47. data/lib/fintecture/utils/date.rb +15 -15
  48. data/lib/fintecture/utils/validation.rb +32 -32
  49. data/lib/fintecture/version.rb +5 -5
  50. data/lib/fintecture.rb +65 -65
  51. metadata +8 -8
@@ -1,50 +1,50 @@
1
- # frozen_string_literal: true
2
-
3
- require 'json'
4
- require 'faraday'
5
- require 'fintecture/endpoints/pis'
6
- require 'fintecture/base_url'
7
-
8
- module Fintecture
9
- module Pis
10
- class Settlements
11
- class << self
12
- # ------------ PUBLIC METHOD ------------
13
- def get(client, settlement_id, include_payments)
14
- @client = client
15
-
16
- # Do the get_payments request
17
- _request settlement_id, include_payments
18
- end
19
-
20
- private
21
-
22
- # ------------ REQUEST ------------
23
- def _request(settlement_id, include_payments)
24
- url = _endpoint
25
- url += "/#{settlement_id}" if settlement_id
26
- url += "?include=payments" if include_payments
27
-
28
- Fintecture::Faraday::Authentication::Connection.get(
29
- url: url,
30
- client: @client,
31
- custom_content_type: 'application/json',
32
- bearer: "Bearer #{@client.token}",
33
- secure_headers: true
34
- )
35
- end
36
-
37
- # ------------ API ENDPOINT ------------
38
- def _endpoint
39
- "#{_api_base_url}/#{Fintecture::Api::Endpoints::Pis::SETTLEMENTS}"
40
- end
41
-
42
- # ------------ BASE URL ------------
43
- def _api_base_url
44
- Fintecture::Api::BaseUrl::FINTECTURE_API_URL[@client.environment.to_sym]
45
- end
46
-
47
- end
48
- end
49
- end
50
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+ require 'faraday'
5
+ require 'fintecture/endpoints/pis'
6
+ require 'fintecture/base_url'
7
+
8
+ module Fintecture
9
+ module Pis
10
+ class Settlements
11
+ class << self
12
+ # ------------ PUBLIC METHOD ------------
13
+ def get(client, settlement_id, include_payments)
14
+ @client = client
15
+
16
+ # Do the get_payments request
17
+ _request settlement_id, include_payments
18
+ end
19
+
20
+ private
21
+
22
+ # ------------ REQUEST ------------
23
+ def _request(settlement_id, include_payments)
24
+ url = _endpoint
25
+ url += "/#{settlement_id}" if settlement_id
26
+ url += "?include=payments" if include_payments
27
+
28
+ Fintecture::Faraday::Authentication::Connection.get(
29
+ url: url,
30
+ client: @client,
31
+ custom_content_type: 'application/json',
32
+ bearer: "Bearer #{@client.token}",
33
+ secure_headers: true
34
+ )
35
+ end
36
+
37
+ # ------------ API ENDPOINT ------------
38
+ def _endpoint
39
+ "#{_api_base_url}/#{Fintecture::Api::Endpoints::Pis::SETTLEMENTS}"
40
+ end
41
+
42
+ # ------------ BASE URL ------------
43
+ def _api_base_url
44
+ Fintecture::Api::BaseUrl::FINTECTURE_API_URL[@client.environment.to_sym]
45
+ end
46
+
47
+ end
48
+ end
49
+ end
50
+ end
@@ -1,57 +1,57 @@
1
- # frozen_string_literal: true
2
-
3
- require 'base64'
4
- require 'json'
5
- require 'faraday'
6
- require 'fintecture/utils/validation'
7
- require 'fintecture/exceptions'
8
- require 'fintecture/utils/date'
9
- require 'fintecture/utils/constants'
10
-
11
- module Fintecture
12
- module Ressources
13
- class Applications
14
- class << self
15
- # ------------ PUBLIC METHOD ------------
16
- def get(client)
17
- @client = client
18
-
19
- # Do the request
20
- _request
21
- end
22
-
23
- private
24
-
25
- # ------------ REQUEST ------------
26
- def _request
27
- # Get the url request
28
- url = _endpoint
29
-
30
- # Build additional headers
31
- additional_headers = {}
32
- additional_headers['app_id'] = @client.app_id
33
-
34
- # Do connect request
35
- Fintecture::Faraday::Authentication::Connection.get(
36
- url: url,
37
- client: @client,
38
- custom_content_type: 'application/json',
39
- secure_headers: true,
40
- additional_headers: additional_headers
41
- )
42
- end
43
-
44
- # ------------ API ENDPOINT ------------
45
- def _endpoint
46
- "#{_api_base_url}/#{Fintecture::Api::Endpoints::Ressources::APPLICATION}"
47
- end
48
-
49
- # ------------ BASE URL ------------
50
- def _api_base_url
51
- Fintecture::Api::BaseUrl::FINTECTURE_API_URL[@client.environment.to_sym]
52
- end
53
-
54
- end
55
- end
56
- end
57
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'base64'
4
+ require 'json'
5
+ require 'faraday'
6
+ require 'fintecture/utils/validation'
7
+ require 'fintecture/exceptions'
8
+ require 'fintecture/utils/date'
9
+ require 'fintecture/utils/constants'
10
+
11
+ module Fintecture
12
+ module Ressources
13
+ class Applications
14
+ class << self
15
+ # ------------ PUBLIC METHOD ------------
16
+ def get(client)
17
+ @client = client
18
+
19
+ # Do the request
20
+ _request
21
+ end
22
+
23
+ private
24
+
25
+ # ------------ REQUEST ------------
26
+ def _request
27
+ # Get the url request
28
+ url = _endpoint
29
+
30
+ # Build additional headers
31
+ additional_headers = {}
32
+ additional_headers['app_id'] = @client.app_id
33
+
34
+ # Do connect request
35
+ Fintecture::Faraday::Authentication::Connection.get(
36
+ url: url,
37
+ client: @client,
38
+ custom_content_type: 'application/json',
39
+ secure_headers: true,
40
+ additional_headers: additional_headers
41
+ )
42
+ end
43
+
44
+ # ------------ API ENDPOINT ------------
45
+ def _endpoint
46
+ "#{_api_base_url}/#{Fintecture::Api::Endpoints::Ressources::APPLICATION}"
47
+ end
48
+
49
+ # ------------ BASE URL ------------
50
+ def _api_base_url
51
+ Fintecture::Api::BaseUrl::FINTECTURE_API_URL[@client.environment.to_sym]
52
+ end
53
+
54
+ end
55
+ end
56
+ end
57
+ end
@@ -1,61 +1,61 @@
1
- # frozen_string_literal: true
2
-
3
- require 'base64'
4
- require 'json'
5
- require 'faraday'
6
- require 'fintecture/utils/validation'
7
- require 'fintecture/exceptions'
8
- require 'fintecture/utils/date'
9
- require 'fintecture/utils/constants'
10
-
11
- module Fintecture
12
- module Ressources
13
- class Providers
14
- class << self
15
- # ------------ PUBLIC METHOD ------------
16
- def get(client, provider_id, paramsProviders)
17
- @client = client
18
-
19
- # Do the request
20
- _request provider_id, paramsProviders
21
- end
22
-
23
- private
24
-
25
- # ------------ REQUEST ------------
26
- def _request(provider_id, paramsProviders)
27
- # Get the url request
28
- url = _endpoint provider_id
29
-
30
- # Build additional headers
31
- additional_headers = {}
32
- additional_headers['app_id'] = @client.app_id
33
-
34
- # Build uri params
35
- query_string = ''
36
- query_string = "?#{paramsProviders.map { |key, value| "#{key}=#{value}" }.join('&')}" if paramsProviders
37
-
38
- # Do connect request
39
- Fintecture::Faraday::Authentication::Connection.get(
40
- url: url + query_string,
41
- client: @client,
42
- custom_content_type: 'application/json',
43
- secure_headers: true,
44
- additional_headers: additional_headers
45
- )
46
- end
47
-
48
- # ------------ API ENDPOINT ------------
49
- def _endpoint(provider_id)
50
- "#{_api_base_url}/#{Fintecture::Api::Endpoints::Ressources::PROVIDERS}/#{provider_id || ''}"
51
- end
52
-
53
- # ------------ BASE URL ------------
54
- def _api_base_url
55
- Fintecture::Api::BaseUrl::FINTECTURE_API_URL[@client.environment.to_sym]
56
- end
57
-
58
- end
59
- end
60
- end
61
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'base64'
4
+ require 'json'
5
+ require 'faraday'
6
+ require 'fintecture/utils/validation'
7
+ require 'fintecture/exceptions'
8
+ require 'fintecture/utils/date'
9
+ require 'fintecture/utils/constants'
10
+
11
+ module Fintecture
12
+ module Ressources
13
+ class Providers
14
+ class << self
15
+ # ------------ PUBLIC METHOD ------------
16
+ def get(client, provider_id, paramsProviders)
17
+ @client = client
18
+
19
+ # Do the request
20
+ _request provider_id, paramsProviders
21
+ end
22
+
23
+ private
24
+
25
+ # ------------ REQUEST ------------
26
+ def _request(provider_id, paramsProviders)
27
+ # Get the url request
28
+ url = _endpoint provider_id
29
+
30
+ # Build additional headers
31
+ additional_headers = {}
32
+ additional_headers['app_id'] = @client.app_id
33
+
34
+ # Build uri params
35
+ query_string = ''
36
+ query_string = "?#{paramsProviders.map { |key, value| "#{key}=#{value}" }.join('&')}" if paramsProviders
37
+
38
+ # Do connect request
39
+ Fintecture::Faraday::Authentication::Connection.get(
40
+ url: url + query_string,
41
+ client: @client,
42
+ custom_content_type: 'application/json',
43
+ secure_headers: true,
44
+ additional_headers: additional_headers
45
+ )
46
+ end
47
+
48
+ # ------------ API ENDPOINT ------------
49
+ def _endpoint(provider_id)
50
+ "#{_api_base_url}/#{Fintecture::Api::Endpoints::Ressources::PROVIDERS}/#{provider_id || ''}"
51
+ end
52
+
53
+ # ------------ BASE URL ------------
54
+ def _api_base_url
55
+ Fintecture::Api::BaseUrl::FINTECTURE_API_URL[@client.environment.to_sym]
56
+ end
57
+
58
+ end
59
+ end
60
+ end
61
+ end
@@ -1,60 +1,60 @@
1
- # frozen_string_literal: true
2
-
3
- require 'base64'
4
- require 'json'
5
- require 'faraday'
6
- require 'fintecture/utils/validation'
7
- require 'fintecture/exceptions'
8
- require 'fintecture/utils/date'
9
- require 'fintecture/utils/constants'
10
-
11
- module Fintecture
12
- module Ressources
13
- class TestAccounts
14
- class << self
15
- # ------------ PUBLIC METHOD ------------
16
- def get(client, provider_id)
17
- @client = client
18
-
19
- # Do the request
20
- _request provider_id
21
- end
22
-
23
- private
24
-
25
- # ------------ REQUEST ------------
26
- def _request(provider_id)
27
- # Get the url request
28
- url = _endpoint
29
-
30
- # Build additional headers
31
- additional_headers = {}
32
- additional_headers['app_id'] = @client.app_id
33
-
34
- # Build uri params
35
- query_string = ''
36
- query_string = "?filter[provider_id]=#{provider_id}" if provider_id
37
- # Do connect request
38
- Fintecture::Faraday::Authentication::Connection.get(
39
- url: url + query_string,
40
- client: @client,
41
- custom_content_type: 'application/json',
42
- secure_headers: true,
43
- additional_headers: additional_headers
44
- )
45
- end
46
-
47
- # ------------ API ENDPOINT ------------
48
- def _endpoint
49
- "#{_api_base_url}/#{Fintecture::Api::Endpoints::Ressources::TESTACCOUNTS}"
50
- end
51
-
52
- # ------------ BASE URL ------------
53
- def _api_base_url
54
- Fintecture::Api::BaseUrl::FINTECTURE_API_URL[@client.environment.to_sym]
55
- end
56
-
57
- end
58
- end
59
- end
60
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'base64'
4
+ require 'json'
5
+ require 'faraday'
6
+ require 'fintecture/utils/validation'
7
+ require 'fintecture/exceptions'
8
+ require 'fintecture/utils/date'
9
+ require 'fintecture/utils/constants'
10
+
11
+ module Fintecture
12
+ module Ressources
13
+ class TestAccounts
14
+ class << self
15
+ # ------------ PUBLIC METHOD ------------
16
+ def get(client, provider_id)
17
+ @client = client
18
+
19
+ # Do the request
20
+ _request provider_id
21
+ end
22
+
23
+ private
24
+
25
+ # ------------ REQUEST ------------
26
+ def _request(provider_id)
27
+ # Get the url request
28
+ url = _endpoint
29
+
30
+ # Build additional headers
31
+ additional_headers = {}
32
+ additional_headers['app_id'] = @client.app_id
33
+
34
+ # Build uri params
35
+ query_string = ''
36
+ query_string = "?filter[provider_id]=#{provider_id}" if provider_id
37
+ # Do connect request
38
+ Fintecture::Faraday::Authentication::Connection.get(
39
+ url: url + query_string,
40
+ client: @client,
41
+ custom_content_type: 'application/json',
42
+ secure_headers: true,
43
+ additional_headers: additional_headers
44
+ )
45
+ end
46
+
47
+ # ------------ API ENDPOINT ------------
48
+ def _endpoint
49
+ "#{_api_base_url}/#{Fintecture::Api::Endpoints::Ressources::TESTACCOUNTS}"
50
+ end
51
+
52
+ # ------------ BASE URL ------------
53
+ def _api_base_url
54
+ Fintecture::Api::BaseUrl::FINTECTURE_API_URL[@client.environment.to_sym]
55
+ end
56
+
57
+ end
58
+ end
59
+ end
60
+ end
@@ -1,26 +1,26 @@
1
- module Fintecture
2
- module Api
3
- module BaseUrl
4
- FINTECTURE_OAUTH_URL = {
5
- local: 'http://host.docker.internal:3333/oauth',
6
- test: 'https://oauth-sandbox-test.fintecture.com/oauth',
7
- sandbox: 'https://api-sandbox.fintecture.com/oauth',
8
- production: 'https://api.fintecture.com/oauth'
9
- }
10
-
11
- FINTECTURE_API_URL = {
12
- local: 'http://host.docker.internal:3333',
13
- test: 'https://api-sandbox-test.fintecture.com',
14
- sandbox: 'https://api-sandbox.fintecture.com',
15
- production: 'https://api.fintecture.com'
16
- }
17
-
18
- FINTECTURE_CONNECT_URL = {
19
- local: 'http://localhost:4201',
20
- test: 'https://connect-test.fintecture.com',
21
- sandbox: 'https://connect-sandbox.fintecture.com',
22
- production: 'https://connect.fintecture.com'
23
- }
24
- end
25
- end
26
- end
1
+ module Fintecture
2
+ module Api
3
+ module BaseUrl
4
+ FINTECTURE_OAUTH_URL = {
5
+ local: 'http://localhost:3030/oauth',
6
+ test: 'https://oauth-sandbox-test.fintecture.com/oauth',
7
+ sandbox: 'https://api-sandbox.fintecture.com/oauth',
8
+ production: 'https://api.fintecture.com/oauth'
9
+ }
10
+
11
+ FINTECTURE_API_URL = {
12
+ local: 'http://localhost:3030',
13
+ test: 'https://api-sandbox-test.fintecture.com',
14
+ sandbox: 'https://api-sandbox.fintecture.com',
15
+ production: 'https://api.fintecture.com'
16
+ }
17
+
18
+ FINTECTURE_CONNECT_URL = {
19
+ local: 'http://localhost:4201',
20
+ test: 'https://connect-test.fintecture.com',
21
+ sandbox: 'https://connect-sandbox.fintecture.com',
22
+ production: 'https://connect.fintecture.com'
23
+ }
24
+ end
25
+ end
26
+ end
@@ -1,17 +1,17 @@
1
- # frozen_string_literal: true
2
-
3
- module Fintecture
4
- module Api
5
- module Endpoints
6
- module Ais
7
- # TODO: faire plus complet, avec un mot clef a remplacer
8
- CONNECT = 'ais/v2/connect'
9
- ACCOUNTS = 'ais/v1/customer'
10
- TRANSACTIONS = 'ais/v1/customer'
11
- ACCOUNTHOLDERS = 'ais/v1/customer'
12
- CUSTOMER = 'ais/v1/customer'
13
- AUTHORIZE = 'ais/v1/provider'
14
- end
15
- end
16
- end
17
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Fintecture
4
+ module Api
5
+ module Endpoints
6
+ module Ais
7
+ # TODO: faire plus complet, avec un mot clef a remplacer
8
+ CONNECT = 'ais/v2/connect'
9
+ ACCOUNTS = 'ais/v1/customer'
10
+ TRANSACTIONS = 'ais/v1/customer'
11
+ ACCOUNTHOLDERS = 'ais/v1/customer'
12
+ CUSTOMER = 'ais/v1/customer'
13
+ AUTHORIZE = 'ais/v1/provider'
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,13 +1,13 @@
1
- # frozen_string_literal: true
2
-
3
- module Fintecture
4
- module Api
5
- module Endpoints
6
- module Authentication
7
- OAUTH_TOKEN_AUTHORIZE = '/token/authorize'
8
- OAUTH_ACCESS_TOKEN = '/accesstoken'
9
- OAUTH_REFRESH_TOKEN = '/refreshtoken'
10
- end
11
- end
12
- end
13
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Fintecture
4
+ module Api
5
+ module Endpoints
6
+ module Authentication
7
+ OAUTH_TOKEN_AUTHORIZE = '/token/authorize'
8
+ OAUTH_ACCESS_TOKEN = '/accesstoken'
9
+ OAUTH_REFRESH_TOKEN = '/refreshtoken'
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,16 +1,16 @@
1
- # frozen_string_literal: true
2
-
3
- module Fintecture
4
- module Api
5
- module Endpoints
6
- module Pis
7
- INITIATE = 'pis/v2/provider'
8
- REFUND = 'pis/v2/refund'
9
- REQUEST_TO_PAY = 'pis/v2/request-to-pay'
10
- PAYMENTS = 'pis/v2/payments'
11
- CONNECT = 'pis/v2/connect'
12
- SETTLEMENTS = 'pis/v2/settlements'
13
- end
14
- end
15
- end
16
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Fintecture
4
+ module Api
5
+ module Endpoints
6
+ module Pis
7
+ INITIATE = 'pis/v2/provider'
8
+ REFUND = 'pis/v2/refund'
9
+ REQUEST_TO_PAY = 'pis/v2/request-to-pay'
10
+ PAYMENTS = 'pis/v2/payments'
11
+ CONNECT = 'pis/v2/connect'
12
+ SETTLEMENTS = 'pis/v2/settlements'
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1,13 +1,13 @@
1
- # frozen_string_literal: true
2
-
3
- module Fintecture
4
- module Api
5
- module Endpoints
6
- module Ressources
7
- APPLICATION = 'res/v1/applications'
8
- PROVIDERS = 'res/v1/providers'
9
- TESTACCOUNTS = 'res/v1/testaccounts'
10
- end
11
- end
12
- end
13
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Fintecture
4
+ module Api
5
+ module Endpoints
6
+ module Ressources
7
+ APPLICATION = 'res/v1/applications'
8
+ PROVIDERS = 'res/v1/providers'
9
+ TESTACCOUNTS = 'res/v1/testaccounts'
10
+ end
11
+ end
12
+ end
13
+ end