-
Notifications
You must be signed in to change notification settings - Fork 456
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor #1452: registration from java to kotlin
- Loading branch information
1 parent
f34cb50
commit fbf4ba3
Showing
12 changed files
with
916 additions
and
983 deletions.
There are no files selected for viewing
59 changes: 0 additions & 59 deletions
59
...spay/src/main/java/org/mifos/mobilewallet/mifospay/registration/RegistrationContract.java
This file was deleted.
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
mifospay/src/main/java/org/mifos/mobilewallet/mifospay/registration/RegistrationContract.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.mifos.mobilewallet.mifospay.registration | ||
|
||
import org.mifos.mobilewallet.mifospay.base.BasePresenter | ||
import org.mifos.mobilewallet.mifospay.base.BaseView | ||
|
||
/** | ||
* Created by ankur on 21/June/2018 | ||
*/ | ||
interface RegistrationContract { | ||
interface MobileVerificationView : BaseView<MobileVerificationPresenter?> { | ||
fun onRequestOtpSuccess() | ||
fun onOtpVerificationSuccess() | ||
fun showToast(s: String?) | ||
fun hideProgressDialog() | ||
fun onRequestOtpFailed(s: String?) | ||
fun onOtpVerificationFailed(s: String?) | ||
} | ||
|
||
interface MobileVerificationPresenter : BasePresenter { | ||
fun requestOTPfromServer(fullNumber: String?, s: String?) | ||
fun verifyOTP(otp: String?) | ||
} | ||
|
||
interface SignupView : BaseView<SignupPresenter?> { | ||
fun showToast(s: String?) | ||
fun hideProgressDialog() | ||
fun loginSuccess() | ||
fun onRegisterFailed(message: String?) | ||
fun onRegisterSuccess(s: String?) | ||
fun updatePasswordStrength(stringRes: Int, colorRes: Int, value: Int) | ||
} | ||
|
||
interface SignupPresenter : BasePresenter { | ||
fun checkPasswordStrength(password: String?) | ||
fun registerUser( | ||
firstName: String?, lastName: String?, mobileNumber: String?, email: String?, | ||
businessName: String?, addressline1: String?, addressline2: String?, pincode: String?, | ||
city: String?, countryName: String?, username: String?, password: String?, | ||
stateId: String?, countryId: String?, mifosSavingProductId: Int | ||
) | ||
} | ||
} |
63 changes: 0 additions & 63 deletions
63
...a/org/mifos/mobilewallet/mifospay/registration/presenter/MobileVerificationPresenter.java
This file was deleted.
Oops, something went wrong.
50 changes: 50 additions & 0 deletions
50
...ava/org/mifos/mobilewallet/mifospay/registration/presenter/MobileVerificationPresenter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package org.mifos.mobilewallet.mifospay.registration.presenter | ||
|
||
import org.mifos.mobilewallet.core.base.UseCase.UseCaseCallback | ||
import org.mifos.mobilewallet.core.base.UseCaseHandler | ||
import org.mifos.mobilewallet.core.domain.usecase.client.SearchClient | ||
import org.mifos.mobilewallet.mifospay.base.BaseView | ||
import org.mifos.mobilewallet.mifospay.registration.RegistrationContract | ||
import org.mifos.mobilewallet.mifospay.registration.RegistrationContract.MobileVerificationView | ||
import javax.inject.Inject | ||
|
||
/** | ||
* Created by ankur on 21/June/2018 | ||
*/ | ||
class MobileVerificationPresenter @Inject constructor(private val mUseCaseHandler: UseCaseHandler) : | ||
RegistrationContract.MobileVerificationPresenter { | ||
var mMobileVerificationView: MobileVerificationView? = null | ||
|
||
@JvmField | ||
@Inject | ||
var searchClientUseCase: SearchClient? = null | ||
override fun attachView(baseView: BaseView<*>?) { | ||
mMobileVerificationView = baseView as MobileVerificationView? | ||
mMobileVerificationView!!.setPresenter(this) | ||
} | ||
|
||
override fun requestOTPfromServer(fullNumber: String?, mobileNo: String?) { | ||
mUseCaseHandler.execute(searchClientUseCase, SearchClient.RequestValues(mobileNo), | ||
object : UseCaseCallback<SearchClient.ResponseValue?> { | ||
override fun onSuccess(response: SearchClient.ResponseValue?) { | ||
mMobileVerificationView!!.onRequestOtpFailed("Mobile number already exists.") | ||
} | ||
|
||
override fun onError(message: String) { | ||
// TODO:: request OTP | ||
mMobileVerificationView!!.onRequestOtpSuccess() | ||
} | ||
}) | ||
} | ||
|
||
override fun verifyOTP(otp: String?) { | ||
// TODO:: verify OTP | ||
mMobileVerificationView!!.onOtpVerificationSuccess() | ||
|
||
// TODO:: | ||
|
||
// if (false) { // on error | ||
// mMobileVerificationView.onOtpVerificationFailed("OTP Verification Failed."); | ||
// } | ||
} | ||
} |
Oops, something went wrong.