Worldpay.Reporting.EMAF (Worldpay v1.0.0)

Copy Markdown View Source

Worldpay Enhanced Merchant Activity File (eMAF) parser.

eMAF is Worldpay's daily settlement reconciliation file (v1.43, Apr 2026). Delivered via SFTP. Covers Credit, Debit POS, EBT (SNAP/WIC), Gift Card, POS Check Services, and WIC.

Record types (Credit)

RecordDescription
1Credit Reconciliation Detail Transaction
2Credit Reconciliation Detail Transaction (additional fields)
3DCC / MCP Information
4Risk Holds and Releases
5Reward Data (Summary Level)
7Customer Discretionary Data

Usage

{:ok, records} = Worldpay.Reporting.EMAF.parse_file("/path/to/emaf.dat")
{:ok, records} = Worldpay.Reporting.EMAF.parse_string(file_contents)

# Group by record type
by_type = Worldpay.Reporting.EMAF.group_by_type(records)

# Extract credit detail records
credit_records = Worldpay.Reporting.EMAF.credit_records(records)

# Find transactions with PAR
par_records = Worldpay.Reporting.EMAF.with_par(records)

# Find digital wallet transactions
wallet_records = Worldpay.Reporting.EMAF.wallet_transactions(records)

Key fields added in recent releases

  • Transaction Integrity Classification (TIC) Indicator
  • Payment Account Reference (PAR)
  • Convenience Fee Amount
  • Digital Wallet fields (Auth Detail + Reconciliation Detail)
  • Pin Conversion Flag (Debit POS Record 2)
  • FraudSight records for WIC and EBT transactions

Summary

Functions

Filter for credit detail records (Record 1).

Filter for DCC/MCP information records (Record 3).

Filter for debit POS detail records.

Filter for EBT records.

Filter transactions with FraudSight data.

Extract a named field from a parsed record.

Filter for Gift Card records.

Group records by type.

Parse an eMAF file from disk.

Parse an eMAF file from a string.

Generate a reconciliation summary from eMAF records.

Filter for Risk Hold and Release records (Record 4).

Sum transaction amounts for a list of records.

Filter digital wallet transactions.

Filter for WIC records.

Filter records that have a Payment Account Reference (PAR).

Types

record()

@type record() :: %{
  record_type: record_type(),
  record_number: String.t(),
  fields: [String.t()],
  raw: String.t()
}

record_type()

@type record_type() ::
  :credit_detail
  | :credit_detail_2
  | :dcc_mcp
  | :risk_hold
  | :reward_summary
  | :customer_discretionary
  | :debit_detail
  | :debit_detail_2
  | :ebt_detail
  | :gift_detail
  | :wic_detail
  | :check_detail
  | :header
  | :trailer
  | :unknown

Functions

credit_records(records)

@spec credit_records([record()]) :: [record()]

Filter for credit detail records (Record 1).

dcc_mcp_records(records)

@spec dcc_mcp_records([record()]) :: [record()]

Filter for DCC/MCP information records (Record 3).

debit_records(records)

@spec debit_records([record()]) :: [record()]

Filter for debit POS detail records.

ebt_records(records)

@spec ebt_records([record()]) :: [record()]

Filter for EBT records.

fraudsight_records(records)

@spec fraudsight_records([record()]) :: [record()]

Filter transactions with FraudSight data.

get_field(map, field_name)

@spec get_field(record(), atom()) :: String.t() | nil

Extract a named field from a parsed record.

gift_records(records)

@spec gift_records([record()]) :: [record()]

Filter for Gift Card records.

group_by_type(records)

@spec group_by_type([record()]) :: %{required(record_type()) => [record()]}

Group records by type.

parse_file(path)

@spec parse_file(String.t()) :: {:ok, [record()]} | {:error, term()}

Parse an eMAF file from disk.

parse_string(contents)

@spec parse_string(String.t()) :: {:ok, [record()]}

Parse an eMAF file from a string.

reconciliation_summary(records)

@spec reconciliation_summary([record()]) :: %{
  total_records: non_neg_integer(),
  credit_count: non_neg_integer(),
  debit_count: non_neg_integer(),
  ebt_count: non_neg_integer(),
  gift_count: non_neg_integer(),
  wic_count: non_neg_integer(),
  dcc_count: non_neg_integer(),
  risk_hold_count: non_neg_integer(),
  credit_total: integer(),
  debit_total: integer(),
  wallet_transactions: non_neg_integer(),
  par_transactions: non_neg_integer()
}

Generate a reconciliation summary from eMAF records.

risk_hold_records(records)

@spec risk_hold_records([record()]) :: [record()]

Filter for Risk Hold and Release records (Record 4).

sum_amounts(records)

@spec sum_amounts([record()]) :: integer()

Sum transaction amounts for a list of records.

wallet_transactions(records)

@spec wallet_transactions([record()]) :: [record()]

Filter digital wallet transactions.

wic_records(records)

@spec wic_records([record()]) :: [record()]

Filter for WIC records.

with_par(records)

@spec with_par([record()]) :: [record()]

Filter records that have a Payment Account Reference (PAR).