Creates a new CustomerOtp in the database.
Syntax
long
createOtp
(
int
otpType
,
String
receiver
,
Locale
locale
,
String
referenceId
,
Map< String, String >
msgParams
,
Long
customerId
,
long
callerId
) throws OtpValidationException
Parameters
-
otpType –
the type of OTP to generate/send, defines length, message template, and send mode (email/SMS) (optional)
-
receiver –
the receiver information. Probably an email address or mobile phone number. The Otp-types send mode has to correspond with the type of receiver provided here. Otherwise the service sends an SMS to an email address, which will not work...
-
referenceId –
is stored with the Otp and is returned 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)
-
customerId –
This is completely optional and is only used to attach the outgoing message to the customer for viewing in the message history. In general those kind of OTPs are not linked to customers.
-
callerId –
represents the ID of the caller of the operation. Used for tracking/audit purposes.
Returns
the ID of the newly created Otp
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 ID of the newly created Otp