Where is server coding?

Hi team,
where that we can be defined the API, for the client could be get data.
Hi,

You shall create a new interface and define your data model for the respective API to be consumed by Appzillon application.
Once interface is invoked from the application, API response data gets painted on client application.

Kindly let us know if you still need further clarification on the same.
Hi,
It means that API response at database's properties. When Front-end send requests to Back-end, it only set properties at database as bellow:
Capture.PNG
Capture.PNG (41.71 KiB) Viewed 690 times
Hi,

Can you please provide your requirement in detail? So that we will be able to suggest you with the best possible approach.
Hi,
Now let me explain further by giving you an example:
I have OTP input form to verify the transaction. How can I handle process logic on Back-end?
Capture.PNG
Capture.PNG (10.56 KiB) Viewed 687 times
.
thanhlong wrote:
Tue Sep 25, 2018 4:23 pm
Hi,
Now let me explain further by giving you an example:
I have OTP input form to verify the transaction. How can I handle process logic on Back-end?
Capture.PNG.
How can I know the logic on the back-end? where can I code the logic? (scripts folder or setting on the interface only?)
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);
Hi Arthanarisamy,
Thanks for your prompt reply.
I followed your instruction. However, I can't find the Security Parameters using Admin module in the OTP Parameters. Where can I do it? (on Appzillon or IDE other?). In Validate OTP, the code will be written in Scripts folder of the Applzillon application?
Thank you. :)
Hi,

You can run below update query for Security Parameters.

Code: Select all

UPDATE `TB_ASMI_SECURITY_PARAMETERS` SET 
`OTP_LENGTH`='6', // OTP to be generated of length
`OTP_VALIDATION_COUNT`='3', // OTP lock count after 'N' incorrect OTP attempts
`OTP_EXPIRY`='300', // OTP expiry in seconds
`OTP_RESEND`='Y', // is resnding OTP allowed or not 'Y'/'N'
`OTP_FORMAT`='NUMERIC', // NUMERIC, ALPHA, ALPHANUMERIC
`OTP_RESEND_COUNT`='2', // No of times OTP can be resent
`OTP_RESEND_LOCK_TIMEOUT`='300' // OTP lock timeout in seconds
WHERE `APP_ID` = 'Admin'; // Appzillon ApplicationId
Given values in the query above is for reference, you may change it to suit your requirements.

For validating OTP java scripts function has to be written in Appzillon application.