# Sample Processor Pipeline Configuration # This file demonstrates how to configure processor pipelines for different channels import Config # Configure message processors available for use config :da_product_app, :message_processors, [ DaProductApp.MercuryISO8583.Processors.ValidationProcessor, DaProductApp.MercuryISO8583.Processors.EnrichmentProcessor, DaProductApp.MercuryISO8583.Processors.RoutingProcessor ] # Configure channel-specific processor pipelines config :da_product_app, :channels, %{ # Primary POS channel (8583) - Full processing pipeline 8583 => %{ name: "primary_iso8583", packager: DaProductApp.MercuryISO8583.Packagers.ISO87BPackager, protocol: DaProductApp.Switch.EnhancedProtocol, max_connections: 100, timeout: 30_000, transformations: [], validation_rules: :standard, header_config: %{ enabled: true, type: :base1, encoding: :bcd, pattern: "6000782000", length: 5, source_address_offset: 2, source_address_length: 2, dest_address_offset: 4, dest_address_length: 2 }, processors: [ # 1. Validation - Strict mode with comprehensive checks {DaProductApp.MercuryISO8583.Processors.ValidationProcessor, %{ strict_mode: false, required_fields: [ 3, 4,11, 41, 42], validate_amounts: true, validate_dates: true, max_amount: 1_000_000, # $10,000.00 in cents allowed_mtis: ["0200", "0220", "0400", "0420", "0800", "0810"] }}, # 2. Enrichment - Add all metadata and trace numbers {DaProductApp.MercuryISO8583.Processors.EnrichmentProcessor, %{ add_timestamps: true, add_trace_numbers: true, add_channel_info: true, add_routing_info: true, trace_number_source: "sequential", timezone: "America/New_York" }}, # 3. Routing - Enhanced routing with Mastercard MPGS support and fallback options {DaProductApp.MercuryISO8583.Processors.RoutingProcessor, %{ "routing_mode" => "field_based_routing", # Enhanced routing mode # Mastercard MPGS routing (highest priority - check DE24 first) "field_routes" => %{ "24" => %{ "782" => "ysp_plain", # YSP messages with DE24=782 route to YSP plain network "784" => "mastercard_mpgs_sandbox" # Mastercard MPGS messages with DE24=784 route to simulator } }, # BIN-based routing (fallback for card transactions) "bin_routes" => %{ "4" => "visa_network", "5" => "mastercard_network", "2" => "mastercard_network", "3" => "amex_network", "6011" => "discover_network", "65" => "discover_network" }, "default_route" => "generic_processor", # Special routing for messages without PAN "reversal_route" => "reversal_processor", # For 0400/0420 reversals "admin_route" => "admin_processor", # For 0600/0620 admin messages "no_pan_fallback_route" => "generic_processor", # Fallback for other no-PAN messages # Terminal-based routing for reversals "terminal_routes" => %{ "12345678" => "terminal_specific_processor", "87654321" => "another_terminal_processor" }, # YSP-specific routing configuration "ysp_routes" => %{ "ysp_ssl" => "ysp_plain", # Primary YSP Plain network "ysp_plain" => "ysp_ssl" # Backup YSP plain SSL network }, "enable_load_balancing" => true, "failover_enabled" => true, "failover_networks" => ["ysp_ssl", "backup_processor", "generic_processor"] }} ] }, # ATM channel (8584) - Lighter processing for ATM transactions 8584 => %{ name: "secondary_iso8583", packager: DaProductApp.MercuryISO8583.Packagers.ISO87BPackager, protocol: DaProductApp.Switch.EnhancedProtocol, max_connections: 50, timeout: 15_000, transformations: [:normalize_amounts], validation_rules: :strict, header_config: %{ enabled: true, type: :base, encoding: :bcd, pattern: "123456", length: 3 }, processors: [ # 1. Basic validation - Non-strict mode {DaProductApp.MercuryISO8583.Processors.ValidationProcessor, %{ strict_mode: false, required_fields: [2, 3, 4, 11], validate_amounts: true, validate_dates: false, max_amount: 100_000, # $1,000.00 ATM limit allowed_mtis: ["0200", "0400", "0800"] }}, # 2. Basic enrichment - Timestamps only {DaProductApp.MercuryISO8583.Processors.EnrichmentProcessor, %{ add_timestamps: true, add_trace_numbers: true, add_channel_info: false, add_routing_info: false, trace_number_source: "local", timezone: "UTC" }}, # 3. Simple routing - Card type based {DaProductApp.MercuryISO8583.Processors.RoutingProcessor, %{ "routing_mode" => "card_type", "visa_network" => "visa_atm_network", "mastercard_network" => "mc_atm_network", "default_route" => "atm_processor", "enable_load_balancing" => false, "failover_enabled" => true }} ] }, # Test channel (8585) - Minimal processing for testing 8585 => %{ name: "test_channel", packager: DaProductApp.MercuryISO8583.Packagers.ISO87BPackager, protocol: DaProductApp.Switch.EnhancedProtocol, max_connections: 10, timeout: 10_000, transformations: [:add_local_timestamp], validation_rules: :lenient, header_config: %{ enabled: false, type: :base, encoding: :hex }, processors: [ # 1. Minimal validation - Log warnings only {DaProductApp.MercuryISO8583.Processors.ValidationProcessor, %{ strict_mode: false, required_fields: [], validate_amounts: false, validate_dates: false, allowed_mtis: [] # Allow all MTIs in test }}, # 2. Test enrichment - Basic timestamps {DaProductApp.MercuryISO8583.Processors.EnrichmentProcessor, %{ add_timestamps: true, add_trace_numbers: true, add_channel_info: true, add_routing_info: false, trace_number_source: "sequential", timezone: "UTC" }}, # 3. Test routing - Route everything to test network {DaProductApp.MercuryISO8583.Processors.RoutingProcessor, %{ "routing_mode" => "manual", "route_overrides" => %{ {:any, :any} => "test_network" }, "default_route" => "test_network", "enable_load_balancing" => false, "failover_enabled" => false }} ] } }