figo 1.4.1 → 1.4.2

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
- SHA1:
3
- metadata.gz: a9056ee1be6196ae07dbda95d909564cb8e1684f
4
- data.tar.gz: dfcab9df9f7149bbf9f61b0c7913d5698e9bd61e
2
+ SHA256:
3
+ metadata.gz: 209529c7a79df7e73a3611deae5af168d3c4e461163fc2fe84416668c294415c
4
+ data.tar.gz: 699d2be89fbed3d3c704cc400159d72774c3023500dbde7a2f44c3929ee31034
5
5
  SHA512:
6
- metadata.gz: cc31c8bc6a3222067ced83ece55b0733307014f1ea06ccc0c7dcdb3ff162bb4b43e7115b65a5ec7a6b7954919a5fdb2c17ca7c2f46120fb8df8fc2546cadf052
7
- data.tar.gz: f942caf2f1b1c9b5771d403600660526d03d24bfd83c870cd74f8dc3caabb94daa9b827ab752587f05144a70a2a40eecec2c0552e04e984446e8170c5715a1ba
6
+ metadata.gz: 5732f40ddd68feb6cdbe5458d9b66e38ce05937f06c13312507fceaa49b66b0332fdddf7e9120a12df3eb37e0282653e2554f9fc6a69eb1c1f10e0f5a32344d9
7
+ data.tar.gz: 935d348cbf1ad9133747cabaa42dfb4f6e9b4c47d04fa59557056897f160bde2822724fc4d3f7efab3a222228a8705ae41f0a3135b1330ff8f08bd286d82d3ec
@@ -1,6 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1.1
3
+ - 2.3.4
4
4
  - ruby-head
5
5
  before_install: gem install bundler
6
6
  install:
@@ -8,5 +8,3 @@ install:
8
8
  - gem install rake
9
9
  - gem install minitest
10
10
  - gem install minitest-reporters
11
-
12
-
data/config.yml CHANGED
@@ -1,4 +1 @@
1
1
  API_ENDPOINT: api.figo.me
2
- FINGER_PRINTS:
3
- - "79:B2:A2:93:00:85:3B:06:92:B1:B5:F2:24:79:48:58:3A:A5:22:0F:C5:CD:E9:49:9A:C8:45:1E:DB:E0:DA:50" # valid until Jun 24 23:59:59 2018
4
- - "CD:F3:D3:26:27:89:91:B9:CD:AE:4B:10:6C:96:81:B7:EB:B3:38:10:C4:72:37:6A:4D:9C:84:B7:B3:DC:D6:8D" # valid until Jun 24 23:59:59 2019
@@ -1,8 +1,8 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "figo"
3
- s.version = "1.4.1"
4
- s.authors = ["Berend Kapelle"]
5
- s.email = ["bk@figo.me"]
3
+ s.version = "1.4.2"
4
+ s.authors = ["figo GmbH"]
5
+ s.email = ["devs@figo.io"]
6
6
  s.homepage = "https://github.com/figo-connect/ruby-figo"
7
7
  s.license = "MIT"
8
8
  s.summary = %q{API wrapper for figo Connect.}
@@ -32,7 +32,6 @@ require_relative "./authentification/api_call.rb"
32
32
  module Figo
33
33
  $config = YAML.load_file(File.join(__dir__, '../config.yml'))
34
34
  $api_endpoint = $config["API_ENDPOINT"]
35
- $valid_fingerprints = $config["FINGER_PRINTS"]
36
35
 
37
36
  # Represents a non user-bound connection to the figo Connect API.
38
37
  #
@@ -44,11 +43,11 @@ module Figo
44
43
  # @param client_id [String] the client ID
45
44
  # @param client_secret [String] the client secret
46
45
  # @param redirect_uri [String] optional redirect URI
47
- def initialize(client_id, client_secret, redirect_uri = nil, fingerprints = $valid_fingerprints, api_endpoint = $api_endpoint)
46
+ def initialize(client_id, client_secret, redirect_uri = nil, api_endpoint = $api_endpoint)
48
47
  @client_id = client_id
49
48
  @client_secret = client_secret
50
49
  @redirect_uri = redirect_uri
51
- @https = HTTPS.new("figo-#{client_id}", nil, fingerprints)
50
+ @https = HTTPS.new("figo-#{client_id}", nil)
52
51
  @api_endpoint = api_endpoint
53
52
  end
