|
@ -6,6 +6,7 @@ import android.graphics.Bitmap |
|
|
import android.graphics.drawable.Drawable |
|
|
import android.graphics.drawable.Drawable |
|
|
import android.os.Bundle |
|
|
import android.os.Bundle |
|
|
import android.util.Log |
|
|
import android.util.Log |
|
|
|
|
|
import android.view.View |
|
|
import android.view.WindowManager |
|
|
import android.view.WindowManager |
|
|
import android.webkit.WebView |
|
|
import android.webkit.WebView |
|
|
import android.webkit.WebViewClient |
|
|
import android.webkit.WebViewClient |
|
@ -30,6 +31,8 @@ import com.nivesh.production.bajajfd.util.Common.Companion.selectedShape |
|
|
import com.nivesh.production.bajajfd.util.Common.Companion.showDialogValidation |
|
|
import com.nivesh.production.bajajfd.util.Common.Companion.showDialogValidation |
|
|
import com.nivesh.production.bajajfd.util.Constants.Companion.token |
|
|
import com.nivesh.production.bajajfd.util.Constants.Companion.token |
|
|
import com.nivesh.production.bajajfd.util.ProgressUtil |
|
|
import com.nivesh.production.bajajfd.util.ProgressUtil |
|
|
|
|
|
import com.nivesh.production.bajajfd.util.ProgressUtil.hideLoading |
|
|
|
|
|
import com.nivesh.production.bajajfd.util.ProgressUtil.showLoading |
|
|
import com.nivesh.production.bajajfd.util.Resource |
|
|
import com.nivesh.production.bajajfd.util.Resource |
|
|
import com.nivesh.production.bajajfd.viewModel.* |
|
|
import com.nivesh.production.bajajfd.viewModel.* |
|
|
|
|
|
|
|
@ -54,7 +57,7 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
var nomineeGuardianDetails: NomineeGuardianDetails = NomineeGuardianDetails() |
|
|
var nomineeGuardianDetails: NomineeGuardianDetails = NomineeGuardianDetails() |
|
|
var getClientDetailsResponse: getClientDetailsResponse = getClientDetailsResponse() |
|
|
var getClientDetailsResponse: getClientDetailsResponse = getClientDetailsResponse() |
|
|
var uniqueId: String = "" |
|
|
var uniqueId: String = "" |
|
|
private var stepCount: Int = 0 |
|
|
|
|
|
|
|
|
var stepCount: Int = 0 |
|
|
private lateinit var sectionsPagerAdapter: SectionsPagerAdapter |
|
|
private lateinit var sectionsPagerAdapter: SectionsPagerAdapter |
|
|
private lateinit var fragments: Array<Fragment> |
|
|
private lateinit var fragments: Array<Fragment> |
|
|
var dialogWebView: Dialog? = null |
|
|
var dialogWebView: Dialog? = null |
|
@ -66,15 +69,15 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private fun init() { |
|
|
private fun init() { |
|
|
|
|
|
|
|
|
binding = ActivityBajajFdBinding.inflate(layoutInflater) |
|
|
|
|
|
setContentView(binding.root) |
|
|
|
|
|
|
|
|
|
|
|
//start Repository |
|
|
//start Repository |
|
|
viewModel = ViewModelProvider( |
|
|
viewModel = ViewModelProvider( |
|
|
this@BajajFdMainActivity, |
|
|
this@BajajFdMainActivity, |
|
|
FDModelProviderFactory(MainRepository(ApiClient.getApiClient)) |
|
|
FDModelProviderFactory(MainRepository(ApiClient.getApiClient)) |
|
|
)[BajajFDViewModel::class.java] |
|
|
)[BajajFDViewModel::class.java] |
|
|
|
|
|
binding = ActivityBajajFdBinding.inflate(layoutInflater) |
|
|
|
|
|
binding.apply { |
|
|
|
|
|
setContentView(this.root) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
loginRole = 5 |
|
|
loginRole = 5 |
|
|
if (Common.isNetworkAvailable(this)) { |
|
|
if (Common.isNetworkAvailable(this)) { |
|
@ -88,7 +91,6 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
|
|
|
|
|
|
private fun getStepsCountApi() { |
|
|
private fun getStepsCountApi() { |
|
|
if (Common.isNetworkAvailable(this)) { |
|
|
if (Common.isNetworkAvailable(this)) { |
|
|
ProgressUtil.showLoading(this) |
|
|
|
|
|
val fdStepsCount = FDStepsCountRequest() |
|
|
val fdStepsCount = FDStepsCountRequest() |
|
|
fdStepsCount.FDProvider = getString(R.string.bajaj) |
|
|
fdStepsCount.FDProvider = getString(R.string.bajaj) |
|
|
fdStepsCount.NiveshClientCode = "8872" // 60476 |
|
|
fdStepsCount.NiveshClientCode = "8872" // 60476 |
|
@ -106,6 +108,9 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
when (code) { |
|
|
when (code) { |
|
|
200 -> { |
|
|
200 -> { |
|
|
stepCount = stepsCountResponse.Response.StepsCount |
|
|
stepCount = stepsCountResponse.Response.StepsCount |
|
|
|
|
|
if (stepCount == 3) { |
|
|
|
|
|
binding.llStep4.visibility = View.GONE |
|
|
|
|
|
} |
|
|
getClientDetailsApi(stepsCountResponse.Response.StepsCount) |
|
|
getClientDetailsApi(stepsCountResponse.Response.StepsCount) |
|
|
} |
|
|
} |
|
|
650 -> "" |
|
|
650 -> "" |
|
@ -124,7 +129,7 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
is Resource.Loading -> { |
|
|
is Resource.Loading -> { |
|
|
ProgressUtil.hideLoading() |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
is Resource.DataError -> { |
|
|
is Resource.DataError -> { |
|
|
|
|
|
|
|
@ -136,7 +141,6 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
|
|
|
|
|
|
private fun getClientDetailsApi(stepsCount: Int) { |
|
|
private fun getClientDetailsApi(stepsCount: Int) { |
|
|
if (Common.isNetworkAvailable(this@BajajFdMainActivity)) { |
|
|
if (Common.isNetworkAvailable(this@BajajFdMainActivity)) { |
|
|
ProgressUtil.showLoading(this) |
|
|
|
|
|
val getClientDetailsRequest = getClientDetailsRequest() |
|
|
val getClientDetailsRequest = getClientDetailsRequest() |
|
|
getClientDetailsRequest.client_code = "8872" |
|
|
getClientDetailsRequest.client_code = "8872" |
|
|
getClientDetailsRequest.AppOrWeb = getString(R.string.app) |
|
|
getClientDetailsRequest.AppOrWeb = getString(R.string.app) |
|
@ -160,6 +164,7 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
userRequest.deviceInfo = deviceInfo |
|
|
userRequest.deviceInfo = deviceInfo |
|
|
getClientDetailsRequest.UserRequest = userRequest |
|
|
getClientDetailsRequest.UserRequest = userRequest |
|
|
Log.e("getClientDetail ", " Request -->" + Gson().toJson(getClientDetailsRequest)) |
|
|
Log.e("getClientDetail ", " Request -->" + Gson().toJson(getClientDetailsRequest)) |
|
|
|
|
|
showLoading(this@BajajFdMainActivity) |
|
|
viewModel.getClientDetails(getClientDetailsRequest, token, this) |
|
|
viewModel.getClientDetails(getClientDetailsRequest, token, this) |
|
|
viewModel.getClientDetailsMutableData.observe(this) { response -> |
|
|
viewModel.getClientDetailsMutableData.observe(this) { response -> |
|
|
when (response) { |
|
|
when (response) { |
|
@ -190,7 +195,7 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
is Resource.Loading -> { |
|
|
is Resource.Loading -> { |
|
|
ProgressUtil.hideLoading() |
|
|
|
|
|
|
|
|
hideLoading() |
|
|
} |
|
|
} |
|
|
is Resource.DataError -> { |
|
|
is Resource.DataError -> { |
|
|
|
|
|
|
|
@ -202,7 +207,7 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
|
|
|
|
|
|
private fun setViewPager(stepsCount: Int) { |
|
|
private fun setViewPager(stepsCount: Int) { |
|
|
// steps setting |
|
|
// steps setting |
|
|
setBackground(selectedShape(), defaultShape(), defaultShape(), defaultShape()) |
|
|
|
|
|
|
|
|
setBackground(selectedShape(), defaultShape(), defaultShape(), defaultShape(), stepsCount) |
|
|
|
|
|
|
|
|
if (stepCount == 3) { |
|
|
if (stepCount == 3) { |
|
|
fragments = arrayOf( |
|
|
fragments = arrayOf( |
|
@ -222,12 +227,12 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// set viewPager |
|
|
// set viewPager |
|
|
sectionsPagerAdapter = SectionsPagerAdapter(supportFragmentManager, fragments, stepsCount) |
|
|
|
|
|
|
|
|
sectionsPagerAdapter = SectionsPagerAdapter(supportFragmentManager, fragments) |
|
|
val viewPager: DisableAdapter = binding.viewPager |
|
|
val viewPager: DisableAdapter = binding.viewPager |
|
|
viewPager.setPagingEnabled(false) |
|
|
|
|
|
viewPager.adapter = sectionsPagerAdapter |
|
|
viewPager.adapter = sectionsPagerAdapter |
|
|
|
|
|
viewPager.setPagingEnabled(false) |
|
|
if (sectionsPagerAdapter.count > 1) { |
|
|
if (sectionsPagerAdapter.count > 1) { |
|
|
viewPager.offscreenPageLimit = sectionsPagerAdapter.count - 1 |
|
|
|
|
|
|
|
|
viewPager.offscreenPageLimit = stepCount |
|
|
} else { |
|
|
} else { |
|
|
viewPager.offscreenPageLimit = 1 |
|
|
viewPager.offscreenPageLimit = 1 |
|
|
} |
|
|
} |
|
@ -246,7 +251,8 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
defaultShape(), |
|
|
defaultShape(), |
|
|
defaultShape(), |
|
|
defaultShape(), |
|
|
defaultShape(), |
|
|
defaultShape(), |
|
|
defaultShape() |
|
|
|
|
|
|
|
|
defaultShape(), |
|
|
|
|
|
stepsCount |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|
1 -> { |
|
|
1 -> { |
|
@ -254,7 +260,8 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
selectedShape(), |
|
|
selectedShape(), |
|
|
defaultShape(), |
|
|
defaultShape(), |
|
|
defaultShape(), |
|
|
defaultShape(), |
|
|
defaultShape() |
|
|
|
|
|
|
|
|
defaultShape(), |
|
|
|
|
|
stepsCount |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|
2 -> { |
|
|
2 -> { |
|
@ -262,7 +269,8 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
selectedShape(), |
|
|
selectedShape(), |
|
|
selectedShape(), |
|
|
selectedShape(), |
|
|
defaultShape(), |
|
|
defaultShape(), |
|
|
defaultShape() |
|
|
|
|
|
|
|
|
defaultShape(), |
|
|
|
|
|
stepsCount |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|
3 -> { |
|
|
3 -> { |
|
@ -270,7 +278,8 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
selectedShape(), |
|
|
selectedShape(), |
|
|
selectedShape(), |
|
|
selectedShape(), |
|
|
selectedShape(), |
|
|
selectedShape(), |
|
|
defaultShape() |
|
|
|
|
|
|
|
|
defaultShape(), |
|
|
|
|
|
stepsCount |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|
4 -> { |
|
|
4 -> { |
|
@ -278,7 +287,8 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
selectedShape(), |
|
|
selectedShape(), |
|
|
selectedShape(), |
|
|
selectedShape(), |
|
|
selectedShape(), |
|
|
selectedShape(), |
|
|
selectedShape() |
|
|
|
|
|
|
|
|
selectedShape(), |
|
|
|
|
|
stepsCount |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -293,7 +303,6 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
|
|
|
|
|
|
private fun checkFDCKYCApi() { |
|
|
private fun checkFDCKYCApi() { |
|
|
if (Common.isNetworkAvailable(this@BajajFdMainActivity)) { |
|
|
if (Common.isNetworkAvailable(this@BajajFdMainActivity)) { |
|
|
ProgressUtil.showLoading(this) |
|
|
|
|
|
if (getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CM_MOBILE?.isNotEmpty()!! && getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_DOB?.isNotEmpty()!! && getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_PAN?.isNotEmpty()!! && getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_CODE?.isNotEmpty()!!) { |
|
|
if (getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CM_MOBILE?.isNotEmpty()!! && getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_DOB?.isNotEmpty()!! && getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_PAN?.isNotEmpty()!! && getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_CODE?.isNotEmpty()!!) { |
|
|
val checkFDKYCRequest = CheckFDKYCRequest() |
|
|
val checkFDKYCRequest = CheckFDKYCRequest() |
|
|
checkFDKYCRequest.Mobile = |
|
|
checkFDKYCRequest.Mobile = |
|
@ -337,7 +346,7 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
is Resource.Loading -> { |
|
|
is Resource.Loading -> { |
|
|
ProgressUtil.hideLoading() |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
is Resource.DataError -> { |
|
|
is Resource.DataError -> { |
|
|
|
|
|
|
|
@ -354,12 +363,16 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
drawable: Drawable?, |
|
|
drawable: Drawable?, |
|
|
drawable1: Drawable?, |
|
|
drawable1: Drawable?, |
|
|
drawable2: Drawable?, |
|
|
drawable2: Drawable?, |
|
|
drawable3: Drawable? |
|
|
|
|
|
|
|
|
drawable3: Drawable?, |
|
|
|
|
|
stepsCount: Int |
|
|
) { |
|
|
) { |
|
|
binding.stepOne.background = drawable |
|
|
binding.stepOne.background = drawable |
|
|
binding.stepTwo.background = drawable1 |
|
|
binding.stepTwo.background = drawable1 |
|
|
binding.stepThree.background = drawable2 |
|
|
binding.stepThree.background = drawable2 |
|
|
binding.stepFour.background = drawable3 |
|
|
|
|
|
|
|
|
if (stepsCount == 4) { |
|
|
|
|
|
binding.stepFour.background = drawable3 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// step 1 response |
|
|
// step 1 response |
|
@ -370,6 +383,9 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
// step 2 response |
|
|
// step 2 response |
|
|
fun stepTwoApi() { |
|
|
fun stepTwoApi() { |
|
|
binding.viewPager.currentItem = 2 |
|
|
binding.viewPager.currentItem = 2 |
|
|
|
|
|
if (stepCount == 3) { |
|
|
|
|
|
stepFourBajajFDFragment.displayReceivedData() |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// step 3 response |
|
|
// step 3 response |
|
@ -425,16 +441,16 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
|
|
|
|
|
|
fun paymentReQueryApi() { |
|
|
fun paymentReQueryApi() { |
|
|
if (Common.isNetworkAvailable(this)) { |
|
|
if (Common.isNetworkAvailable(this)) { |
|
|
ProgressUtil.showLoading(this) |
|
|
|
|
|
val paymentReQueryRequest = PaymentReQueryRequest() |
|
|
val paymentReQueryRequest = PaymentReQueryRequest() |
|
|
paymentReQueryRequest.UniqueId = uniqueId |
|
|
paymentReQueryRequest.UniqueId = uniqueId |
|
|
paymentReQueryRequest.NiveshClientCode = |
|
|
paymentReQueryRequest.NiveshClientCode = |
|
|
getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_CODE |
|
|
getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_CODE |
|
|
|
|
|
ProgressUtil.showLoading(this@BajajFdMainActivity) |
|
|
viewModel.getPaymentReQuery(paymentReQueryRequest, token, this) |
|
|
viewModel.getPaymentReQuery(paymentReQueryRequest, token, this) |
|
|
viewModel.getPaymentReQueryMutableData.observe(this) { response -> |
|
|
viewModel.getPaymentReQueryMutableData.observe(this) { response -> |
|
|
when (response) { |
|
|
when (response) { |
|
|
is Resource.Success -> { |
|
|
is Resource.Success -> { |
|
|
Log.e("response", "-->$response") |
|
|
|
|
|
|
|
|
Log.e("paymentReQueryApi ", "response -->$response") |
|
|
val paymentReQueryResponse: PaymentReQueryResponse = |
|
|
val paymentReQueryResponse: PaymentReQueryResponse = |
|
|
Gson().fromJson( |
|
|
Gson().fromJson( |
|
|
response.data?.toString(), |
|
|
response.data?.toString(), |
|
@ -442,7 +458,8 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
) |
|
|
) |
|
|
paymentReQueryResponse.Response.StatusCode.let { code -> |
|
|
paymentReQueryResponse.Response.StatusCode.let { code -> |
|
|
when (code) { |
|
|
when (code) { |
|
|
200 -> { |
|
|
|
|
|
|
|
|
650 -> "" |
|
|
|
|
|
else -> { |
|
|
if (stepCount == 4) { |
|
|
if (stepCount == 4) { |
|
|
binding.viewPager.currentItem = 4 |
|
|
binding.viewPager.currentItem = 4 |
|
|
} else { |
|
|
} else { |
|
@ -450,13 +467,6 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
} |
|
|
} |
|
|
stepFiveBajajFDFragment.getData(paymentReQueryResponse) |
|
|
stepFiveBajajFDFragment.getData(paymentReQueryResponse) |
|
|
} |
|
|
} |
|
|
650 -> "" |
|
|
|
|
|
else -> { |
|
|
|
|
|
showDialogValidation( |
|
|
|
|
|
this@BajajFdMainActivity, |
|
|
|
|
|
paymentReQueryResponse.Response.Errors[0].ErrorMessage |
|
|
|
|
|
) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -466,7 +476,7 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
is Resource.Loading -> { |
|
|
is Resource.Loading -> { |
|
|
ProgressUtil.hideLoading() |
|
|
|
|
|
|
|
|
hideLoading() |
|
|
} |
|
|
} |
|
|
is Resource.DataError -> { |
|
|
is Resource.DataError -> { |
|
|
|
|
|
|
|
@ -475,4 +485,5 @@ class BajajFdMainActivity : BaseActivity() { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |