fintecture 0.3.1 → 0.4.0

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 +1 -1
  8. data/LICENSE.txt +674 -674
  9. data/README.md +407 -404
  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 -48
  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 +72 -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 +6 -6
data/Rakefile CHANGED
@@ -1,8 +1,8 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
5
-
6
- RSpec::Core::RakeTask.new(:spec)
7
-
8
- task default: :spec
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
data/bin/console CHANGED
@@ -1,15 +1,15 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'bundler/setup'
5
- require 'fintecture'
6
-
7
- # You can add fixtures and/or initialization code here to make experimenting
8
- # with your gem easier. You can also use a different console, if you like.
9
-
10
- # (If you use this, don't forget to add pry to your Gemfile!)
11
- # require "pry"
12
- # Pry.start
13
-
14
- require 'irb'
15
- IRB.start(__FILE__)
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'fintecture'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
data/bin/setup CHANGED
@@ -1,8 +1,8 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/exemples/ais.rb CHANGED
@@ -1,53 +1,53 @@
1
- # frozen_string_literal: true
2
-
3
- require './lib/fintecture'
4
-
5
- config = JSON.parse(File.read('./exemples/config_ais.json'))
6
-
7
- ais_client = Fintecture::AisClient.new({
8
- environment: config['environment'],
9
- app_id: config['app_id'],
10
- app_secret: config['app_secret'],
11
- private_key: config['private_key']
12
- })
13
-
14
- # ######################## AIS ########################
15
-
16
- # ------------ Connect ------------
17
- connect_response = ais_client.connect 'ok', 'https://www.google.fr'
18
- connect_id = connect_response['meta']['connect_id']
19
- url = connect_response['meta']['url']
20
-
21
- puts "Connect url => #{url}"
22
-
23
- # Put the return of connect url here
24
- customer_id = 'c84e6a2c66862f6ce169a11262b28f4c'
25
- code = '173535d0acc16271e7942cc6e1772a5b'
26
-
27
- # ------------ Get access token ------------
28
- ais_client.generate_token code
29
- ais_client.generate_refresh_token
30
- # ------------ Authorize ------------
31
- puts ais_client.authorize app_id_auth: true, provider_id: 'agfbfr', redirect_uri: 'https://www.google.fr', state: 'ok',
32
- x_psu_id: nil, x_psu_ip_address: nil
33
- # ------------ Authorize decoupled ------------
34
- puts ais_client.authorize_decoupled app_id_auth: false, provider_id: 'agfbfr', polling_id: '1234'
35
- # ------------ Get accounts ------------
36
- accounts_response = ais_client.accounts customer_id: customer_id, account_id: nil, remove_nulls: nil, withBalances: nil
37
- account = accounts_response['data'].first
38
- account_id = account['id']
39
- # ------------ Get transactions ------------
40
- transactions_filters = {
41
- "filter[date_to]": '2020-01-01',
42
- 'filter[date_from]': 'max'
43
- }
44
- transactions_response = ais_client.transactions customer_id: customer_id, account_id: account_id, remove_nulls: true,
45
- convert_dates: true, filters: transactions_filters
46
- transaction = transactions_response['data'].first
47
- puts transaction
48
- # ------------ Get account holders ------------
49
- # Caution the hasAccountholders field in db must have a value = 1.
50
- puts ais_client.account_holders customer_id: customer_id, remove_nulls: nil
51
- # ------------ Delete customer ------------
52
- # Customer not found if customer you don't use the api before
53
- puts ais_client.delete_customer customer_id: customer_id
1
+ # frozen_string_literal: true
2
+
3
+ require './lib/fintecture'
4
+
5
+ config = JSON.parse(File.read('./exemples/config_ais.json'))
6
+
7
+ ais_client = Fintecture::AisClient.new({
8
+ environment: config['environment'],
9
+ app_id: config['app_id'],
10
+ app_secret: config['app_secret'],
11
+ private_key: config['private_key']
12
+ })
13
+
14
+ # ######################## AIS ########################
15
+
16
+ # ------------ Connect ------------
17
+ connect_response = ais_client.connect 'ok', 'https://www.google.fr'
18
+ connect_id = connect_response['meta']['connect_id']
19
+ url = connect_response['meta']['url']
20
+
21
+ puts "Connect url => #{url}"
22
+
23
+ # Put the return of connect url here
24
+ customer_id = 'c84e6a2c66862f6ce169a11262b28f4c'
25
+ code = '173535d0acc16271e7942cc6e1772a5b'
26
+
27
+ # ------------ Get access token ------------
28
+ ais_client.generate_token code
29
+ ais_client.generate_refresh_token
30
+ # ------------ Authorize ------------
31
+ puts ais_client.authorize app_id_auth: true, provider_id: 'agfbfr', redirect_uri: 'https://www.google.fr', state: 'ok',
32
+ x_psu_id: nil, x_psu_ip_address: nil
33
+ # ------------ Authorize decoupled ------------
34
+ puts ais_client.authorize_decoupled app_id_auth: false, provider_id: 'agfbfr', polling_id: '1234'
35
+ # ------------ Get accounts ------------
36
+ accounts_response = ais_client.accounts customer_id: customer_id, account_id: nil, remove_nulls: nil, withBalances: nil
37
+ account = accounts_response['data'].first
38
+ account_id = account['id']
39
+ # ------------ Get transactions ------------
40
+ transactions_filters = {
41
+ "filter[date_to]": '2020-01-01',
42
+ 'filter[date_from]': 'max'
43
+ }
44
+ transactions_response = ais_client.transactions customer_id: customer_id, account_id: account_id, remove_nulls: true,
45
+ convert_dates: true, filters: transactions_filters
46
+ transaction = transactions_response['data'].first
47
+ puts transaction
48
+ # ------------ Get account holders ------------
49
+ # Caution the hasAccountholders field in db must have a value = 1.
50
+ puts ais_client.account_holders customer_id: customer_id, remove_nulls: nil
51
+ # ------------ Delete customer ------------
52
+ # Customer not found if customer you don't use the api before
53
+ puts ais_client.delete_customer customer_id: customer_id
@@ -1,8 +1,8 @@
1
- {
2
- "customer_id" : "the_customer_id_here",
3
- "code" : "the_code_here",
4
- "environment": "test",
5
- "app_id": "your_app_id_here",
6
- "app_secret": "your_app_secret_here",
7
- "private_key": "your_private_key here"
1
+ {
2
+ "customer_id" : "the_customer_id_here",
3
+ "code" : "the_code_here",
4
+ "environment": "test",
5
+ "app_id": "your_app_id_here",
6
+ "app_secret": "your_app_secret_here",
7
+ "private_key": "your_private_key here"
8
8
  }
@@ -1,6 +1,6 @@
1
- {
2
- "environment": "test",
3
- "app_id": "your_app_id_here",
4
- "app_secret": "your_app_secret_here",
5
- "private_key": "your_private_key here"
1
+ {
2
+ "environment": "local",
3
+ "app_id": "043e25e7-92b7-4871-a941-3fb4b0fac07c",
4
+ "app_secret": "7c6ec508-600c-43ff-9f89-514ac65c9f67",
5
+ "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCgteF+uhVdSltL\nKYtOwt+PWVu3U1zfPcKFy/Hf2htCyvxXZ4ibR5rXsCDFqpHiyUtAN5YYcaWlqwg2\n2EapV6Z+MGZHff+PVOxDQco08nrfHGESn8akHU1/REKak9WX/tuhmNvqjOirQ8WO\n30AR/Bsz5j09/epOFF925V0MIpFxF7hndQ+YKyzc1VNWiqC5e/MmO6i3ZiwLUABv\n+yMyIOmObbuCc2itMRnQPcpWDi6rLGSnOEJisXdzeYQk8cMiMwtxlATOikA/fQBF\norBHmhuS5IykG6EVRL6wacg3Q5sl0mm1r5oYAf3QPOp/eg08lJPO9KiUDgp8/X7s\nHiZ1CvpVAgMBAAECggEAEcrBCa4hQmBChio1xYT2iiC68itU+1QTjot7Hiy/2t+t\nGyIXshU1084oeqm9F+3wGk5tHAys6Y/rS2MbQ5E0GgFSuXR+EAi3VWTZtY3ow32Z\nU54DuFSUKVRNyV43henNt/C73BY4hgltPDmEFtmhy1egjRXo1DcWMIwJBphnIK1y\nJzD1IDJeCSng3Wa6tp9rhI0Lc5Iu7A9kKW6ACqlaGDziySuF+KI4qHa8DBd3WKIC\nWp0LOyVWzKIAHd9pLul7udBiZMOk7teYpho/OOQGMR7WZ1dhMXsisE+k/o0NGP/w\noHPXB6EbgXCXXDKghS182SwZ81KE5FfmABQ984CYWwKBgQDS7uDCfcNzy5/TJKfO\nFDO7ax3v6q/0XGrE1KfkEj6MBfwKIkA/LQEu4JJAYzAxMjvl3whqWwUI2ULiuKEh\nDMyL7OMUs2CQt1wkpxjSyQhtAmxyiVC7DJQSsGuVdR7Q9KconmaIXtE+IzYwr0k8\n4jmRsRfRlipxoQvj+reFFTYygwKBgQDDDAsJcQJKxQjmvJmffVqhehGRDHJilFVf\ntUVB8QgKB/6z7o7k+Xe6Jm8ZAxjc63mbka1n7WcH+yl/CzIp7n6OgNvn7sZWefqF\nyPP8nBM4/o2JME45CyF3rSKnL/HRQ76TjW8EcLIKZ6NAN0EkedQDK2VLcqk/hqcy\nnDfBTB+oRwKBgG2jrv5JQpvg3q1wYyzSAWXMst3u/hClLPYslywMc6hyv+RAk2aD\nLRdBsaN4KyeXNd0xRf2KXB6SV5rjXxV/wp6EvjAXYP034dRHara9ufx3gwkx6N2h\nFyJzwygHncH9ORn6487EgjyrLtK1efsEl+nrxDazuFIh5L1Wp6esM+SjAoGBAKP2\n2sxcEPYz/xChGW+m3GqEiIHr+bh/Q+nKI+eULRLpt6cg80TvpkN5jclz/hGxbjBm\nXWTRgNyHulGPYuM3F3LKRpMJ+fe2YPDYhqsjtVEjRG5AinGPttm5VTlAp8ModOvr\naJlN942ho+4WxQ9Zzu2/LE8pm7fIhYOZKZG4YaB/AoGAZvY7c/GPbpfdHuSAe5qH\nw3+39bJ0qv8s51V40hjOTMalux3YF5LRG+rDFDhUem9qkdfMIrVAm374w5AVfz6H\nQ60iR+ebz0kkpqHhsyHk2IAwamPPtbNAZhqCRoVvVJWHui7zD3v2jdb2nGbk3oXc\n8BeFbmwg3pKBHmMBAZTzTgg=\n-----END PRIVATE KEY-----"
6
6
  }
data/exemples/pis.rb CHANGED
@@ -1,148 +1,148 @@
1
- # frozen_string_literal: true
2
-
3
- require './lib/fintecture'
4
-
5
- config = JSON.parse(File.read('./exemples/config_pis.json'))
6
-
7
- pis_client = Fintecture::PisClient.new({
8
- environment: config['environment'],
9
- app_id: config['app_id'],
10
- app_secret: config['app_secret'],
11
- private_key: config['private_key']
12
- })
13
-
14
- payload_connect = {
15
- meta: {
16
- psu_name: 'John Doe', # Mandatory
17
- psu_email: 'John.Doe@gmail.com', # Mandatory
18
- psu_phone: '666777888', # Mandatory
19
- psu_phone_prefix: '', # Optionnal
20
- psu_ip: '127.0.0.1', # Optionnal (Plante la signature)
21
- psu_form: '', # Mandatory - if no fixed beneficiary
22
- psu_incorporation: '', # Mandatory - if no fixed beneficiary
23
- psu_address: {
24
- street: 'Main St.', # Mandatory
25
- # number: '123', # Optional
26
- complement: '2nd floor', # Optional
27
- city: 'Paris', # Mandatory
28
- zip: '75000', # Mandatory
29
- country: 'fr' # Mandatory
30
- }
31
- },
32
- data: {
33
- type: 'PIS',
34
- attributes: {
35
- amount: '123', # Mandatory
36
- currency: 'EUR', # Mandatory
37
- communication: 'Thanks Mom!' # Mandatory
38
- # execution_date: '2021-09-31', # Optional
39
- # beneficiary: { # Optional
40
- # name: "Dummy SA", # Conditional
41
- # iban: "FR1420041010050500013M02606", # Conditional
42
- # swift_bic: "FTSBSESSXXX", # Conditional
43
- # street: "road of somewhere", # Conditional
44
- # number: "2", # Optional
45
- # complement:"", # Optional
46
- # city: "Paris", # Conditional
47
- # zip: "93160", # Conditional
48
- # country: "FR", # Conditional
49
- # form: "", # Mandatory if no fixed beneficiary
50
- # incorporation: "" # Mandatory if no fixed beneficiary
51
- # },
52
- # debited_account_id: 'FR1420041010050500013M02606', # Optional
53
- # debited_account_type: 'iban', # Mandatory if debited_account_id exist
54
- # end_to_end_id: '5f78e902907e4209aa8df63659b05d24',
55
- # scheme: 'AUTO' # Optional
56
- }
57
- }
58
- }
59
-
60
- payload_request_to_pay = {
61
- meta: {
62
- psu_name: 'John Doe', # Mandatory
63
- psu_email: 'John.Doe@gmail.com', # Mandatory
64
- psu_phone: '666777888', # Mandatory
65
- psu_phone_prefix: '+33', # Optionnal
66
- psu_address: {
67
- street: 'Main St.', # Mandatory
68
- number: '123', # Optional
69
- city: 'Paris', # Mandatory
70
- zip: '75000', # Mandatory
71
- country: 'fr' # Mandatory
72
- },
73
- expirary: 86_400, # Optional
74
- cc: 'John.Doe@gmail.com', # Optional
75
- bcc: 'John.Doe@gmail.com' # Optional
76
- },
77
- data: {
78
- type: 'REQUEST_TO_PAY',
79
- attributes: {
80
- amount: 123, # Mandatory
81
- currency: 'EUR', # Mandatory
82
- communication: 'Thanks Mom!' # Mandatory
83
- }
84
- }
85
- }
86
-
87
- payload_initiate = {
88
- "meta": {
89
- "psu_name": 'Bob McCheese',
90
- "psu_email": 'John.Doe@gmail.com',
91
- "psu_phone": '09743593535',
92
- "psu_address": {
93
- "street": 'route de la france',
94
- "number": '33',
95
- "complement": '2nd floor',
96
- "zip": '12001',
97
- "city": 'Paris',
98
- "country": 'FR'
99
- }
100
- },
101
- "data": {
102
- "type": 'PIS',
103
- "attributes": {
104
- "amount": '149.30',
105
- "currency": 'EUR',
106
- "communication": 'Order 6543321'
107
- # "beneficiary": {
108
- # "name": "Bob Smith",
109
- # "street": "road of somewhere",
110
- # "number": "2",
111
- # "city": "Paris",
112
- # "zip": "93160",
113
- # "country": "FR",
114
- # "iban": "FR1420041010050500013M02606",
115
- # "swift_bic": "BANKFRXXXXX"
116
- # }
117
- }
118
- }
119
- }
120
-
121
- paramsProviders = {
122
- 'filter[country]': 'FR',
123
- 'filter[pis]': 'SEPA',
124
- 'filter[ais]': 'Accounts',
125
- 'filter[psu_type]': 'retail',
126
- 'filter[auth_model]': 'redirect',
127
- 'sort[name]': 'ASC',
128
- 'sort[full_name]': 'ASC',
129
- 'sort[country]': 'ASC',
130
- 'sort[provider_id]': 'ASC'
131
- }
132
-
133
- # ######################## PIS ########################
134
- # ------------ Get access token ------------
135
- pis_client.generate_token
136
- # ------------ Connect ------------
137
- puts pis_client.connect payload_connect, 'ok', 'https://www.google.fr'
138
- # ------------ Request to pay ------------
139
- puts pis_client.request_to_pay payload_request_to_pay, 'fr', 'https://www.google.fr'
140
- # ------------ Get payments ------------
141
- puts pis_client.payments '7f47d3675f5d4964bc416b43af63b06e'
142
- # ------------ Initiate ------------
143
- puts pis_client.initiate payload_initiate, 'cmcifrpp', 'https://www.google.fr', 'ok'
144
- # ------------ Refund ------------
145
- puts pis_client.refund '7f47d3675f5d4964bc416b43af63b06e', 1
146
- # ------------ settlements ------------
147
- pis_client.settlements
148
- pis_client.settlements '127335fdeb073e0eb2313ba0bd71ad44'
1
+ # frozen_string_literal: true
2
+
3
+ require './lib/fintecture'
4
+
5
+ config = JSON.parse(File.read('./exemples/config_pis.json'))
6
+
7
+ pis_client = Fintecture::PisClient.new({
8
+ environment: config['environment'],
9
+ app_id: config['app_id'],
10
+ app_secret: config['app_secret'],
11
+ private_key: config['private_key']
12
+ })
13
+
14
+ payload_connect = {
15
+ meta: {
16
+ psu_name: 'John Doe', # Mandatory
17
+ psu_email: 'John.Doe@gmail.com', # Mandatory
18
+ psu_phone: '666777888', # Mandatory
19
+ psu_phone_prefix: '', # Optionnal
20
+ psu_ip: '127.0.0.1', # Optionnal (Plante la signature)
21
+ psu_form: '', # Mandatory - if no fixed beneficiary
22
+ psu_incorporation: '', # Mandatory - if no fixed beneficiary
23
+ psu_address: {
24
+ street: 'Main St.', # Mandatory
25
+ # number: '123', # Optional
26
+ complement: '2nd floor', # Optional
27
+ city: 'Paris', # Mandatory
28
+ zip: '75000', # Mandatory
29
+ country: 'fr' # Mandatory
30
+ }
31
+ },
32
+ data: {
33
+ type: 'PIS',
34
+ attributes: {
35
+ amount: '123', # Mandatory
36
+ currency: 'EUR', # Mandatory
37
+ communication: 'Thanks Mom!' # Mandatory
38
+ # execution_date: '2021-09-31', # Optional
39
+ # beneficiary: { # Optional
40
+ # name: "Dummy SA", # Conditional
41
+ # iban: "FR1420041010050500013M02606", # Conditional
42
+ # swift_bic: "FTSBSESSXXX", # Conditional
43
+ # street: "road of somewhere", # Conditional
44
+ # number: "2", # Optional
45
+ # complement:"", # Optional
46
+ # city: "Paris", # Conditional
47
+ # zip: "93160", # Conditional
48
+ # country: "FR", # Conditional
49
+ # form: "", # Mandatory if no fixed beneficiary
50
+ # incorporation: "" # Mandatory if no fixed beneficiary
51
+ # },
52
+ # debited_account_id: 'FR1420041010050500013M02606', # Optional
53
+ # debited_account_type: 'iban', # Mandatory if debited_account_id exist
54
+ # end_to_end_id: '5f78e902907e4209aa8df63659b05d24',
55
+ # scheme: 'AUTO' # Optional
56
+ }
57
+ }
58
+ }
59
+
60
+ payload_request_to_pay = {
61
+ meta: {
62
+ psu_name: 'John Doe', # Mandatory
63
+ psu_email: 'John.Doe@gmail.com', # Mandatory
64
+ psu_phone: '666777888', # Mandatory
65
+ psu_phone_prefix: '+33', # Optionnal
66
+ psu_address: {
67
+ street: 'Main St.', # Mandatory
68
+ number: '123', # Optional
69
+ city: 'Paris', # Mandatory
70
+ zip: '75000', # Mandatory
71
+ country: 'fr' # Mandatory
72
+ },
73
+ expirary: 86_400, # Optional
74
+ cc: 'John.Doe@gmail.com', # Optional
75
+ bcc: 'John.Doe@gmail.com' # Optional
76
+ },
77
+ data: {
78
+ type: 'REQUEST_TO_PAY',
79
+ attributes: {
80
+ amount: 123, # Mandatory
81
+ currency: 'EUR', # Mandatory
82
+ communication: 'Thanks Mom!' # Mandatory
83
+ }
84
+ }
85
+ }
86
+
87
+ payload_initiate = {
88
+ "meta": {
89
+ "psu_name": 'Bob McCheese',
90
+ "psu_email": 'John.Doe@gmail.com',
91
+ "psu_phone": '09743593535',
92
+ "psu_address": {
93
+ "street": 'route de la france',
94
+ "number": '33',
95
+ "complement": '2nd floor',
96
+ "zip": '12001',
97
+ "city": 'Paris',
98
+ "country": 'FR'
99
+ }
100
+ },
101
+ "data": {
102
+ "type": 'PIS',
103
+ "attributes": {
104
+ "amount": '149.30',
105
+ "currency": 'EUR',
106
+ "communication": 'Order 6543321'
107
+ # "beneficiary": {
108
+ # "name": "Bob Smith",
109
+ # "street": "road of somewhere",
110
+ # "number": "2",
111
+ # "city": "Paris",
112
+ # "zip": "93160",
113
+ # "country": "FR",
114
+ # "iban": "FR1420041010050500013M02606",
115
+ # "swift_bic": "BANKFRXXXXX"
116
+ # }
117
+ }
118
+ }
119
+ }
120
+
121
+ paramsProviders = {
122
+ 'filter[country]': 'FR',
123
+ 'filter[pis]': 'SEPA',
124
+ 'filter[ais]': 'Accounts',
125
+ 'filter[psu_type]': 'retail',
126
+ 'filter[auth_model]': 'redirect',
127
+ 'sort[name]': 'ASC',
128
+ 'sort[full_name]': 'ASC',
129
+ 'sort[country]': 'ASC',
130
+ 'sort[provider_id]': 'ASC'
131
+ }
132
+
133
+ # ######################## PIS ########################
134
+ # ------------ Get access token ------------
135
+ pis_client.generate_token
136
+ # # ------------ Connect ------------
137
+ # puts pis_client.connect payload_connect, 'ok', 'https://www.google.fr'
138
+ # # ------------ Request to pay ------------
139
+ # puts pis_client.request_to_pay payload_request_to_pay, 'fr', 'https://www.google.fr'
140
+ # # ------------ Get payments ------------
141
+ # puts pis_client.payments '7f47d3675f5d4964bc416b43af63b06e'
142
+ # # ------------ Initiate ------------
143
+ # puts pis_client.initiate payload_initiate, 'cmcifrpp', 'https://www.google.fr', 'ok'
144
+ # # ------------ Refund ------------
145
+ # puts pis_client.refund '7f47d3675f5d4964bc416b43af63b06e', 1
146
+ # # ------------ settlements ------------
147
+ puts pis_client.settlements
148
+ puts pis_client.settlements 'e76778c4-d987-4b6a-901a-07686b9c7c9c', true
@@ -1,23 +1,23 @@
1
- # frozen_string_literal: true
2
-
3
- require './lib/fintecture'
4
-
5
- # ------------ Test class -------------
6
- config = JSON.parse(File.read('./exemples/config_pis.json'))
7
-
8
- pis_client = Fintecture::PisClient.new({
9
- environment: config['environment'],
10
- app_id: config['app_id'],
11
- app_secret: config['app_secret'],
12
- private_key: config['private_key']
13
- })
14
-
15
- # ######################## RESSOURCES ########################
16
- # ------------ Get providers ------------
17
- puts pis_client.providers provider_id: 'agfbfr'
18
- puts pis_client.providers paramsProviders: paramsProviders
19
- # ------------ Get applications ------------
20
- puts pis_client.applications
21
- # ------------ Get test accounts ------------
22
- puts pis_client.test_accounts
23
- puts pis_client.test_accounts 'bbvaes'
1
+ # frozen_string_literal: true
2
+
3
+ require './lib/fintecture'
4
+
5
+ # ------------ Test class -------------
6
+ config = JSON.parse(File.read('./exemples/config_pis.json'))
7
+
8
+ pis_client = Fintecture::PisClient.new({
9
+ environment: config['environment'],
10
+ app_id: config['app_id'],
11
+ app_secret: config['app_secret'],
12
+ private_key: config['private_key']
13
+ })
14
+
15
+ # ######################## RESSOURCES ########################
16
+ # ------------ Get providers ------------
17
+ puts pis_client.providers provider_id: 'agfbfr'
18
+ puts pis_client.providers paramsProviders: paramsProviders
19
+ # ------------ Get applications ------------
20
+ puts pis_client.applications
21
+ # ------------ Get test accounts ------------
22
+ puts pis_client.test_accounts
23
+ puts pis_client.test_accounts 'bbvaes'
data/fintecture.gemspec CHANGED
@@ -1,44 +1,44 @@
1
- # frozen_string_literal: true
2
-
3
- lib = File.expand_path('lib', __dir__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require 'fintecture/version'
6
-
7
- Gem::Specification.new do |spec|
8
- spec.name = 'fintecture'
9
- spec.version = Fintecture::VERSION
10
- spec.authors = ['Fintecture']
11
- spec.email = ['alvaro.fernandez@nazaries.com']
12
-
13
- spec.summary = 'Short summary'
14
- spec.description = 'Longer summary'
15
- spec.homepage = 'http://fintecture.com'
16
- spec.license = 'GPL-3.0'
17
-
18
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
19
- # to allow pushing to a single host or delete this section to allow pushing to any host.
20
- if spec.respond_to?(:metadata)
21
- # spec.metadata["allowed_push_host"] = 'http://mygemserver.com'
22
-
23
- spec.metadata['homepage_uri'] = spec.homepage
24
- spec.metadata['source_code_uri'] = 'https://github.com/Fintecture/fintecture-sdk-ruby'
25
- # spec.metadata["changelog_uri"] = spec.homepage
26
- else
27
- raise 'RubyGems 2.0 or newer is required to protect against ' \
28
- 'public gem pushes.'
29
- end
30
-
31
- # Specify which files should be added to the gem when it is released.
32
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
33
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
34
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
35
- end
36
- spec.bindir = 'exe'
37
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
38
- spec.require_paths = ['lib']
39
-
40
- spec.add_development_dependency 'bundler', '~> 2.0'
41
- spec.add_development_dependency 'rake', '~> 10.0'
42
- spec.add_development_dependency 'rspec', '~> 3.0'
43
- spec.add_dependency 'faraday'
44
- end
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'fintecture/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'fintecture'
9
+ spec.version = Fintecture::VERSION
10
+ spec.authors = ['Fintecture']
11
+ spec.email = ['alvaro.fernandez@nazaries.com']
12
+
13
+ spec.summary = 'Short summary'
14
+ spec.description = 'Longer summary'
15
+ spec.homepage = 'http://fintecture.com'
16
+ spec.license = 'GPL-3.0'
17
+
18
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
19
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
20
+ if spec.respond_to?(:metadata)
21
+ # spec.metadata["allowed_push_host"] = 'http://mygemserver.com'
22
+
23
+ spec.metadata['homepage_uri'] = spec.homepage
24
+ spec.metadata['source_code_uri'] = 'https://github.com/Fintecture/fintecture-sdk-ruby'
25
+ # spec.metadata["changelog_uri"] = spec.homepage
26
+ else
27
+ raise 'RubyGems 2.0 or newer is required to protect against ' \
28
+ 'public gem pushes.'
29
+ end
30
+
31
+ # Specify which files should be added to the gem when it is released.
32
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
33
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
34
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
35
+ end
36
+ spec.bindir = 'exe'
37
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
38
+ spec.require_paths = ['lib']
39
+
40
+ spec.add_development_dependency 'bundler', '~> 2.0'
41
+ spec.add_development_dependency 'rake', '~> 10.0'
42
+ spec.add_development_dependency 'rspec', '~> 3.0'
43
+ spec.add_dependency 'faraday'
44
+ end