Class: Zaig::RegistrationPayload
- Inherits:
-
Object
- Object
- Zaig::RegistrationPayload
- Includes:
- Singleton
- Defined in:
- lib/zaig/registration_payload.rb
Overview
Service class to build a registration payload request.
Instance Method Summary collapse
Instance Method Details
#call(obj) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/zaig/registration_payload.rb', line 8 def call(obj) payload = { address: build_address(obj[:address]), client_category: obj[:client_category], constitution_date: obj[:constitution_date], constitution_type: obj[:constitution_type], credit_request_date: obj[:credit_request_date], credit_type: obj[:credit_type] || "clean", document_number: CNPJ.new(obj[:document_number]).formatted, email: obj[:email], id: obj[:id], legal_name: obj[:legal_name], monthly_revenue: format_money(obj[:monthly_revenue], require_positive: true), phones: build_phones(obj[:phones]), shareholders: build_shareholders(obj[:shareholders]), trading_name: obj[:trading_name] } payload[:guarantors] = build_shareholders(obj[:guarantors]) if obj.key?(:guarantors) payload[:financial] = build_financial(obj[:financial]) if obj.key?(:financial) payload[:scr_parameters] = build_scr_parameters(obj[:scr_parameters]) if obj.key?(:scr_parameters) payload[:source] = build_source(obj[:source]) if obj.key?(:source) payload[:warrants] = build_warrants(obj[:warrants]) if obj.key?(:warrants) payload end |