Class: ComplyanceSDK::Models::CountryPolicyRegistry

Inherits:
Object
  • Object
show all
Defined in:
lib/complyance_sdk/models/country_policy_registry.rb

Overview

Registry for country-specific document type policies Maps logical document types to base document types and meta configuration flags

Class Method Summary collapse

Class Method Details

.evaluate(country, logical_type) ⇒ PolicyResult

Evaluate a logical document type for a specific country

Parameters:

  • country (Symbol)

    The country code

  • logical_type (Symbol)

    The logical document type

Returns:

Raises:



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/complyance_sdk/models/country_policy_registry.rb', line 20

def evaluate(country, logical_type)
  # Validate inputs
  unless Country.valid?(country)
    raise ComplyanceSDK::Exceptions::ValidationError.new(
      "Invalid country: #{country}. Valid countries: #{Country::ALL_COUNTRIES.join(', ')}"
    )
  end

  unless LogicalDocType.valid?(logical_type)
    raise ComplyanceSDK::Exceptions::ValidationError.new(
      "Invalid logical document type: #{logical_type}. Valid types: #{LogicalDocType::ALL_TYPES.join(', ')}"
    )
  end

  # Get policy for the logical type (country-agnostic for now)
  policy = create_policy_for_logical_type(logical_type)
  
  if policy.nil?
    raise ComplyanceSDK::Exceptions::ValidationError.new(
      "Document type not allowed for country: #{country}. Logical type: #{logical_type}"
    )
  end

  policy
end