54
53
 
@@ -65,7 +64,7 @@ module Figo
65
64
  request.basic_auth(@client_id, @client_secret)
66
65
  request["Accept"] = "application/json"
67
66
  request["Content-Type"] = "application/x-www-form-urlencoded"
68
- request["User-Agent"] = "figo-ruby/1.3.1"
67
+ request["User-Agent"] = "figo-ruby/1.4.2"
69
68
  request.body = URI.encode_www_form(data) unless data.nil?
70
69
 
71
70
  # Send HTTP request.
@@ -105,9 +104,6 @@ module Figo
105
104
  require_relative "./standing_order/model.rb"
106
105
  require_relative "./standing_order/api_call.rb"
107
106
 
108
- require_relative "./process/model.rb"
109
- require_relative "./process/api_call.rb"
110
-
111
107
  require_relative "./security/model.rb"
112
108
  require_relative "./security/api_call.rb"
113
109
 
@@ -119,9 +115,9 @@ module Figo
119
115
  # Create session object with access token.
120
116
  #
121
117
  # @param access_token [String] the access token
122
- def initialize(access_token, fingerprints = $valid_fingerprints, api_endpoint = $api_endpoint)
118
+ def initialize(access_token, api_endpoint = $api_endpoint)
123
119
  @access_token = access_token
124
- @https = HTTPS.new("figo-#{access_token}", nil, fingerprints)
120
+ @https = HTTPS.new("figo-#{access_token}", nil)
125
121
  @api_endpoint = api_endpoint
126
122
  end
127
123
 
@@ -149,7 +145,7 @@ module Figo
149
145
  request["Authorization"] = "Bearer #{@access_token}"
150
146
  request["Accept"] = "application/json"
151
147
  request["Content-Type"] = "application/json"
152
- request["User-Agent"] = "figo-ruby/1.3.1"
148
+ request["User-Agent"] = "figo-ruby/1.4.2"
153
149
 
154
150
  request.body = JSON.generate(data) unless data.nil?
155
151
 
@@ -3,22 +3,8 @@ module Figo
3
3
  # HTTPS class with certificate authentication and enhanced error handling.
4
4
  class HTTPS < Net::HTTP::Persistent
5
5
  # Overwrite `initialize` method from `Net::HTTP::Persistent`.
6
- #
7
- # Verify fingerprints of server SSL/TLS certificates.
8
- def initialize(name = nil, proxy = nil, fingerprints)
6
+ def initialize(name = nil, proxy = nil)
9
7
  super(name: name, proxy: proxy)
10
-
11
- # Attribute ca_file must be set, otherwise verify_callback would never be called.
12
- @ca_file = "lib/cacert.pem"
13
- @verify_callback = proc do |preverify_ok, store_context|
14
- if preverify_ok and store_context.error == 0
15
- certificate = OpenSSL::X509::Certificate.new(store_context.chain[0])
16
- fingerprint = Digest::SHA256.hexdigest(certificate.to_der).upcase.scan(/../).join(":")
17
- fingerprints.include?(fingerprint)
18
- else
19
- false
20
- end
21
- end
22
8
  end
23
9
 
24
10
  # Overwrite `request` method from `Net::HTTP::Persistent`.
@@ -34,30 +34,22 @@ class FigoTest < MiniTest::Unit::TestCase
34
34
  ## Account Setup & Synchronization
35
35
  # Retrieve List of Supported Banks, Credit Cards, other Payment Services
36
36
  def test_retrieve_list_of_supported_baks_cards_services
37
- execption = assert_raises(Figo::Error) { @sut.get_supported_payment_services("DE", "whatever") }
38
- assert "Missing, invalid or expired access token.", execption.message
39
- # assert @sut.get_supported_payment_services("DE", "whatever")
37
+ assert_nil @sut.get_supported_payment_services("DE", "whatever")
40
38
  end
41
39
 
42
40
  # Retrieve List of Supported Credit Cards and other Payment Services
43
41
  def test_retrieve_list_of_supported_cards_services
44
- execption = assert_raises(Figo::Error) { @sut.get_supported_payment_services("DE", "services") }
45
- assert "Missing, invalid or expired access token.", execption.message
46
- # assert @sut.get_supported_payment_services("DE", "services")
42
+ assert_nil @sut.get_supported_payment_services("DE", "services")
47
43
  end
48
44
 
49
45
  # Retrieve List of all Supported Banks
