package org.jpos.tcpay;

import org.jpos.iso.ISOMsg;

public interface TransactionManager {


    /**
     *  Check the mandatory fields and mapping of the Acquirer Terminal
     *  Is the Terminal Busy
     *  Get Acquirer and Acquirer Connection, Jpos Translator
     * @param jposRequest
     * @return true if all validations pass, false otherwise
     */
    boolean checkAndValidateRequest(ISOMsg jposRequest);

    /**
     * Get the translator
     * Get the acquirer channel
     * Create IsoAcquirerTerminal
     * Manipulate meta data if needed
     * Trickle feed the offline txns if Required
     * @param jposRequest
     * @return true if onboarding is successful, false otherwise
     */
    boolean onboardRequest(ISOMsg jposRequest);

    /**
     * Send and receive the Payload
     * Transform the response to POS format
     * @param jposRequest
     * @return the transformed response ISO message
     */
    ISOMsg processTransaction(ISOMsg jposRequest);

    void cleanupTransaction();
}
