Class: FdxV660Api::EventNotificationsController

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

Overview

EventNotificationsController

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_notification_subscription(x_fapi_interaction_id, fdx_api_actor_type: nil, fdx_api_data_provider_id: nil, body: nil) ⇒ ApiResponse

Creates notification subscription entry on the server 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 Notification subscription

Parameters:

  • 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

  • body (NotificationSubscriptionEntity) (defaults to: nil)

    Optional parameter:

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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/fdx_v660_api/controllers/event_notifications_controller.rb', line 22

def create_notification_subscription(x_fapi_interaction_id,
                                     fdx_api_actor_type: nil,
                                     fdx_api_data_provider_id: nil,
                                     body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/notification-subscriptions',
                                 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'))
               .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_param(new_parameter(body))
               .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(NotificationSubscriptionEntity.method(:from_hash))
                .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('405',
                             'Method Not Allowed',
                             ErrorException)
                .local_error('429',
                             'Too Many Requests',
                             ErrorException)
                .local_error('500',
                             'Catch-all exception where request was not processed due to an'\
                              ' internal outage/issue. Consider other more specific errors'\
                              ' before using this error',
                             ErrorException)
                .local_error('501',
                             'Error when FdxVersion in Header is not one of those'\
                              ' implemented at backend',
                             ErrorException)
                .local_error('503',
                             'System is down for maintenance',
                             ErrorException))
    .execute
end

#delete_notification_subscription(x_fapi_interaction_id, subscription_id, fdx_api_actor_type: nil, fdx_api_data_provider_id: nil) ⇒ ApiResponse

Delete a notification subscription 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) subscription 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

  • subscription_id (String)

    Required parameter: ID of notification

  • 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.



146
147
148
149
150
151
152
153
154
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
# File 'lib/fdx_v660_api/controllers/event_notifications_controller.rb', line 146

def delete_notification_subscription(x_fapi_interaction_id,
                                     subscription_id,
                                     fdx_api_actor_type: nil,
                                     fdx_api_data_provider_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/notification-subscriptions/{subscriptionId}',
                                 Server::DEFAULT)
               .header_param(new_parameter(x_fapi_interaction_id, key: 'x-fapi-interaction-id')
                              .is_required(true))
               .template_param(new_parameter(subscription_id, key: 'subscriptionId')
                                .is_required(true)
                                .should_encode(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'))
               .auth(Single.new('OAuthFapi1Baseline')))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             ErrorException)
                .local_error('401',
                             'Request lacks valid authentication credentials for the target'\
                              ' resource',
                             ErrorException)
                .local_error('405',
                             'Method Not Allowed',
                             ErrorException)
                .local_error('429',
                             'Too Many Requests',
                             ErrorException)
                .local_error('500',
                             'Catch-all exception where request was not processed due to an'\
                              ' internal outage/issue. Consider other more specific errors'\
                              ' before using this error',
                             ErrorException)
                .local_error('501',
                             'Error when FdxVersion in Header is not one of those'\
                              ' implemented at backend',
                             ErrorException)
                .local_error('503',
                             'System is down for maintenance',
                             ErrorException))
    .execute
end

#get_notification_subscription(x_fapi_interaction_id, subscription_id, fdx_api_actor_type: nil, fdx_api_data_provider_id: nil) ⇒ ApiResponse

Call to get notification subscription 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) subscription 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

  • subscription_id (String)

    Required parameter: ID of notification

  • 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.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/fdx_v660_api/controllers/event_notifications_controller.rb', line 84

