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     * Returns the numeric internal result code.
040     * @return internal result code
041     */
042    int irc();
043
044    /**
045     * Returns the {@code int irc()} as a left-zero-padded String
046     * This is the default implementation which can be overridden for performance or other reasons.
047     * @return a left-zero-padded String with the integer value of this IRC
048     */
049    default String ircString() {
050        return String.format("%04d" , irc());
051    }
052
053    /**
054     * Returns true if this IRC represents a successful outcome.
055     * @return true if this IRC can be considered a 'success' (not necessarily an approval, could be a partial approval, advice accepted, etc.)
056     */
057    boolean success();
058
059    /**
060     * Returns true if this error type should inhibit the response to the client.
061     * @return true if error type should inhibit response back to client
062     */
063    boolean inhibit();
064}