44import dev .resms .core .net .AbstractHttpResponse ;
55import dev .resms .core .net .HttpMethod ;
66import dev .resms .core .service .BaseService ;
7+ import dev .resms .services .otp .model .CreateOtpOptions ;
78import dev .resms .services .otp .model .CreateOtpResponse ;
89import dev .resms .services .otp .model .DeleteOtpResponse ;
910import dev .resms .services .otp .model .VerifyOtpOptions ;
@@ -26,12 +27,12 @@ public Otp(final String apiKey) {
2627 /**
2728 * Create an OTP based on the provided OTP request
2829 *
29- * @param createOtpResponse The request containing OTP details.
30+ * @param createOtpOptions The request containing OTP details.
3031 * @return The response indicating the status of the OTP creation.
3132 * @throws ReSMSException If an error occurs while creating the OTP.
3233 */
33- public CreateOtpResponse create (CreateOtpResponse createOtpResponse ) throws ReSMSException {
34- String payload = super .reSMSMapper .toJson (createOtpResponse );
34+ public CreateOtpResponse create (CreateOtpOptions createOtpOptions ) throws ReSMSException {
35+ String payload = super .reSMSMapper .toJson (createOtpOptions );
3536
3637 AbstractHttpResponse <String > response =
3738 super .httpClient .perform (CREATE_OTP_PATH , apiKey , HttpMethod .POST , payload );
@@ -41,9 +42,7 @@ public CreateOtpResponse create(CreateOtpResponse createOtpResponse) throws ReSM
4142 "Failed to create otp: " + response .getCode () + " " + response .getBody ());
4243 }
4344
44- String responseBody = response .getBody ();
45-
46- return reSMSMapper .fromJson (responseBody , CreateOtpResponse .class );
45+ return reSMSMapper .fromJson (response .getBody (), CreateOtpResponse .class );
4746 }
4847
4948 /**
@@ -64,9 +63,7 @@ public VerifyOtpResponse verify(VerifyOtpOptions verifyOtpOptions) throws ReSMSE
6463 "Failed to create otp: " + response .getCode () + " " + response .getBody ());
6564 }
6665
67- String responseBody = response .getBody ();
68-
69- return reSMSMapper .fromJson (responseBody , VerifyOtpResponse .class );
66+ return reSMSMapper .fromJson (response .getBody (), VerifyOtpResponse .class );
7067 }
7168
7269 /**
@@ -87,8 +84,6 @@ public DeleteOtpResponse delete(String otpId) throws ReSMSException {
8784 "Failed to create otp: " + response .getCode () + " " + response .getBody ());
8885 }
8986
90- String responseBody = response .getBody ();
91-
92- return reSMSMapper .fromJson (responseBody , DeleteOtpResponse .class );
87+ return reSMSMapper .fromJson (response .getBody (), DeleteOtpResponse .class );
9388 }
9489}
0 commit comments