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.rc;
020
021/**
022 * Internal Result Code
023 *
024 *  0xxx: authorization/financial presentment approved.
025 *  1xxx: authorization/financial presentment denied.
026 *  2xxx: authorization/financial presentment denied, pick up card.
027 *  3xxx: file actions.
028 *  4xxx: reversal or chargeback actions.
029 *  5xxx: reconciliation actions.
030 *  6xxx: administrative actions.
031 *  7xxx: fee collection actions.
032 *  8xxx: network management actions.
033 *  9xxx: error/response actions.
034 * 10xxx: jPOS specific internal result codes.
035 * 11xxx: User specific internal result codes.
036 */
037public interface IRC {
038    /**
039     * @return internal result code
040     */
041    int irc();
042
043    /**
044     * Returns the {@code int irc()} as a left-zero-padded String
045     * This is the default implementation which can be overridden for performance or other reasons.
046     * @return a left-zero-padded String with the integer value of this IRC
047     */
048    default String ircString() {
049        return String.format("%04d" , irc());
050    }
051
052    /**
053     * @return true if this IRC can be considered a 'success' (not necessarily an approval, could be a partial approval, advice accepted, etc.)
054     */
055    boolean success();
056
057    /**
058     * @return true if error type should inhibit response back to client
059     */
060    boolean inhibit();
061}