# Settlement MIS Field Configuration # Format: Simple Elixir data structure # # This file contains 14 fields that need mapping: # - 5 unmapped fields from current 71-field implementation # - 9 new fields for 85-field format # # When you provide mapping details, update the corresponding field and # use SettlementCore.MisFieldConfigReader.generate_code() to generate implementation code %{ version: "1.0.0", last_updated: "2026-04-15", # ═══════════════════════════════════════════════════════════════════════════ # UNMAPPED FIELDS (5) - Exist in current 71-field but return empty # ═══════════════════════════════════════════════════════════════════════════ unmapped_fields: [ # 1. Payment Mode (Column 16 in 71-field, Column 16 in 85-field) %{ column: 16, field_name: "Payment Mode", current_value: "", notes: "ContactContactless/Online - derive from card_type or spare_fields", mapping: %{ enabled: false, # Set true when ready source_type: nil, # :core_transaction | :tid_master | :spare_fields | :calculated source_field: nil, calculation: nil, fallback_value: "", data_type: :string } }, # 2. Interchange Type (Column 42 in 71-field, Column 49 in 85-field) %{ column: 42, column_85: 49, field_name: "Interchange Type", current_value: "", notes: "Requires MMS lookup: card_product × issuer_country", mapping: %{ enabled: false, source_type: nil, source_field: nil, calculation: nil, fallback_value: "", data_type: :string } }, # 3. Tokenise (Column 53 - NEW in 85-field, not in current 71) %{ column: 53, field_name: "Tokenise", current_value: nil, notes: "Y/N - whether transaction used tokenized card", mapping: %{ enabled: false, source_type: nil, source_field: nil, calculation: nil, fallback_value: "N", data_type: :boolean } }, # 4. Token Type (Column 54 - NEW in 85-field, not in current 71) %{ column: 54, field_name: "Token Type", current_value: nil, notes: "3DS/One-time/Recurring - type of token if tokenized", mapping: %{ enabled: false, source_type: nil, source_field: nil, calculation: nil, fallback_value: "", data_type: :string } }, # 5. ARN (Column 62 - NEW in 85-field, not in current 71) %{ column: 62, field_name: "ARN", current_value: nil, notes: "23-character Acquirer Reference Number", mapping: %{ enabled: false, source_type: nil, source_field: nil, calculation: nil, fallback_value: "", data_type: :string } } ], # ═══════════════════════════════════════════════════════════════════════════ # NEW FIELDS (9) - Columns 77-85 in latest 85-field MIS format # ═══════════════════════════════════════════════════════════════════════════ new_fields: [ # 6. Source (Column 77) %{ column: 77, field_name: "Source (direct/Channel Partner)", notes: "Direct or Channel Partner sale indicator", mapping: %{ enabled: false, source_type: nil, source_field: nil, calculation: nil, fallback_value: "Direct", data_type: :string } }, # 7. Source Id (Column 78) %{ column: 78, field_name: "Source Id", notes: "Channel partner unique identifier", mapping: %{ enabled: false, source_type: nil, source_field: nil, calculation: nil, fallback_value: "", data_type: :string } }, # 8. Source Name (Column 79) %{ column: 79, field_name: "Source Name", notes: "Channel partner business name (lookup from partner master)", mapping: %{ enabled: false, source_type: nil, source_field: nil, calculation: nil, fallback_value: "", data_type: :string } }, # 9. Channel Partner Buy rate % (Column 80) %{ column: 80, field_name: "Channel Partner Buy rate %", notes: "MDR rate offered to channel partner", mapping: %{ enabled: false, source_type: nil, source_field: nil, calculation: nil, fallback_value: "0.00", data_type: :decimal } }, # 10. Channel partner mark-up % (Column 81) %{ column: 81, field_name: "Channel partner mark-up %-(Revenue share)", notes: "Partner markup or revenue share percentage", mapping: %{ enabled: false, source_type: nil, source_field: nil, calculation: nil, fallback_value: "0.00", data_type: :decimal } }, # 11. Channel Partner Comm amount (Column 82) %{ column: 82, field_name: "Channel Partner Comm amount", notes: "Commission amount to pay partner (calculated)", mapping: %{ enabled: false, source_type: :calculated, source_field: nil, calculation: nil, # e.g., "mdr_amount × partner_markup_percentage" fallback_value: "0.00", data_type: :decimal } }, # 12. VAT on commission (Column 83) %{ column: 83, field_name: "VAT on commission", notes: "5% UAE VAT on channel partner commission", mapping: %{ enabled: false, source_type: :calculated, source_field: nil, calculation: "channel_partner_commission × 0.05", fallback_value: "0.00", data_type: :decimal } }, # 13. Commission including VAT (Column 84) %{ column: 84, field_name: "Commission including VAT", notes: "Total commission = Commission + VAT", mapping: %{ enabled: false, source_type: :calculated, source_field: nil, calculation: "channel_partner_commission + vat_on_commission", fallback_value: "0.00", data_type: :decimal } }, # 14. Net Revenue (Column 85) %{ column: 85, field_name: "Net Revenue", notes: "Net revenue after partner commissions = revenue - commission_including_vat", mapping: %{ enabled: false, source_type: :calculated, source_field: nil, calculation: "revenue - commission_including_vat", fallback_value: "0.00", data_type: :decimal } } ] } # ═══════════════════════════════════════════════════════════════════════════ # USAGE INSTRUCTIONS # ═══════════════════════════════════════════════════════════════════════════ # # 1. When business provides mapping for a field, edit that field's mapping section: # # mapping: %{ # enabled: true, # ← Set to true # source_type: :calculated, # Choose: :core_transaction, :tid_master, :spare_fields, :calculated # source_field: "card_type_code", # Database column name (if applicable) # calculation: "if x then y", # Formula or logic (if calculated) # fallback_value: "Contact", # data_type: :string # } # # 2. Test the config: # $ elixir scripts/test_mis_config.exs # # 3. Generate code in IEx: # $ iex -S mix # iex> alias SettlementCore.MisFieldConfigReader # iex> MisFieldConfigReader.print_summary() # iex> MisFieldConfigReader.generate_code() # # 4. Copy generated code to: # apps/platform_web/lib/platform_web/helpers/settlement_mis_row_builder.ex # # 5. Test and deploy! # # ═══════════════════════════════════════════════════════════════════════════