Class: ModernTreasury::ValidationController
- Inherits:
-
BaseController
- Object
- BaseController
- ModernTreasury::ValidationController
- Defined in:
- lib/modern_treasury/controllers/validation_controller.rb
Overview
ValidationController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#validate_routing_number(routing_number, routing_number_type) ⇒ ApiResponse
Validates the routing number information supplied without creating a routing detail is being validated.
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 ModernTreasury::BaseController
Instance Method Details
#validate_routing_number(routing_number, routing_number_type) ⇒ ApiResponse
Validates the routing number information supplied without creating a routing detail is being validated. ‘aba`, `au_bsb`, `br_codigo`, `ca_cpa`, `cnaps`, `gb_sort_code`, `in_ifsc`, `my_branch_code`, or `swift`. In sandbox mode we currently only support `aba` and `swift` with routing numbers ’123456789’ and ‘GRINUST0XXX’ respectively.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/modern_treasury/controllers/validation_controller.rb', line 19 def validate_routing_number(routing_number, routing_number_type) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/api/validations/routing_numbers', Server::DEFAULT) .query_param(new_parameter(routing_number, key: 'routing_number') .is_required(true)) .query_param(new_parameter(routing_number_type, key: 'routing_number_type') .is_required(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic_auth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(RoutingNumberLookupRequest.method(:from_hash)) .is_api_response(true) .local_error('404', 'not found', ErrorMessageException) .local_error('422', 'unsuccessful with invalid parameter', ErrorMessageException)) .execute end |