|
|
@ -31,6 +31,7 @@ import com.nivesh.production.niveshfd.adapter.RecommendedBankListAdapter |
|
|
|
import com.nivesh.production.niveshfd.databinding.FragmentNiveshfdStepTwoBinding |
|
|
|
import com.nivesh.production.niveshfd.model.* |
|
|
|
import com.nivesh.production.niveshfd.ui.activity.NiveshFdMainActivity |
|
|
|
import com.nivesh.production.niveshfd.util.Common |
|
|
|
import com.nivesh.production.niveshfd.util.Common.Companion.commonErrorAutoCompleteMethod |
|
|
|
import com.nivesh.production.niveshfd.util.Common.Companion.commonErrorMethod |
|
|
|
import com.nivesh.production.niveshfd.util.Common.Companion.commonSpinnerErrorMethod |
|
|
@ -140,6 +141,7 @@ class StepTwoNiveshFDFragment : Fragment() { |
|
|
|
removeError(binding.tlPanNumber) |
|
|
|
if (s.toString().trim().length == 10) { |
|
|
|
panCheckApi() |
|
|
|
checkFDCKYCApi() |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
@ -715,6 +717,55 @@ class StepTwoNiveshFDFragment : Fragment() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private fun checkFDCKYCApi() { |
|
|
|
if ((activity as NiveshFdMainActivity).getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CM_MOBILE?.isNotEmpty()!! && (activity as NiveshFdMainActivity).getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_DOB?.isNotEmpty()!! && binding.edtPANNumber.text.toString().isNotEmpty() && (activity as NiveshFdMainActivity).getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_CODE?.isNotEmpty()!!) { |
|
|
|
val checkFDKYCRequest = CheckFDKYCRequest() |
|
|
|
checkFDKYCRequest.Mobile = binding.edtMobileNumber.text.toString() |
|
|
|
checkFDKYCRequest.DOB = binding.edtDOB.text.toString() |
|
|
|
checkFDKYCRequest.PAN = binding.edtPANNumber.text.toString() |
|
|
|
checkFDKYCRequest.NiveshClientCode = (activity as NiveshFdMainActivity).getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_CODE.toString() |
|
|
|
(activity as NiveshFdMainActivity).viewModel.checkFDKYC(checkFDKYCRequest, token, activity as NiveshFdMainActivity) |
|
|
|
(activity as NiveshFdMainActivity).viewModel.getFDKYCMutableData.observe(this) { response -> |
|
|
|
when (response) { |
|
|
|
is Resource.Success -> { |
|
|
|
Log.e("response", "-->${response.data.toString()}") |
|
|
|
val getCodeResponse: GetCodeResponse = |
|
|
|
Gson().fromJson( |
|
|
|
response.data?.toString(), |
|
|
|
GetCodeResponse::class.java |
|
|
|
) |
|
|
|
getCodeResponse.Response.StatusCode.let { code -> |
|
|
|
when (code) { |
|
|
|
200 -> { |
|
|
|
// fdInvestmentDetails.CustomerType = "" |
|
|
|
} |
|
|
|
650 -> "" |
|
|
|
else -> { |
|
|
|
showDialogValidation( |
|
|
|
activity as NiveshFdMainActivity, |
|
|
|
getCodeResponse.Response.Errors[0].ErrorMessage |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
is Resource.Error -> { |
|
|
|
response.message?.let { message -> |
|
|
|
showDialogValidation(activity as NiveshFdMainActivity, message) |
|
|
|
} |
|
|
|
} |
|
|
|
is Resource.Loading -> { |
|
|
|
|
|
|
|
} |
|
|
|
is Resource.DataError -> { |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private fun createFDApi(data: CreateFDRequest) { |
|
|
|
ProgressUtil.showLoading(activity as NiveshFdMainActivity) |
|
|
|
(activity as NiveshFdMainActivity).viewModel.createFDApi(data, token, activity as NiveshFdMainActivity) |
|
|
|