50
46
  def test_retreive_list_of_all_supported_banks
51
- execption = assert_raises(Figo::Error) { @sut.get_supported_payment_services("DE", "banks") }
52
- assert "Missing, invalid or expired access token.", execption.message
53
- # assert @sut.get_supported_payment_services("DE", "banks")
47
+ assert_raises(Figo::Error) { @sut.get_supported_payment_services("DE", "banks") }
54
48
  end
55
49
 
56
50
  # Retrieve Login Settings for a Bank or Service
57
51
  def test_retreive_login_settings_for_a_bank_or_service
58
- execption = assert_raises(Figo::Error) { @sut.find_bank("B1.1") }
59
- assert "Missing, invalid or expired access token.", execption.message
60
- # assert @sut.find_bank("B1.1")
52
+ assert_raises(Figo::Error) { @sut.find_bank("B1.1") }
61
53
  end
62
54
 
63
55
  # Setup New Bank Account
@@ -95,12 +95,8 @@ class FigoTest < MiniTest::Unit::TestCase
95
95
 
96
96
  # Remove Stored Pin from Bank Account
97
97
  def test_remove_pin_from_bank_account
98
-
99
98
  new_bank_info = Figo::Bank.new(@sut, {bank_id: "B1.1", sepa_creditor_id: "DE02ZZZ0123456789", save_pin: true})
100
-
101
- execption = assert_raises(Figo::Error) { @sut.remove_bank_pin(new_bank_info) }
102
- assert "Missing, invalid or expired access token.", execption.message
103
-
104
- # assert_nil @sut.remove_bank_pin(new_bank_info)
99
+ response = @sut.remove_bank_pin(new_bank_info)
100
+ assert response["save_pin"] == false
105
101
  end
106
102
  end
@@ -49,20 +49,8 @@ class FigoTest < MiniTest::Unit::TestCase
49
49
  def test_authentification_features
50
50
  connection = Figo::Connection.new(CONFIG["CLIENT_ID"], CONFIG["CLIENT_SECRET"], "")
51
51
 
52
- refute_nil connection.login_url("qweqwe", "accounts=ro transactions=ro balance=ro user=ro")
53
-
54
- execption = assert_raises(Figo::Error) { connection.credential_login(CONFIG["USERNAME"], CONFIG["PASSWORD"]) }
55
- assert "Unsupported grant type.", execption.message
56
- # tokens = connection.credential_login(CONFIG["USERNAME"], CONFIG["PASSWORD"])
57
-
58
- # assert tokens.access_token
59
- # assert tokens.token_type
60
- # assert tokens.refresh_token
61
-
62
- # assert connection.obtain_access_token(CONFIG["AUTHORIZATION_CODE"])
63
-
64
- # assert connection.revoke_token(tokens.refresh_token)
65
-
66
- # assert connection.obtain_access_token(tokens.refresh_token)
52
+ response = connection.credential_login(CONFIG["USERNAME"], CONFIG["PASSWORD"], scope = "offline account=rw")
53
+ assert response["access_token"]
54
+ assert response["token_type"]
67
55
  end
68
56
  end
@@ -43,6 +43,6 @@ class FigoTest < MiniTest::Unit::TestCase
43
43
  end
44
44
 
45
45
  def test_sync_uri
46
- @sut.sync_url("qwe", "qew")
46
+ @sut.sync_url("http://example.com", "qew")
47
47
  end
48
48
  end
@@ -75,8 +75,6 @@ class FigoTest < MiniTest::Unit::TestCase
75
75
  payment = @sut.add_payment(payment)
76
76
  assert payment
77
77
 
78
- execption = assert_raises(Figo::Error) { @sut.submit_payment(payment, "M1.1", "string", "http://127.0.0.1") }
79
- assert "Missing, invalid or expired access token.", execption.message
80
78
  # task = @sut.submit_payment(payment, "M1.1", "string", "http://127.0.0.1")
81
79
  #
82
80
  # assert_match task, /https:/
@@ -31,12 +31,6 @@ class FigoTest < MiniTest::Unit::TestCase
31
31
  @sut = Figo::Session.new(CONFIG["ACCESS_TOKEN"])
32
32
  end
33
33
 
34
- ## Securities
35
- # Retrieve a Security
36
- def test_retreive_a_security
37
- assert @sut.get_security("A1.4", "S1.1")
38
- end
39
-
40
34
  # Retrieve Securities of all Accounts