def get_notification_subscription(x_fapi_interaction_id,
                                  subscription_id,
                                  fdx_api_actor_type: nil,
                                  fdx_api_data_provider_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/notification-subscriptions/{subscriptionId}',
                                 Server::DEFAULT)
               .header_param(new_parameter(x_fapi_interaction_id, key: 'x-fapi-interaction-id')
                              .is_required(true))
               .template_param(new_parameter(subscription_id, key: 'subscriptionId')
                                .is_required(true)
                                .should_encode(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(NotificationSubscriptionEntity.method(:from_hash))
                .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('405',
                             'Method Not Allowed',
                             ErrorException)
                .local_error('429',
                             'Too Many Requests',
                             ErrorException)
                .local_error('500',
                             'Catch-all exception where request was not processed due to an'\
                              ' internal outage/issue. Consider other more specific errors'\
                              ' before using this error',
                             ErrorException)
                .local_error('501',
                             'Error when FdxVersion in Header is not one of those'\
                              ' implemented at backend',
                             ErrorException)
                .local_error('503',
                             'System is down for maintenance',
                             ErrorException))
    .execute
end

#get_notifications(x_fapi_interaction_id, fdx_api_actor_type: nil, fdx_api_data_provider_id: nil, limit: nil, page_key: nil, offset: nil, fdx_api_data_recipient_id: nil, data_recipient_id: nil) ⇒ ApiResponse

Get Notifications 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 consumer wishes to receive. Providers should implement reasonable default/maximum/minimum values based on their internal architecture and update their documentation accordingly provider to send the next set of records. Pagination can be implemented per provider's preference provider to send the next set of records. Deprecated in favor of PageKeyQuery, will be removed with a future major release for the data recipient(s) on whose behalf the request is being made (DR), omit for all DRs of a Data Access Platform. Deprecated in v6.5 and replaced with new shared parameter FdxApiDataRecipientIdHeader

Parameters:

  • 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

  • limit (Integer) (defaults to: nil)

    Optional parameter: Number of elements that the

  • page_key (String) (defaults to: nil)

    Optional parameter: Opaque cursor used by the

  • offset (String) (defaults to: nil)

    Optional parameter: Opaque cursor used by the

  • fdx_api_data_recipient_id (Array[String]) (defaults to: nil)

    Optional parameter: ID(s)

  • data_recipient_id (String) (defaults to: nil)

    Optional parameter: ID of Data Recipient

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# File 'lib/fdx_v660_api/controllers/event_notifications_controller.rb', line 272

def get_notifications(x_fapi_interaction_id,
                      fdx_api_actor_type: nil,
                      fdx_api_data_provider_id: nil,
                      limit: nil,
                      page_key: nil,
                      offset: nil,
                      fdx_api_data_recipient_id: nil,
                      data_recipient_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/notifications',
                                 Server::DEFAULT)
               .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'))
               .query_param(new_parameter(limit, key: 'limit'))
               .query_param(new_parameter(page_key, key: 'pageKey'))
               .query_param(new_parameter(offset, key: 'offset'))
               .header_param(new_parameter(fdx_api_data_recipient_id, key: 'FDX-API-Data-Recipient-Id'))
               .query_param(new_parameter(data_recipient_id, key: 'dataRecipientId'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('OAuthFapi1Baseline')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(NotificationsEntity.method(:from_hash))
                .is_api_response(true)
                .local_error('405',
                             'Method Not Allowed',
                             ErrorException)
                .local_error('429',
                             'Too Many Requests',
                             ErrorException)
                .local_error('500',
                             'Catch-all exception where request was not processed due to an'\
                              ' internal outage/issue. Consider other more specific errors'\
                              ' before using this error',
                             ErrorException)
                .local_error('501',
                             'Error when FdxVersion in Header is not one of those'\
                              ' implemented at backend',
                             ErrorException)
                .local_error('503',
                             'System is down for maintenance',
                             ErrorException))
    .execute
end

#publish_notification(x_fapi_interaction_id, fdx_api_actor_type: nil, fdx_api_data_provider_id: nil, body: nil) ⇒ ApiResponse

Publish Notification 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 description here

Parameters:

  • 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

  • body (NotificationEntity) (defaults to: nil)

    Optional parameter: TODO: type

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/fdx_v660_api/controllers/event_notifications_controller.rb', line 206

def publish_notification(x_fapi_interaction_id,
                         fdx_api_actor_type: nil,
                         fdx_api_data_provider_id: nil,
                         body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/notifications',
                                 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'))
               .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_param(new_parameter(body))
               .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('405',
                             'Method Not Allowed',
                             ErrorException)
                .local_error('429',
                             'Too Many Requests',
                             ErrorException)
                .local_error('500',
                             'Catch-all exception where request was not processed due to an'\
                              ' internal outage/issue. Consider other more specific errors'\
                              ' before using this error',
                             ErrorException)
                .local_error('501',
                             'Error when FdxVersion in Header is not one of those'\
                              ' implemented at backend',
                             ErrorException)
                .local_error('503',
                             'System is down for maintenance',
                             ErrorException))
    .execute
end