public class TransactionGatewayFactory
extends java.lang.Object
TransactionGatewayFactory
class is a singleton that allows one to setup and
configure transaction gateways for use during an EMV transaction. It notably provides
methods to register:
TransactionGateways
enumerated type)TransactionGateway
interface. As described in TransactionGateway
, this is useful
for client-applications providing their own transaction gateway implementation.TransactionGatewayFactory tgf = TransactionGatewayFactory.getInstance(); tgf.registerCurrentGateway(TransactionGateways.SIMULATED);
// Assuming that there exists a MyAutoApprovedGateway class // implementing the TransactionGateway interface. MyAutoApprovedGateway gateway = new MyAutoApprovedGateway() TransactionGatewayFactory gFactory = TransactionGatewayFactory.getInstance(); gFactory.registerCurrentGateway(gateway)For more information about implementing a transaction gateway class see
TransactionGateway
.Modifier and Type | Method and Description |
---|---|
TransactionGateway |
getCurrentGateway()
Returns the transaction gateway currently in use.
|
static TransactionGatewayFactory |
getInstance()
Gets access to the unique instance of the
TransactionGatewayFactory Singleton |
void |
registerCurrentGateway(TransactionGateway gateway)
Registers a given transaction gateway implementation as the current transaction
gateway to use.
|
void |
registerCurrentGateway(TransactionGateways gateway)
Registers a transaction gateway as the current transaction gateway to use
from the list of gateway implementations available within the Yello transaction library.
|
void |
unregisterCurrentGateway()
Unregisters the current gateway from the
TransactionGatewayFactory . |
public static TransactionGatewayFactory getInstance()
TransactionGatewayFactory
SingletonTransactionGatewayFactory
objectpublic void registerCurrentGateway(TransactionGateways gateway) throws java.lang.Exception
gateway
- a gateway enumerated type as defined in TransactionGateways
java.lang.IllegalAccessException
- if an EMV transaction is in progressjava.lang.NullPointerException
- if gateway is not implemented.java.lang.Exception
public void registerCurrentGateway(TransactionGateway gateway) throws java.lang.Exception
gateway
- a gateway class implementing the TransactionGateway
interfacejava.lang.NullPointerException
- if the gateway is nulljava.lang.IllegalAccessException
- if an EMV transaction is in progressjava.lang.Exception
public void unregisterCurrentGateway() throws java.lang.IllegalAccessException
TransactionGatewayFactory
.
In this case, the current gateway will equal to null.java.lang.IllegalAccessException
- if an EMV transaction is in progress.public TransactionGateway getCurrentGateway() throws java.lang.NullPointerException
TransactionGateway
interface.java.lang.NullPointerException
- if no current gateway is set.Copyright © 2019 Yello. All rights reserved.