001/*
002 * jPOS Project [http://jpos.org]
003 * Copyright (C) 2000-2026 jPOS Software SRL
004 *
005 * This program is free software: you can redistribute it and/or modify
006 * it under the terms of the GNU Affero General Public License as
007 * published by the Free Software Foundation, either version 3 of the
008 * License, or (at your option) any later version.
009 *
010 * This program is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
013 * GNU Affero General Public License for more details.
014 *
015 * You should have received a copy of the GNU Affero General Public License
016 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
017 */
018
019package org.jpos.transaction;
020
021/**
022 * Well-known keys for entries placed into a transaction {@link Context}.
023 *
024 * <p>Each constant's {@link #toString()} is the canonical context key used
025 * across jPOS participants and adaptors. Refer to the source for a concise
026 * description of each individual constant.
027 */
028public enum ContextConstants {
029    /** Per-transaction profiler instance. */
030    PROFILER,
031    /** Wall-clock timestamp captured when the transaction started. */
032    TIMESTAMP,
033    /** Source channel/peer from which the request originated. */
034    SOURCE,
035    /** Inbound request message. */
036    REQUEST,
037    /** Outbound response message. */
038    RESPONSE,
039    /** Aggregated log event for the transaction. */
040    LOGEVT,
041    /** Database connection or session reserved for this transaction. */
042    DB,
043    /** Database transaction handle, when applicable. */
044    TX,
045    /** International response code resolved during processing. */
046    IRC,
047    /** Logical transaction name. */
048    TXNNAME,
049    /** Final {@link org.jpos.rc.Result} of the transaction. */
050    RESULT,
051    /** Merchant identifier. */
052    MID,
053    /** Terminal identifier. */
054    TID,
055    /** Processing code. */
056    PCODE,
057    /** Cardholder/card data captured by the transaction. */
058    CARD,
059    /** Transmission timestamp from the inbound message. */
060    TRANSMISSION_TIMESTAMP,
061    /** Transaction timestamp from the inbound message. */
062    TRANSACTION_TIMESTAMP,
063    /** Capture date for clearing/settlement. */
064    CAPTURE_DATE,
065    /** POS data code describing the entry environment. */
066    POS_DATA_CODE,
067    /** Settlement/transaction amount. */
068    AMOUNT,
069    /** Cardholder-billing amount in the cardholder's local currency. */
070    LOCAL_AMOUNT,
071    /** MTI of the original message, when echoing or reversing. */
072    ORIGINAL_MTI,
073    /** STAN of the original message, when echoing or reversing. */
074    ORIGINAL_STAN,
075    /** Transmission timestamp of the original message. */
076    ORIGINAL_TIMESTAMP,
077    /** Data elements echoed from the original message. */
078    ORIGINAL_DATA_ELEMENTS,
079    /** Routing destination chosen for the transaction. */
080    DESTINATION,
081    /** Panic flag indicating the transaction must abort immediately. */
082    PANIC;
083
084    private final String name;
085
086    ContextConstants() {
087        this.name = name();
088    }
089    ContextConstants(String name) {
090        this.name = name;
091    }
092
093    @Override
094    public String toString() {
095        return name;
096    }
097}