|
|
@ -525,9 +525,15 @@ class StepTwoBajajFDFragment : BaseFragment() { |
|
|
|
|
|
|
|
binding.btnAddBank.setOnClickListener { |
|
|
|
if (validateBank()) { |
|
|
|
val fullName= binding.edtFirstName.text.toString().plus(" ").plus(binding.edtMiddleName.text.toString()).plus(" ").plus(binding.edtLastName.text.toString()) |
|
|
|
verifyAccountNo( |
|
|
|
binding.edtAccountNumber.text.toString(), binding.edtIFSC.text.toString(), fullName, binding.edtMobileNumber.text.toString(), 1) |
|
|
|
verifyAccountNo( |
|
|
|
binding.edtAccountNumber.text.toString(), |
|
|
|
binding.edtIFSC.text.toString(), |
|
|
|
binding.edtFirstName.text.toString().plus(" ") |
|
|
|
.plus(binding.edtMiddleName.text.toString()).plus(" ") |
|
|
|
.plus(binding.edtLastName.text.toString()), |
|
|
|
binding.edtMobileNumber.text.toString(), |
|
|
|
1 |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -544,18 +550,29 @@ class StepTwoBajajFDFragment : BaseFragment() { |
|
|
|
binding.addBankDetail.setOnClickListener { |
|
|
|
if (binding.llBankDetails.visibility == View.GONE) { |
|
|
|
binding.llBankDetails.visibility = View.VISIBLE |
|
|
|
binding.addBankDetail.setCompoundDrawablesWithIntrinsicBounds(0,0,R.drawable.ic_minus,0) |
|
|
|
binding.addBankDetail.setCompoundDrawablesWithIntrinsicBounds( |
|
|
|
0, |
|
|
|
0, |
|
|
|
R.drawable.ic_minus, |
|
|
|
0 |
|
|
|
) |
|
|
|
|
|
|
|
} else { |
|
|
|
binding.llBankDetails.visibility = View.GONE |
|
|
|
binding.addBankDetail.setCompoundDrawablesWithIntrinsicBounds(0,0,R.drawable.ic_add_icon,0) |
|
|
|
binding.addBankDetail.setCompoundDrawablesWithIntrinsicBounds( |
|
|
|
0, |
|
|
|
0, |
|
|
|
R.drawable.ic_add_icon, |
|
|
|
0 |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
titleApi() |
|
|
|
setUpRecyclerView( |
|
|
|
(activity as BajajFdMainActivity).getClientDetailsResponse.ObjectResponse?.ClientBanklist, |
|
|
|
(activity as BajajFdMainActivity).getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_ACCNO1) |
|
|
|
(activity as BajajFdMainActivity).getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_ACCNO1 |
|
|
|
) |
|
|
|
|
|
|
|
binding.tvPersonalDetails.setOnClickListener { |
|
|
|
if (binding.llPersonalDetail.visibility == View.VISIBLE) { |
|
|
@ -709,6 +726,7 @@ class StepTwoBajajFDFragment : BaseFragment() { |
|
|
|
(activity as BajajFdMainActivity).createFDApplicantRequest.NomineeGuardianDetails = |
|
|
|
(activity as BajajFdMainActivity).nomineeGuardianDetails |
|
|
|
|
|
|
|
(activity as BajajFdMainActivity).createFDApplicantRequest.UniqueId = "" |
|
|
|
|
|
|
|
(activity as BajajFdMainActivity).createFDRequest.CreateFDApplicationRequest = |
|
|
|
(activity as BajajFdMainActivity).createFDApplicantRequest |
|
|
@ -772,7 +790,7 @@ class StepTwoBajajFDFragment : BaseFragment() { |
|
|
|
} |
|
|
|
|
|
|
|
private fun ifscCodeCheckApi(ifsc: String) { |
|
|
|
if (ifsc.length ==11) { |
|
|
|
if (ifsc.length >= 10) { |
|
|
|
stepTwoBajajFDViewModel.ifscCodeApi(ifsc, activity as BajajFdMainActivity) |
|
|
|
stepTwoBajajFDViewModel.getIfscCodeCheckMutableData.observe(viewLifecycleOwner) { response -> |
|
|
|
when (response) { |
|
|
@ -796,23 +814,16 @@ class StepTwoBajajFDFragment : BaseFragment() { |
|
|
|
listOfIFSC |
|
|
|
) |
|
|
|
binding.edtIFSC.setAdapter(adapter) |
|
|
|
|
|
|
|
binding.edtIFSC.setOnItemClickListener { _, _, position, _ -> |
|
|
|
if (listOfIFSC.size > 0) { |
|
|
|
binding.edtIFSC.setText(adapter.getItem(position).toString()) |
|
|
|
binding.edtIFSC.setText( |
|
|
|
adapter.getItem(position).toString() |
|
|
|
) |
|
|
|
binding.edtIFSC.setSelection(binding.edtIFSC.text.toString().length) |
|
|
|
getIFSCDetailsApi(binding.edtIFSC.toString()) |
|
|
|
getIFSCDetailsApi(binding.edtIFSC.text.toString()) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
// 650 -> refreshToken() |
|
|
|
else -> { |
|
|
@ -850,31 +861,20 @@ class StepTwoBajajFDFragment : BaseFragment() { |
|
|
|
ifscCode, |
|
|
|
activity as BajajFdMainActivity |
|
|
|
) |
|
|
|
stepTwoBajajFDViewModel.getifscCodeDetailsCheckMutableData.observe(viewLifecycleOwner) { response -> |
|
|
|
stepTwoBajajFDViewModel.getIfscCodeDetailsCheckMutableData.observe(viewLifecycleOwner) { response -> |
|
|
|
when (response) { |
|
|
|
is Resource.Success -> { |
|
|
|
val getIFSCCodeResponse = |
|
|
|
Gson().fromJson( |
|
|
|
response.data?.toString(), |
|
|
|
if (response.data.toString().isNotEmpty()) { |
|
|
|
val getIFSCCodeResponse = Gson().fromJson( |
|
|
|
response.data.toString(), |
|
|
|
GetIFSCCodeResponse::class.java |
|
|
|
) |
|
|
|
getIFSCCodeResponse.Response.status_code.let { code -> |
|
|
|
when (code) { |
|
|
|
200 -> { |
|
|
|
binding.edtBankName.setText(getIFSCCodeResponse.BANK) |
|
|
|
binding.edtBankBranch.setText(getIFSCCodeResponse.BRANCH) |
|
|
|
} |
|
|
|
// 650 -> refreshToken() |
|
|
|
else -> { |
|
|
|
Common.showDialogValidation( |
|
|
|
activity as BajajFdMainActivity, |
|
|
|
getIFSCCodeResponse.Response.message |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
binding.edtBankName.setText(getIFSCCodeResponse.IFSCCODEServiceResult[0].BnkDescr) |
|
|
|
binding.edtBankName.setSelection(binding.edtBankName.text.toString().length) |
|
|
|
binding.edtBankBranch.setText(getIFSCCodeResponse.IFSCCODEServiceResult[0].BankBranch) |
|
|
|
binding.edtBankBranch.setSelection( binding.edtBankBranch.text.toString().length) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
is Resource.Error -> { |
|
|
|
response.message?.let { message -> |
|
|
|
Common.showDialogValidation(activity as BajajFdMainActivity, message) |
|
|
@ -886,21 +886,28 @@ class StepTwoBajajFDFragment : BaseFragment() { |
|
|
|
is Resource.DataError -> { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private fun verifyAccountNo(bankAccount :String,Ifsc :String,name:String,phoneNumber:String,bankNo:Int) { |
|
|
|
private fun verifyAccountNo( |
|
|
|
bankAccount: String, Ifsc: String, name: String, phoneNumber: String, bankNo: Int |
|
|
|
) { |
|
|
|
|
|
|
|
val bankValidationApiRequest = BankValidationApiRequest() |
|
|
|
bankValidationApiRequest.BankAccountNo=bankAccount |
|
|
|
bankValidationApiRequest.IFSC=Ifsc |
|
|
|
bankValidationApiRequest.Name=name |
|
|
|
bankValidationApiRequest.PhoneNo=phoneNumber |
|
|
|
bankValidationApiRequest.RoleId=5 |
|
|
|
bankValidationApiRequest.BankNo=bankNo |
|
|
|
stepTwoBajajFDViewModel.bankValidationApi(bankValidationApiRequest, token, activity as BajajFdMainActivity) |
|
|
|
bankValidationApiRequest.BankAccountNo = bankAccount |
|
|
|
bankValidationApiRequest.IFSC = Ifsc |
|
|
|
bankValidationApiRequest.Name = name |
|
|
|
bankValidationApiRequest.PhoneNo = phoneNumber |
|
|
|
bankValidationApiRequest.RoleId = 5 |
|
|
|
bankValidationApiRequest.BankNo = bankNo |
|
|
|
stepTwoBajajFDViewModel.bankValidationApi( |
|
|
|
bankValidationApiRequest, |
|
|
|
token, |
|
|
|
activity as BajajFdMainActivity |
|
|
|
) |
|
|
|
stepTwoBajajFDViewModel.bankValidationApiMutableData.observe(viewLifecycleOwner) { response -> |
|
|
|
when (response) { |
|
|
|
is Resource.Success -> { |
|
|
@ -916,28 +923,38 @@ class StepTwoBajajFDFragment : BaseFragment() { |
|
|
|
|
|
|
|
when (code) { |
|
|
|
200 -> { |
|
|
|
if(getBankValidationApiResponse.Message=="Account verified") { |
|
|
|
val clientBankList =ClientBanklist() |
|
|
|
clientBankList.AccountNumber=bankAccount |
|
|
|
clientBankList.AccountType="sb" |
|
|
|
clientBankList.BankName=binding.edtBankName.text.toString() |
|
|
|
clientBankList.BranchName=binding.edtBankBranch.text.toString() |
|
|
|
clientBankList.IFSCCode=Ifsc |
|
|
|
clientBankList.IsValBank=1 |
|
|
|
if (getBankValidationApiResponse.Message == "Account verified") { |
|
|
|
val clientBankList = ClientBanklist() |
|
|
|
clientBankList.AccountNumber = bankAccount |
|
|
|
clientBankList.AccountType = "sb" |
|
|
|
clientBankList.BankName = |
|
|
|
binding.edtBankName.text.toString() |
|
|
|
clientBankList.BranchName = |
|
|
|
binding.edtBankBranch.text.toString() |
|
|
|
clientBankList.IFSCCode = Ifsc |
|
|
|
clientBankList.IsValBank = 1 |
|
|
|
(activity as BajajFdMainActivity).getClientDetailsResponse.ObjectResponse?.ClientBanklist?.let { |
|
|
|
listOfBanks.addAll( |
|
|
|
it |
|
|
|
) |
|
|
|
} |
|
|
|
listOfBanks.add(clientBankList) |
|
|
|
setUpRecyclerView(listOfBanks , clientBankList.AccountNumber.toString()) |
|
|
|
} |
|
|
|
else { |
|
|
|
Common.showDialogValidation(activity as BajajFdMainActivity, getBankValidationApiResponse.Message) |
|
|
|
setUpRecyclerView( |
|
|
|
listOfBanks, |
|
|
|
clientBankList.AccountNumber.toString() |
|
|
|
) |
|
|
|
} else { |
|
|
|
Common.showDialogValidation( |
|
|
|
activity as BajajFdMainActivity, |
|
|
|
getBankValidationApiResponse.Message |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
else -> { |
|
|
|
Common.showDialogValidation(activity as BajajFdMainActivity, getBankValidationApiResponse.Message) |
|
|
|
Common.showDialogValidation( |
|
|
|
activity as BajajFdMainActivity, |
|
|
|
getBankValidationApiResponse.Message |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -956,7 +973,6 @@ class StepTwoBajajFDFragment : BaseFragment() { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private fun validateBank(): Boolean { |
|
|
@ -995,7 +1011,10 @@ class StepTwoBajajFDFragment : BaseFragment() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private fun setUpRecyclerView( bankList: List<ClientBanklist>?, selectedAccount: String? = null) { |
|
|
|
private fun setUpRecyclerView( |
|
|
|
bankList: List<ClientBanklist>?, |
|
|
|
selectedAccount: String? = null |
|
|
|
) { |
|
|
|
val displayMetrics = DisplayMetrics() |
|
|
|
requireActivity().windowManager.defaultDisplay.getMetrics(displayMetrics) |
|
|
|
val width = displayMetrics.widthPixels.toDouble() |
|
|
@ -1004,7 +1023,7 @@ class StepTwoBajajFDFragment : BaseFragment() { |
|
|
|
LinearLayoutManager.HORIZONTAL, |
|
|
|
false |
|
|
|
) |
|
|
|
bankListAdapter = BankListAdapter(bankList, selectedAccount,width) |
|
|
|
bankListAdapter = BankListAdapter(bankList, selectedAccount, width) |
|
|
|
binding.rvClientBankList.adapter = bankListAdapter |
|
|
|
} |
|
|
|
|
|
|
@ -1228,7 +1247,7 @@ class StepTwoBajajFDFragment : BaseFragment() { |
|
|
|
private fun setUpRecyclerViewPaymentMode(listOfPayMode: List<GetCodes>) { |
|
|
|
|
|
|
|
binding.rvPaymentMode.layoutManager = |
|
|
|
GridLayoutManager(activity as BajajFdMainActivity,2) |
|
|
|
GridLayoutManager(activity as BajajFdMainActivity, 2) |
|
|
|
paymentModeAdapter = PaymentModeAdapter( |
|
|
|
listOfPayMode, |
|
|
|
listOfPayMode[0].Value |
|
|
@ -1896,7 +1915,11 @@ class StepTwoBajajFDFragment : BaseFragment() { |
|
|
|
getString(R.string.emptyState) |
|
|
|
) |
|
|
|
} else if (binding.spCity.text.toString().isEmpty()) { // EditText |
|
|
|
commonSpinnerErrorMethod(binding.spCity, binding.tlCity, getString(R.string.emptyCity)) |
|
|
|
commonSpinnerErrorMethod( |
|
|
|
binding.spCity, |
|
|
|
binding.tlCity, |
|
|
|
getString(R.string.emptyCity) |
|
|
|
) |
|
|
|
} else if (binding.edtPinCode.text.toString().isEmpty()) { // EditText |
|
|
|
commonErrorMethod( |
|
|
|
binding.edtPinCode, |
|
|
|