Class: PreventGo::TaxNotice
- Inherits:
-
Base
- Object
- Base
- PreventGo::TaxNotice
show all
- Defined in:
- lib/prevent_go/tax_notice.rb
Instance Attribute Summary
Attributes inherited from Base
#params, #request
Instance Method Summary
collapse
Methods inherited from Base
#document_controls, #document_details, #document_type, #holder_controls, #initialize
Instance Method Details
#default_holders_keys ⇒ Object
40
41
42
|
# File 'lib/prevent_go/tax_notice.rb', line 40
def default_holders_keys
%w[firstName lastName birthName birthDate]
end
|
#endpoint ⇒ Object
18
19
20
|
# File 'lib/prevent_go/tax_notice.rb', line 18
def endpoint
'/tax-notice'
end
|
#fetch_holders_infos(*keys) ⇒ Object
35
36
37
38
|
# File 'lib/prevent_go/tax_notice.rb', line 35
def fetch_holders_infos(*keys)
keys = default_holders_keys if keys.empty?
holders_data.map { |holder| holder.compact.slice(*keys).values }
end
|
#holders_data ⇒ Object
22
23
24
25
|
# File 'lib/prevent_go/tax_notice.rb', line 22
def holders_data
@_holders_data ||=
[@request.dig('taxNoticeDetails', 'holder1'), @request.dig('taxNoticeDetails', 'holder2')].compact
end
|
#quality_validated? ⇒ Boolean
27
28
29
30
31
32
33
|
# File 'lib/prevent_go/tax_notice.rb', line 27
def quality_validated?
[
document_controls['typeRecognized'],
document_controls.dig('quality', 'aboveMinimumThreshold'),
document_controls['fiscalNumberFound']
].all? { |entry| entry == 'OK' }
end
|