public Token createToken ( Token token ) throws BaseException { logger . debug ( "Enter TokenService::createToken" ) ; // prepare API url String apiUrl = requestContext . getBaseUrl ( ) + "tokens" ; logger . info ( "apiUrl - " + apiUrl ) ; // assign TypeReference for deserialization TypeReference < Token > typeReference = new TypeReference < Token > ( ) { } ; // prepare service request Request request = new Request . RequestBuilder ( MethodType . POST , apiUrl ) . ignoreAuthHeader ( true ) . requestObject ( token ) . typeReference ( typeReference ) . context ( requestContext ) . build ( ) ; // make API call Response response = sendRequest ( request ) ; // retrieve response Token tokenResponse = ( Token ) response . getResponseObject ( ) ; // set additional attributes prepareResponse ( request , response , tokenResponse ) ; return tokenResponse ; }
Method to create BankAccount