-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from mikamai/strong_customer_auth
Strong customer authentication interface
- Loading branch information
Showing
13 changed files
with
300 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative '../base.rb' | ||
|
||
module Figo | ||
class AccessMethod < Base | ||
@dump_attributes = %i[ | ||
id in_psd2_scope type supported_account_types configurable_consent | ||
requires_account_identifiers customer_authentication_flows advice | ||
credentials | ||
] | ||
|
||
def initialize(hash) | ||
hash.keys.each do |key| | ||
send("#{key}=", hash[key]) | ||
end | ||
end | ||
|
||
# @return [String] figo ID of the provider access method. | ||
attr_accessor :id | ||
|
||
# @return [String] Indicates whether payment accounts | ||
# falling into the scope of the PSD2 are accessed via this method. | ||
attr_accessor :in_psd2_scope | ||
|
||
# @return [String] Enum: "API" "FINTS" "SCRAPING" | ||
attr_accessor :type | ||
|
||
# @return [Array] array of strings | ||
# Enum: "Giro account" "Savings account" "Daily savings account" | ||
# "Credit card" "Loan account" "PayPal" "Depot" "Unknown" | ||
attr_accessor :supported_account_types | ||
|
||
# @return [Boolean] Indicates whether consent configuration may be provided | ||
attr_accessor :configurable_consent | ||
|
||
# @return [Boolean] Indicates whether account identifiers have to be provided to connect this financial source. | ||
attr_accessor :requires_account_identifiers | ||
|
||
# @return [Array] array of strings Enum: "EMBEDDED_1FA" "EMBEDDED_2FA" "REDIRECT" "DECOUPLED" | ||
attr_accessor :customer_authentication_flows | ||
|
||
# @return [String] Any advice useful to instruct the user on what data to provide. | ||
attr_accessor :advice | ||
|
||
# @return [Object] | ||
attr_accessor :credentials | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,49 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative '../base.rb' | ||
require_relative '../access_method/model' | ||
require_relative '../base' | ||
|
||
module Figo | ||
# Object representing a bank, i.e. an connection to a bank | ||
class Bank < Base | ||
@dump_attributes = [:sepa_creditor_id] | ||
@dump_attributes = %i[ | ||
id name icon supported country language | ||
access_methods bank_code bic | ||
] | ||
|
||
def initialize(session, json) | ||
super(session, json) | ||
def initialize(hash) | ||
hash.keys.each do |key| | ||
send("#{key}=", hash[key]) | ||
end | ||
end | ||
|
||
# Internal figo Connect bank ID | ||
# @return [String] | ||
attr_accessor :bank_id | ||
# @return [String] figo ID of financial service provider. | ||
attr_accessor :id | ||
|
||
# @return [String] Name of the financial service provider. | ||
attr_accessor :name | ||
|
||
# @return [Object] | ||
attr_accessor :icon | ||
|
||
# @return [Boolean] Indicates if access to financial source is supported by the figo API. | ||
attr_accessor :supported | ||
|
||
# @return [String] Country in which the financial service provider operates. | ||
attr_accessor :country | ||
|
||
# @return [Object] | ||
attr_accessor :language | ||
|
||
# @return [Array] List of access methods available for this catalog item. | ||
attr_reader :access_methods | ||
def access_methods=(array) | ||
@access_methods = array.map { |hash| Figo::AccessMethod.new hash } | ||
end | ||
|
||
# SEPA direct debit creditor ID | ||
# @return [String] | ||
attr_accessor :sepa_creditor_id | ||
# @return [Object] | ||
attr_accessor :bank_code | ||
|
||
# This flag indicates whether the user has chosen to save the PIN on the figo Connect server | ||
# @return [Boolean] | ||
attr_accessor :save_pin | ||
# @return [Object] | ||
attr_accessor :bic | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# frozen_string_literal: true | ||
|
||
module Figo | ||
# List synchronization challenges | ||
# | ||
# @param access_id [String] figo ID of the provider access. | ||
# @param sync_id [String] figo ID of synchronization operation. | ||
# @return [Array] an array of `SynchronizationChallenge` objects | ||
def list_synchronization_challenges(access_id, sync_id) | ||
path = "/rest/accesses/#{access_id}/syncs/#{sync_id}/challenges" | ||
query_api_object SynchronizationChallenge, path, nil, 'GET', 'synchronization_challenges' | ||
end | ||
|
||
# Get synchronization challenge | ||
# | ||
# @param access_id [String] figo ID of the provider access. | ||
# @param sync_id [String] ID of the access to be retrieved. | ||
# @param challenge_id [String] ID of the access to be retrieved. | ||
# @return [Object] a SynchronizationChallenge object | ||
def get_synchronization_challenge(access_id, sync_id, challenge_id) | ||
path = "/rest/accesses/#{access_id}/syncs/#{sync_id}/challenges/#{challenge_id}" | ||
query_api_object SynchronizationChallenge, path, nil, 'GET' | ||
end | ||
|
||
# Solve synchronization challenge | ||
# | ||
# @param access_id [String] figo ID of the provider access. | ||
# @param sync_id [String] ID of the access to be retrieved. | ||
# @param challenge_id [String] ID of the access to be retrieved. | ||
# @return [Object] | ||
def solve_synchronization_challenge(access_id, sync_id, challenge_id) | ||
path = "/rest/accesses/#{access_id}/syncs/#{sync_id}/challenges/#{challenge_id}/response" | ||
query_api path, nil, 'POST' | ||
end | ||
|
||
# List payment challenges | ||
# | ||
# @param account_id [String] figo ID of account. | ||
# @param payment_id [String] figo ID of the payment. | ||
# @param init_d [String] figo ID of the payment initation. | ||
# @return [Array] an array of `SynchronizationChallenge` objects | ||
def list_payment_challenges(account_id, payment_id, init_d) | ||
path = "/rest/accounts/#{account_id}/payments/#{payment_id}/init/#{init_id}/challenges" | ||
query_api_object SynchronizationChallenge, path, nil, 'GET', 'synchronization_challenges' | ||
end | ||
|
||
# Get payment challenge | ||
# | ||
# @param account_id [String] figo ID of account. | ||
# @param payment_id [String] figo ID of the payment. | ||
# @param init_d [String] figo ID of the payment initation. | ||
# @param challenge_id [String] figo ID of the challenge. | ||
# @return [Object] a SynchronizationChallenge object | ||
def get_payment_challenge(account_id, payment_id, init_d, challenge_id) | ||
path = "/rest/accounts/#{account_id}/payments/#{payment_id}/init/#{init_id}/challenges" | ||
query_api_object SynchronizationChallenge, path, nil, 'GET' | ||
end | ||
|
||
# Solve payment challenge | ||
# | ||
# @param account_id [String] figo ID of account. | ||
# @param payment_id [String] figo ID of the payment. | ||
# @param init_d [String] figo ID of the payment initation. | ||
# @param challenge_id [String] figo ID of the challenge. | ||
# @return [Object] | ||
def solve_payment_challenge(account_id, payment_id, init_d, challenge_id) | ||
path = "/rest/accounts/#{account_id}/payments/#{payment_id}/init/#{init_id}/challenges/#{challenge_id}" | ||
query_api path, nil, 'POST' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative '../../base.rb' | ||
module Figo | ||
# Object representing the bank server synchronization status | ||
class AuthMethod < Base | ||
@dump_attributes = %i[ | ||
id medium_name type additional_info | ||
] | ||
|
||
# figo ID of TAN scheme. | ||
# @return [String](TANSchemeID) | ||
attr_accessor :id | ||
|
||
# Description of the medium used to generate the authentication response. | ||
# @return [String] | ||
attr_accessor :medium_name | ||
|
||
# Type of authentication method. | ||
# @return [String] | ||
attr_accessor :type | ||
|
||
# Additional information on the authentication method as key/value pairs. | ||
# @return [String] | ||
attr_accessor :additional_info | ||
end | ||
end |
72 changes: 72 additions & 0 deletions
72
lib/strong_customer_authentication/synchronization_challenge/model.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative '../../base.rb' | ||
module Figo | ||
# Object representing the bank server synchronization status | ||
class SynchronizationChallenge < Base | ||
@dump_attributes = %i[ | ||
id created_at type auth_methods format version data | ||
additional_info label input_format max_length | ||
min_length location message | ||
] | ||
|
||
# figo ID of the challenge. | ||
# @return [String] | ||
attr_accessor :id | ||
|
||
# Time at which the challenge was created. | ||
# @return [String]<ISO 8601> | ||
attr_accessor :created_at | ||
|
||
# Figo ID of the challenge. | ||
# @return [String] | ||
attr_accessor :type | ||
|
||
# Array of objects (AuthMethod) | ||
# @return [Array<AuthMethod>] | ||
attr_reader :auth_methods | ||
def auth_methods=(hash) | ||
AuhtMethodhash.new(hash.delete_if { |_, v| v.nil? }) | ||
end | ||
|
||
# Indicates how the data field should be interpreted. | ||
# @return [String] (Enum: "PHOTO" "HHD" "TEXT" "HTML") | ||
attr_accessor :format | ||
|
||
# The version of the used challenge type. Left empty if it does not apply. | ||
# @return [String] | ||
attr_accessor :version | ||
|
||
# The format of the data is specified in the format field. | ||
# @return [String] | ||
attr_accessor :data | ||
|
||
# Provides additional information text to be displayed to the end-user. | ||
# @return [String] | ||
attr_accessor :additional_info | ||
|
||
# To be used as label for the user input field in UIs. | ||
# @return [String] | ||
attr_accessor :label | ||
|
||
# The expected input format or type for the response to the challenge. | ||
# @return [String] | ||
attr_accessor :input_format | ||
|
||
# Maximum length of the response to be provided to the challenge. | ||
# @return [Integer] | ||
attr_accessor :max_length | ||
|
||
# Maximum length of the response to be provided to the challenge. | ||
# @return [Integer] | ||
attr_accessor :min_length | ||
|
||
# The URI to which the end user is redirected in OAuth cases. | ||
# @return [String] | ||
attr_accessor :location | ||
|
||
# Instructional text to be displayed to the end-user. | ||
# @return [String] | ||
attr_accessor :message | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.