Class: ShellCardManagementApIs::RestrictionController

Inherits:
BaseController
  • Object
show all
Defined in:
lib/shell_card_management_ap_is/controllers/restriction_controller.rb

Overview

RestrictionController

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_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, user_agent

Constructor Details

This class inherits a constructor from ShellCardManagementApIs::BaseController

Instance Method Details

#apply_restriction(apikey, request_id, body: nil) ⇒ CardRestrictionResponse

The Card Limit and Restriction API is REST-based and employs Basic and ApiKey authentication. The API endpoints accept JSON-encoded request bodies, return JSON-encoded responses and use standard HTTP response codes. All resources are located in the Shell Card Platform. The Shell Card Platform is the overall platform that encompasses all the internal Shell systems used to manage resources. The internal workings of the platform are not important when interacting with the API. However, it is worth noting that the platform uses a microservice architecture to communicate with various backend systems and some API calls are processed asynchronously. All endpoints use the ‘POST` verb for retrieving, updating, creating and deleting resources in the Shell Card Platform. The endpoints that retrieve resources from the Shell Card Platform allow flexible search parameters in the API request body. **Important Note** - This operation allows setting or updating the restrictions on existing cards. (For up to 3 cards in a single call). All restrictions of the cards are submitted and executed after successful below condition. • The card exists. • Day time restriction cannot be set to restrict the use of a card on all days of the week i.e., the values for all the days in the restriction cannot be set to false. • Either of the usage, daytime, location or product restriction ‘Reset’ is set to ‘True’ or applied on the card. • All the limits in the usage restriction profile for a card is not set to ‘0’/null. • If IsVelocityCeiling is ‘true’, API will validate below condition: Usage restrictions for a card are lower than Customer Card Type level limits, if there are no customer level overrides available then lower than OU card type limits. • In usage restrictions, the limits per transaction should be less than or equal to Daily, Daily should be less than or equal to Weekly, Weekly should be less than or equal to Monthly, Monthly should be less than or equal to Yearly (Annually). Exception being null/blank will be skipped. i.e., Daily value should be less than equal to Monthly value if Weekly value is null/blank. Lifetime limit is not considered for usage restrictions limits validation. • Apply the card type limit to Gateway when a value is NULL in the input. However, if the card type limit is NULL for the same field, then no limit will be applied in Gateway. • If ‘SetDefaultOnVelocityUpdate’ is ‘true’ then the operation will apply customer cardtype or OU level velocity limits on existing cards when restrictions are modified without providing custom values for all fields. specific environment which needs to be passed by the client. to RFC 4122 standards) for requests and responses. This will be played back in the response from the request. request body

Parameters:

  • apikey (String)

    Required parameter: This is the API key of the

  • request_id (String)

    Required parameter: Mandatory UUID (according

  • body (CardRestrictionReq) (defaults to: nil)

    Optional parameter: Card Restriction

Returns:



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/shell_card_management_ap_is/controllers/restriction_controller.rb', line 117

def apply_restriction(apikey,
                      request_id,
                      body: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/fleetmanagement/v2/restriction/card',
                                 Server::SHELL)
               .header_param(new_parameter(apikey, key: 'apikey'))
               .header_param(new_parameter(request_id, key: 'RequestId'))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .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('BasicAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(CardRestrictionResponse.method(:from_hash))
                .local_error('400',
                             "The server cannot or will not process the request  due to'\
                              ' something that is perceived to be a client\r\n error (e.g.,'\
                              ' malformed request syntax, invalid \r\n request message'\
                              ' framing, or deceptive request routing).",
                             APIException)
                .local_error('401',
                             'The request has not been applied because it lacks valid '\
                              ' authentication credentials for the target resource.',
                             APIException)
                .local_error('403',
                             'The server understood the request but refuses to authorize it'\
                              '.',
                             APIException)
                .local_error('404',
                             'The origin server did not find a current representation  for'\
                              ' the target resource or is not willing to disclose  that one'\
                              ' exists.',
                             APIException)
                .local_error('500',
                             'The server encountered an unexpected condition the prevented'\
                              ' it from fulfilling the request.',
                             APIException))
    .execute
end

#bundledetails(apikey, request_id, body: nil) ⇒ BundleDetailsResponse

This API allows to get the details of a specific card bundle. It returns the bundle basic details along with the cards in the bundle and restrictions applied on them. specific environment which needs to be passed by the client. to RFC 4122 standards) for requests and responses. This will be played back in the response from the request. Request body

Parameters:

  • apikey (String)

    Required parameter: This is the API key of the

  • request_id (String)

    Required parameter: Mandatory UUID (according

  • body (BudleDetailsRequest) (defaults to: nil)

    Optional parameter: Bundle Details

Returns:



583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
# File 'lib/shell_card_management_ap_is/controllers/restriction_controller.rb', line 583

def bundledetails(apikey,
                  request_id,
                  body: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/fleetmanagement/v1/restriction/bundledetails',
                                 Server::SHELL)
               .header_param(new_parameter(apikey, key: 'apikey'))
               .header_param(new_parameter(request_id, key: 'RequestId'))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .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('BasicAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(BundleDetailsResponse.method(:from_hash))
                .local_error('400',
                             "The server cannot or will not process the request  due to'\
                              ' something that is perceived to be a client\r\n error (e.g.,'\
                              ' malformed request syntax, invalid \r\n request message'\
                              ' framing, or deceptive request routing).",
                             APIException)
                .local_error('401',
                             'The request has not been applied because it lacks valid '\
                              ' authentication credentials for the target resource.',
                             APIException)
                .local_error('403',
                             'The server understood the request but refuses to authorize it'\
                              '.',
                             APIException)
                .local_error('404',
                             'The origin server did not find a current representation  for'\
                              ' the target resource or is not willing to disclose  that one'\
                              ' exists.',
                             APIException)
                .local_error('500',
                             'The server encountered an unexpected condition the prevented'\
                              ' it from fulfilling the request.',
                             APIException))
    .execute
end

#create_bundle(apikey, request_id, body: nil) ⇒ CreateBundleResponse

This API enables clients to create a new card bundle and apply restrictions. #### Supported operations

* Create bundle and include mandatory -
  * Usage, day/time, product and location restrictions
  * List of cards to add to bundle
* Create bundle and include optional identifier of bundle in external

system #### Validation rules

The following are the key validation rules with the associated error

codes for failed validation-

* `7012` - At least one card must be added to the bundle
*  `7011` - The total number of cards passed in the input must be 500 or

less.

*  `7014` - All the cards passed in the input are part of the selected

account.

*  `7013` - At least one restriction must be applied to the bundle i.e.

either of usage, day/time, location or product restriction.

*  `7005` - Day time restriction cannot be set to restrict the use of a

card on all days of the week.

*  `7000` - Usage restriction of the bundle is not open ended i.e. all

the limits within the usage restriction must not be set to 0/null.

*  `7004` - In the usage restrictions, the limits per transaction should

be less than or equal to Daily, Daily should be less than or equal to Weekly, Weekly should be less than or equal to Monthly. Exception being 0/blank will be skipped, i.e. Daily value should be less than equal to Monthly value if Weekly value is 0/blank.

*  `0007` - Error returned if request parameters fail validation e.g.

mandatory check. specific environment which needs to be passed by the client. to RFC 4122 standards) for requests and responses. This will be played back in the response from the request. body

Parameters:

  • apikey (String)

    Required parameter: This is the API key of the

  • request_id (String)

    Required parameter: Mandatory UUID (according

  • body (CreateBundleRequest) (defaults to: nil)

    Optional parameter: CreateBundle request

Returns:



197
198
199
200
201
202
203
204
205
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
# File 'lib/shell_card_management_ap_is/controllers/restriction_controller.rb', line 197

def create_bundle(apikey,
                  request_id,
                  body: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/fleetmanagement/v1/restriction/createbundle',
                                 Server::SHELL)
               .header_param(new_parameter(apikey, key: 'apikey'))
               .header_param(new_parameter(request_id, key: 'RequestId'))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .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('BasicAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(CreateBundleResponse.method(:from_hash))
                .local_error('400',
                             "The server cannot or will not process the request  due to'\
                              ' something that is perceived to be a client\r\n error (e.g.,'\
                              ' malformed request syntax, invalid \r\n request message'\
                              ' framing, or deceptive request routing).",
                             APIException)
                .local_error('401',
                             'The request has not been applied because it lacks valid '\
                              ' authentication credentials for the target resource.',
                             APIException)
                .local_error('403',
                             'The server understood the request but refuses to authorize it'\
                              '.',
                             APIException)
                .local_error('404',
                             'The origin server did not find a current representation  for'\
                              ' the target resource or is not willing to disclose  that one'\
                              ' exists.',
                             APIException)
                .local_error('500',
                             'The server encountered an unexpected condition the prevented'\
                              ' it from fulfilling the request.',
                             APIException))
    .execute
end

#delete_bundle(apikey, request_id, body: nil) ⇒ DeleteBundleResponse

This API enables clients to delete an existing card bundle in the Shell Card Platform. Once the card bundle is deleted the usage and product restrictions of the cards that were present in the bundle will be reset based on the request. #### Supported operations

* Delete card bundle by bundle Id

#### Validation rules

The following are the key validation rules with the associated error

codes for failed validation-

*  `7019` - The given card bundle is not available in the Shell Card

Platform.

*  `0007` - Error returned if request parameters fail validation e.g.

mandatory check. specific environment which needs to be passed by the client. to RFC 4122 standards) for requests and responses. This will be played back in the response from the request. request body

Parameters:

  • apikey (String)

    Required parameter: This is the API key of the

  • request_id (String)

    Required parameter: Mandatory UUID (according

  • body (DeleteBundleRequest) (defaults to: nil)

    Optional parameter: Update Bundle

Returns:



349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
# File 'lib/shell_card_management_ap_is/controllers/restriction_controller.rb', line 349

def delete_bundle(apikey,
                  request_id,
                  body: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/fleetmanagement/v1/restriction/deletebundle',
                                 Server::SHELL)
               .header_param(new_parameter(apikey, key: 'apikey'))
               .header_param(new_parameter(request_id, key: 'RequestId'))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .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('BasicAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(DeleteBundleResponse.method(:from_hash))
                .local_error('400',
                             "The server cannot or will not process the request  due to'\
                              ' something that is perceived to be a client\r\n error (e.g.,'\
                              ' malformed request syntax, invalid \r\n request message'\
                              ' framing, or deceptive request routing).",
                             APIException)
                .local_error('401',
                             'The request has not been applied because it lacks valid '\
                              ' authentication credentials for the target resource.',
                             APIException)
                .local_error('403',
                             'The server understood the request but refuses to authorize it'\
                              '.',
                             APIException)
                .local_error('404',
                             'The origin server did not find a current representation  for'\
                              ' the target resource or is not willing to disclose  that one'\
                              ' exists.',
                             APIException)
                .local_error('500',
                             'The server encountered an unexpected condition the prevented'\
                              ' it from fulfilling the request.',
                             APIException))
    .execute
end

#restriction_account(apikey, request_id, body: nil) ⇒ AccountRestrictionResponse

This API allows setting or updating the usage restrictions of an existing account. Then validation rules applied for this API. • The account exists. • Day time restriction cannot be set to restrict the use of a card, under the account, on all days of the week. • Either of the usage, daytime or location is either marked for reset or new restriction values provided for the account. • In usage restrictions, the limits per transaction should be less than or equal to Daily, Daily should be less than or equal to Weekly, Weekly should be less than or equal to Monthly. Exception being 0/blank will be skipped, i.e., Daily value should be less than equal to Monthly value if Weekly value is 0/blank. specific environment which needs to be passed by the client. to RFC 4122 standards) for requests and responses. This will be played back in the response from the request. Restriction request body

Parameters:

  • apikey (String)

    Required parameter: This is the API key of the

  • request_id (String)

    Required parameter: Mandatory UUID (according

  • body (AccountRestrictionRequest) (defaults to: nil)

    Optional parameter: Account

Returns:



475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
# File 'lib/shell_card_management_ap_is/controllers/restriction_controller.rb', line 475

def (apikey,
                        request_id,
                        body: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/fleetmanagement/v1/restriction/account',
                                 Server::SHELL)
               .header_param(new_parameter(apikey, key: 'apikey'))
               .header_param(new_parameter(request_id, key: 'RequestId'))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .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('BearerToken')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(AccountRestrictionResponse.method(:from_hash))
                .local_error('400',
                             "The server cannot or will not process the request  due to'\
                              ' something that is perceived to be a client\r\n error (e.g.,'\
                              ' malformed request syntax, invalid \r\n request message'\
                              ' framing, or deceptive request routing).",
                             APIException)
                .local_error('401',
                             'The request has not been applied because it lacks valid '\
                              ' authentication credentials for the target resource.',
                             APIException)
                .local_error('403',
                             'The server understood the request but refuses to authorize it'\
                              '.',
                             APIException)
                .local_error('404',
                             'The origin server did not find a current representation  for'\
                              ' the target resource or is not willing to disclose  that one'\
                              ' exists.',
                             APIException)
                .local_error('500',
                             'The server encountered an unexpected condition the prevented'\
                              ' it from fulfilling the request.',
                             APIException))
    .execute
end

#search_account_limit(apikey, request_id, body: nil) ⇒ SearchAccountLimitResponse

This API will allow user to get account level limits for the given account. It returns the velocity limits if its overridden at the account else the values will be null/empty. specific environment which needs to be passed by the client. to RFC 4122 standards) for requests and responses. This will be played back in the response from the request. Limit RequestBody

Parameters:

  • apikey (String)

    Required parameter: This is the API key of the

  • request_id (String)

    Required parameter: Mandatory UUID (according

  • body (SearchAccountLimitRequest) (defaults to: nil)

    Optional parameter: Search Account

Returns:



529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
# File 'lib/shell_card_management_ap_is/controllers/restriction_controller.rb', line 529

def (apikey,
                         request_id,
                         body: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/fleetmanagement/v1/restriction/searchaccountlimit',
                                 Server::SHELL)
               .header_param(new_parameter(apikey, key: 'apikey'))
               .header_param(new_parameter(request_id, key: 'RequestId'))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .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('BasicAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SearchAccountLimitResponse.method(:from_hash))
                .local_error('400',
                             "The server cannot or will not process the request  due to'\
                              ' something that is perceived to be a client\r\n error (e.g.,'\
                              ' malformed request syntax, invalid \r\n request message'\
                              ' framing, or deceptive request routing).",
                             APIException)
                .local_error('401',
                             'The request has not been applied because it lacks valid '\
                              ' authentication credentials for the target resource.',
                             APIException)
                .local_error('403',
                             'The server understood the request but refuses to authorize it'\
                              '.',
                             APIException)
                .local_error('404',
                             'The origin server did not find a current representation  for'\
                              ' the target resource or is not willing to disclose  that one'\
                              ' exists.',
                             APIException)
                .local_error('500',
                             'The server encountered an unexpected condition the prevented'\
                              ' it from fulfilling the request.',
                             APIException))
    .execute
end

#search_card_restriction(apikey, request_id, body: nil) ⇒ SearchCardRestrictionRes

This API will allows querying card details including the day/time and product restrictions. #### Supported operations

* Search by list of cards or bundle
* Include card bundle details (optional)

specific environment which needs to be passed by the client. to RFC 4122 standards) for requests and responses. This will be played back in the response from the request. search card request body

Parameters:

  • apikey (String)

    Required parameter: This is the API key of the

  • request_id (String)

    Required parameter: Mandatory UUID (according

  • body (SearchCardRestrictionReq) (defaults to: nil)

    Optional parameter: Restriction

Returns:



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
# File 'lib/shell_card_management_ap_is/controllers/restriction_controller.rb', line 22

def search_card_restriction(apikey,
                            request_id,
                            body: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/fleetmanagement/v2/restriction/searchcard',
                                 Server::SHELL)
               .header_param(new_parameter(apikey, key: 'apikey'))
               .header_param(new_parameter(request_id, key: 'RequestId'))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .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('BasicAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SearchCardRestrictionRes.method(:from_hash))
                .local_error('400',
                             "The server cannot or will not process the request  due to'\
                              ' something that is perceived to be a client\r\n error (e.g.,'\
                              ' malformed request syntax, invalid \r\n request message'\
                              ' framing, or deceptive request routing).",
                             APIException)
                .local_error('401',
                             'The request has not been applied because it lacks valid '\
                              ' authentication credentials for the target resource.',
                             FleetmanagementV2RestrictionSearchcard401ErrorException)
                .local_error('403',
                             'The server understood the request but refuses to authorize it'\
                              '.',
                             APIException)
                .local_error('404',
                             'The origin server did not find a current representation  for'\
                              ' the target resource or is not willing to disclose  that one'\
                              ' exists.',
                             APIException)
                .local_error('500',
                             'The server encountered an unexpected condition the prevented'\
                              ' it from fulfilling the request.',
                             FleetmanagementV2RestrictionSearchcard500ErrorException))
    .execute
end

#summaryofbundles(apikey, request_id, body: nil) ⇒ SummaryofbundleResponse

This API allows clients to get a summary of card bundles associated with Payer/Account. This API will return the basic bundle details including card and restriction details. Optionally the API will also include a count of cards that are not associated with the bundle but returned by the search criteria. Note - to include count of cards of an account that are not associated with any bundles, in the input parameter SearchCardBundles either pass all the bundles of the account in the list or pass only account with bundle id left blank/null. #### Supported operations

* Get summary of bundles by list of bundle Ids

specific environment which needs to be passed by the client. to RFC 4122 standards) for requests and responses. This will be played back in the response from the request. Bundle request body

Parameters:

  • apikey (String)

    Required parameter: This is the API key of the

  • request_id (String)

    Required parameter: Mandatory UUID (according

  • body (SummaryofbundlerRequest) (defaults to: nil)

    Optional parameter: Summary of

Returns:



411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
# File 'lib/shell_card_management_ap_is/controllers/restriction_controller.rb', line 411

def summaryofbundles(apikey,
                     request_id,
                     body: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/fleetmanagement/v1/restriction/summaryofbundles',
                                 Server::SHELL)
               .header_param(new_parameter(apikey, key: 'apikey'))
               .header_param(new_parameter(request_id, key: 'RequestId'))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .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('BasicAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SummaryofbundleResponse.method(:from_hash))
                .local_error('400',
                             "The server cannot or will not process the request  due to'\
                              ' something that is perceived to be a client\r\n error (e.g.,'\
                              ' malformed request syntax, invalid \r\n request message'\
                              ' framing, or deceptive request routing).",
                             APIException)
                .local_error('401',
                             'The request has not been applied because it lacks valid '\
                              ' authentication credentials for the target resource.',
                             APIException)
                .local_error('403',
                             'The server understood the request but refuses to authorize it'\
                              '.',
                             APIException)
                .local_error('404',
                             'The origin server did not find a current representation  for'\
                              ' the target resource or is not willing to disclose  that one'\
                              ' exists.',
                             APIException)
                .local_error('500',
                             'The server encountered an unexpected condition the prevented'\
                              ' it from fulfilling the request.',
                             APIException))
    .execute
end

#update_bundle(apikey, request_id, body: nil) ⇒ UpdateBundleResponse

This API enables clients to update an existing card bundle and its associated restrictions. #### Supported operations

* Add new cards to an existing bundle
* Remove cards from existing bundle
* Update restrictions applied to existing bundle
The following are the key validation rules with the associated error

codes for failed validation- #### Validation rules

*  `9007` - The cards must exist in the cards platform for adding or

removing cards.

*  `7014` - All the cards passed in the input are part of the selected

account.

*  `7018` - All the cards passed in the input are part of the selected

bundle.

*  `7011` - The total number of cards passed in the input must be 500 or

less.

*  `7012` - The action to remove cards should not result in removing all

the cards from the bundle.

*  `7016` - At least one restriction must be modified for “Updateâ€

request action.

*  `7013` - All restrictions cannot be marked for “Reset†for

“Update†request action.

*  `7005` - Day time restriction cannot be set to restrict the use of a

card on all days of the week. This validation is applicable for Update request action.

*  `7000` - Usage restriction of the bundle is not open ended i.e., all

the limits within the usage restriction must not be set to 0/null. This validation is applicable for Update request action.

*  `7004` - In the usage restrictions, the limits per transaction should

be less than or equal to Daily, Daily should be less than or equal to Weekly, Weekly should be less than or equal to Monthly. Exception being 0/blank will be skipped, i.e., Daily value should be less than equal to Monthly value if Weekly value is 0/blank. This validation is applicable for Update request action.

*  `0007` - Error returned if request parameters fail validation e.g. at

least one card must be provided in the input. specific environment which needs to be passed by the client. to RFC 4122 standards) for requests and responses. This will be played back in the response from the request. request body

Parameters:

  • apikey (String)

    Required parameter: This is the API key of the

  • request_id (String)

    Required parameter: Mandatory UUID (according

  • body (UpdateBundleRequest) (defaults to: nil)

    Optional parameter: Update Bundle

Returns:



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
319
320
321
322
323
324
325
326
# File 'lib/shell_card_management_ap_is/controllers/restriction_controller.rb', line 285

def update_bundle(apikey,
                  request_id,
                  body: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/fleetmanagement/v1/restriction/updatebundle',
                                 Server::SHELL)
               .header_param(new_parameter(apikey, key: 'apikey'))
               .header_param(new_parameter(request_id, key: 'RequestId'))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .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('BasicAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(UpdateBundleResponse.method(:from_hash))
                .local_error('400',
                             "The server cannot or will not process the request  due to'\
                              ' something that is perceived to be a client\r\n error (e.g.,'\
                              ' malformed request syntax, invalid \r\n request message'\
                              ' framing, or deceptive request routing).",
                             APIException)
                .local_error('401',
                             'The request has not been applied because it lacks valid '\
                              ' authentication credentials for the target resource.',
                             APIException)
                .local_error('403',
                             'The server understood the request but refuses to authorize it'\
                              '.',
                             APIException)
                .local_error('404',
                             'The origin server did not find a current representation  for'\
                              ' the target resource or is not willing to disclose  that one'\
                              ' exists.',
                             APIException)
                .local_error('500',
                             'The server encountered an unexpected condition the prevented'\
                              ' it from fulfilling the request.',
                             APIException))
    .execute
end