Hi,
Let me explain considering OTP is required for Fund-transfer scenario as narrated below.
1) Customer selects, From and To account, amount and remarks too.
2) On click of next, confirm with the customer that the initiated transaction information are correct.
3) Once confirmed send OTP to customer's registered mobile no
4) Customer enter OTP and submits. Validate OTP and process the Fund-Transfer request.
Interface Creation
1) Create an interface in Appzillon and configure data model according to Fund-Transfer API.
2) Change the interface type to custom.
Generate OTP
Assume this is step 2 in above scenario
1) Create java maven project.
2) Add below dependency to the project pom.
Code: Select all
<dependency>
<groupId>com.iexceed.appzillon</groupId>
<artifactId>appzillon-frameworks</artifactId>
<version>3.5.3.S1</version>
</dependency>
3) Create a class file and extend "ExternalServicesRouter" and your business logic goes here.
4) Below code snippet may be used as reference
Code: Select all
public class FundTransferImpl extends ExternalServicesRouter {
private static final Logger LOG = LoggerFactory.getLoggerFactory().getFrameWorksLogger(ServerConstants.LOGGER_FRAMEWORKS,
FundTransferImpl.class.toString());
public void serviceRequestDispatcher(Message pMessage, SpringCamelContext pContext)
throws ExternalServicesRouterException, InvalidPayloadException, ClassNotFoundException, URIException {
//write your logic here
JSONObject lgenOTPJSON = new JSONObject();
lgenOTPJSON.put("payload", pMessage.getRequestObject().getRequestJson());
//set request format
pMessage.getRequestObject().setRequestJson(new JSONObject().put("generateOTPRequest", lgenOTPJSON));
OTPEngineService otpEngine = new OTPEngineService();
otpEngine.generateOtp(pMessage); // for generating OTP
LOG.debug("OTP Response is : " + pMessage.getResponseObject().getResponseJson());
String otp = pMessage.getResponseObject().getResponseJson().getJSONObject("generateOTPResponse").get("otp") + ""; // OTP received
//Send otp to user's registered mobile no
}
}
OTP Parameters
Please maintain OTP length, expiry and other OTP related parameters under Security Parameters using Admin module.
Validate OTP
Considering user clicks on submit in step 4 as per above scenario.
Invoke a javascript function to validate OTP and process fund transfer request.
Below code snippet can be used for reference.
Code: Select all
var params = {}
params.refno = "434234234";
params.otp = "123456";
apz.server.validateandProcessOTP(params);