Using non-exposable methods of service interface
This recipe explains the usage of methods that are not exposed through a web service interface. These methods are private to the web service implementation and cannot be used for integration through the web service mechanism. In the Java code, such methods have private
access as well.
How to do it…
In the CreditCardGateway
class, , we implement the Void
credit card operation which checks whether the credit card data is authorized and if a possibility of fraud exists. If the transaction is accepted, then we forward the request of the backend system.
public TransactionResponse Void(String token, BigDecimal amount) { if ( isAuthorised(token) && isFraud(token) ) { BackEndSystem.getInstance().voidOp(UUID.fromString(token), amount); return new TransactionResponse("Success.", 20002, token); } else { return new TransactionResponse("Authorization invalid or fraud suspect.", 9997, null); } }
As...