41
35
  def test_retreive_securities_of_all_accounts
42
36
  assert @sut.get_securities({})
@@ -40,16 +40,12 @@ class FigoTest < MiniTest::Unit::TestCase
40
40
 
41
41
  # Create New Figo User
42
42
  def test_create_new_figo_user
43
- execption = assert_raises(Figo::Error) { @con.create_user("John Doe", "jd@example.io", "123456", "en") }
44
- assert "Missing, invalid or expired access token.", execption.message
45
- # assert @con.create_user("John Doe", "jd@example.io", "123456", "en")
43
+ assert_raises(Figo::Error) { @con.create_user("John Doe", "jd@example.io", "123456", "en") }
46
44
  end
47
45
 
48
46
  # Re-Send Verification Email
49
47
  def test_resend_verififcation_email
50
- execption = assert_raises(Figo::Error) { @sut.resend_verification }
51
- assert "Missing, invalid or expired access token.", execption.message
52
- # assert_nil @sut.resend_verification
48
+ assert_nil @sut.resend_verification
53
49
  end
54
50
 
55
51
  # Modify Current User
@@ -74,8 +70,6 @@ class FigoTest < MiniTest::Unit::TestCase
74
70
  verified_email: true
75
71
  }
76
72
  new_user = Figo::User.new(@sut, new_user_hash)
77
-
78
-
79
73
  execption = assert_raises(Figo::Error) { @sut.modify_user(new_user) }
80
74
  assert "Missing, invalid or expired access token.", execption.message
81
75
  # api_user = @sut.modify_user(new_user)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: figo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
- - Berend Kapelle
7
+ - figo GmbH
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-21 00:00:00.000000000 Z
11
+ date: 2019-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: flt
@@ -40,7 +40,7 @@ dependencies:
40
40
  version: '0'
41
41
  description: Library to easily use the API of http://figo.io
42
42
  email:
43
- - bk@figo.me
43
+ - devs@figo.io
44
44
  executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
@@ -69,8 +69,6 @@ files:
69
69
  - lib/notification/model.rb
70
70
  - lib/payment/api_call.rb
71
71
  - lib/payment/model.rb
72
- - lib/process/api_call.rb
73
- - lib/process/model.rb
74
72
  - lib/security/api_call.rb
75
73
  - lib/security/model.rb
76
74
  - lib/standing_order/api_call.rb
@@ -87,12 +85,10 @@ files:
87
85
  - test/test_account_sync_and_setup.rb
88
86
  - test/test_accounts.rb
89
87
  - test/test_authentififcation.rb
90
- - test/test_business_processes.rb
91
88
  - test/test_figo.rb
92
89
  - test/test_notifications.rb
93
90
  - test/test_payments.rb
94
91
  - test/test_securities.rb
95
- - test/test_standing_orders.rb
96
92
  - test/test_transactions.rb
97
93
  - test/test_user_management.rb
98
94
  - web_demo/app.rb
@@ -119,8 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
115
  - !ruby/object:Gem::Version
120
116
  version: '0'
121
117
  requirements: []
122
- rubyforge_project:
123
- rubygems_version: 2.5.2
118
+ rubygems_version: 3.0.3
124
119
  signing_key:
125
120
  specification_version: 4
126
121
  summary: API wrapper for figo Connect.
@@ -129,11 +124,9 @@ test_files:
129
124
  - test/test_account_sync_and_setup.rb
130
125
  - test/test_accounts.rb
131
126
  - test/test_authentififcation.rb
132
- - test/test_business_processes.rb
133
127
  - test/test_figo.rb
134
128
  - test/test_notifications.rb
135
129
  - test/test_payments.rb
136
130
  - test/test_securities.rb
137
- - test/test_standing_orders.rb
138
131
  - test/test_transactions.rb
139
132
  - test/test_user_management.rb
