Author | SHA1 | Message | Date |
---|---|---|---|
|
85575a10dc | bank ifsc | 2 years ago |
|
4459169f33 | fetch | 2 years ago |
|
64ffadb14d | changes added | 2 years ago |
|
a53e1452c4 |
Merge branch 'HemantBranch' of https://git.nivesh.com:443/hemant.khadase/BajajFDLib into PankajBranch
# Conflicts: # app/src/main/java/com/nivesh/production/bajajfd/api/ApiClient.kt # app/src/main/java/com/nivesh/production/bajajfd/ui/activity/BajajFdMainActivity.kt # app/src/main/java/com/nivesh/production/bajajfd/ui/fragment/StepFourBajajFDFragment.kt # app/src/main/java/com/nivesh/production/bajajfd/ui/fragment/StepOneBajajFDFragment.kt # app/src/main/java/com/nivesh/production/bajajfd/ui/fragment/StepThreeBajajFDFragment.kt # app/src/main/java/com/nivesh/production/bajajfd/ui/fragment/StepTwoBajajFDFragment.kt # app/src/main/java/com/nivesh/production/bajajfd/util/Common.kt # app/src/main/java/com/nivesh/production/bajajfd/util/Resource.kt |
2 years ago |
|
8155bb84de | resource change | 2 years ago |
|
c93f829cef | minor changes | 2 years ago |
|
c0fbd9fd56 | added changes | 2 years ago |
|
7eee4b276f | changes | 2 years ago |
|
38f8420ed4 | added minor changes | 2 years ago |
|
0f6c54fe7a | changes done | 2 years ago |
|
e5060d07c8 |
Merge branch 'HemantBranch' of https://git.nivesh.com:443/hemant.khadase/BajajFDLib into PankajBranch
# Conflicts: # app/src/main/java/com/nivesh/production/bajajfd/BajajApplication.kt # app/src/main/java/com/nivesh/production/bajajfd/adapter/CustomerListAdapter.kt # app/src/main/java/com/nivesh/production/bajajfd/api/ApiClient.kt # app/src/main/res/layout/item_customer_list_preview.xml |
2 years ago |
|
06aded85e0 | step | 2 years ago |
|
14f72f3c9f | updated code | 2 years ago |
|
0323379e9a | completed stepfour coding | 2 years ago |
|
63fd4b6da8 | added manoj's code | 2 years ago |
|
a4780f71f1 | v | 2 years ago |
|
8e4bb6a1e1 | added code for stepfour | 2 years ago |
|
587bd7862a | added missing code and resolved an error | 2 years ago |
|
c7c86adc1a |
Merge branch 'HemantBranch' of https://git.nivesh.com:443/hemant.khadase/BajajFDLib into PankajBranch
# Conflicts: # app/src/main/java/com/nivesh/production/bajajfd/ui/activity/BajajFdMainActivity.kt |
2 years ago |
|
78d0613eae | send data fragment | 2 years ago |
|
c7d1169160 | changes | 2 years ago |
|
c5252cc412 | changes | 2 years ago |
|
c169200566 | missing code | 2 years ago |
@ -1,6 +1,22 @@ | |||||
package com.nivesh.production.bajajfd | package com.nivesh.production.bajajfd | ||||
import android.app.Application | import android.app.Application | ||||
import android.content.Context | |||||
class BajajApplication : Application() { | class BajajApplication : Application() { | ||||
private var mInstance: BajajApplication? = null | |||||
// private val mRequestQueue: RequestQueue? = null | |||||
companion object { | |||||
var appContext: Context? = null | |||||
} | |||||
override fun onCreate() { | |||||
super.onCreate() | |||||
mInstance = this | |||||
appContext = applicationContext | |||||
} | |||||
@Synchronized | |||||
fun getInstanceApp(): BajajApplication? { | |||||
return mInstance | |||||
} | |||||
} | } |
@ -0,0 +1,24 @@ | |||||
package com.nivesh.production.bajajfd.adapter | |||||
import android.annotation.SuppressLint | |||||
import android.content.Context | |||||
import android.util.AttributeSet | |||||
import android.view.MotionEvent | |||||
import androidx.viewpager.widget.ViewPager | |||||
class DisableAdapter (context: Context, attrs: AttributeSet) : ViewPager(context, attrs) { | |||||
private var isPagingEnabled = true // change this value for enable and disable the viewpager swipe | |||||
@SuppressLint("ClickableViewAccessibility") | |||||
override fun onTouchEvent(event: MotionEvent?): Boolean { | |||||
return this.isPagingEnabled && super.onTouchEvent(event) | |||||
} | |||||
override fun onInterceptTouchEvent(event: MotionEvent?): Boolean { | |||||
return this.isPagingEnabled && super.onInterceptTouchEvent(event) | |||||
} | |||||
fun setPagingEnabled(b: Boolean) { isPagingEnabled = b | |||||
} | |||||
} |
@ -1,30 +1,19 @@ | |||||
package com.nivesh.production.bajajfd.adapter | package com.nivesh.production.bajajfd.adapter | ||||
import android.content.Context | |||||
import androidx.fragment.app.Fragment | import androidx.fragment.app.Fragment | ||||
import androidx.fragment.app.FragmentManager | import androidx.fragment.app.FragmentManager | ||||
import androidx.fragment.app.FragmentPagerAdapter | |||||
class SectionsPagerAdapter(private val context: Context, fm: FragmentManager) : | |||||
FragmentPagerAdapter(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) { | |||||
private var fragmentList: MutableList<Fragment> = ArrayList() | |||||
class SectionsPagerAdapter(private val fm: FragmentManager, private val fragments: Array<Fragment>, private val NumberOfTabs: Int) : SmartFragmentStatePagerAdapter(fm) { | |||||
override fun getItem(position: Int): Fragment { | override fun getItem(position: Int): Fragment { | ||||
return fragmentList[position] | |||||
return fragments[position] | |||||
} | } | ||||
override fun getCount(): Int { | |||||
return fragmentList.size | |||||
override fun getPageTitle(position: Int): CharSequence? { | |||||
return null | |||||
} | } | ||||
fun addFragment(fragment: Fragment) { | |||||
try { | |||||
if (!fragment.isAdded) { | |||||
fragmentList.add(fragment) | |||||
} | |||||
} catch (e: Exception) { | |||||
e.printStackTrace() | |||||
} | |||||
override fun getCount(): Int { | |||||
return NumberOfTabs | |||||
} | } | ||||
} | } |
@ -0,0 +1,25 @@ | |||||
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<Fragment>() | |||||
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] | |||||
} | |||||
} |
@ -0,0 +1,35 @@ | |||||
package com.nivesh.production.bajajfd.api | |||||
import com.nivesh.production.bajajfd.util.Resource | |||||
import retrofit2.Call | |||||
import retrofit2.Callback | |||||
import retrofit2.Response | |||||
abstract class ApiCallback<T : Any> : Callback<Resource<T>> { | |||||
abstract fun onSuccess(response: Resource<T>) | |||||
abstract fun onFailure(response: Resource<T>) | |||||
override fun onResponse(call: Call<Resource<T>>, response: Response<Resource<T>>) { | |||||
if (response.isSuccessful && response.body() != null && response.code() == 200) { | |||||
onSuccess(response.body()!!) | |||||
} else { | |||||
// handle 4xx & 5xx error codes here | |||||
// val resp = Resource<T>() | |||||
// resp.status = false | |||||
// resp.message = response.message() | |||||
// onFailure(resp) | |||||
} | |||||
} | |||||
override fun onFailure(call: Call<Resource<T>>, t: Throwable) { | |||||
// val response = Resource<T>() | |||||
// response.status = false | |||||
// response.message = t.message.toString() | |||||
// onFailure(response) | |||||
} | |||||
} |
@ -0,0 +1,19 @@ | |||||
package com.nivesh.production.bajajfd.api | |||||
import okhttp3.Authenticator | |||||
import okhttp3.Request | |||||
import okhttp3.Response | |||||
import okhttp3.Route | |||||
class TokenAuthenticator { | |||||
// override fun authenticate(route: Route?, response: Response): Request? { | |||||
//// newAccessToken = service.refreshToken(); | |||||
//// | |||||
//// // Add new header to rejected request and retry it | |||||
//// return response.request().newBuilder() | |||||
//// .header(AUTHORIZATION, newAccessToken) | |||||
//// .build(); | |||||
// | |||||
// | |||||
// } | |||||
} |
@ -1,10 +0,0 @@ | |||||
package com.nivesh.production.bajajfd.interfaces | |||||
import com.nivesh.production.bajajfd.model.CreateFDRequest | |||||
interface BajajFDInterface { | |||||
fun stepOneApi(data: String?) | |||||
fun stepTwoApi(data: CreateFDRequest) | |||||
fun stepThreeApi(data: CreateFDRequest) | |||||
fun stepFourApi(data: String?) | |||||
} |
@ -1,6 +1,8 @@ | |||||
package com.nivesh.production.bajajfd.interfaces | package com.nivesh.production.bajajfd.interfaces | ||||
interface SendData { | |||||
fun sendDataFragment(message: String?) | |||||
import com.nivesh.production.bajajfd.model.CreateFDApplicationResponse | |||||
interface SendData { | |||||
fun sendDataFragment(message: CreateFDApplicationResponse) | |||||
fun sendDataFragmentStepFour(message: CreateFDApplicationResponse) | |||||
} | } |
@ -1,10 +1,10 @@ | |||||
package com.nivesh.production.bajajfd.model | package com.nivesh.production.bajajfd.model | ||||
data class DocumentUpload( | data class DocumentUpload( | ||||
val Description: String? = null, | |||||
val DocumentType: String? = null, | |||||
val FDProvider: String? = null, | |||||
val ImageEncodeToBase64: String? = null, | |||||
val NiveshClientCode: String? = null, | |||||
val UniqueId: String? = null | |||||
var Description: String? = null, | |||||
var DocumentType: String? = null, | |||||
var FDProvider: String? = null, | |||||
var ImageEncodeToBase64: String? = null, | |||||
var NiveshClientCode: String? = null, | |||||
var UniqueId: String? = null | |||||
) | ) |
@ -1,7 +1,7 @@ | |||||
package com.nivesh.production.bajajfd.model | package com.nivesh.production.bajajfd.model | ||||
data class ResponseXXXXXXXXXXXX( | data class ResponseXXXXXXXXXXXX( | ||||
val Errors: Any, | |||||
val Errors: List<Errors>, | |||||
val FDDataResponse: FDDataResponse, | val FDDataResponse: FDDataResponse, | ||||
val Message: String, | val Message: String, | ||||
val Status: String, | val Status: String, | ||||
@ -0,0 +1,8 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class ResponseXXXXXXXXXXXXX( | |||||
val Errors: List<Errors>, | |||||
val Message: String, | |||||
val Status: String, | |||||
val StatusCode: Int | |||||
) |
@ -0,0 +1,8 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class SaveFDOtherDataRequest( | |||||
var FDProvider: String?= "", | |||||
var NiveshClientCode: String? = "", | |||||
var UniqueId: String? = "", | |||||
var Values: String? = "" | |||||
) |
@ -0,0 +1,5 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class SaveFDOtherDataResponse( | |||||
val Response: ResponseXXXXXXXXXXXXX | |||||
) |
@ -0,0 +1,5 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class UploadResponse( | |||||
val Response: ResponseXXXXXXXXXXXX | |||||
) |
@ -0,0 +1,14 @@ | |||||
package com.nivesh.production.bajajfd.ui.activity | |||||
import android.app.Activity | |||||
import android.os.Bundle | |||||
import androidx.appcompat.app.AppCompatActivity | |||||
open class BaseActivity : AppCompatActivity() { | |||||
private lateinit var mActivity: Activity | |||||
override fun onCreate(savedInstanceState: Bundle?) { | |||||
super.onCreate(savedInstanceState) | |||||
mActivity = this | |||||
} | |||||
} |
@ -0,0 +1,36 @@ | |||||
package com.nivesh.production.bajajfd.ui.fragment | |||||
import android.content.Context | |||||
import android.os.Bundle | |||||
import androidx.fragment.app.Fragment | |||||
import com.nivesh.production.bajajfd.ui.activity.BaseActivity | |||||
open class BaseFragment : Fragment() { | |||||
protected var mActivity: BaseActivity? = null | |||||
override fun onAttach(context: Context) { | |||||
super.onAttach(context) | |||||
if (context is BaseActivity) { | |||||
mActivity = context | |||||
} else try { | |||||
throw ClassCastException("You need to extend BaseActivity to calling activity.") | |||||
} catch (e: Exception) { | |||||
e.printStackTrace() | |||||
} | |||||
} | |||||
override fun onCreate(savedInstanceState: Bundle?) { | |||||
super.onCreate(savedInstanceState) | |||||
} | |||||
override fun onStart() { | |||||
super.onStart() | |||||
} | |||||
override fun onStop() { | |||||
super.onStop() | |||||
} | |||||
} |
@ -1,10 +1,26 @@ | |||||
package com.nivesh.production.bajajfd.util | package com.nivesh.production.bajajfd.util | ||||
sealed class Resource<T>( | sealed class Resource<T>( | ||||
val data:T?=null, | |||||
val message:String?=null) | |||||
{ | |||||
class Success<T>(data: T):Resource<T>(data) | |||||
class Error<T>(message: String,data: T?= null):Resource<T>(data,message) | |||||
class Loading<T>:Resource<T>() | |||||
val data: T? = null, | |||||
var message: String? = null, | |||||
val errorCode: Int? = null, | |||||
var status: Boolean = true | |||||
) { | |||||
class Success<T>(data: T) : Resource<T>(data) | |||||
class Error<T>(message: String, data: T? = null) : Resource<T>(data, message) | |||||
class Loading<T> : Resource<T>() | |||||
class DataError<T>(errorCode: Int, message: String, data: T? = null) : | |||||
Resource<T>(null, message, errorCode) | |||||
override fun toString(): String { | |||||
return when (this) { | |||||
is Success<*> -> "Success[data=$data]" | |||||
is DataError -> "ErrorCode[exception=$errorCode]" | |||||
is Loading<T> -> "Loading" | |||||
is Error -> "Error[exception=${error(Any())}]" | |||||
} | |||||
} | |||||
} | } |
@ -1,56 +1,52 @@ | |||||
package com.nivesh.production.bajajfd.viewModel | package com.nivesh.production.bajajfd.viewModel | ||||
import android.app.Activity | |||||
import androidx.lifecycle.MutableLiveData | import androidx.lifecycle.MutableLiveData | ||||
import androidx.lifecycle.ViewModel | import androidx.lifecycle.ViewModel | ||||
import androidx.lifecycle.viewModelScope | import androidx.lifecycle.viewModelScope | ||||
import com.google.gson.JsonObject | import com.google.gson.JsonObject | ||||
import com.nivesh.production.bajajfd.model.CreateFDRequest | |||||
import com.nivesh.production.bajajfd.model.FDStepsCountRequest | |||||
import com.nivesh.production.bajajfd.model.getClientDetailsRequest | |||||
import com.nivesh.production.bajajfd.model.* | |||||
import com.nivesh.production.bajajfd.repositories.MainRepository | import com.nivesh.production.bajajfd.repositories.MainRepository | ||||
import com.nivesh.production.bajajfd.util.Common.Companion.handleRatesResponse | |||||
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.Resource | import com.nivesh.production.bajajfd.util.Resource | ||||
import kotlinx.coroutines.launch | import kotlinx.coroutines.launch | ||||
class BajajFDViewModel(private val mainRepository: MainRepository) : ViewModel() { | class BajajFDViewModel(private val mainRepository: MainRepository) : ViewModel() { | ||||
val getStepsCountMutableData: MutableLiveData<Resource<JsonObject>> = MutableLiveData() | val getStepsCountMutableData: MutableLiveData<Resource<JsonObject>> = MutableLiveData() | ||||
fun getStepsCount(requestBody: FDStepsCountRequest, token: String) = viewModelScope.launch { | |||||
getStepsCountMutableData.postValue(Resource.Loading()) | |||||
val response = mainRepository.getStepsCountResponse(requestBody, token) | |||||
getStepsCountMutableData.postValue(handleRatesResponse(response)) | |||||
fun getStepsCount( | |||||
requestBody: FDStepsCountRequest, | |||||
token: String, | |||||
activity: Activity | |||||
) = viewModelScope.launch(handleError(activity)) { | |||||
if (Common.isNetworkAvailable(activity)) { | |||||
getStepsCountMutableData.postValue(Resource.Loading()) | |||||
val response = mainRepository.getStepsCountResponse(requestBody, token) | |||||
getStepsCountMutableData.postValue(handleResponse(response)) | |||||
} | |||||
} | } | ||||
val getClientDetailsMutableData: MutableLiveData<Resource<JsonObject>> = MutableLiveData() | val getClientDetailsMutableData: MutableLiveData<Resource<JsonObject>> = MutableLiveData() | ||||
fun getClientDetails(getClientDetailsRequest: getClientDetailsRequest, token: String) = | |||||
viewModelScope.launch { | |||||
getClientDetailsMutableData.postValue(Resource.Loading()) | |||||
val response = mainRepository.getClientDetailsResponse(getClientDetailsRequest, token) | |||||
getClientDetailsMutableData.postValue(handleRatesResponse(response)) | |||||
fun getClientDetails(getClientDetailsRequest: getClientDetailsRequest, token: String, activity: Activity) = | |||||
viewModelScope.launch(handleError(activity)) { | |||||
if (Common.isNetworkAvailable(activity)) { | |||||
getClientDetailsMutableData.postValue(Resource.Loading()) | |||||
val response = | |||||
mainRepository.getClientDetailsResponse(getClientDetailsRequest, token) | |||||
getClientDetailsMutableData.postValue(handleResponse(response)) | |||||
} | |||||
} | } | ||||
val getFDResponseMutableData: MutableLiveData<Resource<JsonObject>> = MutableLiveData() | |||||
fun createFDApi(getRatesRequest: CreateFDRequest, token: String) = viewModelScope.launch { | |||||
getFDResponseMutableData.postValue(Resource.Loading()) | |||||
val response = mainRepository.createFDKYCResponse(getRatesRequest, token) | |||||
getFDResponseMutableData.postValue(handleRatesResponse(response)) | |||||
val getFDKYCMutableData: MutableLiveData<Resource<JsonObject>> = MutableLiveData() | |||||
fun checkFDKYC(requestBody: CheckFDKYCRequest, token : String, activity: Activity) = viewModelScope.launch(handleError(activity)) { | |||||
if (Common.isNetworkAvailable(activity)) { | |||||
getFDKYCMutableData.postValue(Resource.Loading()) | |||||
val response = mainRepository.checkFDKYCRequest(requestBody, token) | |||||
getFDKYCMutableData.postValue(handleResponse(response)) | |||||
} | |||||
} | } | ||||
// private fun handleRatesResponse(response: retrofit2.Response<JsonObject>): Resource<JsonObject> { | |||||
// try { | |||||
// if ( response.isSuccessful && response.body() != null) { | |||||
// response.body()?.let { resultResponse -> | |||||
// return Resource.Success(resultResponse) | |||||
// } | |||||
// } | |||||
// } catch (t: Throwable) { | |||||
// return when (t) { | |||||
// is IOException -> Resource.Error("Response : "+t.message.plus(" Cause: "+t.cause)) | |||||
// is HttpException -> Resource.Error("Response : "+t.message.plus(" Cause: "+t.cause)) | |||||
// else -> Resource.Error(t.localizedMessage?.toString() ?: "") | |||||
// } | |||||
// } | |||||
// return Resource.Error(response.message()) | |||||
// } | |||||
} | } |
@ -1,30 +1,53 @@ | |||||
package com.nivesh.production.bajajfd.viewModel | package com.nivesh.production.bajajfd.viewModel | ||||
import android.app.Activity | |||||
import androidx.lifecycle.MutableLiveData | import androidx.lifecycle.MutableLiveData | ||||
import androidx.lifecycle.ViewModel | import androidx.lifecycle.ViewModel | ||||
import androidx.lifecycle.viewModelScope | import androidx.lifecycle.viewModelScope | ||||
import com.google.gson.JsonObject | 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.GetCodeRequest | ||||
import com.nivesh.production.bajajfd.model.GetRatesRequest | import com.nivesh.production.bajajfd.model.GetRatesRequest | ||||
import com.nivesh.production.bajajfd.repositories.MainRepository | import com.nivesh.production.bajajfd.repositories.MainRepository | ||||
import com.nivesh.production.bajajfd.util.Common.Companion.handleRatesResponse | |||||
import com.nivesh.production.bajajfd.util.Common | |||||
import com.nivesh.production.bajajfd.util.Common.Companion.handleResponse | |||||
import com.nivesh.production.bajajfd.util.Resource | import com.nivesh.production.bajajfd.util.Resource | ||||
import kotlinx.coroutines.launch | import kotlinx.coroutines.launch | ||||
class StepThreeBajajFDViewModel(private val mainRepository: MainRepository) : ViewModel() { | class StepThreeBajajFDViewModel(private val mainRepository: MainRepository) : ViewModel() { | ||||
private val getRatesMutableData: MutableLiveData<Resource<JsonObject>> = MutableLiveData() | |||||
fun documentsUpload(getRatesRequest: GetRatesRequest, token: String) = viewModelScope.launch { | |||||
getRatesMutableData.postValue(Resource.Loading()) | |||||
val response = mainRepository.documentsUploadResponse(getRatesRequest, token) | |||||
getRatesMutableData.postValue(handleRatesResponse(response)) | |||||
val getTitleMutableData: MutableLiveData<Resource<JsonObject>> = 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 getTitleMutableData: MutableLiveData<Resource<JsonObject>> = MutableLiveData() | |||||
fun titleApi(getCodeRequest: GetCodeRequest, token: String) = viewModelScope.launch { | |||||
getTitleMutableData.postValue(Resource.Loading()) | |||||
val response = mainRepository.titleCheck(getCodeRequest, token) | |||||
getTitleMutableData.postValue(handleRatesResponse(response)) | |||||
val getDocumentUploadMutableData: MutableLiveData<Resource<JsonObject>> = 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<Resource<JsonObject>> = 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)) | |||||
} | |||||
} | } | ||||
} | } |
@ -1,107 +1,173 @@ | |||||
package com.nivesh.production.bajajfd.viewModel | package com.nivesh.production.bajajfd.viewModel | ||||
import android.app.Activity | |||||
import androidx.lifecycle.MutableLiveData | import androidx.lifecycle.MutableLiveData | ||||
import androidx.lifecycle.ViewModel | import androidx.lifecycle.ViewModel | ||||
import androidx.lifecycle.viewModelScope | import androidx.lifecycle.viewModelScope | ||||
import com.google.gson.JsonObject | import com.google.gson.JsonObject | ||||
import com.nivesh.production.bajajfd.model.* | import com.nivesh.production.bajajfd.model.* | ||||
import com.nivesh.production.bajajfd.repositories.MainRepository | import com.nivesh.production.bajajfd.repositories.MainRepository | ||||
import com.nivesh.production.bajajfd.util.Common.Companion.handleRatesResponse | |||||
import com.nivesh.production.bajajfd.util.Common | |||||
import com.nivesh.production.bajajfd.util.Common.Companion.handleResponse | |||||
import com.nivesh.production.bajajfd.util.Resource | import com.nivesh.production.bajajfd.util.Resource | ||||
import kotlinx.coroutines.launch | import kotlinx.coroutines.launch | ||||
class StepTwoBajajFDViewModel(private val mainRepository: MainRepository) : ViewModel() { | class StepTwoBajajFDViewModel(private val mainRepository: MainRepository) : ViewModel() { | ||||
val getPanCheckMutableData: MutableLiveData<Resource<JsonObject>> = MutableLiveData() | val getPanCheckMutableData: MutableLiveData<Resource<JsonObject>> = MutableLiveData() | ||||
fun panCheck(panCheck: PanCheckRequest, token: String) = viewModelScope.launch { | |||||
getPanCheckMutableData.postValue(Resource.Loading()) | |||||
val response = mainRepository.panCheck(panCheck, token) | |||||
getPanCheckMutableData.postValue(handleRatesResponse(response)) | |||||
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<Resource<JsonObject>> = MutableLiveData() | val getTitleMutableData: MutableLiveData<Resource<JsonObject>> = MutableLiveData() | ||||
fun titleApi(getCodeRequest: GetCodeRequest, token: String) = viewModelScope.launch { | |||||
getTitleMutableData.postValue(Resource.Loading()) | |||||
val response = mainRepository.titleCheck(getCodeRequest, token) | |||||
getTitleMutableData.postValue(handleRatesResponse(response)) | |||||
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<Resource<JsonObject>> = MutableLiveData() | val getGenderMutableData: MutableLiveData<Resource<JsonObject>> = MutableLiveData() | ||||
fun genderApi(getCodeRequest: GetCodeRequest, token: String) = viewModelScope.launch { | |||||
getGenderMutableData.postValue(Resource.Loading()) | |||||
val response = mainRepository.genderCheck(getCodeRequest, token) | |||||
getGenderMutableData.postValue(handleRatesResponse(response)) | |||||
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<Resource<JsonObject>> = MutableLiveData() | val getAnnualIncomeMutableData: MutableLiveData<Resource<JsonObject>> = MutableLiveData() | ||||
fun annualIncomeApi(getCodeRequest: GetCodeRequest, token: String) = viewModelScope.launch { | |||||
getAnnualIncomeMutableData.postValue(Resource.Loading()) | |||||
val response = mainRepository.annualIncomeCheck(getCodeRequest, token) | |||||
getAnnualIncomeMutableData.postValue(handleRatesResponse(response)) | |||||
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<Resource<JsonObject>> = MutableLiveData() | val getRelationShipMutableData: MutableLiveData<Resource<JsonObject>> = MutableLiveData() | ||||
fun relationShipApi(getCodeRequest: GetCodeRequest, token: String) = viewModelScope.launch { | |||||
getRelationShipMutableData.postValue(Resource.Loading()) | |||||
val response = mainRepository.relationShipCheck(getCodeRequest, token) | |||||
getRelationShipMutableData.postValue(handleRatesResponse(response)) | |||||
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<Resource<JsonObject>> = MutableLiveData() | val getMaritalStatusMutableData: MutableLiveData<Resource<JsonObject>> = MutableLiveData() | ||||
fun maritalStatusApi(getCodeRequest: GetCodeRequest, token: String) = viewModelScope.launch { | |||||
getMaritalStatusMutableData.postValue(Resource.Loading()) | |||||
val response = mainRepository.maritalStatusCheck(getCodeRequest, token) | |||||
getMaritalStatusMutableData.postValue(handleRatesResponse(response)) | |||||
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<Resource<JsonObject>> = MutableLiveData() | val getOccupationMutableData: MutableLiveData<Resource<JsonObject>> = MutableLiveData() | ||||
fun occupationApi(getCodeRequest: GetCodeRequest, token: String) = viewModelScope.launch { | |||||
getOccupationMutableData.postValue(Resource.Loading()) | |||||
val response = mainRepository.occupationCheck(getCodeRequest, token) | |||||
getOccupationMutableData.postValue(handleRatesResponse(response)) | |||||
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<Resource<JsonObject>> = MutableLiveData() | val getStateMasterMutableData: MutableLiveData<Resource<JsonObject>> = MutableLiveData() | ||||
fun stateApi(token: String) = viewModelScope.launch { | |||||
getStateMasterMutableData.postValue(Resource.Loading()) | |||||
val response = mainRepository.stateCheck( token) | |||||
getStateMasterMutableData.postValue(handleRatesResponse(response)) | |||||
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<Resource<JsonObject>> = MutableLiveData() | val getCityListMutableData: MutableLiveData<Resource<JsonObject>> = MutableLiveData() | ||||
fun cityListApi(cityRequest: CityRequest, token: String) = viewModelScope.launch { | |||||
getCityListMutableData.postValue(Resource.Loading()) | |||||
val response = mainRepository.cityCheck(cityRequest, token) | |||||
getCityListMutableData.postValue(handleRatesResponse(response)) | |||||
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<Resource<JsonObject>> = MutableLiveData() | val getFDBankListMutableData: MutableLiveData<Resource<JsonObject>> = MutableLiveData() | ||||
fun bankListApi( token: String) = viewModelScope.launch { | |||||
getFDBankListMutableData.postValue(Resource.Loading()) | |||||
val response = mainRepository.bankListCheck( token) | |||||
getFDBankListMutableData.postValue(handleRatesResponse(response)) | |||||
fun bankListApi( token: String,activity : Activity) = viewModelScope.launch( | |||||
Common.handleError(activity) | |||||
) { | |||||
if (Common.isNetworkAvailable(activity)) { | |||||
getFDBankListMutableData.postValue(Resource.Loading()) | |||||
val response = mainRepository.bankListCheck(token) | |||||
getFDBankListMutableData.postValue(handleResponse(response)) | |||||
} | |||||
} | } | ||||
val getifscCodeCheckMutableData: MutableLiveData<Resource<JsonObject>> = MutableLiveData() | val getifscCodeCheckMutableData: MutableLiveData<Resource<JsonObject>> = MutableLiveData() | ||||
fun ifscCodeApi(ifsc : String) = viewModelScope.launch { | |||||
getifscCodeCheckMutableData.postValue(Resource.Loading()) | |||||
val response = mainRepository.ifscCodeCheck(ifsc) | |||||
getifscCodeCheckMutableData.postValue(handleRatesResponse(response)) | |||||
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<Resource<JsonObject>> = MutableLiveData() | val getifscCodeDetailsCheckMutableData: MutableLiveData<Resource<JsonObject>> = MutableLiveData() | ||||
fun ifscCodeDetailsApi(ifsc : String, token: String) = viewModelScope.launch { | |||||
getifscCodeDetailsCheckMutableData.postValue(Resource.Loading()) | |||||
val response = mainRepository.ifscCodeDetailsCheck(ifsc, token) | |||||
getifscCodeDetailsCheckMutableData.postValue(handleRatesResponse(response)) | |||||
fun ifscCodeDetailsApi(ifsc : String, token: String,activity : Activity) = viewModelScope.launch( | |||||
Common.handleError(activity) | |||||
) { | |||||
if (Common.isNetworkAvailable(activity)) { | |||||
getifscCodeDetailsCheckMutableData.postValue(Resource.Loading()) | |||||
val response = mainRepository.ifscCodeDetailsCheck(ifsc, token) | |||||
getifscCodeDetailsCheckMutableData.postValue(handleResponse(response)) | |||||
} | |||||
} | } | ||||
val getPaymentModeMutableData: MutableLiveData<Resource<JsonObject>> = MutableLiveData() | val getPaymentModeMutableData: MutableLiveData<Resource<JsonObject>> = MutableLiveData() | ||||
fun paymentModeApi(getCodeRequest: GetCodeRequest, token: String) = viewModelScope.launch { | |||||
getPaymentModeMutableData.postValue(Resource.Loading()) | |||||
val response = mainRepository.payModeCheck(getCodeRequest, token) | |||||
getPaymentModeMutableData.postValue(handleRatesResponse(response)) | |||||
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<Resource<JsonObject>> = 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)) | |||||
} | |||||
} | } | ||||
} | } |
@ -1,39 +1,28 @@ | |||||
<?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android" | |||||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||||
android:padding="@dimen/margin_1" | |||||
android:orientation="horizontal" | |||||
android:layout_width="match_parent" | android:layout_width="match_parent" | ||||
android:layout_height="wrap_content" | |||||
app:cardBackgroundColor="@color/white" | |||||
app:cardCornerRadius="3dp" | |||||
app:cardElevation="3dp" | |||||
app:cardMaxElevation="1dp" | |||||
app:cardPreventCornerOverlap="true" | |||||
app:cardUseCompatPadding="true"> | |||||
<LinearLayout | |||||
android:padding="@dimen/margin_3" | |||||
android:orientation="horizontal" | |||||
android:layout_width="match_parent" | |||||
android:layout_height="wrap_content"> | |||||
<ImageView | |||||
android:id="@+id/bankSelector" | |||||
android:layout_width="@dimen/margin_25" | |||||
android:layout_height="@dimen/margin_25" | |||||
android:layout_marginStart="@dimen/margin_10" | |||||
android:layout_marginEnd="@dimen/margin_10" | |||||
android:layout_marginBottom="@dimen/margin_10" | |||||
android:padding="@dimen/margin_5" | |||||
android:contentDescription="@null" /> | |||||
android:layout_height="wrap_content"> | |||||
<TextView | <TextView | ||||
android:id="@+id/tvBankName" | |||||
android:layout_width="match_parent" | |||||
android:id="@+id/txtLabel" | |||||
android:gravity="start" | |||||
android:layout_gravity="center_vertical" | |||||
android:padding="@dimen/margin_2" | |||||
android:layout_weight="0.87" | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | android:layout_height="wrap_content" | ||||
android:layout_marginTop="@dimen/margin_4" | |||||
android:textColor="@color/black" | android:textColor="@color/black" | ||||
android:textSize="@dimen/text_size_14" | |||||
android:textStyle="bold" /> | |||||
android:textSize="@dimen/text_size_12"/> | |||||
<com.google.android.material.switchmaterial.SwitchMaterial | |||||
android:id="@+id/tvCustomerName" | |||||
android:layout_width="wrap_content" | |||||
android:padding="@dimen/margin_4" | |||||
android:layout_height="wrap_content" | |||||
android:layout_weight="0.13" | |||||
android:checked="false" | |||||
android:drawablePadding="@dimen/margin_2" /> | |||||
</LinearLayout> | </LinearLayout> | ||||
</com.google.android.material.card.MaterialCardView> |
@ -0,0 +1,43 @@ | |||||
<?xml version="1.0" encoding="utf-8"?> | |||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||||
android:layout_width="match_parent" | |||||
android:layout_height="match_parent" | |||||
android:orientation="vertical" | |||||
xmlns:app="http://schemas.android.com/apk/res-auto"> | |||||
<LinearLayout | |||||
android:layout_width="match_parent" | |||||
android:layout_height="wrap_content" | |||||
android:orientation="horizontal"> | |||||
<TextView | |||||
style="@style/BoldStyle" | |||||
android:gravity="center" | |||||
android:layout_weight="0.1" | |||||
android:layout_marginEnd="@dimen/margin_15" | |||||
android:layout_width="0dp" | |||||
android:layout_height="wrap_content" | |||||
android:text="@string/payment" | |||||
android:padding="@dimen/margin_15" | |||||
android:textSize="@dimen/text_size_18"/> | |||||
<TextView | |||||
android:id="@+id/tvCancel" | |||||
style="@style/BoldStyle" | |||||
android:layout_gravity="end" | |||||
android:layout_marginEnd="@dimen/margin_15" | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:text="@string/x" | |||||
android:padding="@dimen/margin_15" | |||||
android:textSize="@dimen/text_size_18"/> | |||||
</LinearLayout> | |||||
<WebView | |||||
android:layout_marginTop="@dimen/margin_5" | |||||
app:layout_constraintTop_toBottomOf="@+id/tvCancel" | |||||
android:id="@+id/wVPay" | |||||
android:layout_width="match_parent" | |||||
android:layout_height="match_parent"/> | |||||
</LinearLayout> |
Powered by TurnKey Linux.