diff --git a/app/src/main/java/com/nivesh/production/bajajfd/adapter/SectionsPagerAdapter.kt b/app/src/main/java/com/nivesh/production/bajajfd/adapter/SectionsPagerAdapter.kt index a576253..9267a21 100644 --- a/app/src/main/java/com/nivesh/production/bajajfd/adapter/SectionsPagerAdapter.kt +++ b/app/src/main/java/com/nivesh/production/bajajfd/adapter/SectionsPagerAdapter.kt @@ -2,18 +2,31 @@ package com.nivesh.production.bajajfd.adapter import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentManager +import androidx.fragment.app.FragmentPagerAdapter -class SectionsPagerAdapter(private val fm: FragmentManager, private val fragments: Array, private val NumberOfTabs: Int) : SmartFragmentStatePagerAdapter(fm) { - override fun getItem(position: Int): Fragment { - return fragments[position] - } +class SectionsPagerAdapter(manager: FragmentManager,private val fragments: Array, private val NumberOfTabs: Int) : FragmentPagerAdapter(manager, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) { - override fun getPageTitle(position: Int): CharSequence? { - return null - } + private val titles = ArrayList() - override fun getCount(): Int { - return NumberOfTabs - } -} \ No newline at end of file + override fun getItem(position: Int): Fragment = fragments[position] + + override fun getCount(): Int = NumberOfTabs + + override fun getPageTitle(position: Int): CharSequence = titles[position] + +} +//class SectionsPagerAdapter(private val fm: FragmentManager, private val fragments: Array, private val NumberOfTabs: Int) : SmartFragmentStatePagerAdapter(fm) { +// +// override fun getItem(position: Int): Fragment { +// return fragments[position] +// } +// +// override fun getPageTitle(position: Int): CharSequence? { +// return null +// } +// +// override fun getCount(): Int { +// return NumberOfTabs +// } +//} \ No newline at end of file diff --git a/app/src/main/java/com/nivesh/production/bajajfd/adapter/SmartFragmentStatePagerAdapter.kt b/app/src/main/java/com/nivesh/production/bajajfd/adapter/SmartFragmentStatePagerAdapter.kt deleted file mode 100644 index 9bf3033..0000000 --- a/app/src/main/java/com/nivesh/production/bajajfd/adapter/SmartFragmentStatePagerAdapter.kt +++ /dev/null @@ -1,25 +0,0 @@ -package com.nivesh.production.bajajfd.adapter - -import android.util.SparseArray -import android.view.View -import android.view.ViewGroup -import androidx.fragment.app.Fragment -import androidx.fragment.app.FragmentManager -import androidx.fragment.app.FragmentPagerAdapter -import androidx.fragment.app.FragmentStatePagerAdapter -import androidx.viewpager2.adapter.FragmentStateAdapter - -abstract class SmartFragmentStatePagerAdapter(fragmentManager: FragmentManager) : FragmentPagerAdapter(fragmentManager) { - private val registeredFragments = SparseArray() - - override fun instantiateItem(container: ViewGroup, position: Int): Any { - val fragment = super.instantiateItem(container, position) as Fragment - registeredFragments.put(position, fragment) - return fragment - } - - // Returns the fragment for the position (if instantiated) - fun getRegisteredFragment(position: Int): Fragment? { - return registeredFragments[position] - } -} diff --git a/app/src/main/java/com/nivesh/production/bajajfd/ui/activity/BajajFdMainActivity.kt b/app/src/main/java/com/nivesh/production/bajajfd/ui/activity/BajajFdMainActivity.kt index 8281066..83b36fd 100644 --- a/app/src/main/java/com/nivesh/production/bajajfd/ui/activity/BajajFdMainActivity.kt +++ b/app/src/main/java/com/nivesh/production/bajajfd/ui/activity/BajajFdMainActivity.kt @@ -35,7 +35,7 @@ import com.nivesh.production.bajajfd.viewModel.* class BajajFdMainActivity : BaseActivity() { lateinit var binding: ActivityBajajFdBinding - private lateinit var viewModel: BajajFDViewModel + lateinit var viewModel: BajajFDViewModel private val stepOneBajajFDFragment = StepOneBajajFDFragment() private val stepTwoBajajFDFragment = StepTwoBajajFDFragment() @@ -89,13 +89,12 @@ class BajajFdMainActivity : BaseActivity() { if (Common.isNetworkAvailable(this)) { val fdStepsCount = FDStepsCountRequest() fdStepsCount.FDProvider = getString(R.string.bajaj) - fdStepsCount.NiveshClientCode = "8872" - // client code =8872 /60476 + fdStepsCount.NiveshClientCode = "8872" // 60476 viewModel.getStepsCount(fdStepsCount, token, this) viewModel.getStepsCountMutableData.observe(this) { response -> when (response) { is Resource.Success -> { - Log.e("response", "-->$response") + Log.e("response", "-->${response.data.toString()}") val stepsCountResponse: StepsCountResponse = Gson().fromJson( response.data?.toString(), @@ -144,7 +143,6 @@ class BajajFdMainActivity : BaseActivity() { getClientDetailsRequest.client_code = "8872" getClientDetailsRequest.AppOrWeb = getString(R.string.app) getClientDetailsRequest.sub_broker_code = "1038" - // 8872/1038 val userRequest = UserRequest() userRequest.UID = 0 userRequest.IPAddress = "" @@ -168,7 +166,7 @@ class BajajFdMainActivity : BaseActivity() { viewModel.getClientDetailsMutableData.observe(this) { response -> when (response) { is Resource.Success -> { - Log.e("response", "-->$response") + Log.e("response", "-->${response.data.toString()}") getClientDetailsResponse = Gson().fromJson( response.data?.toString(), @@ -230,17 +228,19 @@ class BajajFdMainActivity : BaseActivity() { val viewPager: DisableAdapter = binding.viewPager viewPager.setPagingEnabled(false) viewPager.adapter = sectionsPagerAdapter + if (sectionsPagerAdapter.getCount() > 1){ + viewPager.offscreenPageLimit = sectionsPagerAdapter.count - 1 + }else{ + viewPager.offscreenPageLimit = 1 + } viewPager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener { override fun onPageScrolled( position: Int, positionOffset: Float, positionOffsetPixels: Int - ) { - Log.e("onPageScrolled", "-->".plus(position)) - } + ) {} override fun onPageSelected(position: Int) { - Log.e("onPageSelected", "-->".plus(position)) when (position) { 0 -> { setBackground( @@ -308,7 +308,7 @@ class BajajFdMainActivity : BaseActivity() { viewModel.getFDKYCMutableData.observe(this) { response -> when (response) { is Resource.Success -> { - Log.e("response", "-->$response") + Log.e("response", "-->${response.data.toString()}") val getCodeResponse: GetCodeResponse = Gson().fromJson( response.data?.toString(), @@ -363,8 +363,7 @@ class BajajFdMainActivity : BaseActivity() { } // step 1 response - fun stepOneApi(data: String?) { - Log.e("stepOneApi", " response ---> $data") + fun stepOneApi() { binding.viewPager.currentItem = 1 } diff --git a/app/src/main/java/com/nivesh/production/bajajfd/ui/fragment/StepFourBajajFDFragment.kt b/app/src/main/java/com/nivesh/production/bajajfd/ui/fragment/StepFourBajajFDFragment.kt index 8c31288..c7da25a 100644 --- a/app/src/main/java/com/nivesh/production/bajajfd/ui/fragment/StepFourBajajFDFragment.kt +++ b/app/src/main/java/com/nivesh/production/bajajfd/ui/fragment/StepFourBajajFDFragment.kt @@ -19,7 +19,6 @@ import com.nivesh.production.bajajfd.ui.activity.BajajFdMainActivity import com.nivesh.production.bajajfd.ui.providerfactory.StepFourModelProviderFactory import com.nivesh.production.bajajfd.util.Common import com.nivesh.production.bajajfd.util.Common.Companion.showDialogValidation -import com.nivesh.production.bajajfd.util.Constants import com.nivesh.production.bajajfd.util.Constants.Companion.token import com.nivesh.production.bajajfd.util.Resource import com.nivesh.production.bajajfd.viewModel.StepFourBajajFDViewModel @@ -55,11 +54,23 @@ class StepFourBajajFDFragment : BaseFragment() { } if ((activity as BajajFdMainActivity).loginRole == 5) { - binding.btnNext.text = getString(R.string.pay) - binding.btnNext.setBackgroundColor(ResourcesCompat.getColor(resources, R.color.green, null)) - }else{ + binding.btnNext.text = getString(R.string.pay) + binding.btnNext.setBackgroundColor( + ResourcesCompat.getColor( + resources, + R.color.green, + null + ) + ) + } else { binding.btnNext.text = getString(R.string.viewOrder) - binding.btnNext.setBackgroundColor(ResourcesCompat.getColor(resources, R.color.red, null)) + binding.btnNext.setBackgroundColor( + ResourcesCompat.getColor( + resources, + R.color.red, + null + ) + ) } binding.btnNext.setOnClickListener { @@ -89,7 +100,7 @@ class StepFourBajajFDFragment : BaseFragment() { resources.getString(R.string.validTermsConditions) ) } - }else{ + } else { // go to view order } } @@ -100,8 +111,12 @@ class StepFourBajajFDFragment : BaseFragment() { } private fun saveFDOtherData(data: SaveFDOtherDataRequest, payUrl: String, value: String) { - stepFourBajajFDViewModel.saveFDOtherData(data, token, activity as BajajFdMainActivity) - stepFourBajajFDViewModel.getFDOtherMutableData.observe(viewLifecycleOwner) { response -> + (activity as BajajFdMainActivity).viewModel.saveFDOtherData( + data, + token, + activity as BajajFdMainActivity + ) + (activity as BajajFdMainActivity).viewModel.getFDOtherMutableData.observe(viewLifecycleOwner) { response -> when (response) { is Resource.Success -> { Log.e("response", "-->" + response.data.toString()) @@ -153,12 +168,14 @@ class StepFourBajajFDFragment : BaseFragment() { getCodeRequest.Category = getString(R.string.customerCategory) getCodeRequest.Language = getString(R.string.language) getCodeRequest.InputValue = "" - stepFourBajajFDViewModel.paymentModeApi( + (activity as BajajFdMainActivity).viewModel.paymentModeApi( getCodeRequest, - Constants.token, + token, activity as BajajFdMainActivity ) - stepFourBajajFDViewModel.getPaymentModeMutableData.observe(viewLifecycleOwner) { response -> + (activity as BajajFdMainActivity).viewModel.getPaymentModeMutableData.observe( + viewLifecycleOwner + ) { response -> when (response) { is Resource.Success -> { Log.e("response", "-->$response") @@ -213,12 +230,14 @@ class StepFourBajajFDFragment : BaseFragment() { getFDDetailsRequest.NiveshClientCode = (mActivity as BajajFdMainActivity).getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_CODE getFDDetailsRequest.UniqueId = (activity as BajajFdMainActivity).uniqueId - stepFourBajajFDViewModel.getFDDetails( + (activity as BajajFdMainActivity).viewModel.getFDDetails( getFDDetailsRequest, - Constants.token, + token, activity as BajajFdMainActivity ) - stepFourBajajFDViewModel.getFDDetailsMutableData.observe(viewLifecycleOwner) { response -> + (activity as BajajFdMainActivity).viewModel.getFDDetailsMutableData.observe( + viewLifecycleOwner + ) { response -> when (response) { is Resource.Success -> { Log.e("response", "-->$response") diff --git a/app/src/main/java/com/nivesh/production/bajajfd/ui/fragment/StepOneBajajFDFragment.kt b/app/src/main/java/com/nivesh/production/bajajfd/ui/fragment/StepOneBajajFDFragment.kt index d5a4ad5..7dcec78 100644 --- a/app/src/main/java/com/nivesh/production/bajajfd/ui/fragment/StepOneBajajFDFragment.kt +++ b/app/src/main/java/com/nivesh/production/bajajfd/ui/fragment/StepOneBajajFDFragment.kt @@ -24,12 +24,14 @@ import com.nivesh.production.bajajfd.databinding.FragmentBajajfdStepOneBinding import com.nivesh.production.bajajfd.model.* import com.nivesh.production.bajajfd.repositories.MainRepository import com.nivesh.production.bajajfd.ui.activity.BajajFdMainActivity +import com.nivesh.production.bajajfd.ui.providerfactory.FDModelProviderFactory import com.nivesh.production.bajajfd.ui.providerfactory.StepOneModelProviderFactory import com.nivesh.production.bajajfd.util.Common import com.nivesh.production.bajajfd.util.Common.Companion.commonErrorMethod import com.nivesh.production.bajajfd.util.Common.Companion.removeError import com.nivesh.production.bajajfd.util.Constants.Companion.token import com.nivesh.production.bajajfd.util.Resource +import com.nivesh.production.bajajfd.viewModel.BajajFDViewModel import com.nivesh.production.bajajfd.viewModel.StepOneBajajFDViewModel @@ -38,6 +40,7 @@ class StepOneBajajFDFragment : BaseFragment() { private val binding get() = _binding!! private lateinit var stepOneBajajFDViewModel: StepOneBajajFDViewModel + private lateinit var stepOneBajajFDViewModel1:BajajFDViewModel private lateinit var rgMaturity: RadioButton private lateinit var listOfTenure: MutableList private lateinit var recyclerViewDropDownAdapter: HorizontalRecyclerViewAdapter @@ -57,10 +60,16 @@ class StepOneBajajFDFragment : BaseFragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - stepOneBajajFDViewModel = ViewModelProvider( + + stepOneBajajFDViewModel = ViewModelProvider( + this, + StepOneModelProviderFactory(MainRepository(ApiClient.getApiClient)) + )[StepOneBajajFDViewModel::class.java] + stepOneBajajFDViewModel1 = ViewModelProvider( this, - StepOneModelProviderFactory(MainRepository(ApiClient.getApiClient)) - )[StepOneBajajFDViewModel::class.java] + FDModelProviderFactory(MainRepository(ApiClient.getApiClient)) + )[BajajFDViewModel::class.java] + listOfTenure = ArrayList() binding.edtAmount.filters = arrayOf(InputFilter.LengthFilter(8)) // upto 1 Cr @@ -92,7 +101,6 @@ class StepOneBajajFDFragment : BaseFragment() { } else { binding.txtCumulativeNon.text = getString(R.string.cumulativeROI) } - if (binding.edtAmount.text.toString().trim().isNotEmpty()) { maturityAmountApi(tenure, interest) } @@ -123,11 +131,6 @@ class StepOneBajajFDFragment : BaseFragment() { Log.e("Maturity", "-->" + rgMaturity.text) } - // TAX Deduct - binding.rbDeductTax.setOnCheckedChangeListener { _, _ -> - Log.e("DeductTax", "-->" + binding.rbDeductTax.isChecked) - } - // Next Button binding.btnNext.setOnClickListener { if (validation()) { @@ -162,13 +165,12 @@ class StepOneBajajFDFragment : BaseFragment() { "StepOneData", "-->" + Gson().toJson((activity as BajajFdMainActivity).fdInvestmentDetails) ) - (activity as BajajFdMainActivity).stepOneApi("stepOneResponse") + (activity as BajajFdMainActivity).stepOneApi() } } minAmountApi() interestPayoutApi() - } private fun interestPayoutApi() { @@ -177,11 +179,11 @@ class StepOneBajajFDFragment : BaseFragment() { getCodeRequest.Category = getString(R.string.category) getCodeRequest.Language = getString(R.string.language) getCodeRequest.InputValue = "" - stepOneBajajFDViewModel.getCode(getCodeRequest, token, activity as BajajFdMainActivity) - stepOneBajajFDViewModel.getCodeMutableData.observe(viewLifecycleOwner) { response -> + (activity as BajajFdMainActivity).viewModel.getCode(getCodeRequest, token, activity as BajajFdMainActivity) + (activity as BajajFdMainActivity).viewModel.getCodeMutableData.observe(viewLifecycleOwner) { response -> when (response) { is Resource.Success -> { - Log.e("response", "-->$response") + Log.e("response", "-->${response.data.toString()}") val getCodeResponse: GetCodeResponse = Gson().fromJson(response.data?.toString(), GetCodeResponse::class.java) getCodeResponse.Response.StatusCode.let { code -> @@ -236,11 +238,11 @@ class StepOneBajajFDFragment : BaseFragment() { getCodeRequest.Category = getString(R.string.minAmountCategory) getCodeRequest.Language = getString(R.string.language) getCodeRequest.InputValue = "" - stepOneBajajFDViewModel.getMinAmount(getCodeRequest, token, activity as BajajFdMainActivity) - stepOneBajajFDViewModel.getMinAmountMutableData.observe(viewLifecycleOwner) { response -> + (activity as BajajFdMainActivity).viewModel.getMinAmount(getCodeRequest, token, activity as BajajFdMainActivity) + (activity as BajajFdMainActivity).viewModel.getMinAmountMutableData.observe(viewLifecycleOwner) { response -> when (response) { is Resource.Success -> { - Log.e("response", "-->$response") + Log.e("response", "-->${response.data.toString()}") val getCodeResponse: GetCodeResponse = Gson().fromJson(response.data?.toString(), GetCodeResponse::class.java) getCodeResponse.Response.StatusCode.let { code -> @@ -286,11 +288,11 @@ class StepOneBajajFDFragment : BaseFragment() { getCodeRequest.Category = getString(R.string.MaxAmountCategory) getCodeRequest.Language = getString(R.string.language) getCodeRequest.InputValue = "" - stepOneBajajFDViewModel.getMaxAmount(getCodeRequest, token, activity as BajajFdMainActivity) - stepOneBajajFDViewModel.getMaxAmountMutableData.observe(viewLifecycleOwner) { response -> + (activity as BajajFdMainActivity).viewModel.getMaxAmount(getCodeRequest, token, activity as BajajFdMainActivity) + (activity as BajajFdMainActivity).viewModel.getMaxAmountMutableData.observe(viewLifecycleOwner) { response -> when (response) { is Resource.Success -> { - Log.e("response", "-->$response") + Log.e("response", "-->${response.data.toString()}") val getCodeResponse: GetCodeResponse = Gson().fromJson(response.data?.toString(), GetCodeResponse::class.java) getCodeResponse.Response.StatusCode.let { code -> @@ -353,11 +355,11 @@ class StepOneBajajFDFragment : BaseFragment() { maturityAmountRequest.Frequency = binding.spInterestPayout.text.toString() maturityAmountRequest.Tenure = tenure maturityAmountRequest.Interest = interest - stepOneBajajFDViewModel.getMaturityAmount( + (activity as BajajFdMainActivity).viewModel.getMaturityAmount( maturityAmountRequest, activity as BajajFdMainActivity ) - stepOneBajajFDViewModel.getMaturityAmountMutableData.observe(viewLifecycleOwner) { response -> + (activity as BajajFdMainActivity).viewModel.getMaturityAmountMutableData.observe(viewLifecycleOwner) { response -> when (response) { is Resource.Success -> { val getMaturityAmountResponse = @@ -452,8 +454,8 @@ class StepOneBajajFDFragment : BaseFragment() { } else { getRatesRequest.type = getString(R.string.nonSeniorCitizen) } - stepOneBajajFDViewModel.getRates(getRatesRequest, token, activity as BajajFdMainActivity) - stepOneBajajFDViewModel.getRatesMutableData.observe(viewLifecycleOwner) { response -> + (activity as BajajFdMainActivity).viewModel.getRates(getRatesRequest, token, activity as BajajFdMainActivity) + (activity as BajajFdMainActivity).viewModel.getRatesMutableData.observe(viewLifecycleOwner) { response -> when (response) { is Resource.Success -> { val getRatesResponse: GetRatesResponse = @@ -523,6 +525,6 @@ class StepOneBajajFDFragment : BaseFragment() { override fun onDestroyView() { super.onDestroyView() - _binding = null + // _binding = null } } \ No newline at end of file diff --git a/app/src/main/java/com/nivesh/production/bajajfd/ui/fragment/StepThreeBajajFDFragment.kt b/app/src/main/java/com/nivesh/production/bajajfd/ui/fragment/StepThreeBajajFDFragment.kt index 455916a..df3a61f 100644 --- a/app/src/main/java/com/nivesh/production/bajajfd/ui/fragment/StepThreeBajajFDFragment.kt +++ b/app/src/main/java/com/nivesh/production/bajajfd/ui/fragment/StepThreeBajajFDFragment.kt @@ -397,12 +397,14 @@ class StepThreeBajajFDFragment : BaseFragment() { du.NiveshClientCode = (activity as BajajFdMainActivity).getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_CODE du.UniqueId = (activity as BajajFdMainActivity).uniqueId - stepThreeBajajFDViewModel.documentsUpload( + (activity as BajajFdMainActivity).viewModel.documentsUpload( du, Constants.token, activity as BajajFdMainActivity ) - stepThreeBajajFDViewModel.getDocumentUploadMutableData.observe(viewLifecycleOwner) { response -> + (activity as BajajFdMainActivity).viewModel.getDocumentUploadMutableData.observe( + viewLifecycleOwner + ) { response -> when (response) { is Resource.Success -> { Log.e("UploadImage", "Response-->" + response.data.toString()) @@ -448,12 +450,14 @@ class StepThreeBajajFDFragment : BaseFragment() { } private fun createFDApi(data: CreateFDRequest) { - stepThreeBajajFDViewModel.createFDApi( + (activity as BajajFdMainActivity).viewModel.createFDApi( data, Constants.token, activity as BajajFdMainActivity ) - stepThreeBajajFDViewModel.getFDResponseMutableData.observe(viewLifecycleOwner) { response -> + (activity as BajajFdMainActivity).viewModel.getFDResponseMutableData.observe( + viewLifecycleOwner + ) { response -> when (response) { is Resource.Success -> { Log.e("createFDApi", "response--> " + response.data.toString()) @@ -499,12 +503,12 @@ class StepThreeBajajFDFragment : BaseFragment() { getCodeRequest.Category = getString(R.string.docType) getCodeRequest.Language = getString(R.string.language) getCodeRequest.InputValue = "" - stepThreeBajajFDViewModel.titleApi( + (activity as BajajFdMainActivity).viewModel.titleApi( getCodeRequest, Constants.token, activity as BajajFdMainActivity ) - stepThreeBajajFDViewModel.getTitleMutableData.observe(viewLifecycleOwner) { response -> + (activity as BajajFdMainActivity).viewModel.getTitleMutableData.observe(viewLifecycleOwner) { response -> when (response) { is Resource.Success -> { Log.e("response", "-->$response") diff --git a/app/src/main/java/com/nivesh/production/bajajfd/ui/fragment/StepTwoBajajFDFragment.kt b/app/src/main/java/com/nivesh/production/bajajfd/ui/fragment/StepTwoBajajFDFragment.kt index 7faae89..2ec88d1 100644 --- a/app/src/main/java/com/nivesh/production/bajajfd/ui/fragment/StepTwoBajajFDFragment.kt +++ b/app/src/main/java/com/nivesh/production/bajajfd/ui/fragment/StepTwoBajajFDFragment.kt @@ -728,8 +728,8 @@ class StepTwoBajajFDFragment : BaseFragment() { } private fun createFDApi(data: CreateFDRequest) { - stepTwoBajajFDViewModel.createFDApi(data, token, activity as BajajFdMainActivity) - stepTwoBajajFDViewModel.getFDResponseMutableData.observe(viewLifecycleOwner) { response -> + (activity as BajajFdMainActivity).viewModel.createFDApi(data, token, activity as BajajFdMainActivity) + (activity as BajajFdMainActivity).viewModel.getFDResponseMutableData.observe(viewLifecycleOwner) { response -> when (response) { is Resource.Success -> { Log.e("response", "-->$response") @@ -773,8 +773,8 @@ class StepTwoBajajFDFragment : BaseFragment() { private fun ifscCodeCheckApi(ifsc: String) { if (ifsc.length >= 10) { - stepTwoBajajFDViewModel.ifscCodeApi(ifsc, activity as BajajFdMainActivity) - stepTwoBajajFDViewModel.getIfscCodeCheckMutableData.observe(viewLifecycleOwner) { response -> + (activity as BajajFdMainActivity).viewModel.ifscCodeApi(ifsc, activity as BajajFdMainActivity) + (activity as BajajFdMainActivity).viewModel.getIfscCodeCheckMutableData.observe(viewLifecycleOwner) { response -> when (response) { is Resource.Success -> { val getIFSCCodeListResponse = @@ -839,11 +839,11 @@ class StepTwoBajajFDFragment : BaseFragment() { private fun getIFSCDetailsApi(ifscCode: String) { - stepTwoBajajFDViewModel.ifscCodeDetailsApi( + (activity as BajajFdMainActivity).viewModel.ifscCodeDetailsApi( ifscCode, activity as BajajFdMainActivity ) - stepTwoBajajFDViewModel.getIfscCodeDetailsCheckMutableData.observe(viewLifecycleOwner) { response -> + (activity as BajajFdMainActivity).viewModel.getIfscCodeDetailsCheckMutableData.observe(viewLifecycleOwner) { response -> when (response) { is Resource.Success -> { if (response.data.toString().isNotEmpty()) { @@ -885,12 +885,12 @@ class StepTwoBajajFDFragment : BaseFragment() { bankValidationApiRequest.PhoneNo = phoneNumber bankValidationApiRequest.RoleId = loginRole bankValidationApiRequest.BankNo = bankNo - stepTwoBajajFDViewModel.bankValidationApi( + (activity as BajajFdMainActivity).viewModel.bankValidationApi( bankValidationApiRequest, token, activity as BajajFdMainActivity ) - stepTwoBajajFDViewModel.bankValidationApiMutableData.observe(viewLifecycleOwner) { response -> + (activity as BajajFdMainActivity).viewModel.bankValidationApiMutableData.observe(viewLifecycleOwner) { response -> when (response) { is Resource.Success -> { val getBankValidationApiResponse = @@ -1061,8 +1061,8 @@ class StepTwoBajajFDFragment : BaseFragment() { (activity as BajajFdMainActivity).getClientDetailsResponse.ObjectResponse?.clientDetails?.sub_broker_code panCheck.panNumber = binding.edtPANNumber.text.toString() panCheck.mobileNumber = "" - stepTwoBajajFDViewModel.panCheck(panCheck, token, activity as BajajFdMainActivity) - stepTwoBajajFDViewModel.getPanCheckMutableData.observe(viewLifecycleOwner) { response -> + (activity as BajajFdMainActivity).viewModel.panCheck(panCheck, token, activity as BajajFdMainActivity) + (activity as BajajFdMainActivity).viewModel.getPanCheckMutableData.observe(viewLifecycleOwner) { response -> when (response) { is Resource.Success -> { val panCheckResponse = @@ -1119,8 +1119,8 @@ class StepTwoBajajFDFragment : BaseFragment() { getCodeRequest.Category = getString(R.string.salutationCategory) getCodeRequest.Language = getString(R.string.language) getCodeRequest.InputValue = "" - stepTwoBajajFDViewModel.titleApi(getCodeRequest, token, activity as BajajFdMainActivity) - stepTwoBajajFDViewModel.getTitleMutableData.observe(viewLifecycleOwner) { response -> + (activity as BajajFdMainActivity).viewModel.titleApi(getCodeRequest, token, activity as BajajFdMainActivity) + (activity as BajajFdMainActivity).viewModel.getTitleMutableData.observe(viewLifecycleOwner) { response -> when (response) { is Resource.Success -> { Log.e("response", "-->$response") @@ -1202,12 +1202,12 @@ class StepTwoBajajFDFragment : BaseFragment() { getCodeRequest.Category = getString(R.string.paymentModeCategory) getCodeRequest.Language = getString(R.string.language) getCodeRequest.InputValue = "" - stepTwoBajajFDViewModel.paymentModeApi( + (activity as BajajFdMainActivity).viewModel.paymentModeApi( getCodeRequest, token, activity as BajajFdMainActivity ) - stepTwoBajajFDViewModel.getPaymentModeMutableData.observe(viewLifecycleOwner) { response -> + (activity as BajajFdMainActivity).viewModel.getPaymentModeMutableData.observe(viewLifecycleOwner) { response -> when (response) { is Resource.Success -> { Log.e("response", "-->$response") @@ -1264,12 +1264,12 @@ class StepTwoBajajFDFragment : BaseFragment() { getCodeRequest.Category = getString(R.string.genderCategory) getCodeRequest.Language = getString(R.string.language) getCodeRequest.InputValue = "" - stepTwoBajajFDViewModel.genderApi( + (activity as BajajFdMainActivity).viewModel.genderApi( getCodeRequest, token, activity as BajajFdMainActivity ) - stepTwoBajajFDViewModel.getGenderMutableData.observe(viewLifecycleOwner) { response -> + (activity as BajajFdMainActivity).viewModel.getGenderMutableData.observe(viewLifecycleOwner) { response -> when (response) { is Resource.Success -> { Log.e("response", "-->$response") @@ -1324,12 +1324,12 @@ class StepTwoBajajFDFragment : BaseFragment() { getCodeRequest.Category = getString(R.string.relationshipCategory) getCodeRequest.Language = getString(R.string.language) getCodeRequest.InputValue = "" - stepTwoBajajFDViewModel.relationShipApi( + (activity as BajajFdMainActivity).viewModel.relationShipApi( getCodeRequest, token, activity as BajajFdMainActivity ) - stepTwoBajajFDViewModel.getRelationShipMutableData.observe(viewLifecycleOwner) { response -> + (activity as BajajFdMainActivity).viewModel.getRelationShipMutableData.observe(viewLifecycleOwner) { response -> when (response) { is Resource.Success -> { Log.e("response", "-->$response") @@ -1392,12 +1392,12 @@ class StepTwoBajajFDFragment : BaseFragment() { getCodeRequest.Category = getString(R.string.maritalCategory) getCodeRequest.Language = getString(R.string.language) getCodeRequest.InputValue = "" - stepTwoBajajFDViewModel.maritalStatusApi( + (activity as BajajFdMainActivity).viewModel.maritalStatusApi( getCodeRequest, token, activity as BajajFdMainActivity ) - stepTwoBajajFDViewModel.getMaritalStatusMutableData.observe(viewLifecycleOwner) { response -> + (activity as BajajFdMainActivity).viewModel.getMaritalStatusMutableData.observe(viewLifecycleOwner) { response -> when (response) { is Resource.Success -> { Log.e("response", "-->$response") @@ -1452,12 +1452,12 @@ class StepTwoBajajFDFragment : BaseFragment() { getCodeRequest.Category = getString(R.string.occupationCategory) getCodeRequest.Language = getString(R.string.language) getCodeRequest.InputValue = "" - stepTwoBajajFDViewModel.occupationApi( + (activity as BajajFdMainActivity).viewModel.occupationApi( getCodeRequest, token, activity as BajajFdMainActivity ) - stepTwoBajajFDViewModel.getOccupationMutableData.observe(viewLifecycleOwner) { response -> + (activity as BajajFdMainActivity).viewModel.getOccupationMutableData.observe(viewLifecycleOwner) { response -> when (response) { is Resource.Success -> { Log.e("response", "-->$response") @@ -1512,12 +1512,12 @@ class StepTwoBajajFDFragment : BaseFragment() { getCodeRequest.Category = getString(R.string.annualIncome) getCodeRequest.Language = getString(R.string.language) getCodeRequest.InputValue = "" - stepTwoBajajFDViewModel.annualIncomeApi( + (activity as BajajFdMainActivity).viewModel.annualIncomeApi( getCodeRequest, token, activity as BajajFdMainActivity ) - stepTwoBajajFDViewModel.getAnnualIncomeMutableData.observe(viewLifecycleOwner) { response -> + (activity as BajajFdMainActivity).viewModel.getAnnualIncomeMutableData.observe(viewLifecycleOwner) { response -> when (response) { is Resource.Success -> { Log.e("response", "-->$response") @@ -1567,8 +1567,8 @@ class StepTwoBajajFDFragment : BaseFragment() { } private fun stateListApi() { - stepTwoBajajFDViewModel.stateApi(token, activity as BajajFdMainActivity) - stepTwoBajajFDViewModel.getStateMasterMutableData.observe(viewLifecycleOwner) { response -> + (activity as BajajFdMainActivity).viewModel.stateApi(token, activity as BajajFdMainActivity) + (activity as BajajFdMainActivity).viewModel.getStateMasterMutableData.observe(viewLifecycleOwner) { response -> when (response) { is Resource.Success -> { Log.e("response", "-->$response") @@ -1654,8 +1654,8 @@ class StepTwoBajajFDFragment : BaseFragment() { cityRequest.HOCode = "" cityRequest.Source = getString(R.string.source) cityRequest.APP_Web = getString(R.string.app) - stepTwoBajajFDViewModel.cityListApi(cityRequest, token, activity as BajajFdMainActivity) - stepTwoBajajFDViewModel.getCityListMutableData.observe(viewLifecycleOwner) { response -> + (activity as BajajFdMainActivity).viewModel.cityListApi(cityRequest, token, activity as BajajFdMainActivity) + (activity as BajajFdMainActivity).viewModel.getCityListMutableData.observe(viewLifecycleOwner) { response -> when (response) { is Resource.Success -> { Log.e("response", "-->$response") @@ -1717,8 +1717,8 @@ class StepTwoBajajFDFragment : BaseFragment() { } private fun apiForEligibleBankList() { - stepTwoBajajFDViewModel.bankListApi(token,getString(R.string.language), activity as BajajFdMainActivity) - stepTwoBajajFDViewModel.getFDBankListMutableData.observe(viewLifecycleOwner) { response -> + (activity as BajajFdMainActivity).viewModel.bankListApi(token,getString(R.string.language), activity as BajajFdMainActivity) + (activity as BajajFdMainActivity).viewModel.getFDBankListMutableData.observe(viewLifecycleOwner) { response -> when (response) { is Resource.Success -> { Log.e("response", "-->$response") diff --git a/app/src/main/java/com/nivesh/production/bajajfd/viewModel/BajajFDViewModel.kt b/app/src/main/java/com/nivesh/production/bajajfd/viewModel/BajajFDViewModel.kt index 732aba4..d0ba214 100644 --- a/app/src/main/java/com/nivesh/production/bajajfd/viewModel/BajajFDViewModel.kt +++ b/app/src/main/java/com/nivesh/production/bajajfd/viewModel/BajajFDViewModel.kt @@ -7,14 +7,14 @@ import androidx.lifecycle.viewModelScope import com.google.gson.JsonObject import com.nivesh.production.bajajfd.model.* import com.nivesh.production.bajajfd.repositories.MainRepository -import com.nivesh.production.bajajfd.ui.activity.BajajFdMainActivity import com.nivesh.production.bajajfd.util.Common import com.nivesh.production.bajajfd.util.Common.Companion.handleError import com.nivesh.production.bajajfd.util.Common.Companion.handleResponse +import com.nivesh.production.bajajfd.util.Constants import com.nivesh.production.bajajfd.util.Resource import kotlinx.coroutines.launch -class BajajFDViewModel(private val mainRepository: MainRepository) : ViewModel() { +open class BajajFDViewModel(private val mainRepository: MainRepository) : ViewModel() { val getStepsCountMutableData: MutableLiveData> = MutableLiveData() fun getStepsCount( @@ -49,7 +49,6 @@ class BajajFDViewModel(private val mainRepository: MainRepository) : ViewModel() } } - val getPaymentReQueryMutableData: MutableLiveData> = MutableLiveData() fun getPaymentReQuery(requestBody: PaymentReQueryRequest, token : String, activity: Activity) = viewModelScope.launch(handleError(activity)) { if (Common.isNetworkAvailable(activity)) { @@ -60,4 +59,305 @@ class BajajFDViewModel(private val mainRepository: MainRepository) : ViewModel() } + // Step 1 Api + val getMinAmountMutableData: MutableLiveData> = MutableLiveData() + fun getMinAmount(requestBody: GetCodeRequest, token: String, activity: Activity) = + viewModelScope.launch( + handleError(activity) + ) { + if (Common.isNetworkAvailable(activity)) { + getMinAmountMutableData.postValue(Resource.Loading()) + val response = mainRepository.getCodesResponse(requestBody, token) + getMinAmountMutableData.postValue(handleResponse(response)) + } + } + + val getMaxAmountMutableData: MutableLiveData> = MutableLiveData() + fun getMaxAmount(requestBody: GetCodeRequest, token: String, activity: Activity) = + viewModelScope.launch( + handleError(activity) + ) { + if (Common.isNetworkAvailable(activity)) { + getMaxAmountMutableData.postValue(Resource.Loading()) + val response = mainRepository.getCodesResponse(requestBody, token) + getMaxAmountMutableData.postValue(handleResponse(response)) + } + } + + val getMaturityAmountMutableData: MutableLiveData> = MutableLiveData() + fun getMaturityAmount(requestBody: GetMaturityAmountRequest, activity: Activity) = + viewModelScope.launch( + handleError(activity) + ) { + if (Common.isNetworkAvailable(activity)) { + getMaturityAmountMutableData.postValue(Resource.Loading()) + val response = mainRepository.createCalculateFDMaturityAmount(requestBody, + Constants.token + ) + getMaturityAmountMutableData.postValue(handleResponse(response)) + } + } + + val getRatesMutableData: MutableLiveData> = MutableLiveData() + fun getRates(getRatesRequest: GetRatesRequest, token: String, activity: Activity) = + viewModelScope.launch( + handleError(activity) + ) { + if (Common.isNetworkAvailable(activity)) { + getRatesMutableData.postValue(Resource.Loading()) + val response = mainRepository.getRatesResponse(getRatesRequest, token) + getRatesMutableData.postValue(handleResponse(response)) + } + } + + val getCodeMutableData: MutableLiveData> = MutableLiveData() + fun getCode(requestBody: GetCodeRequest, token: String, activity: Activity) = + viewModelScope.launch( + handleError(activity) + ) { + if (Common.isNetworkAvailable(activity)) { + getCodeMutableData.postValue(Resource.Loading()) + val response = mainRepository.getCodesResponse(requestBody, token) + getCodeMutableData.postValue(handleResponse(response)) + } + } + + + // Step 2 + val getPanCheckMutableData: MutableLiveData> = MutableLiveData() + fun panCheck(panCheck: PanCheckRequest, token: String, activity : Activity) = viewModelScope.launch( + handleError(activity) + ) { + if (Common.isNetworkAvailable(activity)) { + getPanCheckMutableData.postValue(Resource.Loading()) + val response = mainRepository.panCheck(panCheck, token) + getPanCheckMutableData.postValue(handleResponse(response)) + } + } + + val getTitleMutableData: MutableLiveData> = MutableLiveData() + fun titleApi(getCodeRequest: GetCodeRequest, token: String, activity : Activity) = viewModelScope.launch( + handleError(activity) + ) { + if (Common.isNetworkAvailable(activity)) { + getTitleMutableData.postValue(Resource.Loading()) + val response = mainRepository.titleCheck(getCodeRequest, token) + getTitleMutableData.postValue(handleResponse(response)) + } + } + + val getGenderMutableData: MutableLiveData> = MutableLiveData() + fun genderApi(getCodeRequest: GetCodeRequest, token: String,activity : Activity) = viewModelScope.launch( + handleError(activity) + ) { + if (Common.isNetworkAvailable(activity)) { + getGenderMutableData.postValue(Resource.Loading()) + val response = mainRepository.genderCheck(getCodeRequest, token) + getGenderMutableData.postValue(handleResponse(response)) + } + } + + val getAnnualIncomeMutableData: MutableLiveData> = MutableLiveData() + fun annualIncomeApi(getCodeRequest: GetCodeRequest, token: String,activity : Activity) = viewModelScope.launch( + handleError(activity) + ) { + if (Common.isNetworkAvailable(activity)) { + getAnnualIncomeMutableData.postValue(Resource.Loading()) + val response = mainRepository.annualIncomeCheck(getCodeRequest, token) + getAnnualIncomeMutableData.postValue(handleResponse(response)) + } + } + + val getRelationShipMutableData: MutableLiveData> = MutableLiveData() + fun relationShipApi(getCodeRequest: GetCodeRequest, token: String,activity : Activity) = viewModelScope.launch( + handleError(activity) + ) { + if (Common.isNetworkAvailable(activity)) { + getRelationShipMutableData.postValue(Resource.Loading()) + val response = mainRepository.relationShipCheck(getCodeRequest, token) + getRelationShipMutableData.postValue(handleResponse(response)) + } + } + + val getMaritalStatusMutableData: MutableLiveData> = MutableLiveData() + fun maritalStatusApi(getCodeRequest: GetCodeRequest, token: String,activity : Activity) = viewModelScope.launch( + handleError(activity) + ) { + if (Common.isNetworkAvailable(activity)) { + getMaritalStatusMutableData.postValue(Resource.Loading()) + val response = mainRepository.maritalStatusCheck(getCodeRequest, token) + getMaritalStatusMutableData.postValue(handleResponse(response)) + } + } + + val getOccupationMutableData: MutableLiveData> = MutableLiveData() + fun occupationApi(getCodeRequest: GetCodeRequest, token: String,activity : Activity) = viewModelScope.launch( + handleError(activity) + ) { + if (Common.isNetworkAvailable(activity)) { + getOccupationMutableData.postValue(Resource.Loading()) + val response = mainRepository.occupationCheck(getCodeRequest, token) + getOccupationMutableData.postValue(handleResponse(response)) + } + } + + + val getStateMasterMutableData: MutableLiveData> = MutableLiveData() + fun stateApi(token: String,activity : Activity) = viewModelScope.launch( + handleError(activity) + ) { + if (Common.isNetworkAvailable(activity)) { + getStateMasterMutableData.postValue(Resource.Loading()) + val response = mainRepository.stateCheck(token) + getStateMasterMutableData.postValue(handleResponse(response)) + } + } + + val getCityListMutableData: MutableLiveData> = MutableLiveData() + fun cityListApi(cityRequest: CityRequest, token: String,activity : Activity) = viewModelScope.launch( + handleError(activity) + ) { + if (Common.isNetworkAvailable(activity)) { + getCityListMutableData.postValue(Resource.Loading()) + val response = mainRepository.cityCheck(cityRequest, token) + getCityListMutableData.postValue(handleResponse(response)) + } + } + + val getFDBankListMutableData: MutableLiveData> = MutableLiveData() + fun bankListApi( token: String,language: String, activity : Activity) = viewModelScope.launch( + handleError(activity) + ) { + if (Common.isNetworkAvailable(activity)) { + getFDBankListMutableData.postValue(Resource.Loading()) + val response = mainRepository.bankListCheck(token, language) + getFDBankListMutableData.postValue(handleResponse(response)) + } + } + + val getIfscCodeCheckMutableData: MutableLiveData> = MutableLiveData() + fun ifscCodeApi(ifsc : String,activity : Activity) = viewModelScope.launch( + handleError(activity) + ) { + if (Common.isNetworkAvailable(activity)) { + getIfscCodeCheckMutableData.postValue(Resource.Loading()) + val response = mainRepository.ifscCodeCheck(ifsc) + getIfscCodeCheckMutableData.postValue(handleResponse(response)) + } + } + + val getIfscCodeDetailsCheckMutableData: MutableLiveData> = MutableLiveData() + fun ifscCodeDetailsApi(ifsc : String,activity : Activity) = viewModelScope.launch( + handleError(activity) + ) { + if (Common.isNetworkAvailable(activity)) { + getIfscCodeDetailsCheckMutableData.postValue(Resource.Loading()) + val response = mainRepository.ifscCodeBankDetailsCheck(ifsc, Constants.token) + getIfscCodeDetailsCheckMutableData.postValue(Common.handleResponse1(response)) + } + } + + val getPaymentModeMutableData: MutableLiveData> = MutableLiveData() + fun paymentModeApi(getCodeRequest: GetCodeRequest, token: String,activity : Activity) = viewModelScope.launch( + handleError(activity) + ) { + if (Common.isNetworkAvailable(activity)) { + getPaymentModeMutableData.postValue(Resource.Loading()) + val response = mainRepository.payModeCheck(getCodeRequest, token) + getPaymentModeMutableData.postValue(handleResponse(response)) + } + } + + val getFDResponseMutableData: MutableLiveData> = MutableLiveData() + fun createFDApi(getRatesRequest: CreateFDRequest, token: String,activity : Activity) = viewModelScope.launch( + handleError(activity) + ) { + if (Common.isNetworkAvailable(activity)) { + getFDResponseMutableData.postValue(Resource.Loading()) + val response = mainRepository.createFDKYCResponse(getRatesRequest, token) + getFDResponseMutableData.postValue(handleResponse(response)) + } + } + + val bankValidationApiMutableData: MutableLiveData> = MutableLiveData() + fun bankValidationApi(bankValidationApiRequest : BankValidationApiRequest,token:String,activity : Activity) = viewModelScope.launch( + handleError(activity) + ) { + if (Common.isNetworkAvailable(activity)) { + bankValidationApiMutableData.postValue(Resource.Loading()) + val response = mainRepository.bankValidationApiRequest(bankValidationApiRequest,token) + bankValidationApiMutableData.postValue(handleResponse(response)) + } + } + + // Step 3 + + val getDocumentUploadMutableData: MutableLiveData> = MutableLiveData() + fun documentsUpload(documentUpload: DocumentUpload, token: String, activity: Activity) = viewModelScope.launch( + Common.handleError(activity) + ) { + if (Common.isNetworkAvailable(activity)) { + getDocumentUploadMutableData.postValue(Resource.Loading()) + val response = mainRepository.documentsUploadResponse(documentUpload, token) + getDocumentUploadMutableData.postValue(handleResponse(response)) + } + } + + // Step 4 + val getFDDetailsMutableData: MutableLiveData> = MutableLiveData() + fun getFDDetails(getRatesRequest: GetFDDetailsRequest, token: String, + activity: Activity) = viewModelScope.launch(Common.handleError(activity)) { + if (Common.isNetworkAvailable(activity)) { + getFDDetailsMutableData.postValue(Resource.Loading()) + val response = mainRepository.getFDDetailsResponse(getRatesRequest, token) + getFDDetailsMutableData.postValue(handleResponse(response)) + } + } + + val getFDOtherMutableData: MutableLiveData> = MutableLiveData() + fun saveFDOtherData(getRatesRequest: SaveFDOtherDataRequest, token: String, + activity: Activity) = viewModelScope.launch(Common.handleError(activity)) { + if (Common.isNetworkAvailable(activity)) { + getFDOtherMutableData.postValue(Resource.Loading()) + val response = mainRepository.saveFDOtherDataResponse(getRatesRequest, token) + getFDOtherMutableData.postValue(handleResponse(response)) + } + } + + fun updateFDPaymentStatus(getRatesRequest: GetRatesRequest, token: String, + activity: Activity) = + viewModelScope.launch(Common.handleError(activity)) { + if (Common.isNetworkAvailable(activity)) { + getRatesMutableData.postValue(Resource.Loading()) + val response = mainRepository.updateFDPaymentStatusResponse(getRatesRequest, token) + getRatesMutableData.postValue(handleResponse(response)) + } + } + + fun finaliseFD(getRatesRequest: GetRatesRequest, token: String, + activity: Activity) = viewModelScope.launch(Common.handleError(activity)) { + if (Common.isNetworkAvailable(activity)) { + getRatesMutableData.postValue(Resource.Loading()) + val response = mainRepository.finaliseFDResponse(getRatesRequest, token) + getRatesMutableData.postValue(handleResponse(response)) + } + } + + fun finaliseKYC(getRatesRequest: GetRatesRequest, token: String, + activity: Activity) = viewModelScope.launch(Common.handleError(activity)) { + if (Common.isNetworkAvailable(activity)) { + getRatesMutableData.postValue(Resource.Loading()) + val response = mainRepository.finaliseKYCResponse(getRatesRequest, token) + getRatesMutableData.postValue(handleResponse(response)) + } + } + + fun paymentReQuery(getRatesRequest: PaymentReQueryRequest, token: String, + activity: Activity) = viewModelScope.launch(Common.handleError(activity)) { + if (Common.isNetworkAvailable(activity)) { + getRatesMutableData.postValue(Resource.Loading()) + val response = mainRepository.paymentReQueryResponse(getRatesRequest, token) + getRatesMutableData.postValue(handleResponse(response)) + } + } } \ No newline at end of file diff --git a/app/src/main/java/com/nivesh/production/bajajfd/viewModel/StepFourBajajFDViewModel.kt b/app/src/main/java/com/nivesh/production/bajajfd/viewModel/StepFourBajajFDViewModel.kt index 74af264..cc00cdb 100644 --- a/app/src/main/java/com/nivesh/production/bajajfd/viewModel/StepFourBajajFDViewModel.kt +++ b/app/src/main/java/com/nivesh/production/bajajfd/viewModel/StepFourBajajFDViewModel.kt @@ -1,85 +1,78 @@ package com.nivesh.production.bajajfd.viewModel -import android.app.Activity -import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel -import androidx.lifecycle.viewModelScope -import com.google.gson.JsonObject -import com.nivesh.production.bajajfd.model.* import com.nivesh.production.bajajfd.repositories.MainRepository -import com.nivesh.production.bajajfd.util.Common -import com.nivesh.production.bajajfd.util.Common.Companion.handleResponse -import com.nivesh.production.bajajfd.util.Resource -import kotlinx.coroutines.launch class StepFourBajajFDViewModel(private val mainRepository: MainRepository) : ViewModel() { - val getPaymentModeMutableData: MutableLiveData> = MutableLiveData() - fun paymentModeApi(getCodeRequest: GetCodeRequest, token: String, - activity: Activity - ) = viewModelScope.launch(Common.handleError(activity)) { - if (Common.isNetworkAvailable(activity)) { - getPaymentModeMutableData.postValue(Resource.Loading()) - val response = mainRepository.payModeCheck(getCodeRequest, token) - getPaymentModeMutableData.postValue(handleResponse(response)) - } - } +// val getPaymentModeMutableData: MutableLiveData> = MutableLiveData() +// fun paymentModeApi(getCodeRequest: GetCodeRequest, token: String, +// activity: Activity +// ) = viewModelScope.launch(Common.handleError(activity)) { +// if (Common.isNetworkAvailable(activity)) { +// getPaymentModeMutableData.postValue(Resource.Loading()) +// val response = mainRepository.payModeCheck(getCodeRequest, token) +// getPaymentModeMutableData.postValue(handleResponse(response)) +// } +// } +// +// val getFDDetailsMutableData: MutableLiveData> = MutableLiveData() +// fun getFDDetails(getRatesRequest: GetFDDetailsRequest, token: String, +// activity: Activity) = viewModelScope.launch(Common.handleError(activity)) { +// if (Common.isNetworkAvailable(activity)) { +// getFDDetailsMutableData.postValue(Resource.Loading()) +// val response = mainRepository.getFDDetailsResponse(getRatesRequest, token) +// getFDDetailsMutableData.postValue(handleResponse(response)) +// } +// } +// +// val getFDOtherMutableData: MutableLiveData> = MutableLiveData() +// fun saveFDOtherData(getRatesRequest: SaveFDOtherDataRequest, token: String, +// activity: Activity) = viewModelScope.launch(Common.handleError(activity)) { +// if (Common.isNetworkAvailable(activity)) { +// getFDOtherMutableData.postValue(Resource.Loading()) +// val response = mainRepository.saveFDOtherDataResponse(getRatesRequest, token) +// getFDOtherMutableData.postValue(handleResponse(response)) +// } +// } +// +// val getRatesMutableData: MutableLiveData> = MutableLiveData() +// fun updateFDPaymentStatus(getRatesRequest: GetRatesRequest, token: String, +// activity: Activity) = +// viewModelScope.launch(Common.handleError(activity)) { +// if (Common.isNetworkAvailable(activity)) { +// getRatesMutableData.postValue(Resource.Loading()) +// val response = mainRepository.updateFDPaymentStatusResponse(getRatesRequest, token) +// getRatesMutableData.postValue(handleResponse(response)) +// } +// } +// +// fun finaliseFD(getRatesRequest: GetRatesRequest, token: String, +// activity: Activity) = viewModelScope.launch(Common.handleError(activity)) { +// if (Common.isNetworkAvailable(activity)) { +// getRatesMutableData.postValue(Resource.Loading()) +// val response = mainRepository.finaliseFDResponse(getRatesRequest, token) +// getRatesMutableData.postValue(handleResponse(response)) +// } +// } +// +// fun finaliseKYC(getRatesRequest: GetRatesRequest, token: String, +// activity: Activity) = viewModelScope.launch(Common.handleError(activity)) { +// if (Common.isNetworkAvailable(activity)) { +// getRatesMutableData.postValue(Resource.Loading()) +// val response = mainRepository.finaliseKYCResponse(getRatesRequest, token) +// getRatesMutableData.postValue(handleResponse(response)) +// } +// } +// +// fun paymentReQuery(getRatesRequest: PaymentReQueryRequest, token: String, +// activity: Activity) = viewModelScope.launch(Common.handleError(activity)) { +// if (Common.isNetworkAvailable(activity)) { +// getRatesMutableData.postValue(Resource.Loading()) +// val response = mainRepository.paymentReQueryResponse(getRatesRequest, token) +// getRatesMutableData.postValue(handleResponse(response)) +// } +// } - val getFDDetailsMutableData: MutableLiveData> = MutableLiveData() - fun getFDDetails(getRatesRequest: GetFDDetailsRequest, token: String, - activity: Activity) = viewModelScope.launch(Common.handleError(activity)) { - if (Common.isNetworkAvailable(activity)) { - getFDDetailsMutableData.postValue(Resource.Loading()) - val response = mainRepository.getFDDetailsResponse(getRatesRequest, token) - getFDDetailsMutableData.postValue(handleResponse(response)) - } - } - val getRatesMutableData: MutableLiveData> = MutableLiveData() - fun updateFDPaymentStatus(getRatesRequest: GetRatesRequest, token: String, - activity: Activity) = - viewModelScope.launch(Common.handleError(activity)) { - if (Common.isNetworkAvailable(activity)) { - getRatesMutableData.postValue(Resource.Loading()) - val response = mainRepository.updateFDPaymentStatusResponse(getRatesRequest, token) - getRatesMutableData.postValue(handleResponse(response)) - } - } - - fun finaliseFD(getRatesRequest: GetRatesRequest, token: String, - activity: Activity) = viewModelScope.launch(Common.handleError(activity)) { - if (Common.isNetworkAvailable(activity)) { - getRatesMutableData.postValue(Resource.Loading()) - val response = mainRepository.finaliseFDResponse(getRatesRequest, token) - getRatesMutableData.postValue(handleResponse(response)) - } - } - - fun finaliseKYC(getRatesRequest: GetRatesRequest, token: String, - activity: Activity) = viewModelScope.launch(Common.handleError(activity)) { - if (Common.isNetworkAvailable(activity)) { - getRatesMutableData.postValue(Resource.Loading()) - val response = mainRepository.finaliseKYCResponse(getRatesRequest, token) - getRatesMutableData.postValue(handleResponse(response)) - } - } - - fun paymentReQuery(getRatesRequest: PaymentReQueryRequest, token: String, - activity: Activity) = viewModelScope.launch(Common.handleError(activity)) { - if (Common.isNetworkAvailable(activity)) { - getRatesMutableData.postValue(Resource.Loading()) - val response = mainRepository.paymentReQueryResponse(getRatesRequest, token) - getRatesMutableData.postValue(handleResponse(response)) - } - } - - val getFDOtherMutableData: MutableLiveData> = MutableLiveData() - fun saveFDOtherData(getRatesRequest: SaveFDOtherDataRequest, token: String, - activity: Activity) = viewModelScope.launch(Common.handleError(activity)) { - if (Common.isNetworkAvailable(activity)) { - getFDOtherMutableData.postValue(Resource.Loading()) - val response = mainRepository.saveFDOtherDataResponse(getRatesRequest, token) - getFDOtherMutableData.postValue(handleResponse(response)) - } - } } \ No newline at end of file diff --git a/app/src/main/java/com/nivesh/production/bajajfd/viewModel/StepOneBajajFDViewModel.kt b/app/src/main/java/com/nivesh/production/bajajfd/viewModel/StepOneBajajFDViewModel.kt index f9245ac..8397ec1 100644 --- a/app/src/main/java/com/nivesh/production/bajajfd/viewModel/StepOneBajajFDViewModel.kt +++ b/app/src/main/java/com/nivesh/production/bajajfd/viewModel/StepOneBajajFDViewModel.kt @@ -1,79 +1,67 @@ package com.nivesh.production.bajajfd.viewModel -import android.app.Activity -import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel -import androidx.lifecycle.viewModelScope -import com.google.gson.JsonObject -import com.nivesh.production.bajajfd.model.GetCodeRequest -import com.nivesh.production.bajajfd.model.GetMaturityAmountRequest -import com.nivesh.production.bajajfd.model.GetRatesRequest import com.nivesh.production.bajajfd.repositories.MainRepository -import com.nivesh.production.bajajfd.util.Common -import com.nivesh.production.bajajfd.util.Common.Companion.handleResponse -import com.nivesh.production.bajajfd.util.Constants.Companion.token -import com.nivesh.production.bajajfd.util.Resource -import kotlinx.coroutines.launch class StepOneBajajFDViewModel(private val mainRepository: MainRepository) : ViewModel() { - val getCodeMutableData: MutableLiveData> = MutableLiveData() - fun getCode(requestBody: GetCodeRequest, token: String, activity: Activity) = - viewModelScope.launch( - Common.handleError(activity) - ) { - if (Common.isNetworkAvailable(activity)) { - getCodeMutableData.postValue(Resource.Loading()) - val response = mainRepository.getCodesResponse(requestBody, token) - getCodeMutableData.postValue(handleResponse(response)) - } - } +// val getCodeMutableData: MutableLiveData> = MutableLiveData() +// fun getCode(requestBody: GetCodeRequest, token: String, activity: Activity) = +// viewModelScope.launch( +// Common.handleError(activity) +// ) { +// if (Common.isNetworkAvailable(activity)) { +// getCodeMutableData.postValue(Resource.Loading()) +// val response = mainRepository.getCodesResponse(requestBody, token) +// getCodeMutableData.postValue(handleResponse(response)) +// } +// } - val getRatesMutableData: MutableLiveData> = MutableLiveData() - fun getRates(getRatesRequest: GetRatesRequest, token: String, activity: Activity) = - viewModelScope.launch( - Common.handleError(activity) - ) { - if (Common.isNetworkAvailable(activity)) { - getRatesMutableData.postValue(Resource.Loading()) - val response = mainRepository.getRatesResponse(getRatesRequest, token) - getRatesMutableData.postValue(handleResponse(response)) - } - } +// val getRatesMutableData: MutableLiveData> = MutableLiveData() +// fun getRates(getRatesRequest: GetRatesRequest, token: String, activity: Activity) = +// viewModelScope.launch( +// Common.handleError(activity) +// ) { +// if (Common.isNetworkAvailable(activity)) { +// getRatesMutableData.postValue(Resource.Loading()) +// val response = mainRepository.getRatesResponse(getRatesRequest, token) +// getRatesMutableData.postValue(handleResponse(response)) +// } +// } - val getMaturityAmountMutableData: MutableLiveData> = MutableLiveData() - fun getMaturityAmount(requestBody: GetMaturityAmountRequest, activity: Activity) = - viewModelScope.launch( - Common.handleError(activity) - ) { - if (Common.isNetworkAvailable(activity)) { - getMaturityAmountMutableData.postValue(Resource.Loading()) - val response = mainRepository.createCalculateFDMaturityAmount(requestBody, token) - getMaturityAmountMutableData.postValue(handleResponse(response)) - } - } +// val getMaturityAmountMutableData: MutableLiveData> = MutableLiveData() +// fun getMaturityAmount(requestBody: GetMaturityAmountRequest, activity: Activity) = +// viewModelScope.launch( +// Common.handleError(activity) +// ) { +// if (Common.isNetworkAvailable(activity)) { +// getMaturityAmountMutableData.postValue(Resource.Loading()) +// val response = mainRepository.createCalculateFDMaturityAmount(requestBody, token) +// getMaturityAmountMutableData.postValue(handleResponse(response)) +// } +// } - val getMinAmountMutableData: MutableLiveData> = MutableLiveData() - fun getMinAmount(requestBody: GetCodeRequest, token: String, activity: Activity) = - viewModelScope.launch( - Common.handleError(activity) - ) { - if (Common.isNetworkAvailable(activity)) { - getMinAmountMutableData.postValue(Resource.Loading()) - val response = mainRepository.getCodesResponse(requestBody, token) - getMinAmountMutableData.postValue(handleResponse(response)) - } - } +// val getMinAmountMutableData: MutableLiveData> = MutableLiveData() +// fun getMinAmount(requestBody: GetCodeRequest, token: String, activity: Activity) = +// viewModelScope.launch( +// Common.handleError(activity) +// ) { +// if (Common.isNetworkAvailable(activity)) { +// getMinAmountMutableData.postValue(Resource.Loading()) +// val response = mainRepository.getCodesResponse(requestBody, token) +// getMinAmountMutableData.postValue(handleResponse(response)) +// } +// } - val getMaxAmountMutableData: MutableLiveData> = MutableLiveData() - fun getMaxAmount(requestBody: GetCodeRequest, token: String, activity: Activity) = - viewModelScope.launch( - Common.handleError(activity) - ) { - if (Common.isNetworkAvailable(activity)) { - getMaxAmountMutableData.postValue(Resource.Loading()) - val response = mainRepository.getCodesResponse(requestBody, token) - getMaxAmountMutableData.postValue(handleResponse(response)) - } - } +// val getMaxAmountMutableData: MutableLiveData> = MutableLiveData() +// fun getMaxAmount(requestBody: GetCodeRequest, token: String, activity: Activity) = +// viewModelScope.launch( +// Common.handleError(activity) +// ) { +// if (Common.isNetworkAvailable(activity)) { +// getMaxAmountMutableData.postValue(Resource.Loading()) +// val response = mainRepository.getCodesResponse(requestBody, token) +// getMaxAmountMutableData.postValue(handleResponse(response)) +// } +// } } \ No newline at end of file diff --git a/app/src/main/java/com/nivesh/production/bajajfd/viewModel/StepThreeBajajFDViewModel.kt b/app/src/main/java/com/nivesh/production/bajajfd/viewModel/StepThreeBajajFDViewModel.kt index f65da9a..aa1a40d 100644 --- a/app/src/main/java/com/nivesh/production/bajajfd/viewModel/StepThreeBajajFDViewModel.kt +++ b/app/src/main/java/com/nivesh/production/bajajfd/viewModel/StepThreeBajajFDViewModel.kt @@ -1,53 +1,41 @@ package com.nivesh.production.bajajfd.viewModel -import android.app.Activity -import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel -import androidx.lifecycle.viewModelScope -import com.google.gson.JsonObject -import com.nivesh.production.bajajfd.model.CreateFDRequest -import com.nivesh.production.bajajfd.model.DocumentUpload -import com.nivesh.production.bajajfd.model.GetCodeRequest -import com.nivesh.production.bajajfd.model.GetRatesRequest import com.nivesh.production.bajajfd.repositories.MainRepository -import com.nivesh.production.bajajfd.util.Common -import com.nivesh.production.bajajfd.util.Common.Companion.handleResponse -import com.nivesh.production.bajajfd.util.Resource -import kotlinx.coroutines.launch class StepThreeBajajFDViewModel(private val mainRepository: MainRepository) : ViewModel() { - val getTitleMutableData: MutableLiveData> = MutableLiveData() - fun titleApi(getCodeRequest: GetCodeRequest, token: String, activity: Activity) = viewModelScope.launch( - Common.handleError(activity) - ) { - if (Common.isNetworkAvailable(activity)) { - getTitleMutableData.postValue(Resource.Loading()) - val response = mainRepository.titleCheck(getCodeRequest, token) - getTitleMutableData.postValue(handleResponse(response)) - } - } - - val getDocumentUploadMutableData: MutableLiveData> = MutableLiveData() - fun documentsUpload(documentUpload: DocumentUpload, token: String, activity: Activity) = viewModelScope.launch( - Common.handleError(activity) - ) { - if (Common.isNetworkAvailable(activity)) { - getDocumentUploadMutableData.postValue(Resource.Loading()) - val response = mainRepository.documentsUploadResponse(documentUpload, token) - getDocumentUploadMutableData.postValue(handleResponse(response)) - } - } - - val getFDResponseMutableData: MutableLiveData> = MutableLiveData() - fun createFDApi(getRatesRequest: CreateFDRequest, token: String, activity: Activity) = viewModelScope.launch( - Common.handleError(activity) - ) { - if (Common.isNetworkAvailable(activity)) { - getFDResponseMutableData.postValue(Resource.Loading()) - val response = mainRepository.createFDKYCResponse(getRatesRequest, token) - getFDResponseMutableData.postValue(handleResponse(response)) - } - } +// val getTitleMutableData: MutableLiveData> = MutableLiveData() +// fun titleApi(getCodeRequest: GetCodeRequest, token: String, activity: Activity) = viewModelScope.launch( +// Common.handleError(activity) +// ) { +// if (Common.isNetworkAvailable(activity)) { +// getTitleMutableData.postValue(Resource.Loading()) +// val response = mainRepository.titleCheck(getCodeRequest, token) +// getTitleMutableData.postValue(handleResponse(response)) +// } +// } +// +// val getDocumentUploadMutableData: MutableLiveData> = MutableLiveData() +// fun documentsUpload(documentUpload: DocumentUpload, token: String, activity: Activity) = viewModelScope.launch( +// Common.handleError(activity) +// ) { +// if (Common.isNetworkAvailable(activity)) { +// getDocumentUploadMutableData.postValue(Resource.Loading()) +// val response = mainRepository.documentsUploadResponse(documentUpload, token) +// getDocumentUploadMutableData.postValue(handleResponse(response)) +// } +// } +// +// val getFDResponseMutableData: MutableLiveData> = MutableLiveData() +// fun createFDApi(getRatesRequest: CreateFDRequest, token: String, activity: Activity) = viewModelScope.launch( +// Common.handleError(activity) +// ) { +// if (Common.isNetworkAvailable(activity)) { +// getFDResponseMutableData.postValue(Resource.Loading()) +// val response = mainRepository.createFDKYCResponse(getRatesRequest, token) +// getFDResponseMutableData.postValue(handleResponse(response)) +// } +// } } \ No newline at end of file diff --git a/app/src/main/java/com/nivesh/production/bajajfd/viewModel/StepTwoBajajFDViewModel.kt b/app/src/main/java/com/nivesh/production/bajajfd/viewModel/StepTwoBajajFDViewModel.kt index 7a8d89a..c9093ee 100644 --- a/app/src/main/java/com/nivesh/production/bajajfd/viewModel/StepTwoBajajFDViewModel.kt +++ b/app/src/main/java/com/nivesh/production/bajajfd/viewModel/StepTwoBajajFDViewModel.kt @@ -1,191 +1,174 @@ package com.nivesh.production.bajajfd.viewModel -import android.app.Activity -import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel -import androidx.lifecycle.viewModelScope -import com.google.gson.JsonObject -import com.nivesh.production.bajajfd.model.* import com.nivesh.production.bajajfd.repositories.MainRepository -import com.nivesh.production.bajajfd.util.Common -import com.nivesh.production.bajajfd.util.Common.Companion.handleResponse -import com.nivesh.production.bajajfd.util.Common.Companion.handleResponse1 -import com.nivesh.production.bajajfd.util.Constants.Companion.token -import com.nivesh.production.bajajfd.util.Resource -import kotlinx.coroutines.launch -import org.intellij.lang.annotations.Language class StepTwoBajajFDViewModel(private val mainRepository: MainRepository) : ViewModel() { - val getPanCheckMutableData: MutableLiveData> = MutableLiveData() - fun panCheck(panCheck: PanCheckRequest, token: String, activity : Activity) = viewModelScope.launch( - Common.handleError(activity) - ) { - if (Common.isNetworkAvailable(activity)) { - getPanCheckMutableData.postValue(Resource.Loading()) - val response = mainRepository.panCheck(panCheck, token) - getPanCheckMutableData.postValue(handleResponse(response)) - } - } - - val getTitleMutableData: MutableLiveData> = MutableLiveData() - fun titleApi(getCodeRequest: GetCodeRequest, token: String, activity : Activity) = viewModelScope.launch( - Common.handleError(activity) - ) { - if (Common.isNetworkAvailable(activity)) { - getTitleMutableData.postValue(Resource.Loading()) - val response = mainRepository.titleCheck(getCodeRequest, token) - getTitleMutableData.postValue(handleResponse(response)) - } - } - - val getGenderMutableData: MutableLiveData> = MutableLiveData() - fun genderApi(getCodeRequest: GetCodeRequest, token: String,activity : Activity) = viewModelScope.launch( - Common.handleError(activity) - ) { - if (Common.isNetworkAvailable(activity)) { - getGenderMutableData.postValue(Resource.Loading()) - val response = mainRepository.genderCheck(getCodeRequest, token) - getGenderMutableData.postValue(handleResponse(response)) - } - } - - val getAnnualIncomeMutableData: MutableLiveData> = MutableLiveData() - fun annualIncomeApi(getCodeRequest: GetCodeRequest, token: String,activity : Activity) = viewModelScope.launch( - Common.handleError(activity) - ) { - if (Common.isNetworkAvailable(activity)) { - getAnnualIncomeMutableData.postValue(Resource.Loading()) - val response = mainRepository.annualIncomeCheck(getCodeRequest, token) - getAnnualIncomeMutableData.postValue(handleResponse(response)) - } - } - - val getRelationShipMutableData: MutableLiveData> = MutableLiveData() - fun relationShipApi(getCodeRequest: GetCodeRequest, token: String,activity : Activity) = viewModelScope.launch( - Common.handleError(activity) - ) { - if (Common.isNetworkAvailable(activity)) { - getRelationShipMutableData.postValue(Resource.Loading()) - val response = mainRepository.relationShipCheck(getCodeRequest, token) - getRelationShipMutableData.postValue(handleResponse(response)) - } - } - - val getMaritalStatusMutableData: MutableLiveData> = MutableLiveData() - fun maritalStatusApi(getCodeRequest: GetCodeRequest, token: String,activity : Activity) = viewModelScope.launch( - Common.handleError(activity) - ) { - if (Common.isNetworkAvailable(activity)) { - getMaritalStatusMutableData.postValue(Resource.Loading()) - val response = mainRepository.maritalStatusCheck(getCodeRequest, token) - getMaritalStatusMutableData.postValue(handleResponse(response)) - } - } - - val getOccupationMutableData: MutableLiveData> = MutableLiveData() - fun occupationApi(getCodeRequest: GetCodeRequest, token: String,activity : Activity) = viewModelScope.launch( - Common.handleError(activity) - ) { - if (Common.isNetworkAvailable(activity)) { - getOccupationMutableData.postValue(Resource.Loading()) - val response = mainRepository.occupationCheck(getCodeRequest, token) - getOccupationMutableData.postValue(handleResponse(response)) - } - } - - - val getStateMasterMutableData: MutableLiveData> = MutableLiveData() - fun stateApi(token: String,activity : Activity) = viewModelScope.launch( - Common.handleError(activity) - ) { - if (Common.isNetworkAvailable(activity)) { - getStateMasterMutableData.postValue(Resource.Loading()) - val response = mainRepository.stateCheck(token) - getStateMasterMutableData.postValue(handleResponse(response)) - } - } - - val getCityListMutableData: MutableLiveData> = MutableLiveData() - fun cityListApi(cityRequest: CityRequest, token: String,activity : Activity) = viewModelScope.launch( - Common.handleError(activity) - ) { - if (Common.isNetworkAvailable(activity)) { - getCityListMutableData.postValue(Resource.Loading()) - val response = mainRepository.cityCheck(cityRequest, token) - getCityListMutableData.postValue(handleResponse(response)) - } - } - - val getFDBankListMutableData: MutableLiveData> = MutableLiveData() - fun bankListApi( token: String,language: String, activity : Activity) = viewModelScope.launch( - Common.handleError(activity) - ) { - if (Common.isNetworkAvailable(activity)) { - getFDBankListMutableData.postValue(Resource.Loading()) - val response = mainRepository.bankListCheck(token, language) - getFDBankListMutableData.postValue(handleResponse(response)) - } - } - - val getIfscCodeCheckMutableData: MutableLiveData> = MutableLiveData() - fun ifscCodeApi(ifsc : String,activity : Activity) = viewModelScope.launch( - Common.handleError(activity) - ) { - if (Common.isNetworkAvailable(activity)) { - getIfscCodeCheckMutableData.postValue(Resource.Loading()) - val response = mainRepository.ifscCodeCheck(ifsc) - getIfscCodeCheckMutableData.postValue(handleResponse(response)) - } - } - - val getIfscCodeDetailsCheckMutableData: MutableLiveData> = MutableLiveData() - fun ifscCodeDetailsApi(ifsc : String,activity : Activity) = viewModelScope.launch( - Common.handleError(activity) - ) { - if (Common.isNetworkAvailable(activity)) { - getIfscCodeDetailsCheckMutableData.postValue(Resource.Loading()) - val response = mainRepository.ifscCodeBankDetailsCheck(ifsc, token) - getIfscCodeDetailsCheckMutableData.postValue(handleResponse1(response)) - } - } - - - val getPaymentModeMutableData: MutableLiveData> = MutableLiveData() - fun paymentModeApi(getCodeRequest: GetCodeRequest, token: String,activity : Activity) = viewModelScope.launch( - Common.handleError(activity) - ) { - if (Common.isNetworkAvailable(activity)) { - getPaymentModeMutableData.postValue(Resource.Loading()) - val response = mainRepository.payModeCheck(getCodeRequest, token) - getPaymentModeMutableData.postValue(handleResponse(response)) - } - } - - val getFDResponseMutableData: MutableLiveData> = MutableLiveData() - fun createFDApi(getRatesRequest: CreateFDRequest, token: String,activity : Activity) = viewModelScope.launch( - Common.handleError(activity) - ) { - if (Common.isNetworkAvailable(activity)) { - getFDResponseMutableData.postValue(Resource.Loading()) - val response = mainRepository.createFDKYCResponse(getRatesRequest, token) - getFDResponseMutableData.postValue(handleResponse(response)) - } - } - - - - - val bankValidationApiMutableData: MutableLiveData> = MutableLiveData() - - fun bankValidationApi(bankValidationApiRequest : BankValidationApiRequest,token:String,activity : Activity) = viewModelScope.launch( - Common.handleError(activity) - ) { - if (Common.isNetworkAvailable(activity)) { - bankValidationApiMutableData.postValue(Resource.Loading()) - val response = mainRepository.bankValidationApiRequest(bankValidationApiRequest,token) - bankValidationApiMutableData.postValue(handleResponse(response)) - } - } +// val getPanCheckMutableData: MutableLiveData> = MutableLiveData() +// fun panCheck(panCheck: PanCheckRequest, token: String, activity : Activity) = viewModelScope.launch( +// Common.handleError(activity) +// ) { +// if (Common.isNetworkAvailable(activity)) { +// getPanCheckMutableData.postValue(Resource.Loading()) +// val response = mainRepository.panCheck(panCheck, token) +// getPanCheckMutableData.postValue(handleResponse(response)) +// } +// } +// +// val getTitleMutableData: MutableLiveData> = MutableLiveData() +// fun titleApi(getCodeRequest: GetCodeRequest, token: String, activity : Activity) = viewModelScope.launch( +// Common.handleError(activity) +// ) { +// if (Common.isNetworkAvailable(activity)) { +// getTitleMutableData.postValue(Resource.Loading()) +// val response = mainRepository.titleCheck(getCodeRequest, token) +// getTitleMutableData.postValue(handleResponse(response)) +// } +// } +// +// val getGenderMutableData: MutableLiveData> = MutableLiveData() +// fun genderApi(getCodeRequest: GetCodeRequest, token: String,activity : Activity) = viewModelScope.launch( +// Common.handleError(activity) +// ) { +// if (Common.isNetworkAvailable(activity)) { +// getGenderMutableData.postValue(Resource.Loading()) +// val response = mainRepository.genderCheck(getCodeRequest, token) +// getGenderMutableData.postValue(handleResponse(response)) +// } +// } +// +// val getAnnualIncomeMutableData: MutableLiveData> = MutableLiveData() +// fun annualIncomeApi(getCodeRequest: GetCodeRequest, token: String,activity : Activity) = viewModelScope.launch( +// Common.handleError(activity) +// ) { +// if (Common.isNetworkAvailable(activity)) { +// getAnnualIncomeMutableData.postValue(Resource.Loading()) +// val response = mainRepository.annualIncomeCheck(getCodeRequest, token) +// getAnnualIncomeMutableData.postValue(handleResponse(response)) +// } +// } +// +// val getRelationShipMutableData: MutableLiveData> = MutableLiveData() +// fun relationShipApi(getCodeRequest: GetCodeRequest, token: String,activity : Activity) = viewModelScope.launch( +// Common.handleError(activity) +// ) { +// if (Common.isNetworkAvailable(activity)) { +// getRelationShipMutableData.postValue(Resource.Loading()) +// val response = mainRepository.relationShipCheck(getCodeRequest, token) +// getRelationShipMutableData.postValue(handleResponse(response)) +// } +// } +// +// val getMaritalStatusMutableData: MutableLiveData> = MutableLiveData() +// fun maritalStatusApi(getCodeRequest: GetCodeRequest, token: String,activity : Activity) = viewModelScope.launch( +// Common.handleError(activity) +// ) { +// if (Common.isNetworkAvailable(activity)) { +// getMaritalStatusMutableData.postValue(Resource.Loading()) +// val response = mainRepository.maritalStatusCheck(getCodeRequest, token) +// getMaritalStatusMutableData.postValue(handleResponse(response)) +// } +// } +// +// val getOccupationMutableData: MutableLiveData> = MutableLiveData() +// fun occupationApi(getCodeRequest: GetCodeRequest, token: String,activity : Activity) = viewModelScope.launch( +// Common.handleError(activity) +// ) { +// if (Common.isNetworkAvailable(activity)) { +// getOccupationMutableData.postValue(Resource.Loading()) +// val response = mainRepository.occupationCheck(getCodeRequest, token) +// getOccupationMutableData.postValue(handleResponse(response)) +// } +// } +// +// +// val getStateMasterMutableData: MutableLiveData> = MutableLiveData() +// fun stateApi(token: String,activity : Activity) = viewModelScope.launch( +// Common.handleError(activity) +// ) { +// if (Common.isNetworkAvailable(activity)) { +// getStateMasterMutableData.postValue(Resource.Loading()) +// val response = mainRepository.stateCheck(token) +// getStateMasterMutableData.postValue(handleResponse(response)) +// } +// } +// +// val getCityListMutableData: MutableLiveData> = MutableLiveData() +// fun cityListApi(cityRequest: CityRequest, token: String,activity : Activity) = viewModelScope.launch( +// Common.handleError(activity) +// ) { +// if (Common.isNetworkAvailable(activity)) { +// getCityListMutableData.postValue(Resource.Loading()) +// val response = mainRepository.cityCheck(cityRequest, token) +// getCityListMutableData.postValue(handleResponse(response)) +// } +// } +// +// val getFDBankListMutableData: MutableLiveData> = MutableLiveData() +// fun bankListApi( token: String,language: String, activity : Activity) = viewModelScope.launch( +// Common.handleError(activity) +// ) { +// if (Common.isNetworkAvailable(activity)) { +// getFDBankListMutableData.postValue(Resource.Loading()) +// val response = mainRepository.bankListCheck(token, language) +// getFDBankListMutableData.postValue(handleResponse(response)) +// } +// } +// +// val getIfscCodeCheckMutableData: MutableLiveData> = MutableLiveData() +// fun ifscCodeApi(ifsc : String,activity : Activity) = viewModelScope.launch( +// Common.handleError(activity) +// ) { +// if (Common.isNetworkAvailable(activity)) { +// getIfscCodeCheckMutableData.postValue(Resource.Loading()) +// val response = mainRepository.ifscCodeCheck(ifsc) +// getIfscCodeCheckMutableData.postValue(handleResponse(response)) +// } +// } +// +// val getIfscCodeDetailsCheckMutableData: MutableLiveData> = MutableLiveData() +// fun ifscCodeDetailsApi(ifsc : String,activity : Activity) = viewModelScope.launch( +// Common.handleError(activity) +// ) { +// if (Common.isNetworkAvailable(activity)) { +// getIfscCodeDetailsCheckMutableData.postValue(Resource.Loading()) +// val response = mainRepository.ifscCodeBankDetailsCheck(ifsc, token) +// getIfscCodeDetailsCheckMutableData.postValue(handleResponse1(response)) +// } +// } +// +// val getPaymentModeMutableData: MutableLiveData> = MutableLiveData() +// fun paymentModeApi(getCodeRequest: GetCodeRequest, token: String,activity : Activity) = viewModelScope.launch( +// Common.handleError(activity) +// ) { +// if (Common.isNetworkAvailable(activity)) { +// getPaymentModeMutableData.postValue(Resource.Loading()) +// val response = mainRepository.payModeCheck(getCodeRequest, token) +// getPaymentModeMutableData.postValue(handleResponse(response)) +// } +// } +// +// val getFDResponseMutableData: MutableLiveData> = MutableLiveData() +// fun createFDApi(getRatesRequest: CreateFDRequest, token: String,activity : Activity) = viewModelScope.launch( +// Common.handleError(activity) +// ) { +// if (Common.isNetworkAvailable(activity)) { +// getFDResponseMutableData.postValue(Resource.Loading()) +// val response = mainRepository.createFDKYCResponse(getRatesRequest, token) +// getFDResponseMutableData.postValue(handleResponse(response)) +// } +// } +// +// val bankValidationApiMutableData: MutableLiveData> = MutableLiveData() +// fun bankValidationApi(bankValidationApiRequest : BankValidationApiRequest,token:String,activity : Activity) = viewModelScope.launch( +// Common.handleError(activity) +// ) { +// if (Common.isNetworkAvailable(activity)) { +// bankValidationApiMutableData.postValue(Resource.Loading()) +// val response = mainRepository.bankValidationApiRequest(bankValidationApiRequest,token) +// bankValidationApiMutableData.postValue(handleResponse(response)) +// } +// } } \ No newline at end of file