Creates a new CustomerOtp in the database.
Syntax
CustomerOtp
createCustomerOtp
(
long
customerId
,
String
otp
,
int
otpType
,
long
referenceId
,
Map< String, String >
msgParams
,
long
callerId
) throws OtpValidationException
Parameters
-
customerId –
for whom to create the OTP
-
otp –
if this is provided it will be used instead of an automatic generated one (optional). It needs to be numeric in case the OTP type is configured to be numeric, otherwise an OtpValidationException is thrown.
-
otpType –
the type of OTP to generate/send, defines length, message template, and send mode (email/SMS) (optional)
-
referenceId –
is stored with the CustomerOtp and can be retrieved when validating the OTP. This can be for example a transaction id in case the OTP is issued for a specific transaction
-
msgParams –
List of message parameters that is appended to the message that is sent out to the customer. Those can be referenced in the message template (which is configured for the OTP type)
-
callerId –
represents the ID of the caller of the operation. Used for tracking/audit purposes.
Returns
the newly created CustomerOtp
Usage
The OTP itself is either automatically generated according to the rules defined with the OTP type or the provided otp is used. The OTP is sent out in an email or SMS to the customer. A list of parameters can be provided to further customize the message. The key for the otp parameter is "otp". A SecureRandom is used to generate the OTP.
the newly created CustomerOtp