sepa

Status reports & Verification of Payee

Parse pain.002 status reports in Rust: Verification of Payee outcomes, and why a rejection explains itself at only one of three levels.

On this page

parse_pain002 reads pain.002 001.10, 001.03, 002.03 and 003.03; see reader contracts for limits. Parsing is not XSD validation.

Acceptance and rejection🔗

use sepa::parse_pain002;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let xml = std::fs::read_to_string("status-report.xml")?;
    let doc = parse_pain002(&xml)?;

    if doc.is_fully_accepted() {
        println!("accepted");
    } else {
        for tx in doc.rejected_transactions() {
            // `OrgnlEndToEndId` is optional in every version, so this is an
            // Option rather than a stand-in you cannot tell apart from real data.
            match tx.original_end_to_end_id.as_deref() {
                Some(id) => println!("{id} rejected: {:?}", tx.reason_codes),
                None => println!("unattributable rejection: {:?}", tx.reason_codes),
            }
        }
    }
    Ok(())
}

ACTC means the file was technically valid, not that money moved. ACSC is settlement completed. PaymentStatus::is_final tells the two apart when you need to wait for a terminal state.

Inspect every level🔗

Reasons can appear at group, payment-information or transaction level. rejected_transactions() only covers transaction rows; reason_codes() gathers reasons from all three levels:

use sepa::parse_pain002;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let xml = r#"<?xml version="1.0" encoding="UTF-8"?>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.002.001.10">
 <CstmrPmtStsRpt><GrpHdr><MsgId>M</MsgId></GrpHdr>
  <OrgnlGrpInfAndSts>
    <OrgnlMsgId>DD-1</OrgnlMsgId><OrgnlMsgNmId>pain.008.001.08</OrgnlMsgNmId>
    <GrpSts>RJCT</GrpSts>
    <StsRsnInf><Rsn><Cd>DUPL</Cd></Rsn>
      <AddtlInf>MsgId already received</AddtlInf></StsRsnInf>
  </OrgnlGrpInfAndSts>
 </CstmrPmtStsRpt></Document>"#;

    let doc = parse_pain002(xml)?;
    assert!(!doc.is_fully_accepted());
    assert!(doc.rejected_transactions().is_empty()); // nothing to iterate
    assert_eq!(doc.reason_codes().len(), 1);               // but there is a reason
    assert_eq!(doc.group_additional_info, ["MsgId already received"]);
    Ok(())
}

DUPL has no named ReasonCode variant and is carried as ReasonCode::Other.

Verification of Payee🔗

DK Anlage 3 V3.9 section 2.2.6 (12 March 2025; printed page 234, archive) defines these VoP outcomes in pain.002.001.10. They are DK customer-profile semantics, not a universal EPC mapping, and separate from the EPC103-24 inter-PSP API. The codes do not establish liability or settlement.

use sepa::{VerificationOutcome, parse_pain002};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let xml = std::fs::read_to_string("status-report.xml")?;

    for block in &parse_pain002(&xml)?.payment_info_statuses {
        // A file of hundreds reports counts per outcome and itemises only
        // what needs a decision.
        for bucket in &block.status_counts {
            // `count` is None when the reported number is unreadable.
            match bucket.count {
                Some(n) => println!("{n} x {:?}", bucket.status),
                None => println!("? x {:?} (count was {:?})", bucket.status, bucket.count_raw),
            }
        }

        for tx in &block.transactions {
            match tx.status.as_ref().and_then(|s| s.verification()) {
                Some(VerificationOutcome::CloseMatch) => {
                    // Reported text is not authentication of the payee.
                    println!("close match, bank holds: {:?}", tx.additional_info);
                }
                Some(VerificationOutcome::NoMatch) => {
                    println!("no match — payer decision required under the applicable process");
                }
                Some(VerificationOutcome::NotApplicable) => {
                    println!("verification not applicable");
                }
                Some(VerificationOutcome::Match) | None => {}
            }
        }
    }
    Ok(())
}
CodeOutcomeWhat to do
RCVCMatchName matched; payment acceptance is separate
RVMCClose matchShow the returned name and let the payer confirm
RVNMNo matchEscalate under the applicable payer-decision process
RVNANot applicableNo answer, a timeout, or a bank outside the scheme

A verification status is not an acceptance: is_accepted() is false for RCVC; use verification() for the name check.

Reason codes🔗

Rejections carry an ISO reason code: AC01 wrong account, AC04 closed, AC06 blocked, AM04 insufficient funds, MD01 no valid mandate, MD06 debtor revoked. Unknown codes are carried through, not dropped.


Full API reference on docs.rs. Found a mistake? Open an issue.