# Switch Configuration for Mercury Device Middleware import Config # Switch System Configuration config :da_product_app, :switch, # Feature toggles features: %{ enhanced_message_handler: true, enhanced_routing: true, connection_pooling: true, circuit_breakers: true, performance_monitoring: true, security_logging: true }, # Performance settings performance: %{ max_concurrent_messages: 1000, message_processing_timeout_ms: 30_000, enable_async_processing: true, queue_max_size: 10_000 }, # Security settings security: %{ enable_audit_logging: true, mask_sensitive_data: true, max_connection_rate: 100, # per minute enable_rate_limiting: true }, # Monitoring and alerting monitoring: %{ enable_metrics: true, metrics_interval_ms: 60_000, enable_health_checks: true, health_check_interval_ms: 30_000, enable_alerts: true } # Message Handler Configuration config :da_product_app, :switch_message_handler, # Handler selection: :iso8583b (enhanced), :legacy, :auto handler: :iso8583b, # Use modern comprehensive implementation # Fallback configuration enable_fallback: false, # No need for legacy fallback anymore fallback_handler: nil, # Performance settings timeout_ms: 30_000, max_message_size: 8192, # Validation settings strict_validation: false, enable_business_rules: true, # TPDU configuration tpdu: %{ enabled: true, patterns: [ %{ pattern: <<0x60, 0x00, 0x78, 0x20, 0x00>>, length: 5, description: "Mercury Device TPDU" }, %{ pattern: <<0x60, 0x00, 0x78, 0x00, 0x00>>, length: 5, description: "Alternative Mercury TPDU" } ] }, # Error handling error_handling: %{ max_parse_retries: 3, enable_error_recovery: true, log_parse_errors: true, create_error_responses: true } # Protocol Handler Configuration config :da_product_app, :switch_protocol, # Connection settings tcp: %{ port: 8583, max_connections: 100, timeout_ms: 30_000, socket_options: [ {:active, :once}, {:packet, :raw}, {:reuseaddr, true}, {:nodelay, true} ] }, # SSL/TLS settings ssl: %{ enabled: false, port: 8584, certfile: nil, keyfile: nil, cacertfile: nil, verify: :verify_peer }, # Message processing processing: %{ buffer_size: 16384, max_buffer_size: 65536, message_framing: :length_header, enable_keepalive: true }, # Logging and monitoring logging: %{ log_connections: true, log_raw_data: false, # Set to true for debugging log_message_flow: true, log_performance: true } # Routing Configuration config :da_product_app, :switch_routing, # Router selection: :enhanced, :legacy router: :enhanced, # Routing strategies strategies: [ :processing_code, :card_type, :bin_range, :merchant_config, :default ], # Load balancing load_balancing: %{ enabled: true, strategy: :round_robin, health_check_interval: 30_000 }, # Failover configuration failover: %{ enabled: true, max_retries: 3, retry_delay_ms: 1000, circuit_breaker: %{ enabled: true, failure_threshold: 5, timeout_ms: 60_000 } }, # BIN range routing (for enhanced router) bin_routing: %{ enabled: true, ranges: %{ "411111" => %{connector: :visa, priority: 1}, "555555" => %{connector: :mastercard, priority: 1}, "378282" => %{connector: :amex, priority: 1}, "6011" => %{connector: :discover, priority: 1} } } # Connector Configuration config :da_product_app, :switch_connectors, # Connection pooling pool: %{ size: 10, max_overflow: 20, timeout_ms: 30_000, checkout_timeout_ms: 5_000 }, # Connector-specific settings visa: %{ enabled: true, host: "visa.gateway.example.com", port: 8583, ssl: false, timeout_ms: 30_000, max_retries: 3 }, mastercard: %{ enabled: true, host: "mc.gateway.example.com", port: 8583, ssl: false, timeout_ms: 30_000, max_retries: 3 }, master: %{ enabled: true, host: "master.processor.example.com", port: 8583, ssl: false, timeout_ms: 30_000, max_retries: 3 }, fallback: %{ enabled: true, default_response_code: "96", enable_logging: true } # ISO8583B TPDU Configuration (for enhanced handler) config :da_product_app, :iso8583b_tpdu, patterns: [ %{ pattern: <<0x60, 0x00, 0x78, 0x20, 0x00>>, length: 5, description: "Mercury Device TPDU" }, %{ pattern: <<0x60, 0x00, 0x78, 0x00, 0x00>>, length: 5, description: "Alternative Mercury TPDU" } ] # Environment-specific overrides import_config "#{config_env()}.exs"