fintecture 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 +4 -4
- data/.gitignore +17 -17
- data/.rspec +3 -3
- data/.travis.yml +7 -7
- data/CODE_OF_CONDUCT.md +74 -74
- data/Gemfile +8 -8
- data/Gemfile.lock +59 -59
- data/LICENSE.txt +674 -674
- data/README.md +407 -407
- data/Rakefile +8 -8
- data/bin/console +15 -15
- data/bin/setup +8 -8
- data/exemples/ais.rb +53 -53
- data/exemples/config_ais.json +7 -7
- data/exemples/config_pis.json +5 -5
- data/exemples/pis.rb +148 -148
- data/exemples/ressources.rb +23 -23
- data/fintecture.gemspec +44 -44
- data/lib/fintecture/ais_client.rb +94 -94
- data/lib/fintecture/api/ais/account_holders.rb +61 -61
- data/lib/fintecture/api/ais/accounts.rb +63 -63
- data/lib/fintecture/api/ais/authorize.rb +72 -72
- data/lib/fintecture/api/ais/authorize_decoupled.rb +68 -68
- data/lib/fintecture/api/ais/connect.rb +65 -65
- data/lib/fintecture/api/ais/delete_customer.rb +53 -53
- data/lib/fintecture/api/ais/transactions.rb +64 -64
- data/lib/fintecture/api/auth/authentication.rb +78 -78
- data/lib/fintecture/api/pis/connect.rb +77 -77
- data/lib/fintecture/api/pis/initiate.rb +52 -52
- data/lib/fintecture/api/pis/payments.rb +48 -48
- data/lib/fintecture/api/pis/refund.rb +67 -67
- data/lib/fintecture/api/pis/request_to_pay.rb +63 -63
- data/lib/fintecture/api/pis/settlements.rb +50 -50
- data/lib/fintecture/api/ressources/applications.rb +57 -57
- data/lib/fintecture/api/ressources/providers.rb +61 -61
- data/lib/fintecture/api/ressources/test_accounts.rb +60 -60
- data/lib/fintecture/base_url.rb +26 -26
- data/lib/fintecture/endpoints/ais.rb +17 -17
- data/lib/fintecture/endpoints/authentication.rb +13 -13
- data/lib/fintecture/endpoints/pis.rb +16 -16
- data/lib/fintecture/endpoints/ressources.rb +13 -13
- data/lib/fintecture/exceptions.rb +75 -72
- data/lib/fintecture/faraday/authentication/connection.rb +140 -140
- data/lib/fintecture/pis_client.rb +100 -100
- data/lib/fintecture/utils/constants.rb +11 -11
- data/lib/fintecture/utils/crypto.rb +75 -75
- data/lib/fintecture/utils/date.rb +15 -15
- data/lib/fintecture/utils/validation.rb +32 -32
- data/lib/fintecture/version.rb +5 -5
- data/lib/fintecture.rb +65 -65
- metadata +8 -8
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
|
data/exemples/config_ais.json
CHANGED
@@ -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
|
}
|
data/exemples/config_pis.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
{
|
2
|
-
"environment": "
|
3
|
-
"app_id": "
|
4
|
-
"app_secret": "
|
5
|
-
"private_key": "
|
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"
|
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
|
-
#
|
137
|
-
|
138
|
-
#
|
139
|
-
|
140
|
-
#
|
141
|
-
|
142
|
-
#
|
143
|
-
|
144
|
-
#
|
145
|
-
|
146
|
-
#
|
147
|
-
|
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', true
|
data/exemples/ressources.rb
CHANGED
@@ -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', '~>
|
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', '~> 13.0'
|
42
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
43
|
+
spec.add_dependency 'faraday'
|
44
|
+
end
|