@@ -1,17 +0,0 @@
1
- require_relative "model.rb"
2
- module Figo
3
- # Begin process.
4
- #
5
- # @param process [Hash] - Process token object
6
- def start_process(process)
7
- query_api "/process/start?id=" + process.process_token, nil, "GET"
8
- end
9
-
10
- # Create a process.
11
- #
12
- # @param proc [Hash] - Process object
13
- # @return [Hash] - The result parameter is a ProcessToken object of a newly created process.
14
- def create_process(proc)
15
- query_api_object ProcessToken, "/client/process", proc.dump(), "POST", nil
16
- end
17
- end
@@ -1,34 +0,0 @@
1
- require_relative "../base.rb"
2
- module Figo
3
- ### Object representing a process token
4
- class ProcessToken < Base
5
- @dump_attributes = [:process_token];
6
- def initialize(session, json)
7
- super(session, json)
8
- end
9
-
10
- # Properties:
11
- # @param process_token [Object] - Process ID
12
- attr_accessor :process_token
13
- end
14
-
15
- ### Object representing a Bsiness Process
16
- class Process < Base
17
- @dump_attributes = [:email, :password, :redirect_uri, :state, :steps]
18
- def initialize(session, json)
19
- super(session, json)
20
- end
21
-
22
- # Properties:
23
- # @param email [String] - The email of the existing user to use as context or the new user to create beforehand
24
- attr_accessor :email
25
- # @param password [String] - The password of the user existing or new user
26
- attr_accessor :password
27
- # @param redirect_uri [String] - The authorization code will be sent to this callback URL
28
- attr_accessor :redirect_uri
29
- # @param state [String] - Any kind of string that will be forwarded in the callback response message
30
- attr_accessor :state
31
- # @param steps [String] - A list of steps definitions
32
- attr_accessor :steps
33
- end
34
- end
@@ -1,43 +0,0 @@
1
- #
2
- # Copyright (c) 2013 figo GmbH
3
- #
4
- # Permission is hereby granted, free of charge, to any person obtaining a copy
5
- # of this software and associated documentation files (the "Software"), to deal
6
- # in the Software without restriction, including without limitation the rights
7
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- # copies of the Software, and to permit persons to whom the Software is
9
- # furnished to do so, subject to the following conditions:
10
- #
11
- # The above copyright notice and this permission notice shall be included in
12
- # all copies or substantial portions of the Software.
13
- #
14
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
- # THE SOFTWARE.
21
- #
22
-
23
- require "flt"
24
- require "minitest/autorun"
25
- require "minitest/reporters"
26
- Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
27
- require_relative "../lib/figo"
28
-
29
- class FigoTest < MiniTest::Unit::TestCase
30
- def setup
31
- @sut = Figo::Session.new(CONFIG["ACCESS_TOKEN"])
32
- end
33
-
34
- ## Business Process System
35
- def test_create_and_begin_process
36
- process = Figo::Process.new(@sut, { email: "example@example.com", password: "password", redirect_uri: "http://127.0.0.1", state: "123", steps: [] })
37
-
38
- execption = assert_raises(Figo::Error) { @sut.create_process(process) }
39
- assert "Missing, invalid or expired access token.", execption.message
40
- # assert @sut.create_process(process)
41
- # assert_nil @sut.start_task(@sut.create_process(process))
42
- end
43
- end
@@ -1,49 +0,0 @@
1
- #
2
- # Copyright (c) 2013 figo GmbH
3
- #
4
- # Permission is hereby granted, free of charge, to any person obtaining a copy
5
- # of this software and associated documentation files (the "Software"), to deal
6
- # in the Software without restriction, including without limitation the rights
7
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- # copies of the Software, and to permit persons to whom the Software is
9
- # furnished to do so, subject to the following conditions:
10
- #
11
- # The above copyright notice and this permission notice shall be included in
12
- # all copies or substantial portions of the Software.
13
- #
14
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
- # THE SOFTWARE.
21
- #
22
-
23
- require "flt"
24
- require "minitest/autorun"
25
- require "minitest/reporters"
26
- Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
27
- require_relative "../lib/figo"
28
-
29
- class FigoTest < MiniTest::Unit::TestCase
30
- def setup
31
- @sut = Figo::Session.new(CONFIG["ACCESS_TOKEN"])
32
- end
33
-
34
- ## Standing Orders
35
- # Retrieve a Standing Order
36
- def test_retreive_a_standing_order
37
- assert @sut.get_standing_order("SO1.1")
38
- end
39
-
40
- # Retrieve Standing Orders of all Accounts
41
- def test_retreive_a_standing_orders_of_all_accounts
42
- assert @sut.get_standing_orders().length > 0
43
- end
44
-
45
- # Retrieve Standing Orders of one Account
46
- def test_retreive_a_standing_orders_of_one_account
47
- assert @sut.get_account_standing_orders("A1.1").length > 0
48
- end
49
- end