Class: FdxV660Api::UserConsentController

Inherits:
BaseController show all
Defined in:
lib/fdx_v660_api/controllers/user_consent_controller.rb

Overview

UserConsentController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseController

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from FdxV660Api::BaseController

Instance Method Details

Create a Consent Grant identifier for this interaction, as defined by [FAPI 2.0 Implementation Advice, 2.2.1 x-fapi-interaction-id](https://openid.bitbucket.io/fapi/fapi-2_0-implement ation_advice.html#name-x-fapi-interaction-id) description here whether the customer is present (USER) or it is a BATCH operation financial institution responding to the request

Parameters:

  • x_fapi_interaction_id (UUID | String)

    Required parameter: Unique

  • body (ConsentRequestEntity)

    Required parameter: TODO: type

  • fdx_api_actor_type (FdxApiActorType) (defaults to: nil)

    Optional parameter: Identifies

  • fdx_api_data_provider_id (String) (defaults to: nil)

    Optional parameter: ID for the

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/fdx_v660_api/controllers/user_consent_controller.rb', line 22

def create_consent_grant(x_fapi_interaction_id,
                         body,
                         fdx_api_actor_type: nil,
                         fdx_api_data_provider_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/consents',
                                 Server::DEFAULT)
               .header_param(new_parameter(x_fapi_interaction_id, key: 'x-fapi-interaction-id')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter(fdx_api_actor_type, key: 'FDX-API-Actor-Type'))
               .header_param(new_parameter(fdx_api_data_provider_id, key: 'FDX-API-Data-Provider-Id'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('OAuthFapi1Baseline')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ConsentGrantEntity.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Input sent by client does not satisfy API specification',
                             ErrorException))
    .execute
end

Get a Consent Grant identifier for this interaction, as defined by [FAPI 2.0 Implementation Advice, 2.2.1 x-fapi-interaction-id](https://openid.bitbucket.io/fapi/fapi-2_0-implement ation_advice.html#name-x-fapi-interaction-id) whether the customer is present (USER) or it is a BATCH operation financial institution responding to the request

Parameters:

  • consent_id (String)

    Required parameter: Consent Identifier

  • x_fapi_interaction_id (UUID | String)

    Required parameter: Unique

  • fdx_api_actor_type (FdxApiActorType) (defaults to: nil)

    Optional parameter: Identifies

  • fdx_api_data_provider_id (String) (defaults to: nil)

    Optional parameter: ID for the

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/fdx_v660_api/controllers/user_consent_controller.rb', line 110

def get_consent_grant(consent_id,
                      x_fapi_interaction_id,
                      fdx_api_actor_type: nil,
                      fdx_api_data_provider_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/consents/{consentId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(consent_id, key: 'consentId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(x_fapi_interaction_id, key: 'x-fapi-interaction-id')
                              .is_required(true))
               .header_param(new_parameter(fdx_api_actor_type, key: 'FDX-API-Actor-Type'))
               .header_param(new_parameter(fdx_api_data_provider_id, key: 'FDX-API-Data-Provider-Id'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('OAuthFapi1Baseline')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ConsentGrantEntity.method(:from_hash))
                .is_api_response(true)
                .local_error('401',
                             'Request lacks valid authentication credentials for the target'\
                              ' resource',
                             ErrorException)
                .local_error('404',
                             'Data not found for request parameters',
                             ErrorException))
    .execute
end

Retrieve Consent Revocation record identifier for this interaction, as defined by [FAPI 2.0 Implementation Advice, 2.2.1 x-fapi-interaction-id](https://openid.bitbucket.io/fapi/fapi-2_0-implement ation_advice.html#name-x-fapi-interaction-id) whether the customer is present (USER) or it is a BATCH operation financial institution responding to the request

Parameters:

  • consent_id (String)

    Required parameter: Consent Identifier

  • x_fapi_interaction_id (UUID | String)

    Required parameter: Unique

  • fdx_api_actor_type (FdxApiActorType) (defaults to: nil)

    Optional parameter: Identifies

  • fdx_api_data_provider_id (String) (defaults to: nil)

    Optional parameter: ID for the

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/fdx_v660_api/controllers/user_consent_controller.rb', line 211

def get_consent_revocation(consent_id,
                           x_fapi_interaction_id,
                           fdx_api_actor_type: nil,
                           fdx_api_data_provider_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/consents/{consentId}/revocation',
                                 Server::DEFAULT)
               .template_param(new_parameter(consent_id, key: 'consentId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(x_fapi_interaction_id, key: 'x-fapi-interaction-id')
                              .is_required(true))
               .header_param(new_parameter(fdx_api_actor_type, key: 'FDX-API-Actor-Type'))
               .header_param(new_parameter(fdx_api_data_provider_id, key: 'FDX-API-Data-Provider-Id'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('OAuthFapi1Baseline')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ConsentRevocationsEntity.method(:from_hash))
                .is_api_response(true))
    .execute
end

Revoke a Consent Grant identifier for this interaction, as defined by [FAPI 2.0 Implementation Advice, 2.2.1 x-fapi-interaction-id](https://openid.bitbucket.io/fapi/fapi-2_0-implement ation_advice.html#name-x-fapi-interaction-id) initiator of revocation whether the customer is present (USER) or it is a BATCH operation financial institution responding to the request

Parameters:

  • consent_id (String)

    Required parameter: Consent Identifier

  • x_fapi_interaction_id (UUID | String)

    Required parameter: Unique

  • body (RevocationRequestEntity)

    Required parameter: Reason and

  • fdx_api_actor_type (FdxApiActorType) (defaults to: nil)

    Optional parameter: Identifies

  • fdx_api_data_provider_id (String) (defaults to: nil)

    Optional parameter: ID for the

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/fdx_v660_api/controllers/user_consent_controller.rb', line 155

def revoke_consent_grant(consent_id,
                         x_fapi_interaction_id,
                         body,
                         fdx_api_actor_type: nil,
                         fdx_api_data_provider_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/consents/{consentId}/revocation',
                                 Server::DEFAULT)
               .template_param(new_parameter(consent_id, key: 'consentId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(x_fapi_interaction_id, key: 'x-fapi-interaction-id')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter(fdx_api_actor_type, key: 'FDX-API-Actor-Type'))
               .header_param(new_parameter(fdx_api_data_provider_id, key: 'FDX-API-Data-Provider-Id'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('OAuthFapi1Baseline')))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true)
                .local_error('400',
                             'Input sent by client does not satisfy API specification',
                             ErrorException)
                .local_error('401',
                             'Request lacks valid authentication credentials for the target'\
                              ' resource',
                             ErrorException)
                .local_error('403',
                             'Forbidden, server understands the request but refuses to'\
                              ' authorize it',
                             ErrorException)
                .local_error('404',
                             'Data not found for request parameters',
                             ErrorException)
                .local_error('409',
                             'Conflict with current state of target resource',
                             ErrorException))
    .execute
end

Get a list of Consent Grants by query parameters identifier for this interaction, as defined by [FAPI 2.0 Implementation Advice, 2.2.1 x-fapi-interaction-id](https://openid.bitbucket.io/fapi/fapi-2_0-implement ation_advice.html#name-x-fapi-interaction-id) identity of the customer. This identity must be unique to the owning entity whether the customer is present (USER) or it is a BATCH operation financial institution responding to the request status

Parameters:

  • x_fapi_interaction_id (UUID | String)

    Required parameter: Unique

  • customer_id (String)

    Required parameter: Long-term persistent

  • fdx_api_actor_type (FdxApiActorType) (defaults to: nil)

    Optional parameter: Identifies

  • fdx_api_data_provider_id (String) (defaults to: nil)

    Optional parameter: ID for the

  • status (ConsentGrantStatus) (defaults to: nil)

    Optional parameter: Consent Grant

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/fdx_v660_api/controllers/user_consent_controller.rb', line 66

def search_for_consent_grants(x_fapi_interaction_id,
                              customer_id,
                              fdx_api_actor_type: nil,
                              fdx_api_data_provider_id: nil,
                              status: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/consents',
                                 Server::DEFAULT)
               .header_param(new_parameter(x_fapi_interaction_id, key: 'x-fapi-interaction-id')
                              .is_required(true))
               .query_param(new_parameter(customer_id, key: 'customerId')
                             .is_required(true))
               .header_param(new_parameter(fdx_api_actor_type, key: 'FDX-API-Actor-Type'))
               .header_param(new_parameter(fdx_api_data_provider_id, key: 'FDX-API-Data-Provider-Id'))
               .query_param(new_parameter(status, key: 'status'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('OAuthFapi1Baseline')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ConsentGrantsEntity.method(:from_hash))
                .is_api_response(true)
                .local_error('401',
                             'Request lacks valid authentication credentials for the target'\
                              ' resource',
                             ErrorException)
                .local_error('404',
                             'Data not found for request parameters',
                             ErrorException))
    .execute
end