Sha256: fd1323c6f1334fdbc4245d6fb28c90319935fb8e81d60e41563a2342743b2c40
Contents?: true
Size: 1.96 KB
Versions: 4
Compression:
Stored size: 1.96 KB
Contents
# frozen_string_literal: true require 'base64' require 'json' require 'faraday' require 'fintecture/utils/validation' require 'fintecture/exceptions' require 'fintecture/utils/date' require 'fintecture/utils/constants' module Fintecture module Ais class AuthorizeDecoupled class << self # ------------ PUBLIC METHOD ------------ def get(client, app_id_auth, provider_id, polling_id) @client = client # Do the request _request app_id_auth, provider_id, polling_id end private # ------------ REQUEST ------------ def _request(app_id_auth, provider_id, polling_id) # Get the url request url = _endpoint provider_id, polling_id # Build uri params query_string = '' params = {} params['response_type'] = 'code' if app_id_auth params['model'] = 'decoupled' query_string = "?#{params.map { |key, value| "#{key}=#{value}" }.join('&')}" # Build additional headers additional_headers = {} additional_headers['app_id'] = @client.app_id if app_id_auth # Do connect request Fintecture::Faraday::Authentication::Connection.get( url: url + query_string, client: @client, custom_content_type: 'application/json', bearer: "Bearer #{@client.token}", secure_headers: true, additional_headers: additional_headers, disableAuthorization: app_id_auth ? true : false ) end # ------------ API ENDPOINT ------------ def _endpoint(provider_id, polling_id) "#{_api_base_url}/#{Fintecture::Api::Endpoints::Ais::AUTHORIZE}/#{provider_id}/authorize/decoupled/#{polling_id}" end # ------------ BASE URL ------------ def _api_base_url Fintecture::Api::BaseUrl::FINTECTURE_API_URL[@client.environment.to_sym] end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems